Repository navigation
libobs: Move core host code behind obs-host/ capability interfaces (#1051) - #1069
Merged
Merged
Conversation
obs.c, obs-video.c, obs-module.c, obs-display.c, obs-hotkey.c, obs-source.c, obs-video-gpu-encode.c and obs-internal.h still select on _WIN32/__APPLE__ (8 failures); libobs/obs-host.h doesn't exist (1 error). Refs #1051
…1051) Each host capability the libobs core uses gets one interface, libobs/obs-host/<capability>.h, declared with OBS_HOST_EXTERN (plain extern, C linkage, no EXPORT: libobs-internal, kept out of obs.dll's export table). A host that has the capability defines it in its own file (obs-windows.c: com, graphics-thread-hooks, shared-texture, module-symbols, display-clear-workaround; obs-cocoa.m: graphics-thread, module-paths, display-srgb-clear, default-monitoring-device). A host that lacks it builds obs-host/noop/<capability>.c, listed in libobs/cmake/os-<os>.cmake, so no #ifdef picks between them. obs.c, obs-video.c, obs-module.c, obs-display.c, obs-source.c, obs-video-gpu-encode.c and obs-internal.h now hold no host conditionals (baseline 478 -> 448). copy_surfaces_encode is now a field on every host (NULL unless Windows creates it); obs-internal.h is not installed. initialize_com, uninitialize_com and reset_win32_symbol_paths become static in obs-windows.c, and the macOS autorelease wrappers static in obs-cocoa.m. obs-hotkey.c keeps its Apple keypad conditional: two cmocka tests compile that file directly, and C tests are not edited, so it is dropped from the RED list. A new test checks every capability has a no-op and every host builds either the no-op or a full definition, never both. Fixes #866. Refs #1051
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #866. Refs #1051 (phase 4: drain host conditionals out of libobs core).
What
libobs/obs-host/<capability>.h, declared withOBS_HOST_EXTERN: plainexternwith C linkage and noEXPORT, so it stays out of obs.dll's export table.obs-windows.c: com, graphics-thread-hooks (WinRT and the message pump), shared-texture, module-symbols, display-clear-workaround.obs-cocoa.m: graphics-thread (QoS and autorelease), module-paths, display-srgb-clear, default-monitoring-device.obs-host/noop/<capability>.c, listed inlibobs/cmake/os-<os>.cmake, so no#ifdefpicks between them.obs.c,obs-video.c,obs-module.c,obs-display.c,obs-source.c,obs-video-gpu-encode.candobs-internal.hnow hold no host conditionals. The ratchet baseline goes from 478 to 448.obs-hotkey.ckeeps its one Apple conditional: two cmocka tests compile that file directly, and C tests aren't edited.RED
677f5095faddsFacadeTest. It fails with 8 failures and 1 error: the core files still select on_WIN32/__APPLE__, and the facade doesn't exist yet.GREEN
7ff93c40f. A new test checks every capability has a no-op, and that everyos-<os>.cmakeeither builds the no-op or its host file defines the whole capability, never both.Verified locally
rust/tools/linux-validate/run.sh): withENABLE_RUST_LIBOBSOFF and ON, 256/256 cmocka tests pass, and the exported symbols are identical.origin/master's, so none are new.