From: Steinar H. Gunderson Date: Sun, 1 Oct 2023 08:42:55 +0000 (+0200) Subject: Fix channel layout deprecations in AudioEncoder. X-Git-Tag: 2.3.0~10 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=e4037149c9a6fbbd6b3747cdbd0909c0ca3b6382 Fix channel layout deprecations in AudioEncoder. --- diff --git a/nageru/audio_encoder.cpp b/nageru/audio_encoder.cpp index 4d42b40..126e0e2 100644 --- a/nageru/audio_encoder.cpp +++ b/nageru/audio_encoder.cpp @@ -51,16 +51,17 @@ AudioEncoder::AudioEncoder(const string &codec_name, int bit_rate, const AVOutpu abort(); } - resampler = swr_alloc_set_opts(nullptr, - /*out_ch_layout=*/AV_CH_LAYOUT_STEREO, - /*out_sample_fmt=*/ctx->sample_fmt, - /*out_sample_rate=*/OUTPUT_FREQUENCY, - /*in_ch_layout=*/AV_CH_LAYOUT_STEREO, - /*in_sample_fmt=*/AV_SAMPLE_FMT_FLT, - /*in_sample_rate=*/OUTPUT_FREQUENCY, - /*log_offset=*/0, - /*log_ctx=*/nullptr); - if (resampler == nullptr) { + resampler = nullptr; + int ok = swr_alloc_set_opts2(&resampler, + /*out_ch_layout=*/&ctx->ch_layout, + /*out_sample_fmt=*/ctx->sample_fmt, + /*out_sample_rate=*/OUTPUT_FREQUENCY, + /*in_ch_layout=*/&ctx->ch_layout, + /*in_sample_fmt=*/AV_SAMPLE_FMT_FLT, + /*in_sample_rate=*/OUTPUT_FREQUENCY, + /*log_offset=*/0, + /*log_ctx=*/nullptr); + if (ok != 0) { fprintf(stderr, "Allocating resampler failed.\n"); abort(); }