Mercurial > libavformat.hg
changeset 3268:319c36da904b libavformat
set demuxers .value and use common audio_read_header function
author | bcoudurier |
---|---|
date | Mon, 28 Apr 2008 14:14:44 +0000 |
parents | 37e245554350 |
children | 55d4f01c9728 |
files | raw.c |
diffstat | 1 files changed, 14 insertions(+), 78 deletions(-) [+] |
line wrap: on
line diff
--- a/raw.c Sat Apr 26 17:51:02 2008 +0000 +++ b/raw.c Mon Apr 28 14:14:44 2008 +0000 @@ -221,83 +221,14 @@ return 0; } -/* ac3 read */ -static int ac3_read_header(AVFormatContext *s, - AVFormatParameters *ap) +static int audio_read_header(AVFormatContext *s, + AVFormatParameters *ap) { - AVStream *st; - - st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - - st->codec->codec_type = CODEC_TYPE_AUDIO; - st->codec->codec_id = CODEC_ID_AC3; - st->need_parsing = AVSTREAM_PARSE_FULL; - /* the parameters will be extracted from the compressed bitstream */ - return 0; -} - -static int shorten_read_header(AVFormatContext *s, - AVFormatParameters *ap) -{ - AVStream *st; - - st = av_new_stream(s, 0); + AVStream *st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; - st->codec->codec_id = CODEC_ID_SHORTEN; - st->need_parsing = AVSTREAM_PARSE_FULL; - /* the parameters will be extracted from the compressed bitstream */ - return 0; -} - -/* flac read */ -static int flac_read_header(AVFormatContext *s, - AVFormatParameters *ap) -{ - AVStream *st; - - st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - st->codec->codec_type = CODEC_TYPE_AUDIO; - st->codec->codec_id = CODEC_ID_FLAC; - st->need_parsing = AVSTREAM_PARSE_FULL; - /* the parameters will be extracted from the compressed bitstream */ - return 0; -} - -/* dts read */ -static int dts_read_header(AVFormatContext *s, - AVFormatParameters *ap) -{ - AVStream *st; - - st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - - st->codec->codec_type = CODEC_TYPE_AUDIO; - st->codec->codec_id = CODEC_ID_DTS; - st->need_parsing = AVSTREAM_PARSE_FULL; - /* the parameters will be extracted from the compressed bitstream */ - return 0; -} - -/* aac read */ -static int aac_read_header(AVFormatContext *s, - AVFormatParameters *ap) -{ - AVStream *st; - - st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - - st->codec->codec_type = CODEC_TYPE_AUDIO; - st->codec->codec_id = CODEC_ID_AAC; + st->codec->codec_id = s->iformat->value; st->need_parsing = AVSTREAM_PARSE_FULL; /* the parameters will be extracted from the compressed bitstream */ return 0; @@ -459,11 +390,12 @@ "raw shorten", 0, NULL, - shorten_read_header, + audio_read_header, raw_read_partial_packet, raw_read_close, .flags= AVFMT_GENERIC_INDEX, .extensions = "shn", + .value = CODEC_ID_SHORTEN, }; AVInputFormat flac_demuxer = { @@ -471,11 +403,12 @@ "raw flac", 0, flac_probe, - flac_read_header, + audio_read_header, raw_read_partial_packet, raw_read_close, .flags= AVFMT_GENERIC_INDEX, .extensions = "flac", + .value = CODEC_ID_FLAC, }; #ifdef CONFIG_MUXERS @@ -499,11 +432,12 @@ "raw ac3", 0, ac3_probe, - ac3_read_header, + audio_read_header, raw_read_partial_packet, raw_read_close, .flags= AVFMT_GENERIC_INDEX, .extensions = "ac3", + .value = CODEC_ID_AC3, }; #endif @@ -541,11 +475,12 @@ "raw dts", 0, NULL, - dts_read_header, + audio_read_header, raw_read_partial_packet, raw_read_close, .flags= AVFMT_GENERIC_INDEX, .extensions = "dts", + .value = CODEC_ID_DTS, }; AVInputFormat aac_demuxer = { @@ -553,11 +488,12 @@ "ADTS AAC", 0, NULL, - aac_read_header, + audio_read_header, raw_read_partial_packet, raw_read_close, .flags= AVFMT_GENERIC_INDEX, .extensions = "aac", + .value = CODEC_ID_AAC, }; #ifdef CONFIG_ROQ_MUXER