Files
iptvnator/spikes/mpv-frame-copy/Makefile
T
4grayandClaude Fable 5 10cf157f79 spike(embedded-mpv): frame-copy pipeline prototype (helper + shm ring + Electron viewer)
Standalone macOS spike for the frame-copy unification direction from the
2026-07-10 analysis: a helper process renders mpv offscreen into a GL FBO,
reads frames back through an async PBO ring, and publishes BGRA frames into
a 3-slot POSIX shm seqlock ring; a minimal Electron viewer copies the newest
frame via a plain-C N-API addon and uploads it to a WebGL canvas per rAF.

First numbers on M1 Pro (see spike README): 4K60 HEVC hwdec sustained at
60 fps end to end, ~1.2 ms shm copy + ~3.5 ms texture upload, ~10 ms
produce-to-upload age, zero torn frames. Remaining gates: weak hardware,
long-run pacing, HDR, latency flash test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 18:20:45 +02:00

32 lines
963 B
Makefile

# mpv frame-copy spike (macOS only for now).
#
# Requires: Homebrew libmpv (brew install mpv) and Node headers for the
# N-API addon. Override NODE_INC if your Node lives elsewhere:
# make NODE_INC=$(node -e 'console.log(process.execPath)')/../../include/node
BREW_PREFIX ?= /opt/homebrew
NODE_INC ?= $(HOME)/.nvm/versions/node/v22.14.0/include/node
BUILD := build
all: $(BUILD)/mpv_helper $(BUILD)/shm_reader.node
$(BUILD):
mkdir -p $(BUILD)
$(BUILD)/mpv_helper: helper/mpv_helper.cpp common/spike_shm.h | $(BUILD)
clang++ -std=c++17 -O2 -Wall -Icommon -I$(BREW_PREFIX)/include \
-o $@ helper/mpv_helper.cpp \
-L$(BREW_PREFIX)/lib -lmpv -Wl,-rpath,$(BREW_PREFIX)/lib \
-framework OpenGL
$(BUILD)/shm_reader.node: viewer/addon/shm_reader.c common/spike_shm.h | $(BUILD)
clang -std=c11 -O2 -Wall -Icommon -I$(NODE_INC) \
-shared -fPIC -Wl,-undefined,dynamic_lookup \
-o $@ viewer/addon/shm_reader.c
clean:
rm -rf $(BUILD)
.PHONY: all clean