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)
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;
}
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;
}
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;
}
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;