obs-studio: fixed build with ffmpeg 6.0

This commit is contained in:
Tim Biermann 2023-03-05 11:40:48 +01:00
parent a14f5e3dfd
commit 58559059a4
Signed by: tb
GPG Key ID: 42F8B4E30B673606
3 changed files with 103 additions and 4 deletions

View File

@ -1,6 +1,7 @@
untrusted comment: verify with /etc/ports/contrib.pub
RWSagIOpLGJF307WxHl9ouZ7bCZDgdz8fvG0T5kjp8Mz2+F/q05AwXYCa0ctzjfJelnIsFA1di0BNu0ynA+Ps7C6wOl0kpN3NQY=
SHA256 (Pkgfile) = a4e5fb21119b3d652032c11b4c43328207940803289df087f2424181b01479a2
RWSagIOpLGJF34LRC0u7GDdAsC60JkUeW9XTiLreJ3RcO2Ti/dmLIfv/mdSCNA1DcUYXYIYhaBbs9cErtxT8pnIFBj8BnIEqcwA=
SHA256 (Pkgfile) = 6b19e363f28fd30edef928071cc4b675bac94965b82ba2f982843dc3a297f7ea
SHA256 (.footprint) = 1383720d49474c2ed5186845ca48cd3436901f5d772f5598e4af49e1a8070c4b
SHA256 (obs-studio-29.0.2.tar.gz) = 0e6260800b80c3fc9f67c4c3fb12ffae740ab1dd188e526a55e0fc8949168db2
SHA256 (disable-some-plugins.patch) = fee180ca12a1831e1e8c09f90db25776abb77daa9befebf7c3f153cc43f99b91
SHA256 (2e79d4c9.patch) = 96ea913149377b324d132aa56964a72e5263e06a8b8d2103c1708b04752f3b9d

96
obs-studio/2e79d4c9.patch Normal file
View File

