summaryrefslogtreecommitdiffstats
path: root/libhb/sync.c
Commit message (Collapse)AuthorAgeFilesLines
* Enable DTS passthru for matroska containerjstebbins2009-04-181-13/+29
| | | | | | | | since we have no way to create silent dts frames for insertion to maintain sync, frames from other streams may be dropped when there is a sync problem on the DTS stream git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2339 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Adds a job->frame_to_stop variable similar to the existing pts_to_stop ↵jbrjake2009-03-311-0/+22
| | | | | | | | parameter, for ending an encode after a certain number of decoded frames. CLI: Replaces --stop-at-pts and --stop-at-duration with a general --stop-at option. The argument is in the form unit:amount. So --stop-at duration:10 for a 10 second encode, --stop-at pts:300300 to end when that timestamp is reached, or --stop-at frame:1000 to stop after reading 1000 frames. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2286 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Consolidate all the ffmpeg-related includes into libhb/hbffmpeg.h then ↵van2008-12-131-2/+1
| | | | | | prototype hb_avcodec_{init,open,close} so that we don't get gcc warnings from a dozen modules. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2025 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a threading issue with avcodec_open/closejstebbins2008-12-121-2/+2
| | | | | | | | these functions can not be called from 2 threads simultaneosly. made a wrapper function that holds a lock while making the call git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2023 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add metadata support to libhb, add importing of MP4 metadata, add export of ↵eddyg2008-12-021-0/+4
| | | | | | 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
* libhb support for live previewjstebbins2008-11-111-5/+12
| | | | | | | | set job->start_at_preview to the preview frame you want to start at set job->pts_to_stop to the number of 90khz ticks duration git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1915 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - get rid of another deadlock: if there were more than 64 audio frames ↵van2008-09-051-7/+16
| | | | | | | | | before the first video frame we'd lock up the reader. - if we get a bogus timestamp at the end of some conversion just ignore it and don't try to generate minutes or hours of silence to fill the hole. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1665 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix subtitle indepth scan abort & hang.van2008-08-191-3/+6
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1645 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix two problems that would cause HB to hang in the muxer whenever the input ↵van2008-07-301-23/+23
| | | | | | | | | | content's video finished before audio: - sync has to keep processing until all its input fifos report eof otherwise it won't send an eof on all its output fifos. - do_job has to wait for muxer to finish. Waiting for anything earlier in the pipeline (we were waiting for the video encoder) can cause other parts of the pipeline to get terminated early which will result in lost data & no eofs. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1597 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - in encx264, if an video frame is larger than init_delay split it into ↵van2008-07-261-46/+7
| | | | | | | | | | | | pieces so we don't get jerky output caused by out-of-order frames. - add an explicit EOF for all streams, not just video. - don't generate extra audio silence at the end of an encode (don't need it with explicit eof). - get rid of 80ms initial delay in AAC encode & flush final four frames buffered in encoder. - put mp4 'chap' atom on first track (usually video) rather than first audio track since we can now do video without audio (atom just needs to go on an enabled media track & video is always enabled). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1581 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Change HandBrake from using the libsamplerate linear interpolator for ↵eddyg2008-07-061-1/+1
| | | | | | resampling audio to using the SINC medium quality interpolator. Testing has shown a significant improvement in audio using this interpolator when upsampling the audio, most significant for 22Khz up to 48Khz, the audio is a lot brighter. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1557 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - fix an error in the SCR calculation that would cause an extra frame to be ↵van2008-06-301-6/+6
| | | | | | | | | | 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
* Adds a job->cfr boolean to indicate "encode this with a constant frame rate" ↵jbrjake2008-06-051-1/+1
| | | | | | instead of passing through the true frame durations from the source. Includes CLI implementation, which sets cfr to 1 if the user specifies a frame rate. Otherwise, it uses "same as source" frame rate. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1496 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - support blu-ray, avchd & dvb x264van2008-05-311-12/+18
| | | | | | | - 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
* Re-allow constant frame rates. The MacGui should probably be updated to ↵jbrjake2008-05-171-1/+1
| | | | | | always use title fps for VFR instead of "Same as Source" which might be 23.976, but it's taken care of in work.c now so it's purely a cosmetic thing. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1464 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Don't allow chapter durations to go negative (since durations are ↵van2008-04-251-14/+10
| | | | | | | | | unsigned the result will be interpreted as a huge positive number). - Revert the change to sync that pushed out the final frame of video -- on many DVDs this frame seems to be junk that's not intended to be displayed. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1438 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
* Fix the automatic subtitle scan that I broke with r1412.van2008-04-141-0/+8
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1413 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fixes for different number of frames between pass 1 & 2, missing frames at ↵van2008-04-131-61/+22
| | | | | | | | | | | | end, and an deadlock with pcm audio. - since the SCR clock recovery is done in reader.c we can't currently skip audio frames during pass 1 or we miss clock changes signaled by those frames & end up dropping more video frames in pass 1 than pass 2. - since many modules buffer frames we can't tell if we're done just by looking for empty fifos. Send an empty buffer to mark end-of-stream all the way along the processing pipeline & use it to flush internally buffered data. - in a processing pipeline you're done when the end of the pipe says your done. add a thread status variable so we can tell when individual threads are finished then make do_job wait until the encoder thread is done so that we're sure all the frames have been processed and sent to the muxer. - since the muxer alternates between reading video & audio packets we have to have enough buffer in the audio pipeline to handle a video-frame's worth of audio packets (33ms). Since pcm packets are <1ms we need >60 slots in the audio fifos or we'll deadlock. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1412 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix brain fade in comments (it's been a long day).van2008-04-101-3/+3
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1401 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix avi containers which I unwittingly broke with r1341.van2008-04-101-26/+95
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1400 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Fix sync problems associated with sample rate conversion - the truncation ↵van2008-04-061-38/+62
| | | | | | | | | error of the sample rate ratio would build up over time until the audio substantially lagged the video. - Don't feed audio through the sample rate converter if we don't have to - it's faster not to & it can introduce a delay that perturbs a/v sync. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1381 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Minor chapter cleanups.van2008-04-041-0/+13
| | | | | | | | | | - put chapter number in buf rather than a 'new chapter' flag. - use that chapter number to index chapter text in muxers so a dropped chapter doesn't make all subsequent chapter labeling wrong. - get rid of most of the chapter logging & just output one line giving the chapter text, number, frame & time. - fix a bug in sync that could cause chapter marks to be lost. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1377 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - hardware players don't tolerate video or audio frames that overlap in ↵van2008-04-031-8/+13
| | | | | | | | | time & some dvd mastering techniques take advantage of this. Get rid of fudge factors so we drop all such frames otherwise they screw up our a/v sync. - fix video timing 'off by one': since we look one frame ahead time has to actually advance on the next video frame. time that stays the same guarantees a one frame overlap which really messes up mp4 durations. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1372 b64f7644-9d1e-0410-96f1-a4d463321fa5
* New internal audio handling.saintdev2008-04-011-37/+36
| | | | | | | | Each audio track contains it's own settings for codec, bitrate, samplerate, etc. This allows for very complex combinations of audio tracks if desired. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1365 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Should have removed this as part of the r1341 checkin - we now add silence ↵van2008-03-161-22/+0
| | | | | | based only on gaps in the timestamp sequence. The heuristic of looking at what fifos are full or empty can misbehave based on random variation in the thread scheduling. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1342 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Add mpeg2 "Standard Target Decoder" clock recovery to the low level mpeg ↵van2008-03-151-405/+236
| | | | | | | | | | stream reader so we don't have to guess about the clock in sync. - Since sync now has a fairly reliable clock, make it just trim excess audio or video and fill holes so that we maintain cross media sync. - Redo the TS-to-PS transmuxing code to work on smaller units so that we can reliably convert the TS clock (PCR) to a PS clock (SCR). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1341 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Set an minimum subtitle display time of three seconds *or* until the next ↵eddyg2008-02-261-0/+20
| | | | | | subtitle is displayed. This makes subtitles easier to read for the slow readers or for the DVD authors why display the subtitles for too short a period (e.g. only display the subtitles during the talking in a fast speaking tongue). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1317 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Formatting: Remove a lot of trailing whitespace.saintdev2008-02-211-33/+33
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1307 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Allow mac gui to select AC-3 + AAC at the same time, still needs CLI work ↵eddyg2008-02-161-5/+10
| | | | | | for the same. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1267 b64f7644-9d1e-0410-96f1-a4d463321fa5
* When vfr is selected use the frame timing from render.c rather than ↵van2008-01-221-38/+68
| | | | | | generating duplicate frames to turn the content back into 30fps. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1223 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Program Stream Enhancements - Van: Libhbdynaflash2007-12-311-2/+2
| | | | | | | | | | | - 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
* "Great! Where are we going?"jbrjake2007-12-281-2/+2
| | | | | | | Prevents sync.c from prematurely ending the encode when its estimated maximum frame count is too low, by doubling that maximum. Thanks for fixing this long-standing bug, van! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1151 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Changed logging messages about PTS discontinuities to be less verbose, and ↵eddyg2007-10-231-23/+111
| | | | | | changed audio discontinuity handling to work correctly should it be leading the video. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1035 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Somehow this went missing as I prepared these subtitle changes for commit in ↵eddyg2007-10-111-0/+2
| | | | | | 1011. Without this change encoding will hang when there is a subtitle in the fifo at a PTS discontinuity. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1021 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't drop subtitles when crossing PTS discontinuities by using buffer ↵eddyg2007-10-081-40/+185
| | | | | | 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
* This patch from eddyg should help alleviate HandBrake's audio drop issues. ↵jbrjake2007-07-251-13/+47
| | | | | | It also adds a number of beautiful comments to sync.c that really help clarify the code. Thanks, eddy! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@738 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Switch buf->key to buf->frametype which is a bitmask telling us what type of ↵saintdev2007-06-171-1/+1
| | | | | | | | | 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
* Fix Previous Bad commit for Cyanders Chapter Markersdynaflash2007-04-251-1/+9
| | | | 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-0/+14
| | | | | | | | 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-6/+6
| | | | | | | | *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
* Fix about 156,199 bytes of leaked memory.saintdev2007-03-311-0/+3
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@469 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Applied and committed saintdev's patch to fix multi-track audio. Only in ↵maurj2007-03-211-19/+15
| | | | | | | | the CLI for now - the GUI will need updating to reinstate the second audio dropdown. If the -6 option is specified in the CLI (and faac is specified), then *any* 5.1 tracks specified will be exported as 6-channel AAC. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@438 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Merge the 5.1 branch into the trunk.prigaux2007-03-061-0/+679
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@422 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Merge the 0.8.0_mpeg4ip branch into the trunkprigaux2007-02-111-675/+0
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@285 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Structural changes, in order to eventually be able to compile HBtiter2006-03-161-133/+140
| | | | | | | without certain encoders git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@34 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Softer resampling when audio dates are messed up (fix for LPCM issues).titer2006-02-231-18/+11
| | | | | | | Disabled verbose in the OS X UI git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@30 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Quick fix for Madagascar: increased tolerance level for PTS discontinuitiestiter2006-02-231-6/+8
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@29 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix for missing subtitlestiter2006-02-221-3/+12
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@28 b64f7644-9d1e-0410-96f1-a4d463321fa5
* HandBrake 0.7.0handbrake2006-01-141-0/+664
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@16 b64f7644-9d1e-0410-96f1-a4d463321fa5