Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins: Move AMF encoders from obs-ffmpeg as a separate plugin #11334

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ add_obs_plugin(
PLATFORMS WINDOWS MACOS LINUX
WITH_MESSAGE
)
add_obs_plugin(obs-amf PLATFORMS WINDOWS)
add_obs_plugin(coreaudio-encoder PLATFORMS WINDOWS MACOS)
add_obs_plugin(
decklink
Expand Down
31 changes: 31 additions & 0 deletions plugins/obs-amf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.28...3.30)

option(ENABLE_AMF "Build AMD Radeon Hardware Encoder Plugin" ON)

if(NOT ENABLE_AMF)
target_disable_feature(obs-amf "AMD Radeon Hardware Encoder")
target_disable(obs-amf)
return()
endif()

if(NOT TARGET OBS::opts-parser)
add_subdirectory("${CMAKE_SOURCE_DIR}/shared/opts-parser" "${CMAKE_BINARY_DIR}/shared/opts-parser")
endif()

find_package(AMF 1.4.29 REQUIRED)

add_library(obs-amf MODULE)
add_library(OBS::amf ALIAS obs-amf)

add_subdirectory(obs-amf-test)

target_sources(obs-amf PRIVATE obs-amf.c texture-amf-opts.hpp texture-amf.cpp)

target_link_libraries(obs-amf PRIVATE OBS::libobs OBS::opts-parser AMF::AMF)

if(OS_WINDOWS)
configure_file(cmake/windows/obs-module.rc.in obs-amf.rc)
target_sources(obs-amf PRIVATE obs-amf.rc)
endif()

set_target_properties_obs(obs-amf PROPERTIES FOLDER plugins/obs-amf PREFIX "")
24 changes: 24 additions & 0 deletions plugins/obs-amf/cmake/windows/obs-module.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
1 VERSIONINFO
FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "${OBS_COMPANY_NAME}"
VALUE "FileDescription", "OBS AMF module"
VALUE "FileVersion", "${OBS_VERSION_CANONICAL}"
VALUE "ProductName", "${OBS_PRODUCT_NAME}"
VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}"
VALUE "Comments", "${OBS_COMMENTS}"
VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}"
VALUE "InternalName", "obs-amf"
VALUE "OriginalFilename", "obs-amf"
END
END

BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 0x04B0
END
END
24 changes: 24 additions & 0 deletions plugins/obs-amf/obs-amf.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <obs-module.h>

extern void amf_load(void);
extern void amf_unload(void);

OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("obs-amf", "en-US")

MODULE_EXPORT const char *obs_module_description(void)
{
return "AMD Radeon Encoder (AMF) Plugin";
}

bool obs_module_load(void)
{
amf_load();

return true;
}

void obs_module_unload(void)
{
amf_unload();
}
File renamed without changes.
3 changes: 0 additions & 3 deletions plugins/obs-ffmpeg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ target_sources(
$<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:obs-ffmpeg-vaapi.c>
$<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:vaapi-utils.c>
$<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:vaapi-utils.h>
$<$<PLATFORM_ID:Windows>:texture-amf-opts.hpp>
$<$<PLATFORM_ID:Windows>:texture-amf.cpp>
obs-ffmpeg-audio-encoders.c
obs-ffmpeg-av1.c
obs-ffmpeg-compat.h
Expand Down Expand Up @@ -65,7 +63,6 @@ target_link_libraries(
FFmpeg::swscale
FFmpeg::swresample
$<$<PLATFORM_ID:Windows>:OBS::w32-pthreads>
$<$<PLATFORM_ID:Windows>:AMF::AMF>
$<$<PLATFORM_ID:Windows>:ws2_32>
$<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:Libva::va>
$<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:Libva::drm>
Expand Down
5 changes: 1 addition & 4 deletions plugins/obs-ffmpeg/cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ if(NOT TARGET OBS::opts-parser)
add_subdirectory("${CMAKE_SOURCE_DIR}/shared/opts-parser" "${CMAKE_BINARY_DIR}/shared/opts-parser")
endif()

if(OS_WINDOWS)
find_package(AMF 1.4.29 REQUIRED)
add_subdirectory(obs-amf-test)
elseif(OS_LINUX OR OS_FREEBSD OR OS_OPENBSD)
if(OS_LINUX OR OS_FREEBSD OR OS_OPENBSD)
find_package(Libva REQUIRED)
find_package(Libpci REQUIRED)
find_package(Libdrm REQUIRED)
Expand Down
14 changes: 0 additions & 14 deletions plugins/obs-ffmpeg/obs-amf-test/cmake/legacy.cmake

This file was deleted.

13 changes: 0 additions & 13 deletions plugins/obs-ffmpeg/obs-ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,6 @@ static bool hevc_vaapi_supported(void)
#endif
#endif

#ifdef _WIN32
extern void amf_load(void);
extern void amf_unload(void);
#endif

#if ENABLE_FFMPEG_LOGGING
extern void obs_ffmpeg_load_logging(void);
extern void obs_ffmpeg_unload_logging(void);
Expand Down Expand Up @@ -379,10 +374,6 @@ bool obs_module_load(void)
}
#endif

#ifdef _WIN32
amf_load();
#endif

#ifdef LIBAVUTIL_VAAPI_AVAILABLE
const char *libva_env = getenv("LIBVA_DRIVER_NAME");
if (!!libva_env)
Expand Down Expand Up @@ -428,8 +419,4 @@ void obs_module_unload(void)
#if ENABLE_FFMPEG_LOGGING
obs_ffmpeg_unload_logging();
#endif

#ifdef _WIN32
amf_unload();
#endif
}
Loading