summaryrefslogtreecommitdiffstats
path: root/libhb/stream.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-04-24 22:31:47 +0000
committerjstebbins <[email protected]>2015-04-24 22:31:47 +0000
commitca6ad7f1c6f414758a99ea82bdfa9e64aae6aada (patch)
tree2c4e8ffd7f15d96b6ee96a032a1b076d7398b446 /libhb/stream.c
parent5eb127da904759380a7bd9d1d3f1b2d9137bdeba (diff)
p-to-p: fix seek to start pts source initial PTS != 0
When a file demuxed by libav does not start to time 0, our seek to the initial start pts tried to seek too far forward. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7124 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/stream.c')
-rw-r--r--libhb/stream.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libhb/stream.c b/libhb/stream.c
index b1e15cea9..5713f6dee 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -5746,10 +5746,11 @@ hb_buffer_t * hb_ffmpeg_read( hb_stream_t *stream )
// compute a conversion factor to go from the ffmpeg
// timebase for the stream to HB's 90kHz timebase.
AVStream *s = stream->ffmpeg_ic->streams[stream->ffmpeg_pkt->stream_index];
- double tsconv = 90000. * (double)s->time_base.num / (double)s->time_base.den;
+ double tsconv = (double)90000. * s->time_base.num / s->time_base.den;
+ int64_t offset = 90000L * ffmpeg_initial_timestamp(stream) / AV_TIME_BASE;
- buf->s.start = av_to_hb_pts( stream->ffmpeg_pkt->pts, tsconv );
- buf->s.renderOffset = av_to_hb_pts( stream->ffmpeg_pkt->dts, tsconv );
+ buf->s.start = av_to_hb_pts(stream->ffmpeg_pkt->pts, tsconv) - offset;
+ buf->s.renderOffset = av_to_hb_pts(stream->ffmpeg_pkt->dts, tsconv) - offset;
if ( buf->s.renderOffset >= 0 && buf->s.start == AV_NOPTS_VALUE )
{
buf->s.start = buf->s.renderOffset;