diff options
author | Martin Storsjö <martin@martin.st> | 2014-10-29 09:20:51 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2014-10-29 23:01:27 +0200 |
commit | 573b1de2d7f1db71030f91ecdded7d0bc071f6b6 (patch) | |
tree | 53cbc0dfbf1db77af4b17139d06bc0d7932aeca7 /libavformat/movenc.c | |
parent | 84bf64d3598c98a748e609195358ea04b0cfd140 (diff) | |
download | ffmpeg-573b1de2d7f1db71030f91ecdded7d0bc071f6b6.tar.gz |
movenc: Don't use track_id to decide which track is the first in a moof
If one track doesn't have any samples within a moof, no traf/trun
is written for it. When the omit_tfhd_offset flag is set, none
of the tfhd atoms have any base_data_offset set, and the implicit
offset (end of previous track fragment data, or start of the moof
for the first trun) is used.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index d84ddbea96..43b03c5325 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2458,7 +2458,7 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVMuxContext *mov, avio_wb32(pb, track->entry); /* sample count */ if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET && !(mov->flags & FF_MOV_FLAG_SEPARATE_MOOF) && - track->track_id != 1) + !mov->first_trun) avio_wb32(pb, 0); /* Later tracks follow immediately after the previous one */ else avio_wb32(pb, moof_size + 8 + track->data_offset + @@ -2477,6 +2477,7 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVMuxContext *mov, avio_wb32(pb, track->cluster[i].cts); } + mov->first_trun = 0; return update_size(pb, pos); } @@ -2598,6 +2599,7 @@ static int mov_write_moof_tag_internal(AVIOContext *pb, MOVMuxContext *mov, avio_wb32(pb, 0); /* size placeholder */ ffio_wfourcc(pb, "moof"); + mov->first_trun = 1; mov_write_mfhd_tag(pb, mov); for (i = 0; i < mov->nb_streams; i++) { |