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>
release/5.1
Vittorio Giovara 8 years ago committed by James Almer
parent 641761ac6e
commit 2c01257819
  1. 18
      libavformat/amr.c

@ -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…
Cancel
Save