slackware-current/source/xap/ssr/0003-Fix-build-with-ffmpeg-5.0.patch
Patrick J Volkerding 1af8dbc03d Mon Oct 10 18:45:33 UTC 2022
ap/diffstat-1.65-x86_64-1.txz:  Upgraded.
ap/moc-2.6_alpha3-x86_64-1.txz:  Upgraded.
  Compiled against ffmpeg-5.1.2.
kde/attica-5.99.0-x86_64-1.txz:  Upgraded.
kde/baloo-5.99.0-x86_64-1.txz:  Upgraded.
kde/bluez-qt-5.99.0-x86_64-1.txz:  Upgraded.
kde/breeze-icons-5.99.0-noarch-1.txz:  Upgraded.
kde/digikam-7.8.0-x86_64-3.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
kde/extra-cmake-modules-5.99.0-x86_64-1.txz:  Upgraded.
kde/ffmpegthumbs-22.08.1-x86_64-2.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
kde/frameworkintegration-5.99.0-x86_64-1.txz:  Upgraded.
kde/kactivities-5.99.0-x86_64-1.txz:  Upgraded.
kde/kactivities-stats-5.99.0-x86_64-1.txz:  Upgraded.
kde/kapidox-5.99.0-x86_64-1.txz:  Upgraded.
kde/karchive-5.99.0-x86_64-1.txz:  Upgraded.
kde/kauth-5.99.0-x86_64-1.txz:  Upgraded.
kde/kbookmarks-5.99.0-x86_64-1.txz:  Upgraded.
kde/kcalendarcore-5.99.0-x86_64-1.txz:  Upgraded.
kde/kcmutils-5.99.0-x86_64-1.txz:  Upgraded.
kde/kcodecs-5.99.0-x86_64-1.txz:  Upgraded.
kde/kcompletion-5.99.0-x86_64-1.txz:  Upgraded.
kde/kconfig-5.99.0-x86_64-1.txz:  Upgraded.
kde/kconfigwidgets-5.99.0-x86_64-1.txz:  Upgraded.
kde/kcontacts-5.99.0-x86_64-1.txz:  Upgraded.
kde/kcoreaddons-5.99.0-x86_64-1.txz:  Upgraded.
kde/kcrash-5.99.0-x86_64-1.txz:  Upgraded.
kde/kdav-5.99.0-x86_64-1.txz:  Upgraded.
kde/kdbusaddons-5.99.0-x86_64-1.txz:  Upgraded.
kde/kdeclarative-5.99.0-x86_64-1.txz:  Upgraded.
kde/kded-5.99.0-x86_64-1.txz:  Upgraded.
kde/kdelibs4support-5.99.0-x86_64-1.txz:  Upgraded.
kde/kdesignerplugin-5.99.0-x86_64-1.txz:  Upgraded.
kde/kdesu-5.99.0-x86_64-1.txz:  Upgraded.
kde/kdewebkit-5.99.0-x86_64-1.txz:  Upgraded.
kde/kdnssd-5.99.0-x86_64-1.txz:  Upgraded.
kde/kdoctools-5.99.0-x86_64-1.txz:  Upgraded.
kde/kemoticons-5.99.0-x86_64-1.txz:  Upgraded.
kde/kfilemetadata-5.99.0-x86_64-1.txz:  Upgraded.
  Compiled against ffmpeg-5.1.2.
