[FFmpeg-devel] [PATCH 03/41] avformat/utils: use ff_alloc_extradata()
Paul B Mahol
onemda at gmail.com
Sun Oct 13 14:48:24 CEST 2013
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavformat/utils.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index c15bd5f..7e50461 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2948,12 +2948,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);
}
}
@@ -4269,10 +4266,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;
}
--
1.7.11.2
More information about the ffmpeg-devel
mailing list