Skip to content

facade: plugins/obs-qsv11: move 6 platform conditionals behind a per-platform layer #860

Closed

Description

@zackees

Inventory of platform conditionals in shared-named files of plugins/obs-qsv11/ (6 #ifs in 4 files). Existing pattern: common_utils_windows.cpp, common_utils_linux.cpp, bits/{windows,linux}_defs.h, common_directx11.*.

file lines macro what the branch does
common_utils.h 45, 47 _WIN32||_WIN64, __linux__ include bits/windows_defs.h vs bits/linux_defs.h
QSV_Encoder_Internal.cpp 101 _WIN32 D3D11 + texture allocation setup (m_bUseD3D11, implementation variant)
379 _WIN32 Windows-only video signal info ext buffer (TODO notes VAAPI)
obs-qsv11.c 1245 _WIN32 texture validity test (handle vs tex[0]/tex[1])
obs-qsv-test/obs-qsv-test.cpp 17 _MSC_VER export NvOptimusEnablement / AmdPowerXpressRequestHighPerformance

Proposed facade

  • common_utils.h: replace with a single #include "bits/platform_defs.h" chosen by CMake include path, or add qsv_platform.h that includes the right bits header.
  • qsv_platform_init_session(this), qsv_platform_configure_video_signal(...) implemented in common_utils_windows.cpp / common_utils_linux.cpp.
  • qsv_platform_texture_valid(const struct encoder_texture*) for obs-qsv11.c:1245.

Likely must stay

  • obs-qsv-test.cpp:17: GPU-preference export symbols for the Windows test exe; rename file/move the symbols into a -windows.cpp source.
  • CMake OS_LINUX / OS_WINDOWS (CMakeLists.txt:14,56) stay.

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 17, 2026

    @zackees
    MemberAuthor

    Claiming. Same shape as #1248/#1252/#1257: a conditional-free qsv-host.h (bits/defs selection, session/D3D11 setup, video-signal ext buffer, texture validity) with qsv-host-{windows,linux} implementations in per-OS groups; upstream files edited in place, not renamed. The pure texture_valid check gets a cmocka test (RED then GREEN). obs-qsv-test.cpp's GPU-preference exports move to a Windows-only host file if the group rules allow, else stay as the documented exception.

  2. added
    claimed
    on Oct 17, 2026
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