diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-12 23:26:28 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-13 01:02:36 +0200 |
commit | ca5a77191b79e8ff46402e2db6f1bf18d034f9e8 (patch) | |
tree | 90cfc948923c0b3e2fec53567001e6af5b0e777a | |
parent | ccd04f43201d1a147dcb60bf6290c879d59fec37 (diff) | |
parent | dbb472cb2f2f799295a12b4922a6a8be2cccfdee (diff) | |
download | ffmpeg-ca5a77191b79e8ff46402e2db6f1bf18d034f9e8.tar.gz |
Merge commit 'dbb472cb2f2f799295a12b4922a6a8be2cccfdee'
* commit 'dbb472cb2f2f799295a12b4922a6a8be2cccfdee':
movenc: Write edit lists for fragmented files as well, if necessary
Conflicts:
libavformat/movenc.c
The default for writing EDTS for fragmented mp4 is left at disabled
this can be overridden via command line with -use_editlist
but EDTS + fragments still does not fully work, which is why it is
left disabled by default
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/movenc.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index df18de80ef..9140411b29 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -112,6 +112,7 @@ static int64_t update_size(AVIOContext *pb, int64_t pos) static int supports_edts(MOVMuxContext *mov) { // EDTS with fragments is tricky as we don't know the duration when its written + // also we might end up having to write the EDTS before the first packet, which would fail return (mov->use_editlist<0 && !(mov->flags & FF_MOV_FLAG_FRAGMENT)) || mov->use_editlist>0; } @@ -2186,7 +2187,8 @@ static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track) } // This box seems important for the psp playback ... without it the movie seems to hang -static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track) +static int mov_write_edts_tag(AVIOContext *pb, MOVMuxContext *mov, + MOVTrack *track) { int64_t duration = av_rescale_rnd(track->track_duration, MOV_TIMESCALE, track->timescale, AV_ROUND_UP); @@ -2237,6 +2239,13 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track) duration += delay; } + /* For fragmented files, we don't know the full length yet. Setting + * duration to 0 allows us to only specify the offset, including + * the rest of the content (from all future fragments) without specifying + * an explicit duration. */ + if (mov->flags & FF_MOV_FLAG_FRAGMENT) + duration = 0; + /* duration */ if (version == 1) { avio_wb64(pb, duration); @@ -2348,7 +2357,7 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov, ffio_wfourcc(pb, "trak"); mov_write_tkhd_tag(pb, mov, track, st); if (supports_edts(mov)) - mov_write_edts_tag(pb, track); // PSP Movies and several other cases require edts box + mov_write_edts_tag(pb, mov, track); // PSP Movies and several other cases require edts box if (track->tref_tag) mov_write_tref_tag(pb, track); mov_write_mdia_tag(pb, track); |