diff options
author | John Stebbins <[email protected]> | 2016-06-27 16:24:19 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-06-27 16:24:54 -0700 |
commit | 1ac26fb371c869e9b15083ea2274e119022a1400 (patch) | |
tree | 46dcee5eed583787294f54e526da29f34406ae4f /libhb/reader.c | |
parent | 9905eb75a2372039bff7483521923c1f5d603323 (diff) |
reader: fix p-to-p start pos in avformat demuxed streams
Diffstat (limited to 'libhb/reader.c')
-rw-r--r-- | libhb/reader.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/libhb/reader.c b/libhb/reader.c index 45da42ca9..a0e9e9f5f 100644 --- a/libhb/reader.c +++ b/libhb/reader.c @@ -479,6 +479,32 @@ static int reader_work( hb_work_object_t * w, hb_buffer_t ** buf_in, while ((buf = hb_buffer_list_rem_head(&list)) != NULL) { + fifos = GetFifoForId( r, buf->s.id ); + if (fifos && r->stream && !r->start_found) + { + // 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) + { + hb_buffer_close(&buf); + continue; + } + // 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->start_found = 1; + } + if (buf->s.start != AV_NOPTS_VALUE && r->scr_changes != r->demux.scr_changes) { @@ -489,7 +515,7 @@ static int reader_work( hb_work_object_t * w, hb_buffer_t ** buf_in, // libav tries to be too smart with timestamps and // enforces unnecessary conditions. One such condition // is that subtitle timestamps must be monotonically - // increasing. To encure this is the case, we calculate + // increasing. To ensure this is the case, we calculate // an offset upon each SCR change that will guarantee this. // This is just a very rough SCR offset. A fine grained // offset that maintains proper sync is calculated in sync.c @@ -519,32 +545,6 @@ static int reader_work( hb_work_object_t * w, hb_buffer_t ** buf_in, UpdateState(r); } - fifos = GetFifoForId( r, buf->s.id ); - if (fifos && r->stream && !r->start_found) - { - // 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) - { - hb_buffer_close(&buf); - continue; - } - // 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->start_found = 1; - } - buf = splice_discontinuity(r, buf); if (fifos && buf != NULL) { |