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