changeset 3455:cc4b4ea83e29 libavcodec

--enable/disable parsers. Warning: some combinations are broken.
author mru
date Sun, 09 Jul 2006 12:02:15 +0000
parents de0ed6497a13
children fa0b285144f0
files Makefile allcodecs.c h261.c h263dec.c h264.c parser.c pnm.c
diffstat 7 files changed, 82 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun Jul 09 10:33:49 2006 +0000
+++ b/Makefile	Sun Jul 09 12:02:15 2006 +0000
@@ -258,6 +258,20 @@
                                           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
--- a/allcodecs.c	Sun Jul 09 10:33:49 2006 +0000
+++ b/allcodecs.c	Sun Jul 09 12:02:15 2006 +0000
@@ -800,31 +800,45 @@
 #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);
--- a/h261.c	Sun Jul 09 10:33:49 2006 +0000
+++ b/h261.c	Sun Jul 09 12:02:15 2006 +0000
@@ -847,6 +847,7 @@
     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 @@
     *poutbuf_size = buf_size;
     return next;
 }
+#endif
 
 /**
  * returns the number of bytes consumed for building the current frame
@@ -1039,6 +1041,7 @@
     CODEC_CAP_DR1,
 };
 
+#ifdef CONFIG_H261_PARSER
 AVCodecParser h261_parser = {
     { CODEC_ID_H261 },
     sizeof(ParseContext),
@@ -1046,3 +1049,4 @@
     h261_parse,
     ff_parse_close,
 };
+#endif
--- a/h263dec.c	Sun Jul 09 10:33:49 2006 +0000
+++ b/h263dec.c	Sun Jul 09 12:02:15 2006 +0000
@@ -391,6 +391,7 @@
     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 @@
     *poutbuf_size = buf_size;
     return next;
 }
+#endif
 
 int ff_h263_decode_frame(AVCodecContext *avctx,
                              void *data, int *data_size,
@@ -887,6 +889,7 @@
     CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1
 };
 
+#ifdef CONFIG_H263_PARSER
 AVCodecParser h263_parser = {
     { CODEC_ID_H263 },
     sizeof(ParseContext),
@@ -894,3 +897,4 @@
     h263_parse,
     ff_parse_close,
 };
+#endif
--- a/h264.c	Sun Jul 09 10:33:49 2006 +0000
+++ b/h264.c	Sun Jul 09 12:02:15 2006 +0000
@@ -7872,6 +7872,7 @@
     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 @@
     }
     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 @@
     .flush= flush_dpb,
 };
 
+#ifdef CONFIG_H264_PARSER
 AVCodecParser h264_parser = {
     { CODEC_ID_H264 },
     sizeof(H264Context),
@@ -8496,5 +8498,6 @@
     ff_parse_close,
     h264_split,
 };
+#endif
 
 #include "svq3.c"
--- a/parser.c	Sun Jul 09 10:33:49 2006 +0000
+++ b/parser.c	Sun Jul 09 12:02:15 2006 +0000
@@ -298,6 +298,7 @@
     25025,
 };
 
+#ifdef CONFIG_MPEGVIDEO_PARSER
 //FIXME move into mpeg12.c
 static void mpegvideo_extract_headers(AVCodecParserContext *s,
                                       AVCodecContext *avctx,
@@ -450,6 +451,7 @@
     }
     return 0;
 }
+#endif /* CONFIG_MPEGVIDEO_PARSER */
 
 void ff_parse_close(AVCodecParserContext *s)
 {
@@ -468,6 +470,7 @@
 
 /*************************/
 
+#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 @@
     *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 @@
     *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 @@
 
 /*************************/
 
+#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 @@
     }
     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 @@
 #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_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_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 @@
 
     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 @@
 
     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 @@
     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 @@
     s->sync = aac_sync;
     return 0;
 }
+#endif
 
 /* also used for ADTS AAC */
 static int ac3_parse(AVCodecParserContext *s1,
@@ -995,7 +1014,9 @@
     }
     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 @@
     parse1_close,
     mpegvideo_split,
 };
-
+#endif
+#ifdef CONFIG_MPEG4VIDEO_PARSER
 AVCodecParser mpeg4video_parser = {
     { CODEC_ID_MPEG4 },
     sizeof(ParseContext1),
@@ -1013,8 +1035,8 @@
     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 @@
     mpeg4video_split,
 };
 #endif
-
+#ifdef CONFIG_MPEGAUDIO_PARSER
 AVCodecParser mpegaudio_parser = {
     { CODEC_ID_MP2, CODEC_ID_MP3 },
     sizeof(MpegAudioParseContext),
@@ -1032,7 +1054,8 @@
     mpegaudio_parse,
     NULL,
 };
-
+#endif
+#ifdef CONFIG_AC3_PARSER
 AVCodecParser ac3_parser = {
     { CODEC_ID_AC3 },
     sizeof(AC3ParseContext),
@@ -1040,7 +1063,8 @@
     ac3_parse,
     NULL,
 };
-
+#endif
+#ifdef CONFIG_AAC_PARSER
 AVCodecParser aac_parser = {
     { CODEC_ID_AAC },
     sizeof(AC3ParseContext),
@@ -1048,3 +1072,4 @@
     ac3_parse,
     NULL,
 };
+#endif
--- a/pnm.c	Sun Jul 09 10:33:49 2006 +0000
+++ b/pnm.c	Sun Jul 09 12:02:15 2006 +0000
@@ -454,6 +454,7 @@
 }
 #endif
 
+#ifdef CONFIG_PNM_PARSER
 static int pnm_parse(AVCodecParserContext *s,
                            AVCodecContext *avctx,
                            uint8_t **poutbuf, int *poutbuf_size,
@@ -522,6 +523,7 @@
     pnm_parse,
     ff_parse_close,
 };
+#endif /* CONFIG_PNM_PARSER */
 
 #ifdef CONFIG_PGM_ENCODER
 AVCodec pgm_encoder = {