- fc_writer.h/fc_writer.c: new framecache slot writer module - Registers slot via POST /slots to framecache HTTP API on signal lock - Opens shm file returned by API (O_RDWR + mmap MAP_SHARED) - fc_writer_write(): atomic write_cursor advance + sem_post per frame - fc_writer_close(): DELETE /slots/:id + munmap + sem_close - HTTP calls via raw POSIX sockets (no libcurl dependency) - Parses host:port from FC_URL env var or --fc-url arg - main.c changes: - PortState gains slot_id, fc_url, fc_writer fields - --fc-url CLI arg + FC_URL env var (default http://localhost:7435) - On signal lock: fc_writer_open() before thread launch; falls back to FIFO if framecache unreachable (fc_writer == NULL) - video_thread: shm path primary (fc_writer != NULL), FIFO path fallback (fc_writer == NULL or LEGACY_FIFO=1) - Format JSON now includes slot_id field for node-agent consumption - Cleanup: fc_writer_close() before VHD_CloseBoardHandle - CMakeLists.txt: - Add fc_writer.c to build - Link rt (shm_open, sem_open) - LEGACY_FIFO option (OFF by default) for nodes without framecache Audio thread unchanged — audio stays in FIFO (shm audio is roadmap).
49 lines
1.6 KiB
CMake
49 lines
1.6 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(deltacast-bridge C)
|
|
set(CMAKE_C_STANDARD 17)
|
|
|
|
set(SDK_ROOT "/sdk" CACHE PATH "Path to extracted VideoMaster SDK")
|
|
|
|
# Legacy FIFO mode — set LEGACY_FIFO=ON to disable framecache shm writes
|
|
# and fall back to the original named-FIFO path.
|
|
option(LEGACY_FIFO "Use named FIFOs instead of framecache shm" OFF)
|
|
|
|
# Primary binary: deltacast-bridge (shared multi-port daemon)
|
|
add_executable(deltacast-bridge main.c fc_writer.c)
|
|
|
|
if(LEGACY_FIFO)
|
|
target_compile_definitions(deltacast-bridge PRIVATE LEGACY_FIFO=1)
|
|
message(STATUS "deltacast-bridge: LEGACY_FIFO mode enabled (shm disabled)")
|
|
else()
|
|
message(STATUS "deltacast-bridge: framecache shm mode enabled")
|
|
endif()
|
|
|
|
target_include_directories(deltacast-bridge PRIVATE
|
|
${SDK_ROOT}/include/videomaster
|
|
)
|
|
|
|
target_link_directories(deltacast-bridge PRIVATE
|
|
${SDK_ROOT}/lib
|
|
)
|
|
|
|
target_link_libraries(deltacast-bridge PRIVATE
|
|
videomasterhd
|
|
videomasterhd_audio
|
|
pthread
|
|
rt # shm_open, sem_open
|
|
)
|
|
|
|
# Embed the SDK RPATH so the binary finds the .so at runtime
|
|
set_target_properties(deltacast-bridge PROPERTIES
|
|
INSTALL_RPATH "/usr/local/lib/deltacast"
|
|
BUILD_WITH_INSTALL_RPATH TRUE
|
|
)
|
|
|
|
# Compat symlink: deltacast-capture -> deltacast-bridge
|
|
# (node-agent and any legacy scripts that reference the old name still work)
|
|
add_custom_command(TARGET deltacast-bridge POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
|
$<TARGET_FILE:deltacast-bridge>
|
|
$<TARGET_FILE_DIR:deltacast-bridge>/deltacast-capture
|
|
COMMENT "Creating deltacast-capture compat symlink"
|
|
)
|