Commit 20f95f21 authored by Yusuke Nakamura's avatar Yusuke Nakamura Committed by Martin Storsjö
Browse files

mov: Support default-base-is-moof.



default-base-is-moof shall be set to track fragments compatible with DASH
Media Segments. So, this is a fundamental support for ISOBMFF ver. DASH.
This is meaningful only when base-data-offset-present is absent and two or
more track fragments are present in a movie fragment.
Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent 79793f83
...@@ -73,6 +73,7 @@ typedef struct MOVFragment { ...@@ -73,6 +73,7 @@ typedef struct MOVFragment {
unsigned track_id; unsigned track_id;
uint64_t base_data_offset; uint64_t base_data_offset;
uint64_t moof_offset; uint64_t moof_offset;
uint64_t implicit_offset;
unsigned stsd_id; unsigned stsd_id;
unsigned duration; unsigned duration;
unsigned size; unsigned size;
...@@ -174,6 +175,7 @@ void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id); ...@@ -174,6 +175,7 @@ void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id);
#define MOV_TFHD_DEFAULT_SIZE 0x10 #define MOV_TFHD_DEFAULT_SIZE 0x10
#define MOV_TFHD_DEFAULT_FLAGS 0x20 #define MOV_TFHD_DEFAULT_FLAGS 0x20
#define MOV_TFHD_DURATION_IS_EMPTY 0x010000 #define MOV_TFHD_DURATION_IS_EMPTY 0x010000
#define MOV_TFHD_DEFAULT_BASE_IS_MOOF 0x020000
#define MOV_TRUN_DATA_OFFSET 0x01 #define MOV_TRUN_DATA_OFFSET 0x01
#define MOV_TRUN_FIRST_SAMPLE_FLAGS 0x04 #define MOV_TRUN_FIRST_SAMPLE_FLAGS 0x04
......
...@@ -725,7 +725,7 @@ static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -725,7 +725,7 @@ static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
c->fragment.moof_offset = avio_tell(pb) - 8; c->fragment.moof_offset = c->fragment.implicit_offset = avio_tell(pb) - 8;
av_dlog(c->fc, "moof offset %"PRIx64"\n", c->fragment.moof_offset); av_dlog(c->fc, "moof offset %"PRIx64"\n", c->fragment.moof_offset);
return mov_read_default(c, pb, atom); return mov_read_default(c, pb, atom);
} }
...@@ -2502,7 +2502,8 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -2502,7 +2502,8 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
} }
frag->base_data_offset = flags & MOV_TFHD_BASE_DATA_OFFSET ? frag->base_data_offset = flags & MOV_TFHD_BASE_DATA_OFFSET ?
avio_rb64(pb) : frag->moof_offset; avio_rb64(pb) : flags & MOV_TFHD_DEFAULT_BASE_IS_MOOF ?
frag->moof_offset : frag->implicit_offset;
frag->stsd_id = flags & MOV_TFHD_STSD_ID ? avio_rb32(pb) : trex->stsd_id; frag->stsd_id = flags & MOV_TFHD_STSD_ID ? avio_rb32(pb) : trex->stsd_id;
frag->duration = flags & MOV_TFHD_DEFAULT_DURATION ? frag->duration = flags & MOV_TFHD_DEFAULT_DURATION ?
...@@ -2638,7 +2639,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -2638,7 +2639,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (pb->eof_reached) if (pb->eof_reached)
return AVERROR_EOF; return AVERROR_EOF;
frag->moof_offset = offset; frag->implicit_offset = offset;
st->duration = sc->track_end = dts + sc->time_offset; st->duration = sc->track_end = dts + sc->time_offset;
return 0; return 0;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment