diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2012-07-15 10:58:27 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-01-01 17:36:26 +0100 |
commit | 5f95b300c12169b7f44c9b8cd664cf79bed5c5b3 (patch) | |
tree | 1e139c643bb50f412dbd1c4010aa25ca148d3e9a | |
parent | 68e48ed72e0597ae61bc3e9e6e6d9edcb1a00073 (diff) | |
download | ffmpeg-5f95b300c12169b7f44c9b8cd664cf79bed5c5b3.tar.gz |
mov: fix parsing of the chap atom.
This was broken in 0d96ec19ebc1577b27a889136364a906e1c627b1 under the
assumption that there is only one tref leaf atom.
Fixes Ticket #2081.
(cherry picked from commit 765158dd82a2e985f4eb0b201a8256964403f623)
-rw-r--r-- | libavformat/mov.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index ad851579f4..d3027f3d26 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2673,25 +2673,24 @@ static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_tref(MOVContext *c, AVIOContext *pb, MOVAtom atom) +static int mov_read_tmcd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { - uint32_t i, size; + uint32_t i; 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) + if (atom.size < 4) return 0; - sc->trefs_count = (size - 4) / 8; + sc->trefs_count = atom.size / 4; sc->trefs = av_malloc(sc->trefs_count * sizeof(*sc->trefs)); if (!sc->trefs) return AVERROR(ENOMEM); - sc->tref_type = avio_rl32(pb); + sc->tref_type = atom.type; for (i = 0; i < sc->trefs_count; i++) sc->trefs[i] = avio_rb32(pb); return 0; @@ -2744,7 +2743,8 @@ 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_tref }, +{ MKTAG('t','r','e','f'), mov_read_default }, +{ MKTAG('t','m','c','d'), mov_read_tmcd }, { MKTAG('c','h','a','p'), mov_read_chap }, { MKTAG('t','r','e','x'), mov_read_trex }, { MKTAG('t','r','u','n'), mov_read_trun }, |