• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavcodec/bitstream_filter.c

Go to the documentation of this file.
00001 /*
00002  * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * FFmpeg is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with FFmpeg; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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 }

Generated on Fri Sep 16 2011 17:17:34 for FFmpeg by  doxygen 1.7.1