Revision 8bf63e1c libavcodec/bitstream_filter.c

View differences:

libavcodec/bitstream_filter.c
56 56
    *poutbuf_size= buf_size;
57 57
    return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size, buf, buf_size, keyframe);
58 58
}
59

  
60
static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
61
                     uint8_t **poutbuf, int *poutbuf_size,
62
                     const uint8_t *buf, int buf_size, int keyframe){
63
    int cmd= args ? *args : 0;
64
    /* cast to avoid warning about discarding qualifiers */
65
    if(avctx->extradata){
66
        if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) && cmd=='a')
67
           ||(keyframe && (cmd=='k' || !cmd))
68
           ||(cmd=='e')
69
            /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
70
            int size= buf_size + avctx->extradata_size;
71
            *poutbuf_size= size;
72
            *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
73

  
74
            memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
75
            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
76
            return 1;
77
        }
78
    }
79
    return 0;
80
}
81

  
82
#ifdef CONFIG_DUMP_EXTRADATA_BSF
83
AVBitStreamFilter dump_extradata_bsf={
84
    "dump_extra",
85
    0,
86
    dump_extradata,
87
};
88
#endif

Also available in: Unified diff