[FFmpeg-cvslog] movenc: Add some comments explaining subtle details in writing the edit lists

Martin Storsjö git at videolan.org
Sun Oct 12 22:58:22 CEST 2014


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sat Oct 11 23:56:24 2014 +0300| [95ee4e2ce774e0339632d067161596bf3dadfc72] | committer: Martin Storsjö

movenc: Add some comments explaining subtle details in writing the edit lists

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=95ee4e2ce774e0339632d067161596bf3dadfc72
---

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

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 4017a56..218aa50 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1620,6 +1620,11 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
 
     avio_wb32(pb, entry_count);
     if (delay > 0) { /* add an empty edit to delay presentation */
+        /* In the positive delay case, the delay includes the cts
+         * offset, and the second edit list entry below trims out
+         * the same amount from the actual content. This makes sure
+         * that the offsetted last sample is included in the edit
+         * list duration as well. */
         if (version == 1) {
             avio_wb64(pb, delay);
             avio_wb64(pb, -1);
@@ -1634,6 +1639,9 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
          * 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);
+        /* Note, this delay is calculated from the pts of the first sample,
+         * ensuring that we don't reduce the duration for cases with
+         * dts<0 pts=0. */
         duration += delay;
     }
 



More information about the ffmpeg-cvslog mailing list