]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dump_extradata_bsf.c
dcadec: scan for extensions in a separate function
[ffmpeg] / libavcodec / dump_extradata_bsf.c
index ba77b15c6b4457d4e86bff950306b57458c76c51..3f54899794a52f94beaebdd5e438d05860debfa9 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
+
 #include "avcodec.h"
+#include "libavutil/mem.h"
 
 
 static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
@@ -27,16 +30,18 @@ static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx,
     int cmd= args ? *args : 0;
     /* cast to avoid warning about discarding qualifiers */
     if(avctx->extradata){
-        if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) && cmd=='a')
+        if(  (keyframe && (avctx->flags2 & AV_CODEC_FLAG2_LOCAL_HEADER) && cmd == 'a')
            ||(keyframe && (cmd=='k' || !cmd))
            ||(cmd=='e')
             /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
             int size= buf_size + avctx->extradata_size;
             *poutbuf_size= size;
-            *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
+            *poutbuf= av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
+            if (!*poutbuf)
+                return AVERROR(ENOMEM);
 
             memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
-            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
+            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
             return 1;
         }
     }