summaryrefslogtreecommitdiffstats
path: root/libhb/internal.h
Commit message (Collapse)AuthorAgeFilesLines
* Reduce the amount of buffering used and eliminate hb_snooze in the encoding ↵jstebbins2009-12-051-4/+15
| | | | | | | | | | | | | | | | | | | | | | pipeline For HD sources on an 8 core system with hyperthreading, we were using 1.5GB of ram. Add to that the 600MB x264 uses for rc-lookahead, pushes it north of 2GB. To reduce our memory usage, the fifo depths have been reduced are are no longer a multiple of cpu count. Use of hb_snooze has been eliminated in the encoding pipeline so that performance doesn't fall as a result of the reduced fifo depths. In sync, each audio and video were given separate threads so that each can wait on it's respective input fifo without blocking the others. In muxcommon, each stream being muxed was given a separate thread so that each can wait on it's respective fifo. This allows the removal of hb_snooze in the sync and muxer work loops. In both sync and muxer, there is common data that is shared by all threads, so special init routines allocate this shared data and initialize the threads. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3007 b64f7644-9d1e-0410-96f1-a4d463321fa5
* batch file scanning and scan canceljstebbins2009-11-251-3/+14
| | | | | | | | | | When a directory is specified as the source, first we attempt to open as a dvd, then if that fails, we attempt to open each file in the directory as a stream source. Since opening a large directory of files can take a really long time, you can also now cancel a scan. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2980 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Format cleanup.konablend2009-06-251-3/+3
| | | | | | | | | | - fixed ports.c to use a more portable method of getting integral pthread_t representation; resolves mingw crash. - added GCC attribute to generate compiler warnings for invalid usage of hb_log, hb_deep_log and hb_errror; see new macro HB_WPRINTF(s,v) in common.h. - fixed various invalid usage of above functions on osx i386/x86_64, and mingw. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2618 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - fixed gcc warnings for various unused vars, implicit function decls, ↵konablend2009-06-241-0/+3
| | | | | | signedness. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2612 b64f7644-9d1e-0410-96f1-a4d463321fa5
* CLI: SubRip Subtitle importeddyg2009-06-231-0/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2602 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Excises xvid from libhb because it's not worthy. Having two different MPEG-4 ↵jbrjake2009-05-261-1/+0
| | | | | | | | | Part 2 encoders is superfluous and when choosing between ffmpeg and xvid, xvid is the clear loser since we need to keep ffmpeg around for other functions and xvid constantly requires attention to ensure it compiles. MacGui: Removes some stray references to the codec and unlinks it from the Xcode project. CLI: Removes references to the codec and removes it as a dependency. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2448 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Add CoreAudio AAC as one of the encoder on Mac OS X.ritsuka2009-05-231-1/+2
| | | | | | | - Remove hb_init() and hb_init_express() macro. Rename hb_init_real() to hb_init() - Add two more bitrate combination for audio codecs in common.h git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2441 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Change CC608 decoder to be its own threadeddyg2009-05-071-2/+3
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2396 b64f7644-9d1e-0410-96f1-a4d463321fa5
* VOBSUB encoder skeleton for use with mkv VOBSUB pass-througheddyg2009-05-061-0/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2389 b64f7644-9d1e-0410-96f1-a4d463321fa5
* dvdnav: improve title scanningjstebbins2009-05-011-1/+1
| | | | | | | | | | | - looks for ptt with longest pgc sequence instead of just picking first ptt solves many 'short title' problems - constructs chapters from the pg's within the pgc's instead of using ptt's solve the problem of ptt's that point to an intro pgc instead of to the actual chapter position in the title. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2361 b64f7644-9d1e-0410-96f1-a4d463321fa5
* add libdvdnav supportjstebbins2009-04-271-1/+3
| | | | | | | | | | | emulates the vm of a dvd player in order to navigate the disc more reliably it is optional and disabled by default CLI option '--dvdnav' enables. GUI's have a new option in preferences. When dvdnav is enabled, you can also select angles (cli '--angle') git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2355 b64f7644-9d1e-0410-96f1-a4d463321fa5
* More code to deal with the flakey streams from NZ TV. They like to change ↵van2008-12-051-1/+1
| | | | | | the PCR without sending a new PCR and we get big timestamp changes but no new reference clock. So now we look at the PTS and if its change is outside a tolerance window we use the new PTS as a PCR & declare a clock discontinuity. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2008 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - validate frame sync the way the standard suggests (via checking the frame ↵van2008-12-041-1/+5
| | | | | | | | | | | | crc) rather than looking at multiple frames. This should reduce the probability of mis-identifying random junk as AC-3 to less than 1 in 2^32. - check the crc on every frame so we don't let corrupted data into the decoder. - interpret the PTS as per the standard (it's the time of the first frame that starts in the packet, not the time of the first byte of the packet). Incorrect interpretation was resulting in an average 15ms timing error (worse case 31ms). - do all the PTS calculations in doubles so we don't get round-off error that will desync the audio & video with 44.1KHz audio sources (these can't appear on DVDs but do show up in avi/mkv/... files). - don't rely on the container to give us large enough frame fragments to validate the sync (some containers split audio frames into really small pieces). Instead use the 8K of unused space in the esconfig of the audio object as an accumulation buffer. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2002 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add metadata support to libhb, add importing of MP4 metadata, add export of ↵eddyg2008-12-021-0/+5
| | | | | | MP4 metadata, add importing of MP4 chapters, add seek to chapter for input files, add new libmp4v2, remove old MP4 chapter muxing - now in libmp4v2. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1987 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Adds two new parameters to hb_scan, to control the number of preview frames ↵jbrjake2008-11-301-1/+2
| | | | | | | | generated during scan, and whether or not they're written to disk for later display. This will break any interfaces that use hb_scan until the new params are specified...sorry. Also adds a new job->seek_points setting (set this to the same as the number of previews) to be used with job->start_at_preview when doing live preview encodes, so the seek function has a frame of reference. Wires up the CLI with a --previews option (long option only) to control the new scan parameters, and defaults the CLI to not writing previews to disk. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1970 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - add John A. Stebbins' changes to handle TrueHD and DTS-HD multiplexed ↵van2008-11-251-0/+21
| | | | | | | | | | streams. - give transport streams their own demuxer rather than constructing fake PS packets to use the DVD demuxer. - start re-doing the transport stream code so it does fewer memory to memory copies. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1953 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Correct chroma size for raw video frames - width & height need to be rounded ↵van2008-11-081-0/+15
| | | | | | up if they're odd before dividing by 2. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1905 b64f7644-9d1e-0410-96f1-a4d463321fa5
* After discussion with eddyg, extending verbose logging level 2 from just ↵jbrjake2008-10-091-3/+3
| | | | | | memory-related logging to general-purpose housekeeping--stuff that isn't necessary when scrolling through activity logs users submit with bug reports and support queries. This includes things like thread start/exit messages and preview frames. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1820 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Adds an hb_deep_log() function for multiple levels of debugging verbosity. ↵jbrjake2008-10-091-0/+8
| | | | | | Level 1 displays when hb_log does (job->verbose == 1) and is now meant for logging that helps in tech support. Level 2 adds memory-related logging like freed buffers, and level 3 is for granular stuff that displays once per sample, frame, packet, etc. The debug level continues to be set when hb_init() is called. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1819 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Only do 'lost PCR' checks (r1712) when we're dealing with something that ↵van2008-10-031-0/+2
| | | | | | | | | could be an over-the-air transport stream. We can't lose the clock of a program stream and shouldn't have losses on an m2ts stream. - Widen the DTS-to-PCR acceptance window from +-5sec to +-5min since there's nothing in the standard that bounds the offset between a DTS and its clock reference. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1802 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Change buffer reuse policy to MRU to hopefully improve cache and VM performance.eddyg2008-08-291-0/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1659 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Use PTS, not DTS, in encx264 output frames so we don't have to special-case ↵van2008-07-261-0/+1
| | | | | | its output in every muxer. Confine code that deals with Apple's mistakes in handling video with b-frames to muxmp4. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1582 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Get rid of excessive video & audio drops on some content by implementing the ↵van2008-07-161-2/+0
| | | | | | | | | last 20% of the MPEG Standard Target Decoder timing model (per-stream timing state). Should fix the problem reported in http://forum.handbrake.fr/viewtopic.php?f=12&t=6601&sid=81048cf54c40b6cdb945236afb4f99da&p=37563#p37563 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1570 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - fix an error in the SCR calculation that would cause an extra frame to be ↵van2008-06-301-0/+1
| | | | | | | | | | dropped at an SCR discontinuity. - fix a rounding error in the encx264 init_delay computation that would underestimate the delay for progressive content and cause spurious "init_delay too small" messages. - clean up the sync.c "video time didn't advance" logic and try to make the error mgs more useful for debugging frame duration problems. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1543 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - support blu-ray, avchd & dvb x264van2008-05-311-17/+11
| | | | | | | - support video files handled by ffmpeg (avi, mkv, mp4, etc.) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1480 b64f7644-9d1e-0410-96f1-a4d463321fa5
* git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1471 ↵jbrjake2008-05-291-1/+2
| | | | b64f7644-9d1e-0410-96f1-a4d463321fa5
* Move clock recovery code from reader to demuxmpeg so it sees all frames & ↵van2008-04-151-1/+7
| | | | | | not just the ones we happen to be encoding. This change gives a more accurate clock and allows us to once again ignore audio during pass 1 of a 2 pass encode. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1420 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Saearch & Replace domain names to move from .m0k.org to handbrake.fr. Only ↵jbrjake2008-04-151-1/+1
| | | | | | covers trunk files, libhb, and test. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1418 b64f7644-9d1e-0410-96f1-a4d463321fa5
* scan and pcm audio fixes.van2008-04-021-1/+0
| | | | | | | | | | | | | | - lpcm audio fixed to handle 24 bit & interpret header correctly. - get aspect ratio from libmpeg2 rather than doing it ourselves. - announce when aspect ratio changes during preview scan. - if aspect ratio isn't either 4:3 or 16:9 complain & map to either 4:3 or 16:9 (whichever is closest). - start stream previews from file position 0 rather than 1/11 in case there's only on mpeg sequence header in the file. - don't give up on a file just because we can't get a preview due to a missing sequence header - only give up if we can't get any previews. - get audio bitstream characteristics during preview in a uniform way (we were treating PCM & MPEG audio specially which resulted in not getting their sample rate which caused a divide by zero in sync). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1370 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix two of my stupid bugs that prevented using the queue with transport streams:van2008-03-201-1/+1
| | | | | | | | - keep a cache of the pid/substream id mappings from each scan rather than assuming an encode will immediately follow a scan (there will be lots of scans followed by lots of encodes when the queue is used). - rewrite a few things to get rid of static variables. hb_ts_stream_decode is called by both scan & reader and they're in different threads. All the working storage & state has to either be in the stream struct or on the stack so it's private to the calling thread or it gets corrupted when doing a scan in the middle of an encode. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1351 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Theora.saintdev2008-03-201-0/+6
| | | | | | | | This adds the theora encoder to the Xcode project as well. It does not enable anything in the Mac GUI, just allows it to build. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1350 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't crash while scanning when we can't get previews for some title.van2008-02-291-0/+1
| | | | | | | | | - if we get no previews for some title, ignore the title - use the most common aspect ratio found from our 10 previews rather than just the aspect of preview 2 (otherwise we'll crash in hb_fix_aspect if we don't get preview 2). - check parameters in hb_fix_aspect so we don't divide by zero. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1322 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Formatting: Remove a lot of trailing whitespace.saintdev2008-02-211-2/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1307 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Maintains separate filter settings for each job. This prevents the MacGui ↵jbrjake2008-01-221-0/+2
| | | | | | from using the same filter settings for every job in the queue. Patch from travistex. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1228 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Program Stream Enhancements - Van: Libhbdynaflash2007-12-311-2/+0
| | | | | | | | | | | - Thanks Van ! - Identifies program streams by type instead of file extension - Improves proper duration reporting of program streams - fixes audio reconvergence code in libhb/sync.c trying to free a null buffer causing a crash - Assorted other enhancements to encoding program streams. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1155 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Increases the size of the integer holding MPEG-2 picture flags in the ↵jbrjake2007-10-091-1/+1
| | | | | | hb_buffer structure to 16 bits. It was 8-bit, and that couldn't hold 256, the REPEAT_FIRST_FIELD flag for soft-telecine. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1014 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't drop subtitles when crossing PTS discontinuities by using buffer ↵eddyg2007-10-081-0/+2
| | | | | | sequence numbers to determine where in the stream the buffer came from. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1011 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Added buffer management and changed fifo sizes. Changed job->subtitle_scan ↵eddyg2007-09-111-0/+3
| | | | | | to job->indepth_scan, and fixed memory init bug in denoise.c. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@945 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Added rudimentory error handling to HB. Instead of using hb_log() use ↵eddyg2007-08-271-0/+1
| | | | | | hb_error(). Also causes us to stop muxing when we get a write error in MP4 and MKV containers. Still requires macosx dialog box by dynaflash (see main.mm for stub to use). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@869 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add Subtitle scanning for forced subtitles and normal subtitles from the CLIeddyg2007-08-211-1/+1
| | | | | | | and the MacOS GUI. See the new subtitle language options in the GUI. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@844 b64f7644-9d1e-0410-96f1-a4d463321fa5
* This huge patch from huevos_rancheros ports a number of video filters from ↵jbrjake2007-07-271-1/+11
| | | | | | | | | | mencoder to HandBrake: yadif+mcdeint, hqdn3d, pp7, and pullup+softskip+harddup. What this means is that HB now has stateless inverse telecine, temporal denoising, and motion-adaptive deinterlacing! HandBrake is growing up =) Thank you, huevos_rancheros! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@749 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Matroska muxer!saintdev2007-07-141-0/+1
| | | | | | | | | | -Chapters don't work in VLC. I'll need to update the library to work-around this. Most other players should pick them up, however. -PAR, check. -x264 b-frames, check. -Multi-track audio, check. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@680 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Implement transport and program stream support. With these changes it's now ↵awk2007-07-041-1/+11
| | | | | | possible to open a .ts or .mpg files and transcode to standard Handbrake Output files. This fixes Ticket #21. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@648 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Switch buf->key to buf->frametype which is a bitmask telling us what type of ↵saintdev2007-06-171-1/+10
| | | | | | | | | frame we are dealing with. This doesn't change any functionality, but I need to be able to distinguish between x264 IDR and I frames for the upcoming matroska muxer. This also has the side effect of making the code a little easier to read and maintain. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@623 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Added support for DTS audio. DTS audio streams (of 5.1 audio and below) ↵maurj2007-05-021-0/+7
| | | | | | | | | will be detected and decoded. This requires a new library - libdca (and patch) - which is included (in patched form) in a new version of the pre-built UB Darwin contribs (0012). These have been uploaded to download.m0k.org/handbrake/contrib/ . I haven't yet added any code to Controller.mm to recognise the DTS streams as supporting mono / 6ch DPL1 / DPL2 downmixes. Note: running Jam on the new library required me to update some tools on Mac OS X - possibly libtool, autoconf, automake. Not sure which made the difference, but these were the ones I updated. it won't jam successfully without this. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@559 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix Previous Bad commit for Cyanders Chapter Markersdynaflash2007-04-251-0/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@548 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Much better B-frame muxing frame-reordering. This will preserve the sps/pps ↵jbrjake2007-04-161-1/+1
| | | | | | | | info, properly offset the first frame, and flush any remaining frames at the end of the encode. Patch by: Nyx git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@513 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Added libhb and CLI support for Dolby Pro Logic II 5.0 matrix encoding. ↵maurj2007-04-111-11/+3
| | | | | | | | *NOT YET ADDED TO THE GUI*. Handbrake now uses a more general "audio mixdown" concept. For each audio track to be converted you specify a mixdown. These are defined in common.h. This checkin only allows you to specify one mixdown for all tracks in the CLI, although everything is in place internally to specify a different mixdown per track. In the CLI, the "-6 --surround" option has been repurposed as a "-6 --mixdown" option, with a string parameter of mono/stereo/dpl1/dpl2/6ch. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@494 b64f7644-9d1e-0410-96f1-a4d463321fa5
* H.264 B-frame muxing for MP4, including B-pyramids. The latter are QuickTime ↵jbrjake2007-03-301-0/+3
| | | | | | | | incompatible. "Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves." -- Alan Kay git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@464 b64f7644-9d1e-0410-96f1-a4d463321fa5
* -6 channel surround for Vorbis/OGM. The channel mapping seems right for VLC, ↵saintdev2007-03-271-0/+3
| | | | | | | | but may be messed up for other players. -Other small fixes. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@456 b64f7644-9d1e-0410-96f1-a4d463321fa5