[FFmpeg-cvslog] mov: Use defines for sample flags in fragments
Martin Storsjö
git at videolan.org
Sun Feb 19 02:19:08 CET 2012
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Feb 16 21:12:12 2012 +0100| [5be805d38cb43e6f0b85941f75946d09bc8cc13f] | committer: Martin Storsjö
mov: Use defines for sample flags in fragments
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5be805d38cb43e6f0b85941f75946d09bc8cc13f
---
libavformat/isom.h | 10 ++++++++++
libavformat/mov.c | 2 +-
libavformat/movenc.c | 6 ++++--
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 88cda27..32c4b3f 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -171,6 +171,16 @@ void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id);
#define MOV_TRUN_SAMPLE_FLAGS 0x400
#define MOV_TRUN_SAMPLE_CTS 0x800
+#define MOV_FRAG_SAMPLE_FLAG_DEGRADATION_PRIORITY_MASK 0x0000ffff
+#define MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC 0x00010000
+#define MOV_FRAG_SAMPLE_FLAG_PADDING_MASK 0x000e0000
+#define MOV_FRAG_SAMPLE_FLAG_REDUNDANCY_MASK 0x00300000
+#define MOV_FRAG_SAMPLE_FLAG_DEPENDED_MASK 0x00c00000
+#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_MASK 0x03000000
+
+#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO 0x02000000
+#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES 0x01000000
+
int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom);
enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5f1302d..fbc7223 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2282,7 +2282,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_rb32(pb) : 0;
sc->ctts_count++;
if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
- (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS && !i && !(sample_flags & 0xffff0000)) || sample_flags & 0x2000000))
+ (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS && !i && !(sample_flags & ~MOV_FRAG_SAMPLE_FLAG_DEGRADATION_PRIORITY_MASK)) || sample_flags & MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO))
distance = 0;
av_add_index_entry(st, offset, dts, sample_size, distance,
keyframe ? AVINDEX_KEYFRAME : 0);
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 22c9183..30c3061 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2214,7 +2214,8 @@ static int mov_write_tfhd_tag(AVIOContext *pb, MOVTrack *track,
if (flags & MOV_TFHD_DEFAULT_FLAGS) {
track->default_sample_flags =
track->enc->codec_type == AVMEDIA_TYPE_VIDEO ?
- 0x01010000 : 0x02000000;
+ (MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES | MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC) :
+ MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO;
avio_wb32(pb, track->default_sample_flags);
}
@@ -2223,7 +2224,8 @@ static int mov_write_tfhd_tag(AVIOContext *pb, MOVTrack *track,
static uint32_t get_sample_flags(MOVTrack *track, MOVIentry *entry)
{
- return entry->flags & MOV_SYNC_SAMPLE ? 0x02000000 : 0x01010000;
+ return entry->flags & MOV_SYNC_SAMPLE ? MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO :
+ (MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES | MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC);
}
static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track)
More information about the ffmpeg-cvslog
mailing list