kde/kglobalaccel-5.99.0-x86_64-1.txz:  Upgraded.
kde/kguiaddons-5.99.0-x86_64-1.txz:  Upgraded.
kde/kholidays-5.99.0-x86_64-1.txz:  Upgraded.
kde/khtml-5.99.0-x86_64-1.txz:  Upgraded.
kde/ki18n-5.99.0-x86_64-1.txz:  Upgraded.
kde/kiconthemes-5.99.0-x86_64-1.txz:  Upgraded.
kde/kidletime-5.99.0-x86_64-1.txz:  Upgraded.
kde/kimageformats-5.99.0-x86_64-1.txz:  Upgraded.
kde/kinit-5.99.0-x86_64-1.txz:  Upgraded.
kde/kio-5.99.0-x86_64-1.txz:  Upgraded.
kde/kirigami2-5.99.0-x86_64-1.txz:  Upgraded.
kde/kitemmodels-5.99.0-x86_64-1.txz:  Upgraded.
kde/kitemviews-5.99.0-x86_64-1.txz:  Upgraded.
kde/kjobwidgets-5.99.0-x86_64-1.txz:  Upgraded.
kde/kjs-5.99.0-x86_64-1.txz:  Upgraded.
kde/kjsembed-5.99.0-x86_64-1.txz:  Upgraded.
kde/kmediaplayer-5.99.0-x86_64-1.txz:  Upgraded.
kde/knewstuff-5.99.0-x86_64-1.txz:  Upgraded.
kde/knotifications-5.99.0-x86_64-1.txz:  Upgraded.
kde/knotifyconfig-5.99.0-x86_64-1.txz:  Upgraded.
kde/kpackage-5.99.0-x86_64-1.txz:  Upgraded.
kde/kparts-5.99.0-x86_64-1.txz:  Upgraded.
kde/kpeople-5.99.0-x86_64-1.txz:  Upgraded.
kde/kplotting-5.99.0-x86_64-1.txz:  Upgraded.
kde/kpty-5.99.0-x86_64-1.txz:  Upgraded.
kde/kquickcharts-5.99.0-x86_64-1.txz:  Upgraded.
kde/kross-5.99.0-x86_64-1.txz:  Upgraded.
kde/krunner-5.99.0-x86_64-1.txz:  Upgraded.
kde/kservice-5.99.0-x86_64-1.txz:  Upgraded.
kde/ktexteditor-5.99.0-x86_64-1.txz:  Upgraded.
kde/ktextwidgets-5.99.0-x86_64-1.txz:  Upgraded.
kde/kunitconversion-5.99.0-x86_64-1.txz:  Upgraded.
kde/kwallet-5.99.0-x86_64-1.txz:  Upgraded.
kde/kwayland-5.99.0-x86_64-1.txz:  Upgraded.
kde/kwidgetsaddons-5.99.0-x86_64-1.txz:  Upgraded.
kde/kwindowsystem-5.99.0-x86_64-1.txz:  Upgraded.
kde/kxmlgui-5.99.0-x86_64-1.txz:  Upgraded.
kde/kxmlrpcclient-5.99.0-x86_64-1.txz:  Upgraded.
kde/modemmanager-qt-5.99.0-x86_64-1.txz:  Upgraded.
kde/networkmanager-qt-5.99.0-x86_64-1.txz:  Upgraded.
kde/oxygen-icons5-5.99.0-noarch-1.txz:  Upgraded.
kde/plasma-framework-5.99.0-x86_64-1.txz:  Upgraded.
kde/prison-5.99.0-x86_64-1.txz:  Upgraded.
kde/purpose-5.99.0-x86_64-1.txz:  Upgraded.
kde/qqc2-desktop-style-5.99.0-x86_64-1.txz:  Upgraded.
kde/solid-5.99.0-x86_64-1.txz:  Upgraded.
kde/sonnet-5.99.0-x86_64-1.txz:  Upgraded.
kde/syndication-5.99.0-x86_64-1.txz:  Upgraded.
kde/syntax-highlighting-5.99.0-x86_64-1.txz:  Upgraded.
kde/threadweaver-5.99.0-x86_64-1.txz:  Upgraded.
l/QtAV-20220226_fdc613dc-x86_64-1.txz:  Upgraded.
  Compiled against ffmpeg-5.1.2.
l/alsa-plugins-1.2.7.1-x86_64-2.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
l/ffmpeg-5.1.2-x86_64-1.txz:  Upgraded.
  Shared library .so-version bump.
  Enabled glslang and vulkan. Thanks to Heinz Wiesinger.
l/gegl-0.4.38-x86_64-2.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
l/gst-plugins-libav-1.20.3-x86_64-2.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
l/harfbuzz-5.3.0-x86_64-1.txz:  Upgraded.
l/imagemagick-7.1.0_50-x86_64-1.txz:  Upgraded.
l/libvncserver-0.9.13-x86_64-4.txz:  Rebuilt.
  Disabled ffmpeg support (not compatible with ffmpeg5).
l/mlt-7.8.0-x86_64-2.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
l/opencv-4.6.0-x86_64-2.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
l/pcre2-10.40-x86_64-2.txz:  Rebuilt.
  Moved shared libraries into /lib${LIBDIRSUFFIX}. Thanks to TommyC7.
l/pipewire-0.3.59-x86_64-2.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
l/qt5-5.15.6_20220928_06b700dd-x86_64-1.txz:  Upgraded.
  Compiled against ffmpeg-5.1.2.
n/libgpg-error-1.46-x86_64-2.txz:  Rebuilt.
  Rebuilt with --enable-install-gpg-error-config to fix regression building
  gpgme. Thanks to nobodino and ponce.
x/libva-utils-2.16.0-x86_64-1.txz:  Upgraded.
x/wayland-protocols-1.27-noarch-1.txz:  Upgraded.
xap/MPlayer-20221009-x86_64-1.txz:  Upgraded.
  Compiled against ffmpeg-5.1.2.
