diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-04 20:28:45 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-04 20:58:59 +0100 |
commit | fa11f368764f0e4a562d4d8e45da01132c9abf74 (patch) | |
tree | e74188c91b8a344f0c00fbeb5b5bda6eb6105488 /libavformat/mpegenc.c | |
parent | cf369d4449857b094e4ec91e29eaeaa7e7334bad (diff) | |
download | ffmpeg-fa11f368764f0e4a562d4d8e45da01132c9abf74.tar.gz |
mpegpsenc: avoid shifting dts/pts
Only shift if needed to avoid negative scr when requested
or for dvd.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mpegenc.c')
-rw-r--r-- | libavformat/mpegenc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 23ba8edd67..b467bb5de5 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -1062,13 +1062,13 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) dts= pkt->dts; if (s->last_scr == AV_NOPTS_VALUE) { - if (dts == AV_NOPTS_VALUE || s->is_dvd) { + if (dts == AV_NOPTS_VALUE || (dts < preload && ctx->avoid_negative_ts) || s->is_dvd) { if (dts != AV_NOPTS_VALUE) s->preload += av_rescale(-dts, AV_TIME_BASE, 90000); s->last_scr = 0; } else { - s->last_scr = dts + preload; - s->preload *= 2; + s->last_scr = dts - preload; + s->preload = 0; } preload = av_rescale(s->preload, 90000, AV_TIME_BASE); av_log(ctx, AV_LOG_DEBUG, "First SCR: %"PRId64" First DTS: %"PRId64"\n", s->last_scr, dts + preload); |