diff parser.c @ 3455:cc4b4ea83e29 libavcodec

--enable/disable parsers. Warning: some combinations are broken.
author mru
date Sun, 09 Jul 2006 12:02:15 +0000
parents ab49baf4adad
children fa0b285144f0
line wrap: on
line diff
--- 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