Repository navigation
Description
Part of #847.
Inventory of platform conditionals in frontend/utility/* measured on origin/master. Total: 18.
Conditionals
| File | Line | Macro | What the branch does |
|---|---|---|---|
AdvancedOutput.cpp |
51 | __APPLE__ |
translate_macvth264_encoder helper |
AdvancedOutput.cpp |
70 | __APPLE__ |
apply translation to stream/record encoder ids |
AdvancedOutput.cpp |
724 | _WIN32 |
read NewSocketLoop / LowLatency config |
AdvancedOutput.cpp |
742 | _WIN32 |
apply new_socket_loop/low_latency to output settings |
CrashHandler.cpp |
79 | _WIN32 |
localtime_s vs localtime_r |
MissingFilesPathItemDelegate.cpp |
140 | __APPLE__ |
raise window (QTBUG-42661) |
OBSProxyStyle.cpp |
10 | __APPLE__ |
SH_ComboBox_UseNativePopup style hint |
RemuxEntryPathItemDelegate.cpp |
190 | __APPLE__ |
raise window (QTBUG-42661) |
ScreenshotObj.cpp |
28 | _WIN32 |
include wincodec.h |
ScreenshotObj.cpp |
89 | _WIN32 |
HDR extended colour space handling |
ScreenshotObj.cpp |
234 | _WIN32 |
SaveJxrImage helper |
ScreenshotObj.cpp |
345 | _WIN32 |
JXR save with wide-char path |
SimpleOutput.cpp |
727 | _WIN32 |
read NewSocketLoop / LowLatency config |
SimpleOutput.cpp |
736 | _WIN32 |
apply new_socket_loop/low_latency |
WhatsNewInfoThread.cpp |
29 | __APPLE__ |
WHATSNEW_URL = MAC_WHATSNEW_URL |
WhatsNewInfoThread.cpp |
31 | _WIN32 (elif) |
WHATSNEW_URL = WIN_WHATSNEW_URL |
output-filename-reserve.c |
8 | _WIN32 |
include io.h vs unistd.h |
output-filename-reserve.c |
28 | _WIN32 |
wide-char path open |
Proposed facade operations
Declared in frontend/utility/platform.hpp; implemented in frontend/utility/platform-windows.cpp, platform-osx.mm, platform-x11.cpp (Linux/BSD). Names are proposals; one facade function per logical operation, moves kept small and mechanical so upstream merges stay manageable.
| Facade function | Implementation |
|---|---|
platform_localtime (same single entry as the obs-main issue) |
windows / posix |
platform_translate_encoder_id(const char *&) |
osx |
platform_apply_output_network_options(config, settings) |
windows (de-duplicates AdvancedOutput/SimpleOutput) |
platform_raise_dialog_window(QWidget*), platform_style_hint(...) |
osx |
platform_save_jxr(path, pixels, ...), platform_hdr_screenshot_space(...) |
windows (ScreenshotObj) |
platform_whatsnew_url() |
per platform |
platform_reserve_file(path) for output-filename-reserve.c (C file: small extern "C" function in platform-*.cpp with a header the C file can include) |
windows / posix |
Likely must stay / caveats
- output-filename-reserve.c is plain C, so its facade function needs C linkage.
frontend/utility/platform.hppitself has 4 platform conditionals (lines 27, 54, 62, 89) that guard Windows/mac-only declarations; these are the facade surface and can only be removed by declaring everything unconditionally with stubs in the other platforms' impls. Tracked here as a follow-up, not counted in this issue's N.
Test approach
Characterisation tests for platform_translate_encoder_id, platform_whatsnew_url, platform_reserve_file (temp-dir reservation test on each OS) and platform_localtime; ScreenshotObj JXR by ci-full.
RED first (failing characterisation test or facade stub), then GREEN, per docs/rust-port/testing-policy.md. Add the ci-full label since this touches shared frontend code built natively on all platforms.
Done when the listed files have no platform conditionals other than the documented exceptions, and the ratchet baseline (#848) is lowered accordingly.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 23, 2026
Claiming: #883 (15 conditionals left on master), one small PR per facade operation:
WhatsNewInfoThread.cpp.hpp, 2): the macOS and Windowsobs_frontend_platform_whatsnew()macros setWHATSNEW_URLto their macro; the shared file keeps the three URLs and a plain default.platform_apply_output_network_options()(Simple/AdvancedOutput, 4).platform_translate_encoder_id()(AdvancedOutput, 2).platform_raise_dialog_window()and the style hint (3).output-filename-reserve(1, C linkage), then ScreenshotObj (3).Each PR is RED (
ci/test_frontend_cmake_facade.pyor a characterization test) then GREEN, with the ratchet baseline lowered. First PR today.frontend: pick the What's New URL in the host CMake file (obs-rust#883)…
test(ci): the Windows output network options go through the platform …
frontend: set the Windows output network options through the platform…
frontend: set the Windows output network options through the platform…
test(ci): legacy macOS encoder ids are translated by the host file (#883
frontend: translate legacy macOS encoder ids through the platform fac…
test(ci): macOS dialog raise and native combo popup go through the fa…
frontend: macOS dialog raise and native combo popup through the platf…
zackees commentedon Oct 23, 2026
Progress: #1975 and #1976 merged; #1977, #1980 and #1984 are open (encoder ids, macOS dialog/style quirks, HDR screenshots). Together they cover 14 of the 15.
Decision needed for the last one,
output-filename-reserve.c.h(create_exclusive:_WIN32_wopenvs POSIXopen(O_EXCL), plus the matching<io.h>/<unistd.h>in its PCH). Moving it tohosts/{windows,posix}/files meanstest_output_filename_reservehas to compile the host file too, which is an edit totest/cmocka/tests.d/test_output_filename_reserve.cmake(adding a source, no assertion change). Is that build-file edit OK under the "never edit existing C tests" rule? If not, I'd list this file in the ratchet's exceptions with the reason, and #883 closes with the facade done everywhere else.test(ci): macOS dialog raise and native combo popup go through the fa…
frontend: macOS dialog raise and native combo popup through the platf…
frontend: translate legacy macOS encoder ids through the platform fac…
7 remaining items
zackees commentedon Oct 25, 2026
Decided: keep
output-filename-reserve.c.has it is and list it inci/platform_ifdef_ratchet.py's exceptions with the reason; don't edittest/cmocka/tests.d/test_output_filename_reserve.cmake.Reasons:
/ready: with the decision made, #883 closes once those three PRs and the exception land. P3, size:M.
zackees commentedon Oct 25, 2026
Correction: #1977, #1980 and #1984 were already merged (2026-10-23), not open as I wrote. So the only thing left here is the ratchet exception for
output-filename-reserve.c.hdecided above. Then this closes.zackees commentedon Oct 25, 2026
/ready
zackees commentedon Oct 25, 2026
Claiming: #883 (the ratchet exception for
output-filename-reserve.c.h, as decided above).zackees commentedon Oct 25, 2026
Closing #883. The decided exception can't be added as written, and isn't needed:
ci/platform_ifdef_ratchet.pyaccepts exceptions only for public headers.output-filename-reserve.c.hends in.c.h, which is inIMPL_SUFFIXES, soload_exceptionsrejects it ("not a header; only public headers get exceptions").ci/platform-ifdef-exceptions.tomlalso says the list only shrinks.ci/platform-ifdef-baseline.json(frontend/utility/output-filename-reserve.c.h: 1, and its PCHfrontend-utility-output-filename-reserve.pch.h: 2). The ratchet fails if either count grows, so the decision "keep it as it is, don't edit the test's build file" is already enforced.The other 14 conditionals moved in #1975, #1976, #1977, #1980 and #1984. If the maintainer later allows adding a source to
test/cmocka/tests.d/test_output_filename_reserve.cmake, the move can be its own issue.