diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2017-03-31 17:58:46 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:35 -0300 |
commit | 5b51e6771c5419118dc02b325aafed37ce5cb709 (patch) | |
tree | e65e694bad4912bab7b9476bcb0ff67225c70df9 /libavformat/oggparsespeex.c | |
parent | f81417a6d2e2a200658c668b8414547a99f3d002 (diff) |
ogg: 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>
Diffstat (limited to 'libavformat/oggparsespeex.c')
-rw-r--r-- | libavformat/oggparsespeex.c | 8 |
1 files changed, 4 insertions, 4 deletions
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); |