summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Dyomin <artem.dyomin@qt.io>2024-01-24 11:59:50 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-01-24 11:56:58 +0000
commitead22a2ad8e458ec34514e23b291aab5146c9f95 (patch)
tree6c8877914171ba5b4aff45316b44ad319d197b3d
parent56c37105e39303aeb1a27418b80be0953f9b08ea (diff)
Fix build with ffmpeg swrresample version < 4.9.100v6.7.0-beta2
swr_alloc_set_opts2 takes 'const AVChannelLayout*' from LIBSWRESAMPLE_VERSION 4.9.100 Fixes: QTBUG-121455 Pick-to: 6.6 6.5 Change-Id: I06812f9efedd53e12152fb3cf1574ad8c7c61d27 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit b0cffad4411a0c8d6469a892bcf98cf4384ae6f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/multimedia/ffmpeg/qffmpeg.cpp11
-rw-r--r--src/plugins/multimedia/ffmpeg/qffmpeg_p.h2
2 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/multimedia/ffmpeg/qffmpeg.cpp b/src/plugins/multimedia/ffmpeg/qffmpeg.cpp
index f5b97566a..d7095edee 100644
--- a/src/plugins/multimedia/ffmpeg/qffmpeg.cpp
+++ b/src/plugins/multimedia/ffmpeg/qffmpeg.cpp
@@ -479,11 +479,18 @@ SwrContextUPtr createResampleContext(const ResampleAudioFormat& inputFormat,
0,
nullptr);
#else
+
+#if QT_FFMPEG_SWR_CONST_CH_LAYOUT
+ using AVChannelLayoutPrm = const AVChannelLayout*;
+#else
+ using AVChannelLayoutPrm = AVChannelLayout*;
+#endif
+
swr_alloc_set_opts2(&resampler,
- &outputFormat.channelLayout,
+ const_cast<AVChannelLayoutPrm>(&outputFormat.channelLayout),
outputFormat.sampleFormat,
outputFormat.sampleRate,
- &inputFormat.channelLayout,
+ const_cast<AVChannelLayoutPrm>(&inputFormat.channelLayout),
inputFormat.sampleFormat,
inputFormat.sampleRate,
0,
diff --git a/src/plugins/multimedia/ffmpeg/qffmpeg_p.h b/src/plugins/multimedia/ffmpeg/qffmpeg_p.h
index 27d5e723c..76c50887f 100644
--- a/src/plugins/multimedia/ffmpeg/qffmpeg_p.h
+++ b/src/plugins/multimedia/ffmpeg/qffmpeg_p.h
@@ -24,6 +24,8 @@ extern "C" {
(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 3, 100)) // since ffmpeg n6.0
#define QT_FFMPEG_STREAM_SIDE_DATA_DEPRECATED \
(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 15, 100)) // since ffmpeg n6.1
+#define QT_FFMPEG_SWR_CONST_CH_LAYOUT \
+ (LIBSWRESAMPLE_VERSION_INT >= AV_VERSION_INT(4, 9, 100))
QT_BEGIN_NAMESPACE