summaryrefslogtreecommitdiffstats
path: root/libhb/sync.c
Commit message (Collapse)AuthorAgeFilesLines
* cli: fix initialization of encode rangesjstebbins2015-05-131-0/+2
| | | | | | | | | | | The default chapter start or end was used if one but not the other of start-at/stop-at were used. Also don't overwrite current pass and pass_count status in hb_state_t while searching for the position to start encoding. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7177 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Use a buffer flat to indicate EOFjstebbins2015-05-011-8/+8
| | | | | | | | | | | | ... instead of a 0 length buffer. This fixes this issue: https://forum.handbrake.fr/viewtopic.php?f=12&t=31959 Theora can create 0 length output. These 0 length frames indicate duplicate frames. So we can't use 0 length buffers to indicate the end of the stream. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7143 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: fix frame p-to-p extra audio after end framejstebbins2015-04-221-326/+249
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7119 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Eliminate global variable hb_gui_use_hwd_flagjstebbins2015-03-291-2/+2
| | | | | | | | | | | | This global was shared between the CLI and libhb and used as a back door to force scan and encode passes to use the same ffmpeg context for hardware decoding. Aside from the fact that this context sharing should not be necessary and needs fixing, this information belongs in the hb_handle_t that is shared between the scan and the encode. So put it there and make sure the hb_handle_t get propagated to where the flag is needed. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7028 b64f7644-9d1e-0410-96f1-a4d463321fa5
* json: automatically scan title when processing json jobsjstebbins2015-03-071-2/+3
| | | | | | | | | | | | | | | Simplifies the WinGui. This also changes how jobs are processed. Creating the sub-jobs for multiple passes is delayed until after scanning and immediately before running the job. Working status has also changed. Sub-job passes are identified in status with an ID that allows the frontend to definitively identify what pass is in progress. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6976 b64f7644-9d1e-0410-96f1-a4d463321fa5
* New audio output options.Rodeo2015-02-151-8/+88
| | | | | | | | | Dolby Digital Plus (E-AC-3), Dolby TrueHD and FLAC can now be passed through without re-encoding. They aren't covered by Auto Passthru yet, however. In addition, encoding to E-AC-3 is now possible. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6908 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Update year to 2015.bradleys2015-02-011-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6852 b64f7644-9d1e-0410-96f1-a4d463321fa5
* MacGui: separate the video settings logic from the view controller. There ↵ritsuka2014-12-181-0/+1
| | | | | | are a number of small regression ("Custom" preset and auto naming not updating) that will be fixed in the next commits. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6606 b64f7644-9d1e-0410-96f1-a4d463321fa5
* json: add json APIsjstebbins2014-12-161-3/+4
| | | | | | | | | | There are several changes to job and title structs that break current windows interop code. The interop code should be changed such that it only uses json APIs. So if there is any missing features (or bugs) in these APIs, please let me know. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6602 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: fix another issue with overlapping ssa subtitle translation to tx3gjstebbins2014-12-151-7/+15
| | | | | | | It was failing if 3 or more subtitles overlapped simultaneously. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6600 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: fix dropping of subtitles caused by my previous commitjstebbins2014-12-051-0/+4
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6588 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: fix a problem with overlapping ssa in mp4jstebbins2014-12-041-0/+11
| | | | | | | | If an SSA starts before and ends after the subsequent SSA, the subtitles were improperly merged resulting in timestamp issues. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6584 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: fix subtitle buffer leakjstebbins2014-10-301-0/+5
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6482 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix merging of ssa subtitlesjstebbins2014-08-271-6/+34
| | | | | | | | mergeSubtitle was originally written for pure text subs. But now the subtitle buffers have extra ssa formatting that needs different treatment. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6374 b64f7644-9d1e-0410-96f1-a4d463321fa5
* pgssubs: fix pgs passthrujstebbins2014-04-061-2/+18
| | | | | | | Subtitles were being dropped because of the new condition I added that drops subtitles when start == end. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6152 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: enable burn-in of all supported text subtitle formatsjstebbins2014-03-301-5/+14
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6141 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Update some copyright dates to 2014.Rodeo2014-02-181-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6042 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Replace invaled timestamp flag "-1" with AV_NOPTSjstebbins2014-01-261-9/+9
| | | | | | | | | -1 is not a good value as a flag for invalid timestamps. There are cases where small negative timestamps are useful. So this eliminates a potential ambiguity. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6001 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: fix previous commit.Rodeo2013-12-051-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5920 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: find the AAC encoder by name.Rodeo2013-12-051-1/+1
| | | | | | | FDK is non-experimental, so if it's compiled in, it will be selected over the libavcodec encoder, which is what we want to use for consistency (quality hardly matters when encoding silence). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5919 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: use "drop video to sync" fallback also when audio encoding fails or we ↵Rodeo2013-12-051-1/+9
| | | | | | do not get an output packet after 10 tries. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5918 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix double hb_buffer_closejstebbins2013-10-281-1/+0
| | | | | | | Don't close a list of buffers then also close the last item in the list :-\ git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5861 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Plug some leaks and clean up the buffer pool code a little.jstebbins2013-10-231-0/+14
| | | | | | | | | | | Filters were leaking buffers when a job is cancelled. decavcodec could leak when job cancelled. decavcodec leaked audio extradata in BSInfo encavcodec and encavcodecaudio leaked AVCodecContext sync leaked subtitle_sanitizer_t data git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5853 b64f7644-9d1e-0410-96f1-a4d463321fa5
* QSV: minor refactoring.Rodeo2013-09-151-6/+10
| | | | | | | | | | Address the easy issues first. Apologies if I broke HandBrakeInterop. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5783 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Big merge, QSV to trunk: part 1 (tracked files).Rodeo2013-08-221-0/+44
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5737 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: handle zero length EOF subtitle properlyjstebbins2013-07-061-3/+6
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5636 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix a couple of problems with subtitle mergingjstebbins2013-07-061-11/+29
| | | | | | | | | | I did not handle cases where it was impossible to determine the stop time properly. I also did not handle the last subitle properly. It would have been lost. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5635 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: improve handling of overlapping text subtitlesjstebbins2013-07-011-53/+177
| | | | | | | | | mp4 timed text does not support subtitles that overlap (in time). So this patch detects these overlaps and merges subtitles when appropriate. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5632 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: add experimental avformat muxer for mkv and mp4jstebbins2013-06-301-10/+42
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5620 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix hang that can occur under certain error conditionsjstebbins2013-06-161-4/+4
| | | | | | | | | audio and video sync are in wait loops when they first start. if an error happens during this period, the hang would happen. check w->done in these loops to break out in case of error. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5592 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: fall back to drop_video_to_sync when hb_avcodec_open() fails, instesd ↵Rodeo2013-05-171-39/+41
| | | | | | | | | | of killing the job. Patch by John Stebbins. Thanks! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5459 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix crash when EOF is found before first video framejstebbins2013-04-301-0/+1
| | | | | | | buffer got closed twice, once in sync close and once in muxer. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5430 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: fix a hang when the avcodec encoder for silence insertion fails to open.Rodeo2013-04-281-2/+3
| | | | | | | | This affects e.g. AAC Passthru with more than 6 channels. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5423 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Updated all the copyright headers to 2013.sr552013-03-091-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5318 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Fix issue with silence insertion when using FLAC encoderjstebbins2013-01-211-5/+20
| | | | | | | | | | | | | | | When we insert silence to maintain sync, we typically need to insert about 70ms. But the default flac frame duration is very large (>=96ms). This is causing us to overshoot the target and we immediately drop a frame. Dropping a frame undershoots and we insert a frame... ad infinitum. This patch changes the behavior of silence insertion for non-passthru audio. Instead of inserting full frames of silence, the last "frame" inserted may be a partial. This lets us insert a finer grained silence duration and eliminates the problem with large flac frames. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5188 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Bump libav to v9_beta3.Rodeo2012-12-311-15/+8
| | | | | | | | Miscellaneous bugfixes and improvements. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5124 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Fix a timing problem when rendering vobsubsjstebbins2012-12-081-8/+30
| | | | | | | | So, if we are rendering the subtitles, do not delay them in sync. The renderer is responsible for handling stop == -1. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5092 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix generation of silence buffer for filling audio gapsjstebbins2012-11-211-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5076 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Improve management of titles and jobsjstebbins2012-11-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cleans up several several unavoidable memory leaks caused by old api. Clearly separates titles from jobs. Titles are set during scan and never modified now. Since titles are immutable, this lead to API some changes. For example, We were setting chapter names in the title from the front ends. Now these get set in the job. These new APIs allow us to start moving away from our use of title->job. Eventually, I would like to eliminate title->job completely, but the mac ui is too tightly tied to using this field to allow removing it at this time. So there is temporarily a convenience function used only by the mac ui that allows it to continue using title->job and also use the new APIs. New APIs: typedef struct hb_title_set_s hb_title_set_t; struct hb_title_set_s { hb_list_t * list_title; int feature; // Detected DVD feature title }; hb_title_set_t * hb_get_title_set( hb_handle_t * ); This is just something I added to clean up how "feature title" info is passed. hb_job_t * hb_job_init( hb_title_t * title ); Initializes a new job with default settings from the title. hb_job_t * hb_job_init_by_index( hb_handle_t *h, int title_index ); Same as hb_job_init(). For use by win Interop lib. void hb_job_reset( hb_job_t * job ); Convenience function for the MacUi. Clears audio, subtitle, and filter lists. The macui still uses title->job because it is so intricately tied to it. So I created this convenience function that it can call after adding a job. void hb_job_close( hb_job_t ** job ); Releases the job an all resources it contains. void hb_job_set_advanced_opts( hb_job_t *job, const char *advanced_opts ); Makes a copy of "advanced_opts" and stores in job. Freed by hb_job_close(). void hb_job_set_file( hb_job_t *job, const char *file ); Makes a copy of "file" and stores in job. Freed by hb_job_close(). void hb_chapter_set_title(hb_chapter_t *chapter, const char *title); Makes a copy of "title" and stores in chapter. Freed by hb_chapter_close(). Recommended usage (cli and lingui are updated to do this): job = hb_job_init( title ); // set job settings ... hb_add(h, job); hb_job_close( &job ); I have also added new APIs for managing metadata. These are used to add metadata to a job. void hb_metadata_set_name( hb_metadata_t *metadata, const char *name ); void hb_metadata_set_artist( hb_metadata_t *metadata, const char *artist ); void hb_metadata_set_composer( hb_metadata_t *metadata, const char *composer ); void hb_metadata_set_release_date( hb_metadata_t *metadata, const char *release_date ); void hb_metadata_set_comment( hb_metadata_t *metadata, const char *comment ); void hb_metadata_set_genre( hb_metadata_t *metadata, const char *genre ); void hb_metadata_set_album( hb_metadata_t *metadata, const char *album ); void hb_metadata_set_coverart( hb_metadata_t *metadata, const uint8_t *coverart, int size ); Example: job = hb_job_init( &job ); // set job settings ... hb_metadata_set_artist( job->metadata, "Danny Elfman" ); hb_add(h, job); hb_job_close( &job ); Some APIs have changed in order to avoid using title incorrectly and use the new hb_title_set_t. -void hb_autopassthru_apply_settings( hb_job_t * job, hb_title_t * title ); +void hb_autopassthru_apply_settings( hb_job_t * job ); -void hb_get_preview( hb_handle_t *, hb_title_t *, int, uint8_t * ); +void hb_get_preview( hb_handle_t *, hb_job_t *, int, uint8_t * ); hb_thread_t * hb_scan_init( hb_handle_t *, volatile int * die, const char * path, int title_index, - hb_list_t * list_title, int preview_count, + hb_title_set_t * title_set, int preview_count, int store_previews, uint64_t min_duration ); These APIs have been removed. Win Interop will need some changes. I think what I've provided will be suffecient, but let me know if it's not. -void hb_get_preview_by_index( hb_handle_t *, int, int, uint8_t * ); -void hb_set_anamorphic_size_by_index( hb_handle_t *, int, - int *output_width, int *output_height, - int *output_par_width, int *output_par_height ); git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5058 b64f7644-9d1e-0410-96f1-a4d463321fa5
* hb_ff_set_sample_fmt() improvements.Rodeo2012-10-171-4/+4
| | | | | | | | | | - allow setting a sample_fmt other than AV_SAMPLE_FMT_FLT - fall back on planar/packed variant of the requested format if available git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5019 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix calculation of sync->gain_factor.Rodeo2012-09-291-1/+1
| | | | | | | | Revision 4976 simplified it, but it was still slightly incorrect. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4993 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: simplify calculation of sync->gain_factor.Rodeo2012-09-231-3/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4976 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix a collection of small memory leaksjstebbins2012-09-131-3/+8
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4963 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't send empty audio packets downstream, as empty buffers are assumed to ↵Rodeo2012-08-151-0/+7
| | | | | | | | | | mark the end of stream. Such packets can result from samplerate or other types of audio conversion. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4906 b64f7644-9d1e-0410-96f1-a4d463321fa5
* More fine grained progress statistics during subtitle scanjstebbins2012-07-181-0/+16
| | | | | | | | Make reader compute subtitle scan progress based on timestamps seen and duration instead of chapter marks. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4864 b64f7644-9d1e-0410-96f1-a4d463321fa5
* bump libav to libav-v0.8-2197-g1a068bfjstebbins2012-07-111-10/+26
| | | | | | | | | | | | Resolves several deprecated api's Eliminates several libav patches Eliminates our builtin downmix in favour of avresample Eliminate HB_INPUT_CH_LAYOUT_* and replace with AV_CH_LAYOUT_* Resolves 6.x and 7.0 input channel layout issues HB had Adds downmix support to declpcm. We never had it! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4825 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: drop HB_INPUT_CH_LAYOUT_*Rodeo2012-06-181-38/+5
| | | | | | | | AV_CH_LAYOUT_* works for us, and as its usage becomes more widespread in libhb, translating between the two formats gets increasingly tedious. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4754 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Updated file copyright / GPL headerssr552012-06-151-3/+6
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4737 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Make HB_AMIXDOWN_* defines a simple enumeration. The existing system wasn't ↵Rodeo2012-06-061-13/+11
| | | | | | necessary and didn't work in all decoders for Dolby downmixing. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4714 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix problem with incorrect addition of audio silencejstebbins2012-05-011-1/+9
| | | | | | | | | | | | sync needs the precise duration of a frame of audio and has no way to compute it for passthru audio. So add a duration member to hb_buffer_t and set it in the audio decoders. This should eventually supersede hb_buffer_t member "stop" since it provides redundant information. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4618 b64f7644-9d1e-0410-96f1-a4d463321fa5