gentoo-ebuilds/kde-plasma/kpipewire/files/kpipewire-6.4.5-ffmpeg8.patch
Andreas Sturmlechner bb0a7681d0
kde-plasma/kpipewire: Fix build w/ media-video/ffmpeg-8
Closes: https://bugs.gentoo.org/961443
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-09-09 20:00:26 +02:00

116 lines
4.2 KiB
Diff

From 6dc69b0674f9946641e88151c209ce58f085d06a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= <bero@lindev.ch>
Date: Wed, 27 Aug 2025 16:39:36 +0200
Subject: [PATCH] Fix build with ffmpeg >= 8.0
---
src/h264vaapiencoder.cpp | 12 +++++++++---
src/libopenh264encoder.cpp | 12 +++++++++---
src/libx264encoder.cpp | 12 +++++++++---
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/src/h264vaapiencoder.cpp b/src/h264vaapiencoder.cpp
index 0cf251b..eaec8dd 100644
--- a/src/h264vaapiencoder.cpp
+++ b/src/h264vaapiencoder.cpp
@@ -18,6 +18,12 @@ extern "C" {
#include "logging_record.h"
+#ifndef AV_PROFILE_H264_BASELINE // ffmpeg before 8.0
+#define AV_PROFILE_H264_BASELINE FF_PROFILE_H264_BASELINE
+#define AV_PROFILE_H264_MAIN FF_PROFILE_H264_MAIN
+#define AV_PROFILE_H264_HIGH FF_PROFILE_H264_HIGH
+#endif
+
H264VAAPIEncoder::H264VAAPIEncoder(H264Profile profile, PipeWireProduce *produce)
: HardwareEncoder(produce)
, m_profile(profile)
@@ -130,13 +136,13 @@ bool H264VAAPIEncoder::initialize(const QSize &size)
switch (m_profile) {
case H264Profile::Baseline:
- m_avCodecContext->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
+ m_avCodecContext->profile = AV_PROFILE_H264_CONSTRAINED_BASELINE;
break;
case H264Profile::Main:
- m_avCodecContext->profile = FF_PROFILE_H264_MAIN;
+ m_avCodecContext->profile = AV_PROFILE_H264_MAIN;
break;
case H264Profile::High:
- m_avCodecContext->profile = FF_PROFILE_H264_HIGH;
+ m_avCodecContext->profile = AV_PROFILE_H264_HIGH;
break;
}
diff --git a/src/libopenh264encoder.cpp b/src/libopenh264encoder.cpp
index db6ed4d..294c0f2 100644
--- a/src/libopenh264encoder.cpp
+++ b/src/libopenh264encoder.cpp
@@ -21,6 +21,12 @@ extern "C" {
#include "logging_record.h"
+#ifndef AV_PROFILE_H264_BASELINE // ffmpeg before 8.0
+#define AV_PROFILE_H264_CONSTRAINED_BASELINE FF_PROFILE_H264_CONSTRAINED_BASELINE
+#define AV_PROFILE_H264_MAIN FF_PROFILE_H264_MAIN
+#define AV_PROFILE_H264_HIGH FF_PROFILE_H264_HIGH
+#endif
+
LibOpenH264Encoder::LibOpenH264Encoder(H264Profile profile, PipeWireProduce *produce)
: SoftwareEncoder(produce)
, m_profile(profile)
@@ -64,13 +70,13 @@ bool LibOpenH264Encoder::initialize(const QSize &size)
// passes that through, but libopenh264 only allows BASELINE.
// Until that bug is fixed there'll always be a warning that the
// profile is not supported (https://github.com/cisco/openh264/issues/3613)
- m_avCodecContext->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
+ m_avCodecContext->profile = AV_PROFILE_H264_CONSTRAINED_BASELINE;
break;
case H264Profile::Main:
- m_avCodecContext->profile = FF_PROFILE_H264_MAIN;
+ m_avCodecContext->profile = AV_PROFILE_H264_MAIN;
break;
case H264Profile::High:
- m_avCodecContext->profile = FF_PROFILE_H264_HIGH;
+ m_avCodecContext->profile = AV_PROFILE_H264_HIGH;
break;
}
diff --git a/src/libx264encoder.cpp b/src/libx264encoder.cpp
index d9fe44f..a8f0e21 100644
--- a/src/libx264encoder.cpp
+++ b/src/libx264encoder.cpp
@@ -20,6 +20,12 @@ extern "C" {
#include "logging_record.h"
+#ifndef AV_PROFILE_H264_BASELINE // ffmpeg before 8.0
+#define AV_PROFILE_H264_BASELINE FF_PROFILE_H264_BASELINE
+#define AV_PROFILE_H264_MAIN FF_PROFILE_H264_MAIN
+#define AV_PROFILE_H264_HIGH FF_PROFILE_H264_HIGH
+#endif
+
using namespace Qt::StringLiterals;
LibX264Encoder::LibX264Encoder(H264Profile profile, PipeWireProduce *produce)
@@ -68,13 +74,13 @@ bool LibX264Encoder::initialize(const QSize &size)
switch (m_profile) {
case H264Profile::Baseline:
- m_avCodecContext->profile = FF_PROFILE_H264_BASELINE;
+ m_avCodecContext->profile = AV_PROFILE_H264_BASELINE;
break;
case H264Profile::Main:
- m_avCodecContext->profile = FF_PROFILE_H264_MAIN;
+ m_avCodecContext->profile = AV_PROFILE_H264_MAIN;
break;
case H264Profile::High:
- m_avCodecContext->profile = FF_PROFILE_H264_HIGH;
+ m_avCodecContext->profile = AV_PROFILE_H264_HIGH;
break;
}
--
GitLab