update patch?

This commit is contained in:
Ward Nakchbandi 2023-03-08 17:36:14 +03:00
parent bd48198c11
commit 0c0f9226b7
2 changed files with 44 additions and 42 deletions

View File

@ -1,10 +1,10 @@
#! /bin/bash
set -e
# Add dependent repositories
#wget -q -O - https://ppa.pika-os.com/key.gpg | sudo apt-key add -
#add-apt-repository https://ppa.pika-os.com
#add-apt-repository ppa:pikaos/pika
#add-apt-repository ppa:kubuntu-ppa/backports
wget -q -O - https://ppa.pika-os.com/key.gpg | sudo apt-key add -
add-apt-repository https://ppa.pika-os.com
add-apt-repository ppa:pikaos/pika
add-apt-repository ppa:kubuntu-ppa/backports
# Clone Upstream
wget https://launchpad.net/~obsproject/+archive/ubuntu/obs-studio/+sourcefiles/obs-studio/29.0.2-0obsproject1~kinetic/obs-studio_29.0.2.orig.tar.gz
tar -xf ./obs-studio_29.0.2.orig.tar.gz -C ./

View File

@ -1,29 +1,25 @@
From 7ac1d462af1be795569e0d5c8f79871901e5d6e0 Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Sun, 28 Aug 2022 10:15:16 +0200
Subject: [PATCH] obs-ffmpeg: Make AMF encoder work on Linux
From ef97ae930812bcd418cc57403669d50d36f3e5b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Miguel=20Sarasola?= <alosarjos@gmail.com>
Date: Fri, 3 Feb 2023 23:08:46 +0100
Subject: [PATCH] Test
Only the fallback encoders are available (no texture support).
Requires AMD proprietary Vulkan driver, using different driver
will be detected on startup and the encoders disabled.
---
plugins/obs-ffmpeg/CMakeLists.txt | 3 +
.../obs-ffmpeg/obs-amf-test/CMakeLists.txt | 11 +-
.../obs-amf-test/obs-amf-test-linux.cpp | 140 ++++++++++++++++++
plugins/obs-ffmpeg/obs-ffmpeg.c | 10 +-
plugins/obs-ffmpeg/texture-amf-opts.hpp | 2 +-
plugins/obs-ffmpeg/texture-amf.cpp | 81 +++++++++-
6 files changed, 236 insertions(+), 11 deletions(-)
plugins/obs-ffmpeg/texture-amf.cpp | 93 +++++++++---
6 files changed, 236 insertions(+), 23 deletions(-)
create mode 100644 plugins/obs-ffmpeg/obs-amf-test/obs-amf-test-linux.cpp
diff --git a/plugins/obs-ffmpeg/CMakeLists.txt b/plugins/obs-ffmpeg/CMakeLists.txt
index 681a057..35cb1ea 100644
index 244c6df92..ef1cd98d4 100644
--- a/plugins/obs-ffmpeg/CMakeLists.txt
+++ b/plugins/obs-ffmpeg/CMakeLists.txt
@@ -119,11 +119,14 @@
@@ -119,11 +119,14 @@ if(OS_WINDOWS)
obs-ffmpeg.rc)
elseif(OS_POSIX AND NOT OS_MACOS)
+ add_subdirectory(obs-amf-test)
find_package(Libva REQUIRED)
@ -31,13 +27,13 @@ index 681a057..35cb1ea 100644
target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-vaapi.c vaapi-utils.c
vaapi-utils.h)
target_link_libraries(obs-ffmpeg PRIVATE Libva::va Libva::drm LIBPCI::LIBPCI)
+ target_sources(obs-ffmpeg PRIVATE texture-amf.cpp)
+ target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-vaapi.c texture-amf.cpp)
+ target_link_libraries(obs-ffmpeg PRIVATE LIBPCI::LIBPCI)
endif()
setup_plugin_target(obs-ffmpeg)
diff --git a/plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt b/plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt
index 85347e7..034b4cc 100644
index 85347e73d..034b4cc3b 100644
--- a/plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt
+++ b/plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt
@@ -3,8 +3,15 @@ project(obs-amf-test)
@ -60,7 +56,7 @@ index 85347e7..034b4cc 100644
diff --git a/plugins/obs-ffmpeg/obs-amf-test/obs-amf-test-linux.cpp b/plugins/obs-ffmpeg/obs-amf-test/obs-amf-test-linux.cpp
new file mode 100644
index 0000000..018486e
index 000000000..018486e0c
--- /dev/null
+++ b/plugins/obs-ffmpeg/obs-amf-test/obs-amf-test-linux.cpp
@@ -0,0 +1,140 @@
@ -205,10 +201,10 @@ index 0000000..018486e
+ return 0;
+}
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg.c b/plugins/obs-ffmpeg/obs-ffmpeg.c
index 1677e08..4bb870a 100644
index f1884c789..bce316d4f 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg.c
@@ -322,6 +322,9 @@ static bool nvenc_supported(bool *out_h264, bool *out_hevc, bool *out_av1)
@@ -339,6 +339,9 @@ static bool h264_vaapi_supported(void)
#ifdef _WIN32
extern void jim_nvenc_load(bool h264, bool hevc, bool av1);
extern void jim_nvenc_unload(void);
@ -218,7 +214,7 @@ index 1677e08..4bb870a 100644
extern void amf_load(void);
extern void amf_unload(void);
#endif
@@ -391,7 +394,7 @@ bool obs_module_load(void)
@@ -408,7 +411,7 @@ bool obs_module_load(void)
#endif
}
@ -227,7 +223,7 @@ index 1677e08..4bb870a 100644
amf_load();
#endif
@@ -409,8 +412,11 @@ void obs_module_unload(void)
@@ -440,8 +443,11 @@ void obs_module_unload(void)
obs_ffmpeg_unload_logging();
#endif
@ -241,7 +237,7 @@ index 1677e08..4bb870a 100644
#endif
}
diff --git a/plugins/obs-ffmpeg/texture-amf-opts.hpp b/plugins/obs-ffmpeg/texture-amf-opts.hpp
index b1c37d2..d28e3f7 100644
index b1c37d200..d28e3f77e 100644
--- a/plugins/obs-ffmpeg/texture-amf-opts.hpp
+++ b/plugins/obs-ffmpeg/texture-amf-opts.hpp
@@ -321,7 +321,7 @@ static void amf_apply_opt(amf_base *enc, obs_option *opt)
@ -254,7 +250,7 @@ index b1c37d2..d28e3f7 100644
bool bool_val = (bool)val;
set_amf_property(enc, wname, bool_val);
diff --git a/plugins/obs-ffmpeg/texture-amf.cpp b/plugins/obs-ffmpeg/texture-amf.cpp
index 92e57e0..8c648ce 100644
index 7916cf85d..201be298c 100644
--- a/plugins/obs-ffmpeg/texture-amf.cpp
+++ b/plugins/obs-ffmpeg/texture-amf.cpp
@@ -20,6 +20,7 @@
@ -443,16 +439,23 @@ index 92e57e0..8c648ce 100644
static void *amf_av1_create_fallback(obs_data_t *settings,
obs_encoder_t *encoder)
@@ -2159,9 +2215,16 @@ static bool enum_luids(void *param, uint32_t idx, uint64_t luid)
return true;
}
@@ -2151,17 +2207,16 @@ static void register_av1()
/* ========================================================================= */
/* Global Stuff */
-static bool enum_luids(void *param, uint32_t idx, uint64_t luid)
-{
- std::stringstream &cmd = *(std::stringstream *)param;
- cmd << " " << std::hex << luid;
- UNUSED_PARAMETER(idx);
- return true;
-}
+#ifdef _WIN32
+#define OBS_AMF_TEST "obs-amf-test.exe"
+#else
+#define OBS_AMF_TEST "obs-amf-test"
+#endif
+
extern "C" void amf_load(void)
try {
AMF_RESULT res;
@ -460,7 +463,7 @@ index 92e57e0..8c648ce 100644
HMODULE amf_module_test;
/* Check if the DLL is present before running the more expensive */
@@ -2171,17 +2234,25 @@ try {
@@ -2171,18 +2226,20 @@ try {
if (!amf_module_test)
throw "No AMF library";
FreeLibrary(amf_module_test);
@ -475,20 +478,19 @@ index 92e57e0..8c648ce 100644
/* Check for supported codecs */
- BPtr<char> test_exe = os_get_executable_path_ptr("obs-amf-test.exe");
- std::stringstream cmd;
+ BPtr<char> test_exe = os_get_executable_path_ptr(OBS_AMF_TEST);
std::stringstream cmd;
std::string caps_str;
cmd << test_exe;
- cmd << test_exe;
- enum_graphics_device_luids(enum_luids, &cmd);
+#ifdef _WIN32
+ enum_graphics_device_luids(enum_luids, &cmd);
+#endif
os_process_pipe_t *pp = os_process_pipe_create(cmd.str().c_str(), "r");
-
- os_process_pipe_t *pp = os_process_pipe_create(cmd.str().c_str(), "r");
+ os_process_pipe_t *pp = os_process_pipe_create(test_exe, "r");
if (!pp)
throw "Failed to launch the AMF test process I guess";
@@ -2240,12 +2311,12 @@ try {
@@ -2240,12 +2297,12 @@ try {
/* ----------------------------------- */
/* Init AMF */
@ -503,7 +505,7 @@ index 92e57e0..8c648ce 100644
if (!init)
throw "Failed to get AMFInit address";
@@ -2257,7 +2328,7 @@ try {
@@ -2257,7 +2314,7 @@ try {
if (res != AMF_OK)
throw amf_error("GetTrace failed", res);
@ -513,5 +515,5 @@ index 92e57e0..8c648ce 100644
if (!get_ver)
throw "Failed to get AMFQueryVersion address";
--
2.39.0
2.39.1