aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-09-29 06:31:18 +0200
committerMartin Storsjö <martin@martin.st>2014-10-12 17:45:55 +0300
commit72f801619a1ae91969fee9a7d72519422433c998 (patch)
treeed716bea7cc51817eb101f5bac5b7ba0792c03f6
parent8bef43388132b53f59a6e90add18900a3bb4cc60 (diff)
downloadffmpeg-72f801619a1ae91969fee9a7d72519422433c998.tar.gz
movenc: Adjust edit lists to trim out parts of tracks with negative pts
This makes sure that audio preroll for e.g. AAC is signaled correctly. Previously we only wrote the edit list correctly if we had negative dts but started with pts == 0 (e.g. for video with B-frames). Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/movenc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 6c95b4b3aa..4017a56158 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1628,6 +1628,13 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, -1);
}
avio_wb32(pb, 0x00010000);
+ } else {
+ /* Avoid accidentally ending up with start_ct = -1 which has got a
+ * special meaning. Normally start_ct should end up positive or zero
+ * here, but use FFMIN in case dts is a a small positive integer
+ * rounded to 0 when represented in MOV_TIMESCALE units. */
+ start_ct = -FFMIN(track->cluster[0].dts, 0);
+ duration += delay;
}
/* duration */