Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-04 23:28:45 +0400
committerMichael Niedermayer <michaelni@gmx.at>2013-01-04 23:58:59 +0400
commitfa11f368764f0e4a562d4d8e45da01132c9abf74 (patch)
treee74188c91b8a344f0c00fbeb5b5bda6eb6105488 /libavformat/mpegenc.c
parentcf369d4449857b094e4ec91e29eaeaa7e7334bad (diff)
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.c6
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);