You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inventory of platform conditionals in plugins/coreaudio-encoder/encoder.cpp (9 #ifs, 1 file). The plugin is cross-platform by design: macOS uses AudioToolbox directly; Windows loads Apple's CoreAudio DLLs via windows-imports.h. So the branches are genuinely Windows-vs-mac.
lines
macro
what the branch does
11
!_WIN32
include AudioToolbox and Apple cfstring utils
28
_WIN32
include windows-imports.h
130
!_WIN32
default_delete specialisation for CFErrorRef
148
!_MSC_VER
__attribute__((format)) on log_to_dstr
246
!_WIN32
convert OSStatus to string via CFErrorCopyDescription (Windows branch uses another path)
668, 718
_MSC_VER
push/pop warning 4706
1290
_WIN32
load_core_audio() at module load, fail soft if not installed
1319
_WIN32
obs_module_unload() calling unload_core_audio()
Proposed facade
coreaudio-platform.h with ca_platform_load(), ca_platform_unload(), ca_platform_describe_status(OSStatus, DStr&), and a cf_ptr/CFErrorRef deleter helper, implemented in coreaudio-platform-windows.cpp and coreaudio-platform-mac.cpp. Module load/unload entry points then call the facade unconditionally.
Likely must stay
_MSC_VER warning pragmas (668/718) and the format attribute (148): compiler-only, not OS behaviour; could be replaced with a compat macro from util/c99defs.h (e.g. PRINTFATTR).
CMake OS_WINDOWS (CMakeLists.txt:3,24) 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.
Add RED host-boundary/wiring checks and characterize status description, load/soft-failure/unload, and ownership behavior.
Move SDK/type/deleter selection and runtime load/status helpers behind a CoreAudio facade. Use per-host unity groups containing both the shared encoder and host implementation, retaining one Windows static import/function-pointer table per translation unit. Preserve the Windows-only module-unload export and all existing log/registration behavior.
Run focused checks and native Windows/macOS plugin builds in the existing full workflow, then normal merge queue. First draft expected within 45 minutes.
Decisions: The existing compiler-only format attribute and MSVC warning push/pop remain documented exceptions, as the issue permits; no host behavior remains behind _WIN32 in shared encoder code. The Windows imports implementation stays byte-unchanged. No attempt to improve runtime loading, error formatting or encoder behavior. No public C API/header edit or workflow addition.
SDK/type/deleter selection and runtime load/status helpers now live behind a host facade. Per-host unity groups keep the Windows static import/function-pointer table with the encoder; the imports implementation is byte-unchanged. Windows soft DLL failure, log text/severity, registration, status formatting, disposal and Windows-only unload export are preserved. Six OS selections moved; the three documented compiler-only conditions remain as permitted. Ratchet drops the two existing PCH findings. Narrow path mappings route host files correctly and shared API/PCH to both hosts.
RED 997da9c reproduces boundary/wiring failures; additional RED 00acbf5 reproduces five CI routing errors. GREEN 67dc883 passes all 87 focused checks. Native macOS job 119077468100 compiles the new host group and links/touches coreaudio-encoder.plugin. Native Windows job 119077467987 compiles its host group, produces and installs coreaudio-encoder.dll. Complete full validation 39556491770, PR CI 39556498352 and merge-group 39558183507 all passed without retries. Actual AAC encoding with Apple's Windows DLLs is not claimed as tested; the unchanged native builds and loader/ownership fixtures cover this behavior-preserving refactor. No remaining work for #856.
Activity
zackees commentedon Oct 21, 2026
Claiming: #856.
Decisions: The existing compiler-only format attribute and MSVC warning push/pop remain documented exceptions, as the issue permits; no host behavior remains behind _WIN32 in shared encoder code. The Windows imports implementation stays byte-unchanged. No attempt to improve runtime loading, error formatting or encoder behavior. No public C API/header edit or workflow addition.
zackees commentedon Oct 21, 2026
Completed in #1607 (merge f3030da).
SDK/type/deleter selection and runtime load/status helpers now live behind a host facade. Per-host unity groups keep the Windows static import/function-pointer table with the encoder; the imports implementation is byte-unchanged. Windows soft DLL failure, log text/severity, registration, status formatting, disposal and Windows-only unload export are preserved. Six OS selections moved; the three documented compiler-only conditions remain as permitted. Ratchet drops the two existing PCH findings. Narrow path mappings route host files correctly and shared API/PCH to both hosts.
RED 997da9c reproduces boundary/wiring failures; additional RED 00acbf5 reproduces five CI routing errors. GREEN 67dc883 passes all 87 focused checks. Native macOS job 119077468100 compiles the new host group and links/touches coreaudio-encoder.plugin. Native Windows job 119077467987 compiles its host group, produces and installs coreaudio-encoder.dll. Complete full validation 39556491770, PR CI 39556498352 and merge-group 39558183507 all passed without retries. Actual AAC encoding with Apple's Windows DLLs is not claimed as tested; the unchanged native builds and loader/ownership fixtures cover this behavior-preserving refactor. No remaining work for #856.