@ -0,0 +1,96 @@
From 2e79d4c902abf3e6bb4ad1b5bf779c0cc22a6fd0 Mon Sep 17 00:00:00 2001
From: pkv <pkv@obsproject.com>
Date: Tue, 28 Feb 2023 17:28:38 +0100
Subject: [PATCH] obs-ffmpeg: Fix for FFmpeg 6 deprecating a flag
Also modifies libobs & deps/media-playback.
AV_CODEC_CAP_TRUNCATED was removed in avcodec 60 [1].
We ifdef the code depending on it to allow compilation.
[1] avcodec: remove FF_API_FLAG_TRUNCATED
https://github.com/FFmpeg/FFmpeg/commit/3ceffe783965767e62d59e8e68ecd265c98460ec
Signed-off-by: pkv <pkv@obsproject.com>
---
deps/media-playback/media-playback/decode.c | 2 ++
deps/media-playback/media-playback/decode.h | 2 ++
libobs/obs-ffmpeg-compat.h | 2 ++
plugins/obs-ffmpeg/obs-ffmpeg-compat.h | 2 ++
plugins/win-dshow/ffmpeg-decode.c | 2 ++
5 files changed, 10 insertions(+)
diff --git a/deps/media-playback/media-playback/decode.c b/deps/media-playback/media-playback/decode.c
index 05d6afcc649a2..e1aa9aec0577b 100644
--- a/deps/media-playback/media-playback/decode.c
+++ b/deps/media-playback/media-playback/decode.c
@@ -230,8 +230,10 @@ bool mp_decode_init(mp_media_t *m, enum AVMediaType type, bool hw)
d->in_frame = d->sw_frame;
}
+#if LIBAVCODEC_VERSION_MAJOR < 60
if (d->codec->capabilities & CODEC_CAP_TRUNC)
d->decoder->flags |= CODEC_FLAG_TRUNC;
+#endif
d->orig_pkt = av_packet_alloc();
d->pkt = av_packet_alloc();
diff --git a/deps/media-playback/media-playback/decode.h b/deps/media-playback/media-playback/decode.h
index 1ca271b419fbd..6da34061b3dee 100644
--- a/deps/media-playback/media-playback/decode.h
+++ b/deps/media-playback/media-playback/decode.h
@@ -37,8 +37,10 @@ extern "C" {
#endif
#if LIBAVCODEC_VERSION_MAJOR >= 58
+#if LIBAVCODEC_VERSION_MAJOR < 60
#define CODEC_CAP_TRUNC AV_CODEC_CAP_TRUNCATED
#define CODEC_FLAG_TRUNC AV_CODEC_FLAG_TRUNCATED
+#endif
#else
#define CODEC_CAP_TRUNC CODEC_CAP_TRUNCATED
#define CODEC_FLAG_TRUNC CODEC_FLAG_TRUNCATED
diff --git a/libobs/obs-ffmpeg-compat.h b/libobs/obs-ffmpeg-compat.h
index c4e23b9851242..ad633521e3b0b 100644
--- a/libobs/obs-ffmpeg-compat.h
+++ b/libobs/obs-ffmpeg-compat.h
@@ -23,8 +23,10 @@
#endif
#if LIBAVCODEC_VERSION_MAJOR >= 58
+#if LIBAVCODEC_VERSION_MAJOR < 60
#define CODEC_CAP_TRUNC AV_CODEC_CAP_TRUNCATED
#define CODEC_FLAG_TRUNC AV_CODEC_FLAG_TRUNCATED
+#endif
#define INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE
#else
#define CODEC_CAP_TRUNC CODEC_CAP_TRUNCATED
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-compat.h b/plugins/obs-ffmpeg/obs-ffmpeg-compat.h
index 181167aff383d..39efa00c774b3 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-compat.h
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-compat.h
@@ -27,8 +27,10 @@
#endif
#if LIBAVCODEC_VERSION_MAJOR >= 58
+#if LIBAVCODEC_VERSION_MAJOR < 60
#define CODEC_CAP_TRUNC AV_CODEC_CAP_TRUNCATED
#define CODEC_FLAG_TRUNC AV_CODEC_FLAG_TRUNCATED
+#endif
#define CODEC_FLAG_GLOBAL_H AV_CODEC_FLAG_GLOBAL_HEADER
#else
#define CODEC_CAP_TRUNC CODEC_CAP_TRUNCATED
diff --git a/plugins/win-dshow/ffmpeg-decode.c b/plugins/win-dshow/ffmpeg-decode.c
index d27c98441da15..49df62b7a79f2 100644
--- a/plugins/win-dshow/ffmpeg-decode.c
+++ b/plugins/win-dshow/ffmpeg-decode.c
@@ -105,8 +105,10 @@ int ffmpeg_decode_init(struct ffmpeg_decode *decode, enum AVCodecID id,
return ret;
}
+#if LIBAVCODEC_VERSION_MAJOR < 60
if (decode->codec->capabilities & CODEC_CAP_TRUNC)
decode->decoder->flags |= CODEC_FLAG_TRUNC;
+#endif
return 0;
}

View File

@ -6,9 +6,10 @@
name=obs-studio
version=29.0.2
release=1
release=2
source=(https://github.com/obsproject/$name/archive/$version/$name-$version.tar.gz
disable-some-plugins.patch)
disable-some-plugins.patch
2e79d4c9.patch)
build() {
prt-get isinst luajit || PKGMK_OBS+=' -D ENABLE_SCRIPTING_LUA=OFF'
@ -22,6 +23,7 @@ build() {
-v ORS=: '/ccache/ {next} {print}' | sed 's/:*$//')"
patch -Np1 -d $name-$version -i $SRC/disable-some-plugins.patch
patch -Np1 -d $name-$version -i $SRC/2e79d4c9.patch
export QT_QPA_PLATFORMTHEME="qt6ct"
cmake -S $name-$version -B build -G Ninja $PKGMK_OBS \