obs-studio/plugins/obs-ffmpeg/CMakeLists.txt
pkv 039d7347a3
obs-ffmpeg: Allow use of old mpegts output
By default, new mpegts output is used; but to allow CI on linux not
to be broken, we allow use of old mpegts output.
Up to ubuntu 22.04 there is no librist package available.
A manual compile is then required but the CI scripts would need to be
updated.
This also allows easy fallback in case of fatal bugs in new output.

Signed-off-by: pkv <pkv@obsproject.com>
2022-07-30 17:03:20 +02:00

104 lines
2.9 KiB
CMake

project(obs-ffmpeg)
option(ENABLE_FFMPEG_LOGGING "Enables obs-ffmpeg logging" OFF)
option(ENABLE_NEW_MPEGTS_OUTPUT "Use native SRT/RIST mpegts output" ON)
find_package(
FFmpeg REQUIRED
COMPONENTS avcodec
avfilter
avdevice
avutil
swscale
avformat
swresample)
add_library(obs-ffmpeg MODULE)
add_library(OBS::ffmpeg ALIAS obs-ffmpeg)
add_subdirectory(ffmpeg-mux)
if(ENABLE_NEW_MPEGTS_OUTPUT)
find_package(Librist)
find_package(Libsrt)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obs-ffmpeg-config.h.in
${CMAKE_BINARY_DIR}/config/obs-ffmpeg-config.h)
target_sources(
obs-ffmpeg
PRIVATE obs-ffmpeg.c
obs-ffmpeg-video-encoders.c
obs-ffmpeg-audio-encoders.c
obs-ffmpeg-av1.c
obs-ffmpeg-nvenc.c
obs-ffmpeg-output.c
obs-ffmpeg-mux.c
obs-ffmpeg-mux.h
obs-ffmpeg-hls-mux.c
obs-ffmpeg-source.c
obs-ffmpeg-compat.h
obs-ffmpeg-formats.h
${CMAKE_BINARY_DIR}/config/obs-ffmpeg-config.h)
target_include_directories(obs-ffmpeg PRIVATE ${CMAKE_BINARY_DIR}/config)
target_link_libraries(
obs-ffmpeg
PRIVATE OBS::libobs
OBS::media-playback
OBS::opts-parser
FFmpeg::avcodec
FFmpeg::avfilter
FFmpeg::avformat
FFmpeg::avdevice
FFmpeg::avutil
FFmpeg::swscale
FFmpeg::swresample)
if(ENABLE_NEW_MPEGTS_OUTPUT)
target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-mpegts.c obs-ffmpeg-srt.h
obs-ffmpeg-rist.h obs-ffmpeg-url.h)
target_link_libraries(obs-ffmpeg PRIVATE Librist::Librist Libsrt::Libsrt)
if(OS_WINDOWS)
target_link_libraries(obs-ffmpeg PRIVATE ws2_32.lib)
endif()
target_compile_definitions(obs-ffmpeg PRIVATE NEW_MPEGTS_OUTPUT)
endif()
if(ENABLE_FFMPEG_LOGGING)
target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-logging.c)
endif()
set_target_properties(obs-ffmpeg PROPERTIES FOLDER "plugins/obs-ffmpeg" PREFIX
"")
target_compile_options(
obs-ffmpeg
PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:GNU>>:-Wno-switch>
)
if(OS_WINDOWS)
add_subdirectory(obs-amf-test)
if(MSVC)
target_link_libraries(obs-ffmpeg PRIVATE OBS::w32-pthreads)
endif()
set(MODULE_DESCRIPTION "OBS FFmpeg module")
configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in
obs-ffmpeg.rc)
target_sources(
obs-ffmpeg PRIVATE texture-amf.cpp texture-amf-opts.hpp jim-nvenc.c
jim-nvenc.h jim-nvenc-helpers.c obs-ffmpeg.rc)
elseif(OS_POSIX AND NOT OS_MACOS)
find_package(Libpci REQUIRED)
target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-vaapi.c)
target_link_libraries(obs-ffmpeg PRIVATE LIBPCI::LIBPCI)
endif()
setup_plugin_target(obs-ffmpeg)