Skip to content

facade: libobs ported units (c): 9 platform conditionals already replaced by the Rust port #876

Closed

Description

@zackees

Part of #847.

These C units are compiled out when ENABLE_RUST_LIBOBS=ON; the Rust crates (obs-util, obs-media-io) isolate platform code in src/platform/. The C originals remain as the ENABLE_RUST_LIBOBS=OFF oracle. No work except removing the C files when the Rust build becomes the only build; recorded so the ratchet baseline accounts for them.

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

file:line macro branch class proposed function / target
libobs/util/base.c:28 !_MSC_VER printf format attribute for log fn c rust/obs-util/src/base.rs + ffi/base.rs
libobs/util/base-variadic.c:35 !_MSC_VER VPRINTFATTR c rust/obs-util ffi/base.rs (variadic shim only)
libobs/util/base-variadic.c:41 !_MSC_VER && !_WIN32 BASE_HIDDEN ELF visibility c same
libobs/util/bmem.c:41 _WIN32 _aligned_malloc vs alignment hack c rust/obs-util/src/bmem.rs
libobs/util/config-file.c:378 _WIN32 write UTF-8 BOM on Windows c rust/obs-util/src/config_file.rs
libobs/util/utf8.c:22 _WIN32 Windows wide<->utf8 conversions c rust/obs-util/src/platform/windows/utf8.rs
libobs/media-io/audio-io.c:31 _WIN32 include avrt.h c rust/obs-media-io/src/audio_io.rs
libobs/media-io/audio-io.c:207 _WIN32 AvSetMmThreadCharacteristics("Audio") c same
libobs/media-io/audio-io.c:239 _WIN32 AvRevertMmThreadCharacteristics c same

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: Covered by obs-util / obs-media-io unit and parity (Tier 3) tests; no new tests. Close when the C sources are deleted.

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: #876 (ported libobs C units: the C reference still carries 9 platform conditionals). Same pattern as #853/#851/#872: host code to OS-named files or self-guarded per-OS headers, compiler-only attributes behind existing portable macros, Tier 2 test per slice, cross check, baseline entries removed. The Rust side already keeps its platform code in src/platform/; this is the C reference only.

    1. media-io/audio-io.c.h (avrt include + MMCSS thread characteristics), util/config-file.c.h (UTF-8 BOM), util/bmem.c.h (aligned allocation).
    2. util/base.c.h, util/base-variadic.c.h (printf attribute / ELF visibility), util/utf8.c.h.

    First PR within a day.

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

    @zackees
    MemberAuthor

    Done in #2155 and #2156. The Windows-only choices in the libobs C reference now live in self-guarded headers that the group PCHs include:

    • bmem-windows.h: aligned malloc
    • config-file-windows.h: UTF-8 BOM
    • audio-io-windows.h: the MMCSS audio thread, with avrt moved out of the media PCH
    • base-windows.h: VPRINTFATTR and BASE_HIDDEN
    • utf8-windows.h: the Windows converter, now in its own unity group libobs.ported-windows-utf8, which the C oracle and test_utf8_windows also compile

    test_libobs_reference_hosts checks that these headers define nothing off Windows.

    Left as is: media-io/audio-math.h is a public header, so its _MSC_VER pragmas stay.

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