mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
amr: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
641761ac6e
commit
2c01257819
@ -100,33 +100,31 @@ static int amr_read_header(AVFormatContext *s)
|
||||
st->codecpar->codec_tag = MKTAG('s', 'a', 'm', 'r');
|
||||
st->codecpar->codec_id = AV_CODEC_ID_AMR_NB;
|
||||
st->codecpar->sample_rate = 8000;
|
||||
st->codecpar->channels = 1;
|
||||
st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
|
||||
back = read - sizeof(AMR_header);
|
||||
} else if (!memcmp(header, AMRWB_header, sizeof(AMRWB_header))) {
|
||||
st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
|
||||
st->codecpar->codec_id = AV_CODEC_ID_AMR_WB;
|
||||
st->codecpar->sample_rate = 16000;
|
||||
st->codecpar->channels = 1;
|
||||
st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
|
||||
back = read - sizeof(AMRWB_header);
|
||||
} else if (!memcmp(header, AMRMC_header, sizeof(AMRMC_header))) {
|
||||
st->codecpar->codec_tag = MKTAG('s', 'a', 'm', 'r');
|
||||
st->codecpar->codec_id = AV_CODEC_ID_AMR_NB;
|
||||
st->codecpar->sample_rate = 8000;
|
||||
st->codecpar->channels = AV_RL32(header + 12);
|
||||
st->codecpar->ch_layout.nb_channels = AV_RL32(header + 12);
|
||||
back = read - 4 - sizeof(AMRMC_header);
|
||||
} else if (!memcmp(header, AMRWBMC_header, sizeof(AMRWBMC_header))) {
|
||||
st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
|
||||
st->codecpar->codec_id = AV_CODEC_ID_AMR_WB;
|
||||
st->codecpar->sample_rate = 16000;
|
||||
st->codecpar->channels = AV_RL32(header + 15);
|
||||
st->codecpar->ch_layout.nb_channels = AV_RL32(header + 15);
|
||||
back = read - 4 - sizeof(AMRWBMC_header);
|
||||
} else {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (st->codecpar->channels < 1)
|
||||
if (st->codecpar->ch_layout.nb_channels < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
@ -188,8 +186,7 @@ static int amrnb_read_header(AVFormatContext *s)
|
||||
return AVERROR(ENOMEM);
|
||||
st->codecpar->codec_id = AV_CODEC_ID_AMR_NB;
|
||||
st->codecpar->sample_rate = 8000;
|
||||
st->codecpar->channels = 1;
|
||||
st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
|
||||
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW;
|
||||
avpriv_set_pts_info(st, 64, 1, 8000);
|
||||
@ -246,8 +243,7 @@ static int amrwb_read_header(AVFormatContext *s)
|
||||
return AVERROR(ENOMEM);
|
||||
st->codecpar->codec_id = AV_CODEC_ID_AMR_WB;
|
||||
st->codecpar->sample_rate = 16000;
|
||||
st->codecpar->channels = 1;
|
||||
st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
|
||||
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW;
|
||||
avpriv_set_pts_info(st, 64, 1, 16000);
|
||||
|
Loading…
Reference in New Issue
Block a user