xap/audacious-plugins-4.2-x86_64-2.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
xap/ffmpegthumbnailer-2.2.2-x86_64-4.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
xap/freerdp-2.8.0-x86_64-2.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
xap/ssr-0.4.4-x86_64-1.txz:  Upgraded.
  Compiled against ffmpeg-5.1.2.
xap/xine-lib-1.2.12-x86_64-2.txz:  Rebuilt.
  Recompiled against ffmpeg-5.1.2.
2022-10-11 07:00:35 +02:00

237 lines
11 KiB
Diff

From: =?utf-8?q?Bernhard_Rosenkr=C3=A4nzer?= <bero@lindev.ch>
Date: Sun, 16 Jan 2022 02:40:04 +0100
Subject: Fix build with ffmpeg 5.0
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Adapt to ffmpeg 5.0 requiring more const-ness for AVCodec.
Signed-off-by: Bernhard Rosenkränzer <bero@lindev.ch>
---
src/AV/Output/AudioEncoder.cpp | 6 +++---
src/AV/Output/AudioEncoder.h | 4 ++--
src/AV/Output/BaseEncoder.cpp | 4 ++--
src/AV/Output/BaseEncoder.h | 4 ++--
src/AV/Output/Muxer.cpp | 12 ++++++------
src/AV/Output/Muxer.h | 4 ++--
src/AV/Output/VideoEncoder.cpp | 6 +++---
src/AV/Output/VideoEncoder.h | 4 ++--
8 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/AV/Output/AudioEncoder.cpp b/src/AV/Output/AudioEncoder.cpp
index 34d015c..cefc2e0 100644
--- a/src/AV/Output/AudioEncoder.cpp
+++ b/src/AV/Output/AudioEncoder.cpp
@@ -34,7 +34,7 @@ const std::vector<AudioEncoder::SampleFormatData> AudioEncoder::SUPPORTED_SAMPLE
const unsigned int AudioEncoder::DEFAULT_FRAME_SAMPLES = 1024;
-AudioEncoder::AudioEncoder(Muxer* muxer, AVStream* stream, AVCodecContext *codec_context, AVCodec* codec, AVDictionary** options)
+AudioEncoder::AudioEncoder(Muxer* muxer, AVStream* stream, AVCodecContext *codec_context, const AVCodec* codec, AVDictionary** options)
: BaseEncoder(muxer, stream, codec_context, codec, options) {
#if !SSR_USE_AVCODEC_ENCODE_AUDIO2
@@ -77,7 +77,7 @@ unsigned int AudioEncoder::GetSampleRate() {
}
bool AudioEncoder::AVCodecIsSupported(const QString& codec_name) {
- AVCodec *codec = avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
+ const AVCodec *codec = avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
if(codec == NULL)
return false;
if(!av_codec_is_encoder(codec))
@@ -93,7 +93,7 @@ bool AudioEncoder::AVCodecIsSupported(const QString& codec_name) {
return false;
}
-void AudioEncoder::PrepareStream(AVStream* stream, AVCodecContext* codec_context, AVCodec* codec, AVDictionary** options, const std::vector<std::pair<QString, QString> >& codec_options,
+void AudioEncoder::PrepareStream(AVStream* stream, AVCodecContext* codec_context, const AVCodec* codec, AVDictionary** options, const std::vector<std::pair<QString, QString> >& codec_options,
unsigned int bit_rate, unsigned int channels, unsigned int sample_rate) {
if(channels == 0) {
diff --git a/src/AV/Output/AudioEncoder.h b/src/AV/Output/AudioEncoder.h
index c93278c..ae9c82e 100644
--- a/src/AV/Output/AudioEncoder.h
+++ b/src/AV/Output/AudioEncoder.h
@@ -40,7 +40,7 @@ private:
#endif
public:
- AudioEncoder(Muxer* muxer, AVStream* stream, AVCodecContext* codec_context, AVCodec* codec, AVDictionary** options);
+ AudioEncoder(Muxer* muxer, AVStream* stream, AVCodecContext* codec_context, const AVCodec* codec, AVDictionary** options);
~AudioEncoder();
// Returns the required frame size, i.e. the number of samples (for each channel).
@@ -57,7 +57,7 @@ public:
public:
static bool AVCodecIsSupported(const QString& codec_name);
- static void PrepareStream(AVStream* stream, AVCodecContext* codec_context, AVCodec* codec, AVDictionary** options, const std::vector<std::pair<QString, QString> >& codec_options,
+ static void PrepareStream(AVStream* stream, AVCodecContext* codec_context, const AVCodec* codec, AVDictionary** options, const std::vector<std::pair<QString, QString> >& codec_options,
unsigned int bit_rate, unsigned int channels, unsigned int sample_rate);
private:
diff --git a/src/AV/Output/BaseEncoder.cpp b/src/AV/Output/BaseEncoder.cpp
index 7c01ef3..4780aaf 100644
--- a/src/AV/Output/BaseEncoder.cpp
+++ b/src/AV/Output/BaseEncoder.cpp
@@ -42,7 +42,7 @@ double ParseCodecOptionDouble(const QString& key, const QString& value, double m
return clamp(value_double, min, max) * multiply;
}
-BaseEncoder::BaseEncoder(Muxer* muxer, AVStream* stream, AVCodecContext* codec_context, AVCodec* codec, AVDictionary** options) {
+BaseEncoder::BaseEncoder(Muxer* muxer, AVStream* stream, AVCodecContext* codec_context, const AVCodec* codec, AVDictionary** options) {
m_muxer = muxer;
m_stream = stream;
@@ -157,7 +157,7 @@ void BaseEncoder::IncrementPacketCounter() {
++lock->m_total_packets;
}
-void BaseEncoder::Init(AVCodec* codec, AVDictionary** options) {
+void BaseEncoder::Init(const AVCodec* codec, AVDictionary** options) {
// open codec
if(avcodec_open2(m_codec_context, codec, options) < 0) {
diff --git a/src/AV/Output/BaseEncoder.h b/src/AV/Output/BaseEncoder.h
index 3d92f29..7f02bbd 100644
--- a/src/AV/Output/BaseEncoder.h
+++ b/src/AV/Output/BaseEncoder.h
@@ -51,7 +51,7 @@ private:
std::atomic<bool> m_should_stop, m_should_finish, m_is_done, m_error_occurred;
protected:
- BaseEncoder(Muxer* muxer, AVStream* stream, AVCodecContext* codec_context, AVCodec* codec, AVDictionary** options);
+ BaseEncoder(Muxer* muxer, AVStream* stream, AVCodecContext* codec_context, const AVCodec* codec, AVDictionary** options);
public:
virtual ~BaseEncoder(); // encoders will be deleted by Muxer, don't delete them yourself!
@@ -117,7 +117,7 @@ protected:
void IncrementPacketCounter();
private:
- void Init(AVCodec* codec, AVDictionary** options);
+ void Init(const AVCodec* codec, AVDictionary** options);
void Free();
void EncoderThread();
diff --git a/src/AV/Output/Muxer.cpp b/src/AV/Output/Muxer.cpp
index ad58380..1094dcc 100644
--- a/src/AV/Output/Muxer.cpp
+++ b/src/AV/Output/Muxer.cpp
@@ -87,7 +87,7 @@ Muxer::~Muxer() {
VideoEncoder* Muxer::AddVideoEncoder(const QString& codec_name, const std::vector<std::pair<QString, QString> >& codec_options,
unsigned int bit_rate, unsigned int width, unsigned int height, unsigned int frame_rate) {
- AVCodec *codec = FindCodec(codec_name);
+ const AVCodec *codec = FindCodec(codec_name);
AVCodecContext *codec_context = NULL;
AVStream *stream = AddStream(codec, &codec_context);
VideoEncoder *encoder;
@@ -111,7 +111,7 @@ VideoEncoder* Muxer::AddVideoEncoder(const QString& codec_name, const std::vecto
AudioEncoder* Muxer::AddAudioEncoder(const QString& codec_name, const std::vector<std::pair<QString, QString> >& codec_options,
unsigned int bit_rate, unsigned int channels, unsigned int sample_rate) {
- AVCodec *codec = FindCodec(codec_name);
+ const AVCodec *codec = FindCodec(codec_name);
AVCodecContext *codec_context = NULL;
AVStream *stream = AddStream(codec, &codec_context);
AudioEncoder *encoder;
@@ -194,7 +194,7 @@ unsigned int Muxer::GetQueuedPacketCount(unsigned int stream_index) {
void Muxer::Init() {
// get the format we want (this is just a pointer, we don't have to free this)
- AVOutputFormat *format = av_guess_format(m_container_name.toUtf8().constData(), NULL, NULL);
+ auto format = av_guess_format(m_container_name.toUtf8().constData(), NULL, NULL);
if(format == NULL) {
Logger::LogError("[Muxer::Init] " + Logger::tr("Error: Can't find chosen output format!"));
throw LibavException();
@@ -261,8 +261,8 @@ void Muxer::Free() {
}
}
-AVCodec* Muxer::FindCodec(const QString& codec_name) {
- AVCodec *codec = avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
+const AVCodec* Muxer::FindCodec(const QString& codec_name) {
+ const AVCodec *codec = avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
if(codec == NULL) {
Logger::LogError("[Muxer::FindCodec] " + Logger::tr("Error: Can't find codec!"));
throw LibavException();
@@ -270,7 +270,7 @@ AVCodec* Muxer::FindCodec(const QString& codec_name) {
return codec;
}
-AVStream* Muxer::AddStream(AVCodec* codec, AVCodecContext** codec_context) {
+AVStream* Muxer::AddStream(const AVCodec* codec, AVCodecContext** codec_context) {
assert(!m_started);
assert(m_format_context->nb_streams < MUXER_MAX_STREAMS);
diff --git a/src/AV/Output/Muxer.h b/src/AV/Output/Muxer.h
index d72347d..b104bcb 100644
--- a/src/AV/Output/Muxer.h
+++ b/src/AV/Output/Muxer.h
@@ -114,8 +114,8 @@ private:
void Init();
void Free();
- AVCodec* FindCodec(const QString& codec_name);
- AVStream* AddStream(AVCodec* codec, AVCodecContext** codec_context);
+ const AVCodec* FindCodec(const QString& codec_name);
+ AVStream* AddStream(const AVCodec* codec, AVCodecContext** codec_context);
void MuxerThread();
diff --git a/src/AV/Output/VideoEncoder.cpp b/src/AV/Output/VideoEncoder.cpp
index 8087e8e..fc8b5d1 100644
--- a/src/AV/Output/VideoEncoder.cpp
+++ b/src/AV/Output/VideoEncoder.cpp
@@ -34,7 +34,7 @@ const std::vector<VideoEncoder::PixelFormatData> VideoEncoder::SUPPORTED_PIXEL_F
{"rgb", AV_PIX_FMT_RGB24, false},
};
-VideoEncoder::VideoEncoder(Muxer* muxer, AVStream* stream, AVCodecContext* codec_context, AVCodec* codec, AVDictionary** options)
+VideoEncoder::VideoEncoder(Muxer* muxer, AVStream* stream, AVCodecContext* codec_context, const AVCodec* codec, AVDictionary** options)
: BaseEncoder(muxer, stream, codec_context, codec, options) {
#if !SSR_USE_AVCODEC_ENCODE_VIDEO2
@@ -95,7 +95,7 @@ unsigned int VideoEncoder::GetFrameRate() {
}
bool VideoEncoder::AVCodecIsSupported(const QString& codec_name) {
- AVCodec *codec = avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
+ const AVCodec *codec = avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
if(codec == NULL)
return false;
if(!av_codec_is_encoder(codec))
@@ -111,7 +111,7 @@ bool VideoEncoder::AVCodecIsSupported(const QString& codec_name) {
return false;
}
-void VideoEncoder::PrepareStream(AVStream* stream, AVCodecContext* codec_context, AVCodec* codec, AVDictionary** options, const std::vector<std::pair<QString, QString> >& codec_options,
+void VideoEncoder::PrepareStream(AVStream* stream, AVCodecContext* codec_context, const AVCodec* codec, AVDictionary** options, const std::vector<std::pair<QString, QString> >& codec_options,
unsigned int bit_rate, unsigned int width, unsigned int height, unsigned int frame_rate) {
if(width == 0 || height == 0) {
diff --git a/src/AV/Output/VideoEncoder.h b/src/AV/Output/VideoEncoder.h
index cb7ca27..68d872e 100644
--- a/src/AV/Output/VideoEncoder.h
+++ b/src/AV/Output/VideoEncoder.h
@@ -40,7 +40,7 @@ private:
#endif
public:
- VideoEncoder(Muxer* muxer, AVStream* stream, AVCodecContext* codec_context, AVCodec* codec, AVDictionary** options);
+ VideoEncoder(Muxer* muxer, AVStream* stream, AVCodecContext* codec_context, const AVCodec* codec, AVDictionary** options);
~VideoEncoder();
// Returns the required pixel format.
@@ -55,7 +55,7 @@ public:
public:
static bool AVCodecIsSupported(const QString& codec_name);
- static void PrepareStream(AVStream* stream, AVCodecContext* codec_context, AVCodec* codec, AVDictionary** options, const std::vector<std::pair<QString, QString> >& codec_options,
+ static void PrepareStream(AVStream* stream, AVCodecContext* codec_context, const AVCodec* codec, AVDictionary** options, const std::vector<std::pair<QString, QString> >& codec_options,
unsigned int bit_rate, unsigned int width, unsigned int height, unsigned int frame_rate);
private: