summaryrefslogtreecommitdiffstats
path: root/libhb/sync.c
Commit message (Collapse)AuthorAgeFilesLines
* fix audio sync when resampling 48khz to 44.1khzjstebbins2010-11-061-6/+6
| | | | | | | | Rounding errors in timestamp calculations caused a gradual slip in both sync.c and encfaac.c. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3653 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a segfault and a deadlock if reader exits befor first buffer sentjstebbins2010-10-291-1/+1
| | | | | | | | This can happen if enough of the source is good that it scans but the beginning has an error that causes reader to exit. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3628 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add ac3 encodingjstebbins2010-10-041-8/+8
| | | | | | | Uses ffmpeg's ac3 encoder. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3570 b64f7644-9d1e-0410-96f1-a4d463321fa5
* SSA subtitle burn injstebbins2010-09-281-15/+41
| | | | | | | | | | Anime fans rejoice! This patch adds SSA subtitle burn-in support with libass. Therefore SSA subtitles should now be rendered in full quality, with the appropriate embedded fonts and positioning information. Thanks to davidfstr git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3557 b64f7644-9d1e-0410-96f1-a4d463321fa5
* remove the 8 audio limit. isn't needed anymore.jstebbins2010-09-151-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3531 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add SSA subtitle supportjstebbins2010-06-011-1/+2
| | | | | | | Thanks to davidfster git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3342 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a problem with point-to-point hanging when searching for start pointjstebbins2010-05-261-1/+8
| | | | | | | | | | in reader, the timestamps were not being correctly adjusted for scr offset before comparing to start time. This could cause an early start in reader. Then in sync, syncAudioWork stalled until the correct start of video was found, causing the audio fifo to fill and stall the whole pipeline. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3329 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Universal Text Subtitle Support Initial Implementationdynaflash2010-05-041-1/+3
| | | | | | | | | | | | | - Patch by davidfstr ... Thanks! - Adds support for reading TEXT subtitle tracks from file inputs - Tested combinations: -- MKV UTF-8 -> MKV UTF-8 (passthru) -- MKV UTF-8 -> MP4 TX3G (upconvert) -- MP4 TX3G -> MKV UTF-8 (downconvert) -- MP4 TX3G -> MP4 TX3G (downconvert to UTF-8 then upconvert) - Further explained here http://forum.handbrake.fr/viewtopic.php?f=4&t=16099 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3283 b64f7644-9d1e-0410-96f1-a4d463321fa5
* make count of video frames encoded logging accurate.jstebbins2010-04-241-0/+3
| | | | | | | it was missing the last frame in the count. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3263 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a problem with point-to-point (and live preview) when there are subtitlesjstebbins2010-04-211-2/+38
| | | | | | | | end of stream markers were not being put in the fifo for subtitles when the end point was reached, causing a hang. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3248 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix some mingw warnings and a mingw build issuejstebbins2010-04-101-1/+1
| | | | | | | mingw gcc-4.5 has linker issues against shared libstdc++ git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3217 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix silence insertion problem in audio sync and pipeline stall problemjstebbins2010-04-031-8/+5
| | | | | | | | | | | | | | | | | | | | the current audio buffer was being dropped when silence was inserted, causing the time to fall even further behind and provoke more silence insertion in some cases. with pont-to-point, it is possible for one stream to complete before the other(s). when the work_loop exits for that stream, the fifo is no longer serviced and may fill. This can back up and cause a stall in reader causing the streams that are not yet complete to stall. The Solution is to continue servicing the fifo after work for a stream is complete. This was complicated by the fact that the video sync work object was being used as the indicator that all work was finished. When it exited everything was told to stop. So now, the muxer work object (last in the chain) is the indicator when work is done. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3197 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix cancel during p-to-p searchjstebbins2010-01-201-0/+5
| | | | | | | | | when canceling, video sync was closed, but audio sync was stuck waiting on a condition variable. so force audio sync to wake up when video sync closes. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3078 b64f7644-9d1e-0410-96f1-a4d463321fa5
* prevent hang during foreign audio searchjstebbins2010-01-101-4/+5
| | | | | | | was waiting for an audio pts during the indepth scan when there is no audio being processed git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3065 b64f7644-9d1e-0410-96f1-a4d463321fa5
* add point-to-point encodingjstebbins2009-12-231-25/+299
| | | | | | | | | | | | | | allows frame and pts based start points. end points were already previously supported. New job variables pts_to_start and frame_to_start specify the start point. There can be a period during the encode where it has to search for the start point. During this period, libhb sets a new state HB_STATE_SEARCHING and sets progress and eta till start point found. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3039 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a double free of an hb_buffer in syncjstebbins2009-12-061-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3010 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Reduce the amount of buffering used and eliminate hb_snooze in the encoding ↵jstebbins2009-12-051-644/+711
| | | | | | | | | | | | | | | | | | | | | | 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
* Maintain an accurate job ETA across pause/resumejstebbins2009-11-071-1/+3
| | | | | | | | Keeps track of how much time is spent paused and factors that into the ETA calculation git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2918 b64f7644-9d1e-0410-96f1-a4d463321fa5
* possible fix for WDTV vobsub duration problemjstebbins2009-11-051-10/+0
| | | | | | | | | | | There were 2 problems 1. The duration was not being written to the mkv track. Other players use the timestamps in the vobsub. WDTV appears to use the duration in the mkv. 2. The vobsub timestamps were being rewritten improperly in sync.c. They don't need to be rewritten at all. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2917 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - cleanup gcc format warnings showing up on linux 64-bitkonablend2009-06-251-7/+7
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2619 b64f7644-9d1e-0410-96f1-a4d463321fa5
* CLI: SubRip Subtitle importeddyg2009-06-231-1/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2602 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - nasty bug: at eof, dropping a delay queue frame for CFR could link the ↵van2009-06-071-15/+2
| | | | | | | | | | render video output to the free list causing hangs and/or garbage output. - since frame rate conversion moved from sync to render, sync has to use input (title) frame rate, not output (job) frame rate. - get rid of 'too many frames' check in sync. it can't be done here because it causes reader to deadlock and it belongs in the dvd reader anyway (only dvd input can loop). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2496 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Adds an interjob structure to preserve some encode data across jobs within ↵jbrjake2009-06-041-15/+34
| | | | | | an instance of libhb. This allows correcting the estimated bitrate/filesize of 2-pass encodes of variable framerate content, as the actual frame count is known after the first pass. Thanks for putting the idea into code, Shaya. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2482 b64f7644-9d1e-0410-96f1-a4d463321fa5
* softsubtitles:jstebbins2009-06-021-4/+4
| | | | | | | | | | | | | | | | | | - when doing an indepth scan, do not scan CC tracks - separate subtitle configureation attributes into separate hb_subtitle_config_t. Add an instance of this to hb_job_t for setting the attributes of the subtitle found through an indepth scan - Add a default_track flag to hb_subtitle_config_t that tells the muxer that the track should be flaged as the default. muxmkv uses this. - When an indepth scan is complete, check to see if the autoselected subtitle matchces (by id) one of the manually selected subtitles. If a match is found, the autoselected subtitle with all the attributes the user assigned to it replaces the manually selected subtitle. - LinGui: Add "Default" column to subtitle tab. This is a radio that lets the user choose which subtitle should be displayed by default. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2468 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix sync problem with dts passthru and video re-syncjstebbins2009-05-281-3/+12
| | | | | | | the video drop-frame logic for gaps in the dts stream was broken git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2456 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Change minimum vobsub time from 3sec to 2sec, been meaning to do this for a ↵eddyg2009-05-191-2/+2
| | | | | | while. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2430 b64f7644-9d1e-0410-96f1-a4d463321fa5
* mkv soft subtitle supportjstebbins2009-05-191-124/+122
| | | | | | | | | | | | | - new libmkv 0.6.4 with subtitle track support - muxmkv supports vobsub and closed caption subtitles - added subtitle format, source, and dest initialization to dvdnav - moved subtitle_force flag into hb_subtitle_t struct as it needs to be settable per subtitle - gtk ui added subtitle tab which allows selection of multiple subtitles - reorgainize subtitle sync code to prevent dropping of subtitles when multiple subtitles are enabled git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2428 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Remove some noise from the log: Only announce chapters when we're reading, ↵van2009-05-161-4/+0
| | | | | | not while we're getting previews and get rid of a spurious chapter annoucement in sync (video decoders announce chapters since that's where they first get put in the output data stream). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2421 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix timestamps on CC's they are now 100% ready and working. Thanks to j45 ↵eddyg2009-05-081-2/+9
| | | | | | and ritsuka for their assistence in getting soft subs finally in HB. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2403 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Change CC608 decoder to be its own threadeddyg2009-05-071-2/+28
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2396 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Removed double EOF for CC's (one from dvd and one from cc), fixed compiler ↵eddyg2009-05-061-6/+14
| | | | | | warnings for CC. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2394 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix Closed Caption start/stop times, switched to SRT encoding including ↵eddyg2009-05-061-0/+3
| | | | | | markup for text subs internal to HB. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2392 b64f7644-9d1e-0410-96f1-a4d463321fa5
* VOBSUB encoder skeleton for use with mkv VOBSUB pass-througheddyg2009-05-061-2/+4
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2389 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Push an EOF onto the subtitle fifos from the reader for DVD VOBSUBs and also ↵eddyg2009-05-061-19/+50
| | | | | | from cc608 for closed captions git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2388 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Rewrite pass-through timestamps in sync, put on subtitle->fifo_out for ↵eddyg2009-05-051-13/+59
| | | | | | muxing. Also put the mp4 subtitle display inline with muxing - easy for ritsuka to put into a subtitle track ;) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2384 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Stage 1 Soft Subtitle Support - Allow multiple subtitle tracks to be ↵eddyg2009-05-041-104/+124
| | | | | | selected, and mark them for Render or Pass Through. No functional difference from the UIs, however in theory they could render multiple tracks - would be a dogs breakfast on screen though, and is untested. Have tested all normal operations from the UIs, including scanning. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2373 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Move frame rate code from sync to the end of render so it can account for ↵van2009-05-021-78/+20
| | | | | | | | | | | | frame timing changes made by filters. - Fix a bug that would make CFR alternate between massive drops and massive dups on some titles. - If we're not doing CFR add a factor-of-two fudge factor to init_delay to account f or the awful clock resolution of some mkvs and mp4s. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2368 b64f7644-9d1e-0410-96f1-a4d463321fa5
* 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