Commit cd61e407 authored by Jason Millard's avatar Jason Millard Committed by Aurelien Jacobs

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?

Originally committed as revision 9010 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent cf329752
......@@ -155,6 +155,9 @@ show_help(){
echo " --enable-parser=NAME enables parser NAME"
echo " --disable-parser=NAME disables parser NAME"
echo " --disable-parsers disables all parsers"
echo " --enable-bsf=NAME enables bitstream filter NAME"
echo " --disable-bsf=NAME disables bitstream filter NAME"
echo " --disable-bsfs disables all bitstream filters"
echo " --enable-protocol=NAME enables protocol NAME"
echo " --disable-protocol=NAME disables protocol NAME"
echo " --disable-protocols disables all protocols"
......@@ -554,6 +557,7 @@ CONFIG_LIST='
encoders
decoders
parsers
bsfs
muxers
demuxers
audio_beos
......@@ -908,11 +912,12 @@ FFMPEG_CONFIGURATION="$@"
ENCODER_LIST=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
DECODER_LIST=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
PARSER_LIST=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
BSF_LIST=`sed -n 's/^[^#]*BSF.*, *\(.*\)).*/\1_bsf/p' "$source_path/libavcodec/allcodecs.c"`
MUXER_LIST=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
PROTOCOL_LIST=`sed -n 's/^[^#]*PROTOCOL.*, *\(.*\)).*/\1_protocol/p' "$source_path/libavformat/allformats.c"`
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST $PROTOCOL_LIST
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST $PROTOCOL_LIST $BSF_LIST
die_unknown(){
echo "Unknown option \"$1\"."
......@@ -979,12 +984,14 @@ for opt do
;;
--disable-parsers) disable $PARSER_LIST
;;
--disable-bsfs) disable $BSF_LIST
;;
--disable-protocols) disable $PROTOCOL_LIST
;;
--enable-*=*|--disable-*=*)
eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
case "$thing" in
encoder|decoder|muxer|demuxer|parser|protocol) $action ${optval}_${thing} ;;
encoder|decoder|muxer|demuxer|parser|bsf|protocol) $action ${optval}_${thing} ;;
*) die_unknown "$opt" ;;
esac
;;
......@@ -1816,11 +1823,12 @@ enabled_any $DECODER_LIST && enable decoders
enabled_any $MUXER_LIST && enable muxers
enabled_any $DEMUXER_LIST && enable demuxers
enabled_any $PROTOCOL_LIST && enable protocols
enabled_any $BSF_LIST && enable bsfs
enabled_any $THREADS_LIST && enable threads
check_deps $CONFIG_LIST $HAVE_LIST $DECODER_LIST $ENCODER_LIST $PARSER_LIST \
$DEMUXER_LIST $MUXER_LIST $PROTOCOL_LIST
$BSF_LIST $DEMUXER_LIST $MUXER_LIST $PROTOCOL_LIST
enabled libogg && append pkg_requires "ogg >= 1.1"
enabled libtheora && append pkg_requires "theora"
......@@ -2040,7 +2048,7 @@ else
fi
for part in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST $PROTOCOL_LIST; do
for part in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $BSF_LIST $DEMUXER_LIST $MUXER_LIST $PROTOCOL_LIST; do
ucname="`toupper $part`"
config_name="CONFIG_$ucname"
enabled_name="ENABLE_$ucname"
......
......@@ -302,6 +302,14 @@ OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o
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
......
......@@ -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 @@ void avcodec_register_all(void)
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);
}
......@@ -253,32 +253,42 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext
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
......@@ -2564,8 +2564,10 @@ AVCodec ljpeg_encoder = { //FIXME avoid MPV_* lossless jpeg shouldnt need them
};
#endif
#ifdef CONFIG_MJPEGA_DUMP_HEADER_BSF
AVBitStreamFilter mjpega_dump_header_bsf = {
"mjpegadump",
0,
mjpega_dump_header,
};
#endif
......@@ -3354,6 +3354,7 @@ AVCodec mpeg_xvmc_decoder = {
#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 @@ AVBitStreamFilter imx_dump_header_bsf = {
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_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment