summaryrefslogtreecommitdiffstats
path: root/libhb/decpgssub.c
Commit message (Collapse)AuthorAgeFilesLines
* sync: correct timestamp discontinuities in sync instead of reader (#192)John Stebbins2016-05-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sync: correct timestamp discontinuities in sync instead of reader This patch passes discontinuity information through the pipeline till it reaches sync.c. The timestamps are passed through the pipeline as read and unmodified to sync.c (instead of attempting to correct discontinuities in reader). In sync, when we see a discontinuity, we know where the next timestamp should be based on the timestamp and duration of the previous buffer (before the discontinuity). So we calculate an "SCR" offset based on the timestamp after the discontinuity and what we calculate it should be. The old discontinuity handling code was broken due to the following. The MPEG STD timing model relies heavily on the decoder having an STC that is phase lock looped to the PCRs in the stream. When decoding a broadcast stream, the decoder can count on the time measure between PCRs using the STC to match to a high degree of accuracy. I.e. STC - lastSTC == PCR - lastPCR. When a discontinuity occurs, the decoder calculates a new PCR offset = PCR - STC. I.e. the offset is the new PCR value minus what it would have been if there had been no discontinuity. The above does not work without a reliable STC, which we do not have. We have been attempting to approximate one by avereraging the duration of received packets and extrapolating an "STC" based on the last PTS and the average packet duration. But this is highly variable and unreliable. * decavcodec: fix data type of next_pts It needs to be double so that partial ticks are not lost * deccc608sub: clarify comment * sync: allow queueing more audio Audio is small, and there is often a significant amount of audio in the stream before the first video frame. * sync: improve handling of damaged streams When data is missing, the audio decoder was extrapolating timestamps from the last pts before the error caused by the missing data which caused sync issues. Also, missing data can cause the video decoder to output a frame out of order with the wrong scr sequence. Drop such frames.
* sync: fix merging of multiple SSA to tx3gJohn Stebbins2016-05-171-10/+12
| | | | | | When more than 2 subtitles overlapped in time, they were not merged properly and could result in cases where the subtitle time went backwards
* libhb: remove unused hb_buffer_t sequence numberJohn Stebbins2016-05-171-2/+0
|
* decpgssub: allow PGS to have negative timestampsJohn Stebbins2016-05-171-4/+12
| | | | | This can happen due to poorly muxed MTS files that result in a suboptimal scr offset calculation in reader.c
* Update copyright dates to 2016.Bradley Sepos2016-01-011-1/+1
|
* libhb: add hb_buffer_listJohn Stebbins2015-09-241-62/+28
| | | | | This brings together several independent implementations of a simple buffer list manager.
* rendersub: handle mismatched video and subtitle dimensionsJohn Stebbins2015-09-241-8/+10
| | | | | The video frame subtitles are meant to be rendered to may not match the actual video we are encoding. So scale to match as needed.
* libhb: Use a buffer flat to indicate EOFjstebbins2015-05-011-1/+1
| | | | | | | | | | | | ... 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
* Update year to 2015.bradleys2015-02-011-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6852 b64f7644-9d1e-0410-96f1-a4d463321fa5
* decpgssub: make sure all packets get marked as subtitle framesjstebbins2014-10-291-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6476 b64f7644-9d1e-0410-96f1-a4d463321fa5
* decpgssub: partial fix for "multi-object" PGS subsjstebbins2014-06-131-24/+50
| | | | | | | | | | | We were packaging multiple subtitle packets with the same pts and passing down to rendersub which would then throw away all but the last sub with a given pts. So put all AVSubtitleRects into the same hb_buffer_t. A patch to libav is also required to fix the multi-object problem. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6211 b64f7644-9d1e-0410-96f1-a4d463321fa5
* pgssubs: fix pgs passthrujstebbins2014-04-061-8/+10
| | | | | | | 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
* 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-2/+2
| | | | | | | | | -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
* bump libav, libav-v10_alpha1-90-g63debaajstebbins2014-01-121-0/+13
| | | | | | | | | Adds interlaced VC1 and HEVC support. Eliminates the need for most of our local patches. Many assorted bug fixes and improvements. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5962 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix pgs timestamp problemsjstebbins2013-10-191-23/+35
| | | | | | | | Fixes "pts < dts" and "non-monotically increasing dts" errors in avformat muxing. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5843 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix potential pgs timestamp problemjstebbins2013-08-261-1/+20
| | | | | | | Under rare circumstances, the computed start time would jump backward. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5753 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: add experimental avformat muxer for mkv and mp4jstebbins2013-06-301-0/+3
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5620 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
* Bump libav to v9_beta3.Rodeo2012-12-311-10/+12
| | | | | | | | Miscellaneous bugfixes and improvements. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5124 b64f7644-9d1e-0410-96f1-a4d463321fa5
* decpgssub: avoid dropping subtitles when we get broken timestamps.Rodeo2012-09-201-9/+24
| | | | | | | | Instead, use a default PTS difference of 3 seconds. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4970 b64f7644-9d1e-0410-96f1-a4d463321fa5
* decpgssub: simplify code (merge several if/else blocks).Rodeo2012-07-151-35/+27
| | | | | | | | Also, discard empty subtitles until we've seen the first non-empty sub, as they are not needed. This can happen when encoding from the middle of a source, for example. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4837 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Updated file copyright / GPL headerssr552012-06-151-0/+9
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4737 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: forgot to clear the flag indicating forced sub seenjstebbins2012-05-171-0/+1
| | | | | | | | since the flag wasn't cleared, it would output multiple empty subs for each forced sub git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4684 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: improve termination of forced subtitlesjstebbins2012-05-171-5/+107
| | | | | | | | | There isn't always an "empty" sub directly after a forced subtitle. This causes the forced subtitle to be displayed for too long. So take the next sub and convert it to an empty sub. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4683 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: PGS subtitle improvements.Rodeo2012-05-101-17/+92
| | | | | | | | | | | | | | Some devices (such as the WD TV Live) expect PGS subtitle "frames" to come as a single packet, whereas on Blu-ray, each frame "segment" comes in its own packet. When doing PGS passthrough, merge packets so that 1 subtitle == 1 packet. This matches what MakeMKV amd mkvmerge do. Also, when doing forced-only extraction, don't include more 'empty' PGS subtitles than necessary. In muxmkv, cleanup negative subtitle durations (doesn't appear to fix anything, but it doesn't make anything worse either). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4658 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Simplify Foreign Audio Search code:Rodeo2012-05-011-15/+13
| | | | | | | | | | | | | | | | | | | | - move all subtitle hit counting to the decoders instead of reader ---> allows us to count actual subtitles rather than just packets - always count subtitles, even when not doing a scan (may be useful in the future) Miscellaneous improvements: - always insert select_subtitle at the head of the output subtitle list, to make it less likely to be dropped - when multiple subtitle tracks have forced hits, pick the track with the fewest forced hits ---> Foreign Audio Search should now work with Star Wars on Blu-ray - logging improvements (more readable, and log job->select_subtitle configuration - Forced Only vs. All, Render vs. Passthrough) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4622 b64f7644-9d1e-0410-96f1-a4d463321fa5
* PGS (bluray) subtitle support \o/jstebbins2012-04-261-0/+268
Thanks to patches supplied by David Mitchell and Rob McMullen we finally have PGS support. I added a fix for libav pgs timestamp processing and detection of forced subtitles to their work, then made foreign audio search work with PGS subs. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4605 b64f7644-9d1e-0410-96f1-a4d463321fa5