diff options
author | Clément Bœsch <clement.boesch@smartjog.com> | 2012-06-04 11:09:31 +0200 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2012-06-11 07:35:14 +0200 |
commit | 0d96ec19ebc1577b27a889136364a906e1c627b1 (patch) | |
tree | 6f13e284390ac37106ff88bccbaab710c7214155 /libavformat/mov.c | |
parent | 9fb2e234d079a834e66870691bdf1eb8f4648076 (diff) | |
download | ffmpeg-0d96ec19ebc1577b27a889136364a906e1c627b1.tar.gz |
mov: parse tref atom.
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 97564136c5..85fb255610 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2589,6 +2589,30 @@ static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +static int mov_read_tref(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ + uint32_t i, size; + MOVStreamContext *sc; + + if (c->fc->nb_streams < 1) + return AVERROR_INVALIDDATA; + sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; + + size = avio_rb32(pb); + if (size < 12) + return 0; + + sc->trefs_count = (size - 4) / 8; + sc->trefs = av_malloc(sc->trefs_count * sizeof(*sc->trefs)); + if (!sc->trefs) + return AVERROR(ENOMEM); + + sc->tref_type = avio_rl32(pb); + for (i = 0; i < sc->trefs_count; i++) + sc->trefs[i] = avio_rb32(pb); + return 0; +} + static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('A','P','R','G'), mov_read_aprg }, { MKTAG('a','v','s','s'), mov_read_avss }, @@ -2633,7 +2657,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('t','f','h','d'), mov_read_tfhd }, /* track fragment header */ { MKTAG('t','r','a','k'), mov_read_trak }, { MKTAG('t','r','a','f'), mov_read_default }, -{ MKTAG('t','r','e','f'), mov_read_default }, +{ MKTAG('t','r','e','f'), mov_read_tref }, { MKTAG('c','h','a','p'), mov_read_chap }, { MKTAG('t','r','e','x'), mov_read_trex }, { MKTAG('t','r','u','n'), mov_read_trun }, @@ -2822,6 +2846,7 @@ static int mov_read_close(AVFormatContext *s) av_freep(&sc->drefs[j].dir); } av_freep(&sc->drefs); + av_freep(&sc->trefs); if (sc->pb && sc->pb != s->pb) avio_close(sc->pb); sc->pb = NULL; |