aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-02-16 21:12:12 +0100
committerMartin Storsjö <martin@martin.st>2012-02-18 21:13:36 +0200
commit5be805d38cb43e6f0b85941f75946d09bc8cc13f (patch)
treefb9fb4ce920efd1285c1e1965dd1d82387359e29 /libavformat
parent3eec23f3cd7b0d8ef0a545089f75b55390a8ddb9 (diff)
downloadffmpeg-5be805d38cb43e6f0b85941f75946d09bc8cc13f.tar.gz
mov: Use defines for sample flags in fragments
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/isom.h10
-rw-r--r--libavformat/mov.c2
-rw-r--r--libavformat/movenc.c6
3 files changed, 15 insertions, 3 deletions
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 88cda27c43..32c4b3fd1d 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 5f1302d6c3..fbc7223233 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 22c918391c..30c3061d74 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)