- services/framecache/client/fc_pipe.c: new slot→stdout pipe adapter
- Opens framecache slot as consumer (independent cursor per instance)
- Streams raw UYVY422 frames to stdout continuously
- SIGPIPE detection via write() return — exits cleanly on ffmpeg exit
- SIGTERM/SIGINT clean stop from capture-manager
- Periodic stats to stderr (every 300 frames)
- Exit codes: 0=clean, 1=slot not found, 2=EPIPE
- services/framecache/CMakeLists.txt: add fc_pipe target + install
- services/framecache/Dockerfile: copy fc_pipe to runtime image
- services/capture/Dockerfile:
- New fc-pipe-builder stage (builds fc_pipe from framecache sources)
- Copies fc_pipe binary to /usr/local/bin/fc_pipe in runtime image
- services/capture/src/capture-manager.js:
- _buildInputArgs: new framecache path for deltacast + sdi/blackmagic
when FC_SLOT_ID env is set (injected by node-agent from bridge fmt JSON)
- Spawns fc_pipe <slot_id> as child process
- Uses pipe:0 as ffmpeg rawvideo input 0
- Audio FIFO (unchanged) as ffmpeg input 1
- Falls back to legacy FIFO path when FC_SLOT_ID unset
- audioMap: covers blackmagic via framecache (input 1 for audio FIFO)
- isInterlacedSource: covers blackmagic interlaced signals
- hiresStdio: pipe stdin when bridgeProcess set (fc_pipe stdout→ffmpeg)
- Non-growing spawn: pipes fc_pipe.stdout → ffmpeg.stdin
- Growing orchestrator spawn: pipes fc_pipe.stdout → bash.stdin
- sdiHlsDir: covers blackmagic source type
- Session state stores _fcPipeProcess for clean stop
- stop(): sends SIGTERM to fc_pipe after ffmpeg SIGINT
50 lines
2.1 KiB
CMake
50 lines
2.1 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(framecache C)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -O2")
|
|
|
|
# ── libmicrohttpd ────────────────────────────────────────────────────
|
|
find_library(MHD_LIB microhttpd REQUIRED)
|
|
find_path(MHD_INCLUDE microhttpd.h REQUIRED)
|
|
include_directories(${MHD_INCLUDE})
|
|
|
|
# ── framecache server ────────────────────────────────────────────────
|
|
add_executable(framecache
|
|
src/framecache.c
|
|
src/slot.c
|
|
src/registry.c
|
|
)
|
|
target_link_libraries(framecache ${MHD_LIB} rt pthread)
|
|
|
|
# ── fc_client static library (used by bridges + test) ───────────────
|
|
add_library(fc_client STATIC
|
|
client/fc_client.c
|
|
src/slot.c # client needs fc_slot_shm_size / fc_frame_at
|
|
)
|
|
target_include_directories(fc_client PUBLIC src client)
|
|
target_link_libraries(fc_client rt pthread)
|
|
|
|
# ── fc_pipe — slot → stdout adapter (used by capture-manager.js) ─────
|
|
# Spawned by capture-manager as a child process; writes raw UYVY422
|
|
# frames from a framecache slot to stdout so ffmpeg reads them as
|
|
# rawvideo pipe input. Multiple fc_pipe instances on the same slot
|
|
# each get an independent cursor — zero-copy fan-out.
|
|
add_executable(fc_pipe
|
|
client/fc_pipe.c
|
|
)
|
|
target_link_libraries(fc_pipe fc_client)
|
|
target_include_directories(fc_pipe PRIVATE src client)
|
|
|
|
# ── test consumer (dev utility) ──────────────────────────────────────
|
|
if(BUILD_TESTS)
|
|
add_executable(fc_test_consumer
|
|
client/fc_test_consumer.c
|
|
)
|
|
target_link_libraries(fc_test_consumer fc_client)
|
|
target_include_directories(fc_test_consumer PRIVATE src client)
|
|
endif()
|
|
|
|
install(TARGETS framecache fc_pipe DESTINATION bin)
|
|
install(FILES client/fc_client.h src/slot.h DESTINATION include/framecache)
|
|
install(TARGETS fc_client DESTINATION lib)
|