00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #include "avcodec.h"
00022 
00023 
00024 static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
00025                      uint8_t **poutbuf, int *poutbuf_size,
00026                      const uint8_t *buf, int buf_size, int keyframe){
00027     int cmd= args ? *args : 0;
00028     
00029     if(avctx->extradata){
00030         if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) && cmd=='a')
00031            ||(keyframe && (cmd=='k' || !cmd))
00032            ||(cmd=='e')
00033             ){
00034             int size= buf_size + avctx->extradata_size;
00035             *poutbuf_size= size;
00036             *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
00037 
00038             memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
00039             memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
00040             return 1;
00041         }
00042     }
00043     return 0;
00044 }
00045 
00046 AVBitStreamFilter ff_dump_extradata_bsf={
00047     "dump_extra",
00048     0,
00049     dump_extradata,
00050 };