diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-25 16:37:42 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-25 17:38:29 +0100 |
commit | 3e5a7dffe8037945f77e98d935e04fab6940d5a5 (patch) | |
tree | 7f65e5bb0e9db79d590c8dfd44ea06bfd6f2355c /libavformat | |
parent | 28cc7062c8766668afbcc0d4b3233fd3ed1c1948 (diff) | |
download | ffmpeg-3e5a7dffe8037945f77e98d935e04fab6940d5a5.tar.gz |
avformat/mov: use ff_get_extradata()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mov.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 9049a3c251..940393d3b3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1086,9 +1086,8 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) st->codec->codec_id == AV_CODEC_ID_SPEEX) { // pass all frma atom to codec, needed at least for QDMC and QDM2 av_free(st->codec->extradata); - if (ff_alloc_extradata(st->codec, atom.size)) + if (ff_get_extradata(st->codec, pb, atom.size) < 0) return AVERROR(ENOMEM); - avio_read(pb, st->codec->extradata, atom.size); } else if (atom.size > 8) { /* to read frma, esds atoms */ int ret; if ((ret = mov_read_default(c, pb, atom)) < 0) @@ -1123,9 +1122,9 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) return mov_read_default(c, pb, atom); } av_free(st->codec->extradata); - if (ff_alloc_extradata(st->codec, atom.size)) + if (ff_get_extradata(st->codec, pb, atom.size) < 0) return AVERROR(ENOMEM); - avio_read(pb, st->codec->extradata, atom.size); + return 0; } @@ -1146,13 +1145,10 @@ static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom) if ((profile_level & 0xf0) != 0xc0) return 0; - av_free(st->codec->extradata); - if (ff_alloc_extradata(st->codec, atom.size - 7)) - return AVERROR(ENOMEM); avio_seek(pb, 6, SEEK_CUR); - ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size); - if (ret != st->codec->extradata_size) - return ret < 0 ? ret : AVERROR_INVALIDDATA; + av_free(st->codec->extradata); + if ((ret = ff_get_extradata(st->codec, pb, atom.size - 7)) < 0) + return ret; return 0; } @@ -1175,11 +1171,10 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) if ((uint64_t)atom.size > (1<<30)) return AVERROR_INVALIDDATA; + avio_skip(pb, 40); av_free(st->codec->extradata); - if (ff_alloc_extradata(st->codec, atom.size - 40)) + if (ff_get_extradata(st->codec, pb, atom.size - 40) < 0) return AVERROR(ENOMEM); - avio_skip(pb, 40); - avio_read(pb, st->codec->extradata, atom.size - 40); return 0; } @@ -1491,9 +1486,8 @@ static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, int size) { if (st->codec->codec_tag == MKTAG('t','m','c','d')) { - if (ff_alloc_extradata(st->codec, size)) + if (ff_get_extradata(st->codec, pb, size) < 0) return AVERROR(ENOMEM); - avio_read(pb, st->codec->extradata, size); if (size > 16) { MOVStreamContext *tmcd_ctx = st->priv_data; int val; |