obs-x264: Refactor tokenizing of options

We do a bad job of handling errors in user-supplied x264 options. I want
to improve our error handling. To make my job easier, move the code for
parsing the x264 options string into its own function. Also, add some
tests for the functionality.

Aside from a minor tweak to a log message for the opencl option, this
commit should not change behavior.
This commit is contained in:
Matthew Glazar
2020-05-16 20:35:35 -07:00
parent 07ae6b4ca9
commit 40b4e32c41
5 changed files with 217 additions and 64 deletions

View File

@@ -4,6 +4,18 @@ find_package(Libx264 REQUIRED)
include_directories(${LIBX264_INCLUDE_DIRS})
add_definitions(${LIBX264_DEFINITIONS})
set(obs-x264-util_HEADERS
obs-x264-options.h)
set(obs-x264-util_SOURCES
obs-x264-options.c)
add_library(obs-x264-util STATIC
${obs-x264-util_HEADERS}
${obs-x264-util_SOURCES})
target_link_libraries(obs-x264-util PRIVATE libobs)
set_target_properties(obs-x264-util PROPERTIES FOLDER "plugins")
set(obs-x264_SOURCES
obs-x264.c
obs-x264-plugin-main.c)
@@ -16,10 +28,17 @@ if(WIN32)
endif()
add_library(obs-x264 MODULE
${obs-x264_HEADERS}
${obs-x264_SOURCES})
target_link_libraries(obs-x264
libobs
obs-x264-util
${LIBX264_LIBRARIES})
set_target_properties(obs-x264 PROPERTIES FOLDER "plugins")
install_obs_plugin_with_data(obs-x264 data)
add_executable(obs-x264-test obs-x264-test.c)
set_target_properties(obs-x264-test PROPERTIES FOLDER "plugins")
target_link_libraries(obs-x264-test PRIVATE libobs obs-x264-util)
add_test(NAME obs-x264-test COMMAND obs-x264-test)