1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

set demuxers .value and use common audio_read_header function

Originally committed as revision 13012 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Baptiste Coudurier 2008-04-28 14:14:44 +00:00
parent 39902a8c93
commit a0af2fa445

View File

@ -221,83 +221,14 @@ int pcm_read_seek(AVFormatContext *s,
return 0; return 0;
} }
/* ac3 read */ static int audio_read_header(AVFormatContext *s,
static int ac3_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVFormatParameters *ap)
{ {
AVStream *st; AVStream *st = av_new_stream(s, 0);
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);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_SHORTEN; st->codec->codec_id = s->iformat->value;
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->need_parsing = AVSTREAM_PARSE_FULL; st->need_parsing = AVSTREAM_PARSE_FULL;
/* the parameters will be extracted from the compressed bitstream */ /* the parameters will be extracted from the compressed bitstream */
return 0; return 0;
@ -459,11 +390,12 @@ AVInputFormat shorten_demuxer = {
"raw shorten", "raw shorten",
0, 0,
NULL, NULL,
shorten_read_header, audio_read_header,
raw_read_partial_packet, raw_read_partial_packet,
raw_read_close, raw_read_close,
.flags= AVFMT_GENERIC_INDEX, .flags= AVFMT_GENERIC_INDEX,
.extensions = "shn", .extensions = "shn",
.value = CODEC_ID_SHORTEN,
}; };
AVInputFormat flac_demuxer = { AVInputFormat flac_demuxer = {
@ -471,11 +403,12 @@ AVInputFormat flac_demuxer = {
"raw flac", "raw flac",
0, 0,
flac_probe, flac_probe,
flac_read_header, audio_read_header,
raw_read_partial_packet, raw_read_partial_packet,
raw_read_close, raw_read_close,
.flags= AVFMT_GENERIC_INDEX, .flags= AVFMT_GENERIC_INDEX,
.extensions = "flac", .extensions = "flac",
.value = CODEC_ID_FLAC,
}; };
#ifdef CONFIG_MUXERS #ifdef CONFIG_MUXERS
@ -499,11 +432,12 @@ AVInputFormat ac3_demuxer = {
"raw ac3", "raw ac3",
0, 0,
ac3_probe, ac3_probe,
ac3_read_header, audio_read_header,
raw_read_partial_packet, raw_read_partial_packet,
raw_read_close, raw_read_close,
.flags= AVFMT_GENERIC_INDEX, .flags= AVFMT_GENERIC_INDEX,
.extensions = "ac3", .extensions = "ac3",
.value = CODEC_ID_AC3,
}; };
#endif #endif
@ -541,11 +475,12 @@ AVInputFormat dts_demuxer = {
"raw dts", "raw dts",
0, 0,
NULL, NULL,
dts_read_header, audio_read_header,
raw_read_partial_packet, raw_read_partial_packet,
raw_read_close, raw_read_close,
.flags= AVFMT_GENERIC_INDEX, .flags= AVFMT_GENERIC_INDEX,
.extensions = "dts", .extensions = "dts",
.value = CODEC_ID_DTS,
}; };
AVInputFormat aac_demuxer = { AVInputFormat aac_demuxer = {
@ -553,11 +488,12 @@ AVInputFormat aac_demuxer = {
"ADTS AAC", "ADTS AAC",
0, 0,
NULL, NULL,
aac_read_header, audio_read_header,
raw_read_partial_packet, raw_read_partial_packet,
raw_read_close, raw_read_close,
.flags= AVFMT_GENERIC_INDEX, .flags= AVFMT_GENERIC_INDEX,
.extensions = "aac", .extensions = "aac",
.value = CODEC_ID_AAC,
}; };
#ifdef CONFIG_ROQ_MUXER #ifdef CONFIG_ROQ_MUXER