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 AVBitStreamFilter *first_bitstream_filter= NULL;
00024
00025 void av_register_bitstream_filter(AVBitStreamFilter *bsf){
00026 bsf->next = first_bitstream_filter;
00027 first_bitstream_filter= bsf;
00028 }
00029
00030 AVBitStreamFilterContext *av_bitstream_filter_init(const char *name){
00031 AVBitStreamFilter *bsf= first_bitstream_filter;
00032
00033 while(bsf){
00034 if(!strcmp(name, bsf->name)){
00035 AVBitStreamFilterContext *bsfc= av_mallocz(sizeof(AVBitStreamFilterContext));
00036 bsfc->filter= bsf;
00037 bsfc->priv_data= av_mallocz(bsf->priv_data_size);
00038 return bsfc;
00039 }
00040 bsf= bsf->next;
00041 }
00042 return NULL;
00043 }
00044
00045 void av_bitstream_filter_close(AVBitStreamFilterContext *bsfc){
00046 if(bsfc->filter->close)
00047 bsfc->filter->close(bsfc);
00048 av_freep(&bsfc->priv_data);
00049 av_parser_close(bsfc->parser);
00050 av_free(bsfc);
00051 }
00052
00053 int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
00054 AVCodecContext *avctx, const char *args,
00055 uint8_t **poutbuf, int *poutbuf_size,
00056 const uint8_t *buf, int buf_size, int keyframe){
00057 *poutbuf= (uint8_t *) buf;
00058 *poutbuf_size= buf_size;
00059 return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size, buf, buf_size, keyframe);
00060 }