Module: libav
Branch: master
Commit: 72f801619a1ae91969fee9a7d72519422433c998

Author:    Michael Niedermayer <[email protected]>
Committer: Martin Storsjö <[email protected]>
Date:      Sat Sep 29 06:31:18 2012 +0200

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ö <[email protected]>

---

 libavformat/movenc.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 6c95b4b..4017a56 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 */

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to