aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/parser.c
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2006-07-09 12:02:15 +0000
committerMåns Rullgård <mans@mansr.com>2006-07-09 12:02:15 +0000
commitaf9e7d181068a42272b290e48c43c343b492a349 (patch)
tree1bde651a37cc81e9dcb06406af4e098b588ac750 /libavcodec/parser.c
parent18769c0a7974a1ba7385eb030e4400046df5330d (diff)
downloadffmpeg-af9e7d181068a42272b290e48c43c343b492a349.tar.gz
--enable/disable parsers. Warning: some combinations are broken.
Originally committed as revision 5691 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/parser.c')
-rw-r--r--libavcodec/parser.c41
1 files changed, 33 insertions, 8 deletions
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