Skip to content

facade: libobs top-level files (obs-module, obs-display, obs-hotkey, obs-source, obs-internal, gpu-encode, audio-controls, media-remux): move 14 platform conditionals #870

Closed

Description

@zackees

Part of #847.

Remaining platform conditionals in non-public libobs/*.c and obs-internal.h. obs-module.c, obs-display.c, obs-source.c and obs-hotkey.c are not ported to Rust yet (only obs-hotkey-name-map.c is).

Class totals: (a) movable 14, (b) stays - public header 0, (c) Rust-ported 0. Total: 14. Line numbers on origin/master.

file:line macro branch class proposed function / target
libobs/obs-module.c:97 _WIN32 extern reset_win32_symbol_paths decl a declare in obs-internal.h; define in obs-windows.c; no cond at use
libobs/obs-module.c:150 __APPLE__ skip obsolete obs-browser build in Application Support a obs_platform_skip_module(path) in obs-cocoa.m
libobs/obs-module.c:628 _WIN32 profile name string for reset_win32_symbol_paths a moves into obs_platform_after_module_load()
libobs/obs-module.c:634 _WIN32 call reset_win32_symbol_paths after loading modules a obs_platform_after_module_load() in obs-windows.c; no-op elsewhere
libobs/obs-module.c:735 __APPLE__ append ".so" fallback when bin path missing a obs_platform_module_path_fixup(dstr*) in obs-cocoa.m
libobs/obs-display.c:27 _WIN32 multi-GPU NVIDIA clear workaround flag a obs_platform_display_needs_clear_workaround() in obs-windows.c
libobs/obs-display.c:197 __APPLE__ && __aarch64__ Apple Silicon: sRGB clear colour path a obs_platform_display_clear_color(display,&c) in obs-cocoa.m
libobs/obs-hotkey.c:1443 __APPLE__ macOS keypad translation names (apple_keypad_*) a obs_platform_add_numpad_translations() in obs-cocoa.m (coordinate with Rust-ported name map)
libobs/obs-internal.h:378 _WIN32 copy_surfaces_encode[] member of obs_core_video a wrap in a struct obs_video_platform_data member; Windows variant in an obs-windows header
libobs/obs-internal.h:641 __APPLE__ extern autorelease graphics thread fns a move declarations to an obs-cocoa private header
libobs/obs-source.c:433 __APPLE__ resolve "default" audio device id via get_desktop_default_id a obs_platform_resolve_default_device_id(char**) in obs-cocoa.m
libobs/obs-video-gpu-encode.c:256 _WIN32 use gs_texture_get_shared_handle else (uint32_t)-1 a obs_gpu_encode_shared_handle(tex) in obs-windows.c
libobs/obs-audio-controls.c:32 _MSC_VER disable MSVC warnings 4056/4756 (float overflow constants) a per-file /wd option in cmake/os-windows.cmake
libobs/media-io/media-remux.c:39 _MSC_VER _stat64 vs stat to get file size a use os_stat (already abstracted) / new os_fstat64() in util/platform-windows.c

Classes: (a) movable behind per-platform files; (b) public-header ABI/export/type selection, stays; (c) already replaced by the Rust port (platform code isolated in src/platform/). Macro column abbreviates the #if expression; ! means negated, elif means an #elif line.

Test approach: Existing cmocka libobs tests (module loading, hotkeys) on Linux Tier 2; macOS/Windows by native builds (ci-full). Add a characterization test for module path resolution if absent.

Each move is one function per facade entry, mechanical, so upstream merges stay manageable; the ratchet baseline (step 1) drops by the moved count.

Activity

  1. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Claiming: #870, the remainder. Most rows are already gone from ci/platform-ifdef-baseline.json; left are media-io/media-remux.c.h (1), obs-audio-controls.c.h (1) and obs-hotkey-translations.c.h (1). One PR: MSVC pragmas to per-source CMake options, the remux file size through a portable call, the macOS keypad names behind a host file; Tier 2 test, cross check, baseline entries removed. PR within a day.

  2. added
    claimed
    on Oct 24, 2026
  3. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Fixed by #2147, which took the last platform conditionals out of shared libobs code:

    • obs-hotkey-translations-macos.h is a self-guarded macOS header that holds the numpad host keys.
    • media-remux gets the file size from os_get_file_size.
    • The MSVC warning pragmas in audio-controls became a CMake source property.

    Covered by the test_hotkey_numpad_host Tier 2 test. Nothing is left for this issue; the remaining libobs util/media-io sites are tracked in #876.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions