changeset 4994:3fa689636240 libavcodec

allow to enable or disable every bitstream filters individually Original patch by Jason Millard jsm174 _at_ gmail Date: On Fri, 11 May 2007 11:14:01 -0400 Subject: [FFmpeg-devel] enable/disable bitstream filters?
author aurel
date Sat, 12 May 2007 23:33:53 +0000
parents a1bbd3c01264
children 2f1d87a1dbc6
files Makefile allcodecs.c bitstream_filter.c mjpeg.c mpeg12.c
diffstat 5 files changed, 32 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat May 12 22:50:12 2007 +0000
+++ b/Makefile	Sat May 12 23:33:53 2007 +0000
@@ -302,6 +302,14 @@
 OBJS-$(CONFIG_PNM_PARSER)              += pnm_parser.o pnm.o
 OBJS-$(CONFIG_VC1_PARSER)              += vc1_parser.o
 
+OBJS-$(CONFIG_DUMP_EXTRADATA_BSF)      += bitstream_filter.o
+OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF)    += bitstream_filter.o
+OBJS-$(CONFIG_NOISE_BSF)               += bitstream_filter.o
+OBJS-$(CONFIG_MP3_HEADER_COMPRESS_BSF) += bitstream_filter.o
+OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += bitstream_filter.o
+OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF)  += mjpeg.o
+OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF)     += mpeg12.o
+
 OBJS-$(HAVE_PTHREADS)                  += pthread.o
 OBJS-$(HAVE_W32THREADS)                += w32thread.o
 OBJS-$(HAVE_OS2THREADS)                += os2thread.o
--- a/allcodecs.c	Sat May 12 22:50:12 2007 +0000
+++ b/allcodecs.c	Sat May 12 23:33:53 2007 +0000
@@ -34,6 +34,8 @@
 
 #define REGISTER_PARSER(X,x) \
           if(ENABLE_##X##_PARSER)  av_register_codec_parser(&x##_parser)
+#define REGISTER_BSF(X,x) \
+          if(ENABLE_##X##_BSF)     av_register_bitstream_filter(&x##_bsf)
 
 /**
  * Register all the codecs, parsers and bitstream filters which were enabled at
@@ -273,12 +275,13 @@
     REGISTER_PARSER (PNM, pnm);
     REGISTER_PARSER (VC1, vc1);
 
-    av_register_bitstream_filter(&dump_extradata_bsf);
-    av_register_bitstream_filter(&remove_extradata_bsf);
-    av_register_bitstream_filter(&noise_bsf);
-    av_register_bitstream_filter(&mp3_header_compress_bsf);
-    av_register_bitstream_filter(&mp3_header_decompress_bsf);
-    av_register_bitstream_filter(&mjpega_dump_header_bsf);
-    av_register_bitstream_filter(&imx_dump_header_bsf);
+    /* bitstream filters */
+    REGISTER_BSF    (DUMP_EXTRADATA, dump_extradata);
+    REGISTER_BSF    (REMOVE_EXTRADATA, remove_extradata);
+    REGISTER_BSF    (NOISE, noise);
+    REGISTER_BSF    (MP3_HEADER_COMPRESS, mp3_header_compress);
+    REGISTER_BSF    (MP3_HEADER_DECOMPRESS, mp3_header_decompress);
+    REGISTER_BSF    (MJPEGA_DUMP_HEADER, mjpega_dump_header);
+    REGISTER_BSF    (IMX_DUMP_HEADER, imx_dump_header);
 }
 
--- a/bitstream_filter.c	Sat May 12 22:50:12 2007 +0000
+++ b/bitstream_filter.c	Sat May 12 23:33:53 2007 +0000
@@ -253,32 +253,42 @@
     return 1;
 }
 
+#ifdef CONFIG_DUMP_EXTRADATA_BSF
 AVBitStreamFilter dump_extradata_bsf={
     "dump_extra",
     0,
     dump_extradata,
 };
+#endif
 
+#ifdef CONFIG_REMOVE_EXTRADATA_BSF
 AVBitStreamFilter remove_extradata_bsf={
     "remove_extra",
     0,
     remove_extradata,
 };
+#endif
 
+#ifdef CONFIG_NOISE_BSF
 AVBitStreamFilter noise_bsf={
     "noise",
     sizeof(int),
     noise,
 };
+#endif
 
+#ifdef CONFIG_MP3_HEADER_COMPRESS_BSF
 AVBitStreamFilter mp3_header_compress_bsf={
     "mp3comp",
     0,
     mp3_header_compress,
 };
+#endif
 
+#ifdef CONFIG_MP3_HEADER_DECOMPRESS_BSF
 AVBitStreamFilter mp3_header_decompress_bsf={
     "mp3decomp",
     0,
     mp3_header_decompress,
 };
+#endif
--- a/mjpeg.c	Sat May 12 22:50:12 2007 +0000
+++ b/mjpeg.c	Sat May 12 23:33:53 2007 +0000
@@ -2564,8 +2564,10 @@
 };
 #endif
 
+#ifdef CONFIG_MJPEGA_DUMP_HEADER_BSF
 AVBitStreamFilter mjpega_dump_header_bsf = {
     "mjpegadump",
     0,
     mjpega_dump_header,
 };
+#endif
--- a/mpeg12.c	Sat May 12 22:50:12 2007 +0000
+++ b/mpeg12.c	Sat May 12 23:33:53 2007 +0000
@@ -3354,6 +3354,7 @@
 
 #endif
 
+#ifdef CONFIG_IMX_DUMP_HEADER_BSF
 static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
                            uint8_t **poutbuf, int *poutbuf_size,
                            const uint8_t *buf, int buf_size, int keyframe)
@@ -3382,6 +3383,7 @@
     0,
     imx_dump_header,
 };
+#endif
 
 /* this is ugly i know, but the alternative is too make
    hundreds of vars global and prefix them with ff_mpeg1_