From 2b3070f108036a2eee50b4a7b8cbfc3eb60cf748 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 10 Apr 2024 18:44:49 +0200 Subject: Fix audio (swr) for ffmpeg 4.4 --- src/main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index be0bba2..2365f56 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2381,8 +2381,13 @@ int main(int argc, char **argv) { fprintf(stderr, "Failed to create SwrContext\n"); _exit(1); } - av_opt_set_int(swr, "in_channel_layout", AV_CH_LAYOUT_STEREO, 0); - av_opt_set_int(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0); + #if LIBAVUTIL_VERSION_MAJOR <= 56 + av_opt_set_channel_layout(swr, "in_channel_layout", AV_CH_LAYOUT_STEREO, 0); + av_opt_set_channel_layout(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0); + #else + av_opt_set_chlayout(swr, "in_channel_layout", &audio_track.codec_context->ch_layout, 0); + av_opt_set_chlayout(swr, "out_channel_layout", &audio_track.codec_context->ch_layout, 0); + #endif av_opt_set_int(swr, "in_sample_rate", audio_track.codec_context->sample_rate, 0); av_opt_set_int(swr, "out_sample_rate", audio_track.codec_context->sample_rate, 0); av_opt_set_sample_fmt(swr, "in_sample_fmt", sound_device_sample_format, 0); -- cgit v1.2.3