Skip to content

facade: plugins/obs-vst: move 16 platform conditionals behind a per-platform layer #854

Closed

Description

@zackees

Inventory of platform conditionals in shared-named files of plugins/obs-vst/ (16 #ifs in 3 files). The plugin already has win/, mac/, linux/ implementations for VSTPlugin and EditorWidget; the remaining shared code branches on member types and path lists. Note: several branches also use #elif WIN32 / #elif __linux__ (no defined()), which the #847 ratchet regex must match too.

file lines macro what the branch does
headers/EditorWidget.h 24, 27 _WIN32, __linux__ platform includes (Windows.h; xcb/xcb.h)
50, 52 __APPLE__, _WIN32 platform member (cocoaViewContainer / HWND windowHandle)
headers/VSTPlugin.h 33, 72, 76 __APPLE__, __linux__ (+WIN32) CoreFoundation include; module handle member (CFBundleRef / HINSTANCE / void*)
obs-vst.cpp 106 __linux__ migrate Flatpak 21.08 VST paths to 22.08
166, 193 (+WIN32 branch) __APPLE__, __linux__ default VST search directory lists
170, 184 _WIN64 32-bit-on-WOW64 Program Files (x86) search paths
224, 228 __APPLE__, __linux__ plugin file filters (*.vst, *.dll, *.so/*.o)
244, 248 __APPLE__, __linux__ strip extension from plugin display name

Proposed facade

Follow the existing win/ mac/ linux/ layout: add vst_platform.h with

  • vst_platform_search_dirs(), vst_platform_file_filters(), vst_platform_strip_extension(name), vst_platform_migrate_path(path)
    implemented in win/vst-platform-win.cpp, mac/vst-platform-osx.mm, linux/vst-platform-linux.cpp.
  • Members: hold platform state in an opaque struct VSTPlatformHandle * owned by the per-platform VSTPlugin-* / EditorWidget-* files (pimpl) so the headers lose 24/27/33/50/52/72/76.

Likely must stay

  • If pimpl is judged too invasive for the Qt widget headers, the member-type conditionals in EditorWidget.h and VSTPlugin.h (7 lines) stay as documented exceptions: they select the type of a field, not behaviour.
  • CMake OS_WINDOWS block (CMakeLists.txt:43) stays.

Test approach

Behaviour-preserving moves. Verify with: the plugin's native builds on each platform (ci-full label, since these are outside the quick gate), the existing cmocka tests where the moved function is testable, and ./lint. Where a facade function is pure (path/name/constant selection) add a small unit test per platform implementation. The #847 ratchet lint baseline must go down by the count moved.

Part of #847.

Activity

  1. zackees commented on Oct 21, 2026

    @zackees
    MemberAuthor

    Claiming: VST platform facade. 1. Characterize search paths, file filters, name stripping and Flatpak migration with RED boundary tests. 2. Move behavior into existing native groups and select private per-host type/member fragments through CMake, preserving the exact existing field declarations and ownership (avoids a new pimpl allocation). 3. Verify pure policies with Qt, native plugin builds on all platforms, ratchet and normal merge queue. First draft PR today. Decisions: keep private member names/types/initializers and native loader/editor code unchanged via host-selected declaration fragments; no new exceptions or runtime ownership changes.

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

    @zackees
    MemberAuthor

    Releasing #854 temporarily while fixing a native-build prerequisite. Draft #1625 contains the facade and corrected compatibility/Cargo include wiring. Its real Qt policy tests and all 19 existing Qt tests pass. Full Windows x64 run 39634088997 job 119340768888 fails in unchanged obs-nvenc-with-rust: both variants generate the same obs-nvenc.lib/obs-nvenc.exp path, producing LNK1104. I will handle that blocker as the sole active issue, then resume this draft; no VST behavior changes are needed for that failure.

  4. removed
    claimed
    on Oct 21, 2026
  5. zackees commented on Oct 21, 2026

    @zackees
    MemberAuthor

    Claiming: resuming VST facade draft #1625 now that prerequisite #1626 is merged in #1627. 1. Rebase onto current master containing the NVENC archive isolation fix. 2. Re-run focused/real Qt and full native app/plugin validation on the rebased head. 3. Use the normal merge queue and close this issue. Existing behavior and native loader/editor ownership remain unchanged.

  6. added
    claimed
    on Oct 21, 2026
  7. zackees commented on Oct 21, 2026

    @zackees
    MemberAuthor

    Fixed by #1625 (merge 81a0fc5), after prerequisite #1626 landed separately in #1627. All shared VST host decisions are removed; private host member declarations preserve original names/types/initializers and ownership. Ratchet drops 23 findings. Final-head native Windows/macOS/Linux plugin/app builds, five real Qt policy variants, all existing Qt compatibility tests, complete full CI 39640976288, PR CI 39640985777 and merge-result CI 39645562159 passed. No remaining work for this issue.

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