aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-13 03:11:53 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-13 03:11:53 +0100
commitd9a41695edffa789e0aee228cf8ab26b3574f3d7 (patch)
tree17769475ebd7b4758913fe095fd95c4376a8f981 /libavformat
parent1f83f046090cac09b7a3da7f15182d2143bccf87 (diff)
downloadffmpeg-d9a41695edffa789e0aee228cf8ab26b3574f3d7.tar.gz
mp4enc: Only store flags in trun when they differ from the default and set a sane default.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/movenc.c7
-rw-r--r--libavformat/movenc.h1
2 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 31fd05d370..e26865b877 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1447,12 +1447,14 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track)
int tr_flags=0;
int i;
- tr_flags |= 0x600; //FIXME
+ tr_flags |= 0x200; //FIXME
for(i=track->cluster_write_index; i<track->entry; i++){
int64_t duration = i + 1 == track->entry ?
track->trackDuration - track->cluster[i].dts + track->cluster[0].dts : /* readjusting */
track->cluster[i+1].dts - track->cluster[i].dts;
if(duration != 1) tr_flags |= 0x100;
+ if(track->trex_flags != ((track->cluster[i].flags&MOV_SYNC_SAMPLE) ? 0x02000000 : 0x01010000))
+ tr_flags |= 0x400;
if(track->cluster[i].cts) tr_flags |= 0x800;
}
@@ -1912,7 +1914,8 @@ static int mov_write_trex_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
avio_wb32(pb, 1); // stsd_id
avio_wb32(pb, 1); // duration
avio_wb32(pb, 1/*Size*/);
- avio_wb32(pb, 1<<16);
+ track->trex_flags= st->codec->codec_type != AVMEDIA_TYPE_VIDEO ? 0x02000000 : 0x01010000;
+ avio_wb32(pb, track->trex_flags);
return updateSize(pb, pos);
}
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index 356421c7db..08dfedad8a 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -93,6 +93,7 @@ typedef struct MOVIndex {
int height; ///< active picture (w/o VBI) height for D-10/IMX
uint32_t tref_tag;
int tref_id; ///< trackID of the referenced track
+ uint32_t trex_flags;
int hint_track; ///< the track that hints this track, -1 if no hint track is set
int src_track; ///< the track that this hint track describes