summaryrefslogtreecommitdiff
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-08 00:41:51 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-08 01:04:04 +0100
commitc9a9a7a1fd7e00a838a94e3792235ceb4755648c (patch)
tree46ce16501fce2cc79d419266255fa501db9d53cf /libavformat/movenc.c
parente2e36a739d3ad0d207a31c76f414a912d08b1d6d (diff)
parent9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d (diff)
Merge commit '9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d'
* commit '9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d': movenc: Write correct presentation timestamps in tfra Conflicts: libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index f3b99a1f6c..67697dd838 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -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);