summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure12
-rw-r--r--libavcodec/Makefile14
-rw-r--r--libavcodec/allcodecs.c28
-rw-r--r--libavcodec/h261.c4
-rw-r--r--libavcodec/h263dec.c4
-rw-r--r--libavcodec/h264.c5
-rw-r--r--libavcodec/parser.c41
-rw-r--r--libavcodec/pnm.c2
8 files changed, 93 insertions, 17 deletions
diff --git a/configure b/configure
index 904c97fc6b..3b3e8606c9 100755
--- a/configure
+++ b/configure
@@ -106,6 +106,9 @@ show_help(){
echo " --disable-decoders disables all decoders"
echo " --disable-muxers disables all muxers"
echo " --disable-demuxers disables all demuxers"
+ echo " --enable-parser=NAME enables parser NAME"
+ echo " --disable-parser=NAME disables parser NAME"
+ echo " --disable-parsers disables all parsers"
echo ""
echo "NOTE: Object files are built at the place where configure is launched."
exit 1
@@ -658,6 +661,7 @@ for opt do
done
CODEC_LIST=`grep 'register_avcodec(&[a-z]' $source_path/libavcodec/allcodecs.c | sed 's/.*&\(.*\)).*/\1/'`
+PARSER_LIST=`grep 'av_register_codec_parser(&[a-z]' $source_path/libavcodec/allcodecs.c | sed 's/.*&\(.*\)).*/\1/'`
for opt do
case "$opt" in
@@ -819,6 +823,12 @@ for opt do
;;
--disable-demuxers) demuxers="no"
;;
+ --enable-parser=*) PARSER_LIST="$PARSER_LIST ${opt#*=}_parser"
+ ;;
+ --disable-parser=*) PARSER_LIST="`echo $PARSER_LIST | sed -e \"s#${opt#*=}_parser##\"`"
+ ;;
+ --disable-parsers) PARSER_LIST=""
+ ;;
--help) show_help
;;
*)
@@ -2072,7 +2082,7 @@ if test "$amr_if2" = "yes" ; then
fi
-for codec in $CODEC_LIST ; do
+for codec in $CODEC_LIST $PARSER_LIST; do
echo "#define CONFIG_`echo $codec | tr a-z A-Z` 1" >> $TMPH
echo "CONFIG_`echo $codec | tr a-z A-Z`=yes" >> config.mak
done
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 4eff1e8e44..ba7162d9e3 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -258,6 +258,20 @@ OBJS-$(AMR_WB) += amrwb_float/dec_acelp.o \
amrwb_float/enc_util.o \
amrwb_float/if_rom.o
+OBJS-$(CONFIG_AAC_PARSER) += parser.o
+OBJS-$(CONFIG_AC3_PARSER) += parser.o
+OBJS-$(CONFIG_CAVS_PARSER) += parser.o
+OBJS-$(CONFIG_DVBSUB_PARSER) += dvbsubdec.o
+OBJS-$(CONFIG_DVDSUB_PARSER) += dvdsub.o
+OBJS-$(CONFIG_H261_PARSER) += h261.o
+OBJS-$(CONFIG_H263_PARSER) += h263dec.o
+OBJS-$(CONFIG_H264_PARSER) += h264.o
+OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg.o
+OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += parser.o
+OBJS-$(CONFIG_MPEGAUDIO_PARSER) += parser.o
+OBJS-$(CONFIG_MPEGVIDEO_PARSER) += parser.o
+OBJS-$(CONFIG_PNM_PARSER) += pnm.o
+
OBJS-$(HAVE_PTHREADS) += pthread.o
OBJS-$(HAVE_W32THREADS) += w32thread.o
OBJS-$(HAVE_OS2THREADS) += os2thread.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index cb21c5ec71..172193fc1d 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -800,31 +800,45 @@ void avcodec_register_all(void)
#endif
/* parsers */
+#ifdef CONFIG_MPEGVIDEO_PARSER
av_register_codec_parser(&mpegvideo_parser);
+#endif
+#ifdef CONFIG_MPEG4VIDEO_PARSER
av_register_codec_parser(&mpeg4video_parser);
-#ifdef CONFIG_CAVS_DECODER
+#endif
+#ifdef CONFIG_CAVSVIDEO_PARSER
av_register_codec_parser(&cavsvideo_parser);
#endif
-#if defined(CONFIG_H261_DECODER) || defined(CONFIG_H261_ENCODER)
+#ifdef CONFIG_H261_PARSER
av_register_codec_parser(&h261_parser);
#endif
+#ifdef CONFIG_H263_PARSER
av_register_codec_parser(&h263_parser);
-#ifdef CONFIG_H264_DECODER
+#endif
+#ifdef CONFIG_H264_PARSER
av_register_codec_parser(&h264_parser);
#endif
+#ifdef CONFIG_MJPEG_PARSER
av_register_codec_parser(&mjpeg_parser);
+#endif
+#ifdef CONFIG_PNM_PARSER
av_register_codec_parser(&pnm_parser);
-
+#endif
+#ifdef CONFIG_MPEGAUDIO_PARSER
av_register_codec_parser(&mpegaudio_parser);
+#endif
+#ifdef CONFIG_AC3_PARSER
av_register_codec_parser(&ac3_parser);
-
-#ifdef CONFIG_DVDSUB_DECODER
+#endif
+#ifdef CONFIG_DVDSUB_PARSER
av_register_codec_parser(&dvdsub_parser);
#endif
-#ifdef CONFIG_DVBSUB_DECODER
+#ifdef CONFIG_DVBSUB_PARSER
av_register_codec_parser(&dvbsub_parser);
#endif
+#ifdef CONFIG_AAC_PARSER
av_register_codec_parser(&aac_parser);
+#endif
av_register_bitstream_filter(&dump_extradata_bsf);
av_register_bitstream_filter(&remove_extradata_bsf);
diff --git a/libavcodec/h261.c b/libavcodec/h261.c
index a1a7f14f56..e56978e611 100644
--- a/libavcodec/h261.c
+++ b/libavcodec/h261.c
@@ -847,6 +847,7 @@ static int h261_decode_gob(H261Context *h){
return -1;
}
+#ifdef CONFIG_H261_PARSER
static int h261_find_frame_end(ParseContext *pc, AVCodecContext* avctx, const uint8_t *buf, int buf_size){
int vop_found, i, j;
uint32_t state;
@@ -900,6 +901,7 @@ static int h261_parse(AVCodecParserContext *s,
*poutbuf_size = buf_size;
return next;
}
+#endif
/**
* returns the number of bytes consumed for building the current frame
@@ -1039,6 +1041,7 @@ AVCodec h261_decoder = {
CODEC_CAP_DR1,
};
+#ifdef CONFIG_H261_PARSER
AVCodecParser h261_parser = {
{ CODEC_ID_H261 },
sizeof(ParseContext),
@@ -1046,3 +1049,4 @@ AVCodecParser h261_parser = {
h261_parse,
ff_parse_close,
};
+#endif
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 1eba9db40a..73b050325e 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -391,6 +391,7 @@ static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_siz
return END_NOT_FOUND;
}
+#ifdef CONFIG_H263_PARSER
static int h263_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
@@ -411,6 +412,7 @@ static int h263_parse(AVCodecParserContext *s,
*poutbuf_size = buf_size;
return next;
}
+#endif
int ff_h263_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
@@ -887,6 +889,7 @@ AVCodec flv_decoder = {
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1
};
+#ifdef CONFIG_H263_PARSER
AVCodecParser h263_parser = {
{ CODEC_ID_H263 },
sizeof(ParseContext),
@@ -894,3 +897,4 @@ AVCodecParser h263_parser = {
h263_parse,
ff_parse_close,
};
+#endif
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 8012ae1ead..ad25c7c99f 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -7872,6 +7872,7 @@ static int find_frame_end(H264Context *h, const uint8_t *buf, int buf_size){
return END_NOT_FOUND;
}
+#ifdef CONFIG_H264_PARSER
static int h264_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
@@ -7917,7 +7918,7 @@ static int h264_split(AVCodecContext *avctx,
}
return 0;
}
-
+#endif /* CONFIG_H264_PARSER */
static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
MpegEncContext * const s = &h->s;
@@ -8488,6 +8489,7 @@ AVCodec h264_decoder = {
.flush= flush_dpb,
};
+#ifdef CONFIG_H264_PARSER
AVCodecParser h264_parser = {
{ CODEC_ID_H264 },
sizeof(H264Context),
@@ -8496,5 +8498,6 @@ AVCodecParser h264_parser = {
ff_parse_close,
h264_split,
};
+#endif
#include "svq3.c"
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 2c910499ca..008c264dc2 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -298,6 +298,7 @@ static const int frame_rate_tab[16] = {
25025,
};
+#ifdef CONFIG_MPEGVIDEO_PARSER
//FIXME move into mpeg12.c
static void mpegvideo_extract_headers(AVCodecParserContext *s,
AVCodecContext *avctx,
@@ -450,6 +451,7 @@ static int mpegvideo_split(AVCodecContext *avctx,
}
return 0;
}
+#endif /* CONFIG_MPEGVIDEO_PARSER */
void ff_parse_close(AVCodecParserContext *s)
{
@@ -468,6 +470,7 @@ static void parse1_close(AVCodecParserContext *s)
/*************************/
+#ifdef CONFIG_MPEG4VIDEO_PARSER
/* used by parser */
/* XXX: make it use less memory */
static int av_mpeg4_decode_header(AVCodecParserContext *s1,
@@ -533,8 +536,9 @@ static int mpeg4video_parse(AVCodecParserContext *s,
*poutbuf_size = buf_size;
return next;
}
+#endif
-#ifdef CONFIG_CAVS_DECODER
+#ifdef CONFIG_CAVSVIDEO_PARSER
static int cavsvideo_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
@@ -558,7 +562,7 @@ static int cavsvideo_parse(AVCodecParserContext *s,
*poutbuf_size = buf_size;
return next;
}
-#endif /* CONFIG_CAVS_DECODER */
+#endif /* CONFIG_CAVSVIDEO_PARSER */
static int mpeg4video_split(AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
@@ -576,6 +580,7 @@ static int mpeg4video_split(AVCodecContext *avctx,
/*************************/
+#ifdef CONFIG_MPEGAUDIO_PARSER
typedef struct MpegAudioParseContext {
uint8_t inbuf[MPA_MAX_CODED_FRAME_SIZE]; /* input buffer */
uint8_t *inbuf_ptr;
@@ -753,7 +758,9 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
}
return buf_ptr - buf;
}
+#endif /* CONFIG_MPEGAUDIO_PARSER */
+#if defined(CONFIG_AC3_PARSER) || defined(CONFIG_AAC_PARSER)
/* also used for ADTS AAC */
typedef struct AC3ParseContext {
uint8_t *inbuf_ptr;
@@ -767,6 +774,7 @@ typedef struct AC3ParseContext {
#define AC3_HEADER_SIZE 7
#define AAC_HEADER_SIZE 7
+#ifdef CONFIG_AC3_PARSER
static const int ac3_sample_rates[4] = {
48000, 44100, 32000, 0
};
@@ -821,7 +829,9 @@ static const int ac3_bitrates[64] = {
static const int ac3_channels[8] = {
2, 1, 2, 3, 3, 4, 4, 5
};
+#endif /* CONFIG_AC3_PARSER */
+#ifdef CONFIG_AAC_PARSER
static int aac_sample_rates[16] = {
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000, 7350
@@ -830,7 +840,9 @@ static int aac_sample_rates[16] = {
static int aac_channels[8] = {
0, 1, 2, 3, 4, 5, 6, 8
};
+#endif
+#ifdef CONFIG_AC3_PARSER
static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate,
int *bit_rate, int *samples)
{
@@ -869,7 +881,9 @@ static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate,
return ac3_frame_sizes[frmsizecod][fscod] * 2;
}
+#endif /* CONFIG_AC3_PARSER */
+#ifdef CONFIG_AAC_PARSER
static int aac_sync(const uint8_t *buf, int *channels, int *sample_rate,
int *bit_rate, int *samples)
{
@@ -909,7 +923,9 @@ static int aac_sync(const uint8_t *buf, int *channels, int *sample_rate,
return size;
}
+#endif /* CONFIG_AAC_PARSER */
+#ifdef CONFIG_AC3_PARSER
static int ac3_parse_init(AVCodecParserContext *s1)
{
AC3ParseContext *s = s1->priv_data;
@@ -918,7 +934,9 @@ static int ac3_parse_init(AVCodecParserContext *s1)
s->sync = ac3_sync;
return 0;
}
+#endif
+#ifdef CONFIG_AAC_PARSER
static int aac_parse_init(AVCodecParserContext *s1)
{
AC3ParseContext *s = s1->priv_data;
@@ -927,6 +945,7 @@ static int aac_parse_init(AVCodecParserContext *s1)
s->sync = aac_sync;
return 0;
}
+#endif
/* also used for ADTS AAC */
static int ac3_parse(AVCodecParserContext *s1,
@@ -995,7 +1014,9 @@ static int ac3_parse(AVCodecParserContext *s1,
}
return buf_ptr - buf;
}
+#endif /* CONFIG_AC3_PARSER || CONFIG_AAC_PARSER */
+#ifdef CONFIG_MPEGVIDEO_PARSER
AVCodecParser mpegvideo_parser = {
{ CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO },
sizeof(ParseContext1),
@@ -1004,7 +1025,8 @@ AVCodecParser mpegvideo_parser = {
parse1_close,
mpegvideo_split,
};
-
+#endif
+#ifdef CONFIG_MPEG4VIDEO_PARSER
AVCodecParser mpeg4video_parser = {
{ CODEC_ID_MPEG4 },
sizeof(ParseContext1),
@@ -1013,8 +1035,8 @@ AVCodecParser mpeg4video_parser = {
parse1_close,
mpeg4video_split,
};
-
-#ifdef CONFIG_CAVS_DECODER
+#endif
+#ifdef CONFIG_CAVSVIDEO_PARSER
AVCodecParser cavsvideo_parser = {
{ CODEC_ID_CAVS },
sizeof(ParseContext1),
@@ -1024,7 +1046,7 @@ AVCodecParser cavsvideo_parser = {
mpeg4video_split,
};
#endif
-
+#ifdef CONFIG_MPEGAUDIO_PARSER
AVCodecParser mpegaudio_parser = {
{ CODEC_ID_MP2, CODEC_ID_MP3 },
sizeof(MpegAudioParseContext),
@@ -1032,7 +1054,8 @@ AVCodecParser mpegaudio_parser = {
mpegaudio_parse,
NULL,
};
-
+#endif
+#ifdef CONFIG_AC3_PARSER
AVCodecParser ac3_parser = {
{ CODEC_ID_AC3 },
sizeof(AC3ParseContext),
@@ -1040,7 +1063,8 @@ AVCodecParser ac3_parser = {
ac3_parse,
NULL,
};
-
+#endif
+#ifdef CONFIG_AAC_PARSER
AVCodecParser aac_parser = {
{ CODEC_ID_AAC },
sizeof(AC3ParseContext),
@@ -1048,3 +1072,4 @@ AVCodecParser aac_parser = {
ac3_parse,
NULL,
};
+#endif
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 163da829b6..b7e5283c72 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -454,6 +454,7 @@ static int pam_probe(AVProbeData *pd)
}
#endif
+#ifdef CONFIG_PNM_PARSER
static int pnm_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
@@ -522,6 +523,7 @@ AVCodecParser pnm_parser = {
pnm_parse,
ff_parse_close,
};
+#endif /* CONFIG_PNM_PARSER */
#ifdef CONFIG_PGM_ENCODER
AVCodec pgm_encoder = {