@@ -64,7 +64,8 @@ static int celt_header(AVFormatContext *s, int idx)
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = AV_CODEC_ID_CELT;
st->codecpar->sample_rate = sample_rate;
- st->codecpar->channels = nb_channels;
+ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+ st->codecpar->ch_layout.nb_channels = nb_channels;
if (sample_rate)
avpriv_set_pts_info(st, 64, 1, sample_rate);
@@ -97,7 +97,8 @@ ogm_header(AVFormatContext *s, int idx)
st->codecpar->height = bytestream2_get_le32(&p);
avpriv_set_pts_info(st, 64, time_unit, spu * 10000000);
} else {
- st->codecpar->channels = bytestream2_get_le16(&p);
+ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+ st->codecpar->ch_layout.nb_channels = bytestream2_get_le16(&p);
bytestream2_skip(&p, 2); /* block_align */
st->codecpar->bit_rate = bytestream2_get_le32(&p) * 8;
st->codecpar->sample_rate = spu * 10000000 / time_unit;
@@ -160,7 +161,8 @@ ogm_dshow_header(AVFormatContext *s, int idx)
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = ff_codec_get_id(ff_codec_wav_tags, AV_RL16(p + 124));
- st->codecpar->channels = AV_RL16(p + 126);
+ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+ st->codecpar->ch_layout.nb_channels = AV_RL16(p + 126);
st->codecpar->sample_rate = AV_RL32(p + 128);
st->codecpar->bit_rate = AV_RL32(p + 132) * 8;
}
@@ -55,7 +55,8 @@ static int opus_header(AVFormatContext *avf, int idx)
return AVERROR_INVALIDDATA;
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = AV_CODEC_ID_OPUS;
- st->codecpar->channels = AV_RL8(packet + 9);
+ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+ st->codecpar->ch_layout.nb_channels = AV_RL8(packet + 9);
priv->pre_skip = AV_RL16(packet + 10);
st->codecpar->initial_padding = priv->pre_skip;
@@ -60,6 +60,7 @@ static int speex_header(AVFormatContext *s, int idx) {
if (spxp->seq == 0) {
int frames_per_packet;
+ int channels;
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = AV_CODEC_ID_SPEEX;
@@ -73,13 +74,12 @@ static int speex_header(AVFormatContext *s, int idx) {
av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate);
return AVERROR_INVALIDDATA;
}
- st->codecpar->channels = AV_RL32(p + 48);
- if (st->codecpar->channels < 1 || st->codecpar->channels > 2) {
+ channels = AV_RL32(p + 48);
+ if (channels < 1 || channels > 2) {
av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n");
return AVERROR_INVALIDDATA;
}
- st->codecpar->channel_layout = st->codecpar->channels == 1 ? AV_CH_LAYOUT_MONO :
- AV_CH_LAYOUT_STEREO;
+ av_channel_layout_default(&st->codecpar->ch_layout, channels);
spxp->packet_size = AV_RL32(p + 56);
frames_per_packet = AV_RL32(p + 64);
@@ -336,11 +336,13 @@ static int vorbis_header(AVFormatContext *s, int idx)
return AVERROR_INVALIDDATA;
channels = bytestream_get_byte(&p);
- if (st->codecpar->channels && channels != st->codecpar->channels) {
+ if (st->codecpar->ch_layout.nb_channels &&
+ channels != st->codecpar->ch_layout.nb_channels) {
av_log(s, AV_LOG_ERROR, "Channel change is not supported\n");
return AVERROR_PATCHWELCOME;
}
- st->codecpar->channels = channels;
+ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+ st->codecpar->ch_layout.nb_channels = channels;
srate = bytestream_get_le32(&p);
p += 4; // skip maximum bitrate
st->codecpar->bit_rate = bytestream_get_le32(&p); // nominal bitrate