New upstream version 26.0.0+dfsg1
This commit is contained in:
parent
8e020cdacb
commit
240080891f
837 changed files with 41275 additions and 9196 deletions
|
|
@ -1,10 +1,16 @@
|
|||
|
||||
add_subdirectory(test-input)
|
||||
if(BUILD_TESTS)
|
||||
add_subdirectory(test-input)
|
||||
|
||||
if(WIN32)
|
||||
add_subdirectory(win)
|
||||
if(WIN32)
|
||||
add_subdirectory(win)
|
||||
endif()
|
||||
|
||||
if(APPLE AND UNIX)
|
||||
add_subdirectory(osx)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE AND UNIX)
|
||||
add_subdirectory(osx)
|
||||
if (ENABLE_UNIT_TESTS)
|
||||
add_subdirectory(cmocka)
|
||||
endif()
|
||||
|
|
|
|||
39
test/cmocka/CMakeLists.txt
Normal file
39
test/cmocka/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
project(obs-cmocka)
|
||||
|
||||
# Fix libobs path
|
||||
macro(fixLink target_arg)
|
||||
if(APPLE AND UNIX)
|
||||
add_custom_command (TARGET ${target_arg}
|
||||
POST_BUILD COMMAND "${CMAKE_INSTALL_NAME_TOOL}"
|
||||
"-change" "@rpath/libobs.0.dylib" "@executable_path/../../libobs/libobs.0.dylib"
|
||||
"$<TARGET_FILE:${target_arg}>" VERBATIM)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
set(CMAKE_MACOSX_RPATH TRUE)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/" "@executable_path/")
|
||||
|
||||
find_package(CMocka CONFIG REQUIRED)
|
||||
include_directories(${CMOCKA_INCLUDE_DIR})
|
||||
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs")
|
||||
|
||||
# fix rpath on linux
|
||||
if (UNIX AND NOT APPLE)
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN";../../libobs)
|
||||
endif()
|
||||
|
||||
# Serializer test
|
||||
add_executable(test_serializer test_serializer.c)
|
||||
target_link_libraries(test_serializer ${CMOCKA_LIBRARIES} libobs)
|
||||
|
||||
add_test(test_serializer ${CMAKE_CURRENT_BINARY_DIR}/test_serializer)
|
||||
fixLink(test_serializer)
|
||||
|
||||
|
||||
# darray test
|
||||
add_executable(test_darray test_darray.c)
|
||||
target_link_libraries(test_darray ${CMOCKA_LIBRARIES} libobs)
|
||||
|
||||
add_test(test_darray ${CMAKE_CURRENT_BINARY_DIR}/test_darray)
|
||||
fixLink(test_darray)
|
||||
29
test/cmocka/test_darray.c
Normal file
29
test/cmocka/test_darray.c
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <cmocka.h>
|
||||
|
||||
#include <util/darray.h>
|
||||
|
||||
static void array_basic_test(void **state)
|
||||
{
|
||||
DARRAY(uint8_t) testarray;
|
||||
da_init(testarray);
|
||||
|
||||
uint8_t t = 1;
|
||||
da_push_back_array(testarray, &t, sizeof(uint8_t));
|
||||
|
||||
assert_int_equal(testarray.num, 1);
|
||||
assert_memory_equal(testarray.array, &t, 1);
|
||||
|
||||
da_free(testarray);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(array_basic_test),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
31
test/cmocka/test_serializer.c
Normal file
31
test/cmocka/test_serializer.c
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <cmocka.h>
|
||||
|
||||
#include <util/array-serializer.h>
|
||||
|
||||
static void serialize_test(void **state)
|
||||
{
|
||||
struct array_output_data output;
|
||||
struct serializer s;
|
||||
|
||||
array_output_serializer_init(&s, &output);
|
||||
|
||||
s_w8(&s, 0x01);
|
||||
s_w8(&s, 0xff);
|
||||
s_w8(&s, 0xe1);
|
||||
|
||||
assert_int_equal(output.bytes.num, 3);
|
||||
uint8_t expected[3] = {0x01, 0xff, 0xe1};
|
||||
assert_memory_equal(output.bytes.array, expected, 3);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(serialize_test),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ set(osx-test_SOURCES
|
|||
|
||||
add_executable(osx_test
|
||||
${osx-test_SOURCES})
|
||||
set_target_properties(osx_test PROPERTIES FOLDER "tests and examples")
|
||||
target_link_libraries(osx_test
|
||||
libobs
|
||||
${COCOA})
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ using DisplayContext =
|
|||
|
||||
static void CreateOBS()
|
||||
{
|
||||
if (!obs_startup("en", nullptr))
|
||||
if (!obs_startup("en", nullptr, nullptr))
|
||||
throw "Couldn't create OBS";
|
||||
|
||||
struct obs_video_info ovi;
|
||||
|
|
@ -67,7 +67,7 @@ static DisplayContext CreateDisplay(NSView *view)
|
|||
info.zsformat = GS_ZS_NONE;
|
||||
info.window.view = view;
|
||||
|
||||
return DisplayContext{obs_display_create(&info)};
|
||||
return DisplayContext{obs_display_create(&info, 0)};
|
||||
}
|
||||
|
||||
static SceneContext SetupScene()
|
||||
|
|
|
|||
|
|
@ -24,5 +24,6 @@ add_library(test-input MODULE
|
|||
target_link_libraries(test-input
|
||||
${test-input_PLATFORM_DEPS}
|
||||
libobs)
|
||||
set_target_properties(test-input PROPERTIES FOLDER "tests and examples")
|
||||
|
||||
install_obs_plugin_with_data(test-input data)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <util/bmem.h>
|
||||
#include <util/threading.h>
|
||||
#include <util/platform.h>
|
||||
#include <util/util_uint64.h>
|
||||
#include <obs.h>
|
||||
|
||||
struct sync_pair_aud {
|
||||
|
|
@ -54,7 +55,8 @@ static void *sync_pair_aud_thread(void *pdata)
|
|||
|
||||
for (uint64_t i = 0; i < frames; i++) {
|
||||
uint64_t ts =
|
||||
last_time + i * 1000000000ULL / sample_rate;
|
||||
last_time +
|
||||
util_mul_div64(i, 1000000000ULL, sample_rate);
|
||||
|
||||
if (whitelist_time(ts, interval, fps_num, fps_den)) {
|
||||
cos_val += rate * M_PI_X2;
|
||||
|
|
|
|||
|
|
@ -9,4 +9,5 @@ add_executable(win-test WIN32
|
|||
${win-text_SOURCES})
|
||||
target_link_libraries(win-test
|
||||
libobs)
|
||||
set_target_properties(win-test PROPERTIES FOLDER "tests and examples")
|
||||
define_graphic_modules(win-test)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue