diff options
author | John Stebbins <[email protected]> | 2017-04-15 13:20:21 -0600 |
---|---|---|
committer | John Stebbins <[email protected]> | 2017-04-15 13:22:55 -0600 |
commit | bb92ab00e37bdb87b528b1901d956c1f24417387 (patch) | |
tree | f327eb191c83b6ffad38ad32c8d144f6b0582ee5 /libhb/reader.c | |
parent | 52d4c21b22cfc91b63a680aa7e475cc0ca6012cb (diff) |
decsrt: fix p-to-p start time after seeking
Reader can skip data at the beginning of the file. We were not
informing decsrt how much was skipped when pts_to_start caused the skip.
Fixes https://forum.handbrake.fr/viewtopic.php?f=11&t=36258
Diffstat (limited to 'libhb/reader.c')
-rw-r--r-- | libhb/reader.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/libhb/reader.c b/libhb/reader.c index 71a961a1c..7f1e7cc1a 100644 --- a/libhb/reader.c +++ b/libhb/reader.c @@ -115,7 +115,7 @@ static int hb_reader_open( hb_work_private_t * r ) // to start decoding early using r->pts_to_start hb_bd_seek_pts(r->bd, r->job->pts_to_start); r->duration -= r->job->pts_to_start; - r->job->pts_to_start = 0; + r->job->reader_pts_offset = r->job->pts_to_start; r->start_found = 1; } else @@ -172,6 +172,7 @@ static int hb_reader_open( hb_work_private_t * r ) // first packet we get, subtract that from pts_to_start, and // inspect the reset of the frames in sync. r->duration -= r->job->pts_to_start; + r->job->reader_pts_offset = AV_NOPTS_VALUE; } else { @@ -491,7 +492,8 @@ static int reader_work( hb_work_object_t * w, hb_buffer_t ** buf_in, // libav is allowing SSA subtitles to leak through that are // prior to the seek point. So only make the adjustment to // pts_to_start after we see the next video buffer. - if (buf->s.id != r->job->title->video_id) + if (buf->s.id != r->job->title->video_id || + buf->s.start == AV_NOPTS_VALUE) { hb_buffer_close(&buf); continue; @@ -499,15 +501,7 @@ static int reader_work( hb_work_object_t * w, hb_buffer_t ** buf_in, // We will inspect the timestamps of each frame in sync // to skip from this seek point to the timestamp we // want to start at. - if (buf->s.start != AV_NOPTS_VALUE && - buf->s.start < r->job->pts_to_start) - { - r->job->pts_to_start -= buf->s.start; - } - else if ( buf->s.start >= r->job->pts_to_start ) - { - r->job->pts_to_start = 0; - } + r->job->reader_pts_offset = buf->s.start; r->start_found = 1; } |