aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-10-20 14:19:45 -0300
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:45 -0300
commit2b1fd08f3f60d4eb7aff90aa47d1cf738e61c785 (patch)
tree4a5775ed57f6e6dc6367f809c39ef85ada27f5d7
parent73cb6c87acd270551253db1871b245ffe3420d5b (diff)
downloadffmpeg-2b1fd08f3f60d4eb7aff90aa47d1cf738e61c785.tar.gz
speex: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavcodec/speexdec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/speexdec.c b/libavcodec/speexdec.c
index dcbdf5e010..7b482f5390 100644
--- a/libavcodec/speexdec.c
+++ b/libavcodec/speexdec.c
@@ -1450,7 +1450,7 @@ static av_cold int speex_decode_init(AVCodecContext *avctx)
if (s->rate <= 0)
return AVERROR_INVALIDDATA;
- s->nb_channels = avctx->channels;
+ s->nb_channels = avctx->ch_layout.nb_channels;
if (s->nb_channels <= 0)
return AVERROR_INVALIDDATA;
@@ -1492,7 +1492,9 @@ static av_cold int speex_decode_init(AVCodecContext *avctx)
if (s->bitrate > 0)
avctx->bit_rate = s->bitrate;
- avctx->channels = s->nb_channels;
+ av_channel_layout_uninit(&avctx->ch_layout);
+ avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+ avctx->ch_layout.nb_channels = s->nb_channels;
avctx->sample_rate = s->rate;
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
@@ -1554,12 +1556,12 @@ static int speex_decode_frame(AVCodecContext *avctx, void *data,
ret = speex_modes[s->mode].decode(avctx, &s->st[s->mode], &s->gb, dst + i * s->frame_size);
if (ret < 0)
return ret;
- if (avctx->channels == 2)
+ if (avctx->ch_layout.nb_channels == 2)
speex_decode_stereo(dst + i * s->frame_size, s->frame_size, &s->stereo);
}
dst = (float *)frame->extended_data[0];
- s->fdsp->vector_fmul_scalar(dst, dst, scale, frame->nb_samples * frame->channels);
+ s->fdsp->vector_fmul_scalar(dst, dst, scale, frame->nb_samples * frame->ch_layout.nb_channels);
frame->nb_samples = s->frame_size * s->frames_per_packet;
*got_frame_ptr = 1;