comparison bitstream_filter.c @ 5037:654e035bc755 libavcodec

move dump_extradata bitstream filter in its own file
author aurel
date Sat, 19 May 2007 00:35:27 +0000
parents 06f4c436a09f
children 327f714d69c0
comparison
equal deleted inserted replaced
5036:06f4c436a09f 5037:654e035bc755
54 const uint8_t *buf, int buf_size, int keyframe){ 54 const uint8_t *buf, int buf_size, int keyframe){
55 *poutbuf= (uint8_t *) buf; 55 *poutbuf= (uint8_t *) buf;
56 *poutbuf_size= buf_size; 56 *poutbuf_size= buf_size;
57 return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size, buf, buf_size, keyframe); 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