2014-01-20 16:58:58 +01:00
|
|
|
project(obs-ffmpeg)
|
|
|
|
|
2019-07-09 08:44:04 -07:00
|
|
|
option(ENABLE_FFMPEG_LOGGING "Enables obs-ffmpeg logging" OFF)
|
2022-03-13 11:06:11 +01:00
|
|
|
option(ENABLE_NEW_MPEGTS_OUTPUT "Use native SRT/RIST mpegts output" ON)
|
2019-07-09 08:44:04 -07:00
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
find_package(
|
|
|
|
FFmpeg REQUIRED
|
|
|
|
COMPONENTS avcodec
|
|
|
|
avfilter
|
|
|
|
avdevice
|
|
|
|
avutil
|
|
|
|
swscale
|
|
|
|
avformat
|
|
|
|
swresample)
|
2021-09-27 20:37:52 +02:00
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
add_library(obs-ffmpeg MODULE)
|
|
|
|
add_library(OBS::ffmpeg ALIAS obs-ffmpeg)
|
2022-02-27 15:30:40 +01:00
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
add_subdirectory(ffmpeg-mux)
|
2022-03-13 11:06:11 +01:00
|
|
|
if(ENABLE_NEW_MPEGTS_OUTPUT)
|
2022-08-04 21:30:45 +02:00
|
|
|
find_package(Librist QUIET)
|
|
|
|
find_package(Libsrt QUIET)
|
|
|
|
|
|
|
|
if(NOT TARGET Librist::Librist AND NOT TARGET Libsrt::Libsrt)
|
|
|
|
obs_status(
|
|
|
|
FATAL_ERROR
|
|
|
|
"SRT and RIST libraries not found! Please install SRT and RIST libraries or set ENABLE_NEW_MPEGTS_OUTPUT=OFF."
|
|
|
|
)
|
|
|
|
elseif(NOT TARGET Libsrt::Libsrt)
|
|
|
|
obs_status(
|
|
|
|
FATAL_ERROR
|
|
|
|
"SRT library not found! Please install SRT library or set ENABLE_NEW_MPEGTS_OUTPUT=OFF."
|
|
|
|
)
|
|
|
|
elseif(NOT TARGET Librist::Librist)
|
|
|
|
obs_status(
|
|
|
|
FATAL_ERROR
|
|
|
|
"RIST library not found! Please install RIST library or set ENABLE_NEW_MPEGTS_OUTPUT=OFF."
|
|
|
|
)
|
|
|
|
endif()
|
2022-03-13 11:06:11 +01:00
|
|
|
endif()
|
2019-07-09 08:44:04 -07:00
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obs-ffmpeg-config.h.in
|
|
|
|
${CMAKE_BINARY_DIR}/config/obs-ffmpeg-config.h)
|
2019-07-09 08:44:04 -07:00
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
target_sources(
|
|
|
|
obs-ffmpeg
|
|
|
|
PRIVATE obs-ffmpeg.c
|
2022-04-22 12:51:38 -07:00
|
|
|
obs-ffmpeg-video-encoders.c
|
2022-03-16 23:10:42 +01:00
|
|
|
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
|
2022-03-13 11:06:11 +01:00
|
|
|
${CMAKE_BINARY_DIR}/config/obs-ffmpeg-config.h)
|
2018-04-08 15:05:22 -04:00
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
target_include_directories(obs-ffmpeg PRIVATE ${CMAKE_BINARY_DIR}/config)
|
2015-03-04 12:45:50 -06:00
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
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
|
2022-03-13 11:06:11 +01:00
|
|
|
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()
|
2018-04-08 15:05:22 -04:00
|
|
|
|
2019-07-09 08:44:04 -07:00
|
|
|
if(ENABLE_FFMPEG_LOGGING)
|
2022-03-16 23:10:42 +01:00
|
|
|
target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-logging.c)
|
2019-07-09 08:44:04 -07:00
|
|
|
endif()
|
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
set_target_properties(obs-ffmpeg PROPERTIES FOLDER "plugins/obs-ffmpeg" PREFIX
|
|
|
|
"")
|
2022-06-20 09:43:50 +02:00
|
|
|
target_compile_options(
|
|
|
|
obs-ffmpeg
|
|
|
|
PRIVATE
|
|
|
|
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:GNU>>:-Wno-switch>
|
|
|
|
)
|
2019-02-05 18:20:16 -08:00
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
if(OS_WINDOWS)
|
2022-04-22 17:39:59 -07:00
|
|
|
add_subdirectory(obs-amf-test)
|
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
if(MSVC)
|
|
|
|
target_link_libraries(obs-ffmpeg PRIVATE OBS::w32-pthreads)
|
|
|
|
endif()
|
2014-01-20 16:58:58 +01:00
|
|
|
|
2022-03-16 23:10:42 +01:00
|
|
|
set(MODULE_DESCRIPTION "OBS FFmpeg module")
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in
|
|
|
|
obs-ffmpeg.rc)
|
2015-05-28 23:10:45 -07:00
|
|
|
|
2022-04-22 17:39:59 -07:00
|
|
|
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)
|
2022-03-16 23:10:42 +01:00
|
|
|
|
|
|
|
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)
|