From: Vittorio Giovara <vittorio.giov...@gmail.com> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com> Signed-off-by: Anton Khirnov <an...@khirnov.net> Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/oggparsecelt.c | 3 ++- libavformat/oggparseogm.c | 6 ++++-- libavformat/oggparseopus.c | 3 ++- libavformat/oggparsespeex.c | 8 ++++---- libavformat/oggparsevorbis.c | 6 ++++-- 5 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/libavformat/oggparsecelt.c b/libavformat/oggparsecelt.c index f7a88af616..af15c07443 100644 --- a/libavformat/oggparsecelt.c +++ b/libavformat/oggparsecelt.c @@ -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); diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c index f777790523..c30e0324ae 100644 --- a/libavformat/oggparseogm.c +++ b/libavformat/oggparseogm.c @@ -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; } diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c index 36d691e9aa..adeda95fdb 100644 --- a/libavformat/oggparseopus.c +++ b/libavformat/oggparseopus.c @@ -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; diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c index c4fee7e076..7d3d653384 100644 --- a/libavformat/oggparsespeex.c +++ b/libavformat/oggparsespeex.c @@ -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); diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index e1ef510892..7e94054f19 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -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 -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".