commit dd02476638d50208f04e842b51e5a3790d4c1b47
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Wed Feb 9 23:24:08 2022 +0000
fix
ffmpeg-5-compilation.patch | 62 ++++++++++++++++++++++++++++++++++++++++++++++
qmplay2.spec | 2 +-
2 files changed, 63 insertions(+), 1 deletion(-)
---
diff --git a/ffmpeg-5-compilation.patch b/ffmpeg-5-compilation.patch
new file mode 100644
index 0000000..79e0407
--- /dev/null
+++ b/ffmpeg-5-compilation.patch
@@ -0,0 +1,62 @@
+From bb48170d01c784d3c0436e9e341e21ad08721ff6 Sun 23 1 11:55:36 2022
+From: Simon Vogl <simon.vogl(a)gmx.net>
+Date: Sun, 23 Jan 2022 11:55:36 UTC
+Subject: [PATCH] Fix FFmpeg 5 compilation
+
+This patch is required to fix a compile error when builing QMPlay2 against FFmpeg >=
5.0.0.
+
+
+diff --git src/modules/CUVID/CuvidDec.cpp src/modules/CUVID/CuvidDec.cpp
+index 64ae9386..f8288764 100644
+--- src/modules/CUVID/CuvidDec.cpp
++++ src/modules/CUVID/CuvidDec.cpp
+@@ -431,7 +431,7 @@ bool CuvidDec::open(StreamInfo &streamInfo)
+ if (streamInfo.codec_type != AVMEDIA_TYPE_VIDEO)
+ return false;
+
+- AVCodec *avCodec = avcodec_find_decoder_by_name(streamInfo.codec_name);
++ auto avCodec = const_cast<AVCodec
*>(avcodec_find_decoder_by_name(streamInfo.codec_name));
+ if (!avCodec)
+ return false;
+
+diff --git src/modules/CUVID/CuvidDec.hpp src/modules/CUVID/CuvidDec.hpp
+index 0efb5bd9..cce1308d 100644
+--- src/modules/CUVID/CuvidDec.hpp
++++ src/modules/CUVID/CuvidDec.hpp
+@@ -26,6 +26,10 @@
+ #include <QCoreApplication>
+ #include <QQueue>
+
++extern "C" {
++ #include <libavcodec/bsf.h>
++}
++
+ class CuvidHWInterop;
+ class VideoWriter;
+
+diff --git src/modules/FFmpeg/FFDec.cpp src/modules/FFmpeg/FFDec.cpp
+index 592f12b7..9683bcfa 100644
+--- src/modules/FFmpeg/FFDec.cpp
++++ src/modules/FFmpeg/FFDec.cpp
+@@ -70,7 +70,7 @@ void FFDec::clearFrames()
+
+ AVCodec *FFDec::init(StreamInfo &streamInfo)
+ {
+- AVCodec *codec = avcodec_find_decoder_by_name(streamInfo.codec_name);
++ auto codec = const_cast< AVCodec
*>(avcodec_find_decoder_by_name(streamInfo.codec_name));
+ if (codec)
+ {
+ codec_ctx = avcodec_alloc_context3(codec);
+diff --git src/modules/FFmpeg/FormatContext.cpp src/modules/FFmpeg/FormatContext.cpp
+index 88f8ccb8..e96758e3 100644
+--- src/modules/FFmpeg/FormatContext.cpp
++++ src/modules/FFmpeg/FormatContext.cpp
+@@ -687,7 +687,7 @@ bool FormatContext::open(const QString &_url, const QString
¶m)
+ if (scheme != "rtsp")
+ {
+ // It is needed for QMPlay2 schemes like "alsa://",
"v4l2://", etc.
+- inputFmt = av_find_input_format(scheme);
++ inputFmt = const_cast<AVInputFormat *>(av_find_input_format(scheme));
+ if (inputFmt)
+ url = _url.right(_url.length() - scheme.length() - 3);
+ }
diff --git a/qmplay2.spec b/qmplay2.spec
index f85cb30..f8969fa 100644
--- a/qmplay2.spec
+++ b/qmplay2.spec
@@ -1,5 +1,4 @@
%undefine _strict_symbol_defs_build
-%undefine __cmake_in_source_build
%global pname QMPlay2
Name: qmplay2
@@ -10,6 +9,7 @@ License: LGPLv3+
URL:
http://zaps166.sourceforge.net/?app=QMPlay2
Source:
https://github.com/zaps166/QMPlay2/archive/%{version}.tar.gz#/%{pname}-%{...
Patch0: %{name}-numeric_limit_fix.patch
+Patch1: ffmpeg-5-compilation.patch
BuildRequires: cmake3
BuildRequires: ninja-build