summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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