From 490718c22b511a08923771afdf52cacc20be96fe Mon Sep 17 00:00:00 2001 From: Alexis Maiquez Date: Tue, 7 Feb 2023 00:45:44 +0100 Subject: [PATCH] Fix missing #if body for number of out channels Signed-off-by: Alexis Maiquez --- src/WallpaperEngine/Audio/CAudioStream.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/WallpaperEngine/Audio/CAudioStream.cpp b/src/WallpaperEngine/Audio/CAudioStream.cpp index 666a14d..84b6a7e 100644 --- a/src/WallpaperEngine/Audio/CAudioStream.cpp +++ b/src/WallpaperEngine/Audio/CAudioStream.cpp @@ -487,8 +487,21 @@ int CAudioStream::resampleAudio ( } // get number of output audio channels +#if FF_API_OLD_CHANNEL_LAYOUT out_nb_channels = this->getContext ()->ch_layout.nb_channels; +#else + int64_t out_channel_layout; + // set output audio channels based on the input audio channels + switch (this->m_audioContext->getChannels ()) + { + case 1: out_channel_layout = AV_CH_LAYOUT_MONO; break; + case 2: out_channel_layout = AV_CH_LAYOUT_STEREO; break; + default: out_channel_layout = AV_CH_LAYOUT_SURROUND; break; + } + + out_nb_channels = av_get_channel_layout_nb_channels(out_channel_layout); +#endif ret = av_samples_alloc_array_and_samples( &resampled_data, &out_linesize,