[FFmpeg-devel] [PATCH] avcodec/opusdec: stop setting deprecated swr options
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Sep 23 22:55:48 EEST 2022
James Almer:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> libavcodec/opusdec.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
> index c04aa598b8..8b10bd1a25 100644
> --- a/libavcodec/opusdec.c
> +++ b/libavcodec/opusdec.c
> @@ -640,7 +640,7 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
>
> for (i = 0; i < c->nb_streams; i++) {
> OpusStreamContext *s = &c->streams[i];
> - uint64_t layout;
> + AVChannelLayout layout;
>
> s->output_channels = (i < c->nb_stereo_streams) ? 2 : 1;
>
> @@ -658,14 +658,17 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
> if (!s->swr)
> return AVERROR(ENOMEM);
>
> - layout = (s->output_channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
> + layout = (s->output_channels == 1) ? (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO :
> + (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
> av_opt_set_int(s->swr, "in_sample_fmt", avctx->sample_fmt, 0);
> av_opt_set_int(s->swr, "out_sample_fmt", avctx->sample_fmt, 0);
> - av_opt_set_int(s->swr, "in_channel_layout", layout, 0);
> - av_opt_set_int(s->swr, "out_channel_layout", layout, 0);
> + av_opt_set_chlayout(s->swr, "in_chlayout", &layout, 0);
> + av_opt_set_chlayout(s->swr, "out_chlayout", &layout, 0);
> av_opt_set_int(s->swr, "out_sample_rate", avctx->sample_rate, 0);
> av_opt_set_int(s->swr, "filter_size", 16, 0);
>
> + av_channel_layout_uninit(&layout);
Unnecessary. You are not even using any of the av_channel_layout*
function to init layout.
> +
> ret = ff_silk_init(avctx, &s->silk, s->output_channels);
> if (ret < 0)
> return ret;
More information about the ffmpeg-devel
mailing list