macos-port #1

Merged
slagge merged 3 commits from macos-port into main 2026-07-03 21:51:06 +02:00
Owner
No description provided.
Milestone A of the macOS port (Initiative 15): the plugin builds, links
against libobs, loads in OBS on Apple Silicon, and receives over UDP --
verified end to end (video + audio; SLM Receiver and SLM Audio Receiver both
discover and connect). Built against the buildspec's libobs 31.1.1, loads
cleanly in the installed OBS 32.1.2. UDP receive only; SHM has no local
producer on macOS yet.

Portability fixes (bite on any native Mac, not just cross-compile):
- CMakeLists: link librt only when NOT APPLE. macOS keeps shm_open/sem_*/
  clock_gettime in libSystem; there is no librt (-lrt failed the link).
- CMakeLists: skip the vendored -slm FFmpeg archives on APPLE. They are ELF
  x86-64 / Windows .lib only, so linking them on arm64 failed; fall through
  to the system libavcodec (pkg-config) path. A bare Mac (no ffmpeg) then
  builds RAW-only; an arm64 libavcodec-slm build re-enables H.264/H.265.
- slm_shm.c: macOS has no sem_timedwait (undeclared -> compile error). Poll
  with sem_trywait + os_sleep_ms(5) under __APPLE__; the reader already
  re-checks write_seq and the heartbeat on every wake, so behaviour holds.
- slm_discover.c: also set SO_REUSEPORT on the discovery socket on APPLE.
  SO_REUSEADDR alone lets two source instances share the 9878 discovery port
  on Linux/Windows but not on macOS/BSD, so a second source (e.g. SLM Audio
  Receiver next to SLM Receiver) failed to bind and saw no announces. Apple-
  only: Linux SO_REUSEPORT would load-balance announces across the sockets.
- slm_udp.c: prev_codec is read only in the HAVE_LIBAV decoder-reinit path,
  so a RAW-only build flagged it unused under the macOS -Werror. Scope the
  declaration to HAVE_LIBAV. (Latent on Linux/Windows, which build libav on.)

CMakePresets: macOS target is arm64-only (Intel Macs are not targeted); the
universal x86_64 slice is dropped, which also sidesteps an unrelated Xcode 26
explicit-modules crash cross-compiling x86_64 on Apple Silicon.

Ref #28
Build FFmpeg 8.0 static for arm64-macOS (minimal h264/hevc decoder set -- the
macOS analogue of ffmpeg-build's "plugin" profile, minus the Linux CUDA/VAAPI
flags) and vendor libavcodec-slm.a + libavutil-slm.a under vendor/lib/macos-arm64/.
HAVE_LIBAV now turns on so the UDP path decodes H.264/H.265, matching Linux and
Windows -- the public-release target.

Verified on the Mac mini: the OBS log shows "decoder 'h264' initialised" and
"decoder 'hevc' initialised", video decodes cleanly, and the RAW-path frame
timeouts are gone (encoded is far leaner than 1080p NV12 over the network).

- CMakeLists: per-platform vendored-libav dir -- macOS reads its Mach-O archives
  from vendor/lib/macos-arm64/ so they do not collide with the checked-in Linux
  ELF ones; headers are shared (same FFmpeg 8.0 release).
- CMakeLists: link the frameworks libavutil auto-pulls on macOS (VideoToolbox/
  CoreMedia/CoreVideo/CoreFoundation/CoreServices) + libiconv; the static
  archives carry no framework refs. VideoToolbox is compiled in but dormant
  (decode stays software), mirroring dormant NVDEC on Linux/Windows.

Ref #28
macOS builds on the Apple Silicon host over SSH, mirroring the Windows path:
sync the checkout, build FFmpeg via ffmpeg-build/macos/build.sh when the
vendored arm64 libav is absent, run cmake --preset macos, then copy the .plugin
bundle back to builds/macos/. publish.sh zips the bundle to
slm-wire-for-obs-<ver>-macos-arm64.zip and uploads it like the other platforms.

The macOS artifact is a self-contained .plugin bundle (binary + Info.plist +
Resources/locale), so there is no obs-plugins/data split. cmake is a userland
install on the mac buildbox (Xcode bundles none), located via the newest
CMake.app tarball in $HOME.

build.sh --platform macos resets the mac checkout to origin/main, so it is fully
usable once macos-port merges to main. The mac FFmpeg builder lives in the
ffmpeg-build repo (macos/build.sh, e930b23).

Ref #28
slagge merged commit 32d557c696 into main 2026-07-03 21:51:06 +02:00
slagge deleted branch macos-port 2026-07-03 21:51:07 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
slayradio-public/slm-wire-for-obs!1
No description provided.