If you could post that patch here...
Thanks,
- Fabian
Ofcourse.
FYI, it was created with deepseek and I cannot determine if the code is
completely correct and safe but I did test it and both AAC and MP3 are
working now.
Someone still has to review this code.
Cheers,
Bob
--- simplescreenrecorder-0.4.4.orig/src/AV/Output/AudioEncoder.cpp 2026-05-29 11:08:45.000000000 +0200
+++ simplescreenrecorder-0.4.4/src/AV/Output/AudioEncoder.cpp 2026-05-28 00:08:31.252238961 +0200
@@ -113,9 +113,16 @@
#if LIBAVCODEC_VERSION_MAJOR < 61
codec_context->channels = channels;
codec_context->channel_layout = (channels == 1)? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
+#elif LIBAVCODEC_VERSION_MAJOR < 62
+ // FFmpeg 6.x and 7.x - Use proper API function
+ if(channels == 1) {
+ av_channel_layout_from_mask(&codec_context->ch_layout, AV_CH_LAYOUT_MONO);
+ } else {
+ av_channel_layout_from_mask(&codec_context->ch_layout, AV_CH_LAYOUT_STEREO);
+ }
#else
- codec_context->ch_layout.nb_channels = channels;
- codec_context->ch_layout.u.mask = (channels == 1)? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
+ // FFmpeg 8.x and newer
+ av_channel_layout_default(&codec_context->ch_layout, channels);
#endif
codec_context->sample_rate = sample_rate;
codec_context->time_base.num = 1;