2014-01-20 07:58:58 -08:00
|
|
|
project(obs-ffmpeg)
|
|
|
|
|
2015-02-04 23:09:48 -08:00
|
|
|
if(MSVC)
|
2014-05-05 10:07:42 -07:00
|
|
|
set(obs-ffmpeg_PLATFORM_DEPS
|
|
|
|
w32-pthreads)
|
|
|
|
endif()
|
|
|
|
|
2019-07-09 08:44:04 -07:00
|
|
|
option(ENABLE_FFMPEG_LOGGING "Enables obs-ffmpeg logging" OFF)
|
|
|
|
|
2015-07-18 16:15:01 -07:00
|
|
|
find_package(FFmpeg REQUIRED
|
2015-03-04 10:45:50 -08:00
|
|
|
COMPONENTS avcodec avfilter avdevice avutil swscale avformat swresample)
|
2014-09-23 06:26:08 -07:00
|
|
|
include_directories(${FFMPEG_INCLUDE_DIRS})
|
2014-01-20 07:58:58 -08:00
|
|
|
|
2019-07-09 08:44:04 -07:00
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/obs-ffmpeg-config.h.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/obs-ffmpeg-config.h")
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
set(obs-ffmpeg_config_HEADERS
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/obs-ffmpeg-config.h")
|
|
|
|
|
2014-04-05 01:13:11 -07:00
|
|
|
set(obs-ffmpeg_HEADERS
|
2014-06-28 11:45:23 -07:00
|
|
|
obs-ffmpeg-formats.h
|
2019-04-19 11:57:54 -07:00
|
|
|
obs-ffmpeg-compat.h
|
|
|
|
ffmpeg-encoded-output.h)
|
2018-04-08 12:05:22 -07:00
|
|
|
|
2014-01-20 07:58:58 -08:00
|
|
|
set(obs-ffmpeg_SOURCES
|
|
|
|
obs-ffmpeg.c
|
2017-07-31 14:29:50 -07:00
|
|
|
obs-ffmpeg-audio-encoders.c
|
2016-04-18 10:19:49 -07:00
|
|
|
obs-ffmpeg-nvenc.c
|
2015-03-04 10:45:50 -08:00
|
|
|
obs-ffmpeg-output.c
|
2015-05-28 23:11:37 -07:00
|
|
|
obs-ffmpeg-mux.c
|
2019-04-19 11:57:54 -07:00
|
|
|
ffmpeg-encoded-output.c
|
2015-03-04 10:45:50 -08:00
|
|
|
obs-ffmpeg-source.c)
|
|
|
|
|
2018-04-08 12:05:22 -07:00
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
list(APPEND obs-ffmpeg_SOURCES
|
|
|
|
obs-ffmpeg-vaapi.c)
|
|
|
|
LIST(APPEND obs-ffmpeg_PLATFORM_DEPS
|
|
|
|
${LIBVA_LBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2019-07-09 08:44:04 -07:00
|
|
|
if(ENABLE_FFMPEG_LOGGING)
|
|
|
|
list(APPEND obs-ffmpeg_SOURCES
|
|
|
|
obs-ffmpeg-logging.c)
|
|
|
|
endif()
|
|
|
|
|
2019-02-05 18:20:16 -08:00
|
|
|
if(WIN32)
|
2019-06-16 04:42:58 -07:00
|
|
|
set(MODULE_DESCRIPTION "OBS FFmpeg module")
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obs-ffmpeg.rc)
|
2019-02-05 18:20:16 -08:00
|
|
|
list(APPEND obs-ffmpeg_SOURCES
|
|
|
|
jim-nvenc.c
|
2019-06-16 04:42:58 -07:00
|
|
|
jim-nvenc-helpers.c
|
|
|
|
obs-ffmpeg.rc)
|
2019-02-05 18:20:16 -08:00
|
|
|
list(APPEND obs-ffmpeg_HEADERS
|
|
|
|
jim-nvenc.h)
|
|
|
|
endif()
|
|
|
|
|
2014-01-20 07:58:58 -08:00
|
|
|
add_library(obs-ffmpeg MODULE
|
2019-07-09 08:44:04 -07:00
|
|
|
${obs-ffmpeg_config_HEADERS}
|
2014-04-05 01:13:11 -07:00
|
|
|
${obs-ffmpeg_HEADERS}
|
Revamp API and start using doxygen
The API used to be designed in such a way to where it would expect
exports for each individual source/output/encoder/etc. You would export
functions for each and it would automatically load those functions based
on a specific naming scheme from the module.
The idea behind this was that I wanted to limit the usage of structures
in the API so only functions could be used. It was an interesting idea
in theory, but this idea turned out to be flawed in a number of ways:
1.) Requiring exports to create sources/outputs/encoders/etc meant that
you could not create them by any other means, which meant that
things like faruton's .net plugin would become difficult.
2.) Export function declarations could not be checked, therefore if you
created a function with the wrong parameters and parameter types,
the compiler wouldn't know how to check for that.
3.) Required overly complex load functions in libobs just to handle it.
It makes much more sense to just have a load function that you call
manually. Complexity is the bane of all good programs.
4.) It required that you have functions of specific names, which looked
and felt somewhat unsightly.
So, to fix these issues, I replaced it with a more commonly used API
scheme, seen commonly in places like kernels and typical C libraries
with abstraction. You simply create a structure that contains the
callback definitions, and you pass it to a function to register that
definition (such as obs_register_source), which you call in the
obs_module_load of the module.
It will also automatically check the structure size and ensure that it
only loads the required values if the structure happened to add new
values in an API change.
The "main" source file for each module must include obs-module.h, and
must use OBS_DECLARE_MODULE() within that source file.
Also, started writing some doxygen documentation in to the main library
headers. Will add more detailed documentation as I go.
2014-02-12 07:04:50 -08:00
|
|
|
${obs-ffmpeg_SOURCES})
|
2014-01-20 07:58:58 -08:00
|
|
|
target_link_libraries(obs-ffmpeg
|
|
|
|
libobs
|
2017-03-26 06:21:59 -07:00
|
|
|
media-playback
|
2014-05-05 10:07:42 -07:00
|
|
|
${obs-ffmpeg_PLATFORM_DEPS}
|
2014-09-23 06:26:08 -07:00
|
|
|
${FFMPEG_LIBRARIES})
|
2014-01-20 07:58:58 -08:00
|
|
|
|
2014-08-19 05:24:59 -07:00
|
|
|
install_obs_plugin_with_data(obs-ffmpeg data)
|
2015-05-28 23:10:45 -07:00
|
|
|
|
|
|
|
add_subdirectory(ffmpeg-mux)
|