aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-04-10 18:44:49 +0200
committerdec05eba <dec05eba@protonmail.com>2024-04-10 18:44:49 +0200
commit2b3070f108036a2eee50b4a7b8cbfc3eb60cf748 (patch)
treed62e24d587de634b8fe89ec2eb158bc88ad93aee /src/main.cpp
parent356714a6eb92f7d458d3419e8bb2333141bd4638 (diff)
Fix audio (swr) for ffmpeg 4.4
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 7 insertions, 2 deletions
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);