avformat: use ff_alloc_extradata()

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol
2013-10-13 10:30:59 +00:00
parent 3fd79833e2
commit a807c68253
52 changed files with 83 additions and 218 deletions

View File

@@ -2950,12 +2950,9 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
if(st->parser && st->parser->parser->split && !st->codec->extradata){
int i= st->parser->parser->split(st->codec, pkt->data, pkt->size);
if (i > 0 && i < FF_MAX_EXTRADATA_SIZE) {
st->codec->extradata_size= i;
st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
if (ff_alloc_extradata(st->codec, i))
return AVERROR(ENOMEM);
memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size);
memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE);
}
}
@@ -4271,10 +4268,7 @@ void ff_generate_avci_extradata(AVStream *st)
if (!size)
return;
av_freep(&st->codec->extradata);
st->codec->extradata_size = 0;
st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
if (ff_alloc_extradata(st->codec, size))
return;
memcpy(st->codec->extradata, data, size);
st->codec->extradata_size = size;
}