Merge commit '9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 7 Nov 2014 23:41:51 +0000 (00:41 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 8 Nov 2014 00:04:04 +0000 (01:04 +0100)
* commit '9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d':
  movenc: Write correct presentation timestamps in tfra

Conflicts:
libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/movenc.c
libavformat/version.h

index f3b99a1..67697dd 100644 (file)
@@ -3740,6 +3740,17 @@ static int mov_flush_fragment(AVFormatContext *s)
             info = &track->frag_info[track->nb_frag_info - 1];
             info->offset   = avio_tell(s->pb);
             info->time     = track->frag_start;
+            if (track->entry) {
+                // Try to recreate the original pts for the first packet
+                // from the fields we have stored
+                info->time = track->start_dts + track->frag_start +
+                             track->cluster[0].cts;
+                // If the pts is less than zero, we will have trimmed
+                // away parts of the media track using an edit list,
+                // and the corresponding start presentation time is zero.
+                if (info->time < 0)
+                    info->time = 0;
+            }
             info->duration = duration;
             mov_write_tfrf_tags(s->pb, mov, track);
 
index 1368f23..4596175 100644 (file)
@@ -31,7 +31,7 @@
 
 #define LIBAVFORMAT_VERSION_MAJOR 56
 #define LIBAVFORMAT_VERSION_MINOR  12
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MICRO 103
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \