[FFmpeg-devel] [PATCH 24/41] avformat/westwood_vqa: use ff_alloc_extradata()

Paul B Mahol onemda at gmail.com
Sun Oct 13 14:48:45 CEST 2013


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavformat/westwood_vqa.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c
index d8791da..2e72928 100644
--- a/libavformat/westwood_vqa.c
+++ b/libavformat/westwood_vqa.c
@@ -101,10 +101,8 @@ static int wsvqa_read_header(AVFormatContext *s)
     avio_seek(pb, 20, SEEK_SET);
 
     /* the VQA header needs to go to the decoder */
-    st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!st->codec->extradata)
+    if (ff_alloc_extradata(st->codec, VQA_HEADER_SIZE))
         return AVERROR(ENOMEM);
-    st->codec->extradata_size = VQA_HEADER_SIZE;
     header = (unsigned char *)st->codec->extradata;
     if (avio_read(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
         VQA_HEADER_SIZE) {
@@ -221,9 +219,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
                         break;
                     case SND2_TAG:
                         st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_WS;
-                        st->codec->extradata_size = 2;
-                        st->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE);
-                        if (!st->codec->extradata)
+                        if (ff_alloc_extradata(st->codec, 2))
                             return AVERROR(ENOMEM);
                         AV_WL16(st->codec->extradata, wsvqa->version);
                         break;
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list