Every existing HyperHDR route replaces whatever else is on the LEDs: routes 1/2 hand HyperHDR's own audio effect a device to read, route 3 sends a synthetic spectrum image, and both take over via HyperHDR's priority system. For a setup that already has a real colour source (a screen grabber, a USB capture card) feeding an ambilight-style LED run, none of that is what's wanted -- the colour should stay put and only brightness should react. Read HyperHDR's own source (sources/api/JSONRPC_schema/schema-adjustment.json) rather than guess: "adjustment" is a post-processing command with a scaleOutput parameter (0-2.0) that applies regardless of which priority is currently active. Confirmed the wire format too -- sources/jsonserver/JsonClientConnection.cpp frames it as plain newline-delimited JSON over TCP (default port 19444), nothing like the length-prefixed Flatbuffers protocol the visualiser sink speaks, and with no handshake or registration needed before the first write. sink_hyperhdr_adjust.c sends only that: no image, no priority, so it never competes with an existing grabber. Non-blocking connect with the same poll()+SO_ERROR pattern net/hyperion.c already uses, reconnects every 5s, rate-limited to 20 Hz (a HyperHDR command every audio block would be pointless flooding), and resets scaleOutput to 1.0 on close rather than leaving the LEDs stuck at whatever it last sent. Cross- compiles clean under -Wall -Wextra on the real webOS toolchain. Wired through the same path every other sink follows: registered in sink.c/sink.h, defaults in config.c, fields in frontend/js/app.js (SINK_FIELDS/SINK_HELP), mock.js and ui_smoke.js updated for the new sink card. Bumped to 1.0.3. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
112 lines
3.1 KiB
CMake
112 lines
3.1 KiB
CMake
cmake_minimum_required(VERSION 3.5)
|
|
project(lgtv-audio-cap C)
|
|
|
|
# Built with the openlgtv arm-webos-linux-gnueabi buildroot SDK:
|
|
#
|
|
# source /path/to/arm-webos-linux-gnueabi_sdk-buildroot/environment-setup
|
|
# cmake -B build -DCMAKE_BUILD_TYPE=Release native
|
|
# cmake --build build
|
|
#
|
|
# The SDK's environment-setup exports CC/SYSROOT and puts its pkg-config in
|
|
# front, so luna-service2 and glib resolve to the TV's versions rather than the
|
|
# host's.
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE Release)
|
|
endif()
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(LUNASERVICE REQUIRED luna-service2)
|
|
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
|
pkg_check_modules(GTHREAD REQUIRED gthread-2.0)
|
|
# PmLogLib is how webOS services normally reach the system log. It is optional
|
|
# here: the logger writes to stderr, which the service launcher captures.
|
|
pkg_check_modules(PMLOG PmLogLib)
|
|
|
|
add_executable(audiocap-service
|
|
src/main.c
|
|
src/service.c
|
|
src/engine.c
|
|
src/config.c
|
|
src/dsp.c
|
|
src/common/log.c
|
|
src/common/json.c
|
|
src/common/ringbuf.c
|
|
src/capture/capture.c
|
|
src/capture/cap_pulse.c
|
|
src/capture/cap_alsa.c
|
|
src/capture/cap_exec.c
|
|
src/capture/cap_tone.c
|
|
src/net/flatbuf.c
|
|
src/net/hyperion.c
|
|
src/net/streamserv.c
|
|
src/sinks/sink.c
|
|
src/sinks/sink_hyperhdr.c
|
|
src/sinks/sink_hyperhdr_viz.c
|
|
src/sinks/sink_hyperhdr_adjust.c
|
|
src/sinks/sink_udp.c
|
|
src/sinks/sink_tcp.c
|
|
src/sinks/sink_http.c
|
|
)
|
|
|
|
target_include_directories(audiocap-service PRIVATE
|
|
src
|
|
${LUNASERVICE_INCLUDE_DIRS}
|
|
${GLIB_INCLUDE_DIRS}
|
|
${GTHREAD_INCLUDE_DIRS}
|
|
${PMLOG_INCLUDE_DIRS}
|
|
)
|
|
|
|
target_compile_options(audiocap-service PRIVATE
|
|
-Wall -Wextra -Wno-unused-parameter
|
|
${LUNASERVICE_CFLAGS_OTHER}
|
|
${GLIB_CFLAGS_OTHER}
|
|
)
|
|
|
|
target_compile_definitions(audiocap-service PRIVATE
|
|
_GNU_SOURCE
|
|
# Lets LSRegisterPubPriv resolve on firmware older than 3.5 without making
|
|
# the symbol mandatory on newer builds.
|
|
SECURITY_COMPATIBILITY
|
|
)
|
|
|
|
# The audio backends are dlopen'd at runtime, so libpulse and libasound are
|
|
# deliberately absent from this list: the service has to start on a TV that has
|
|
# neither, report that in the diagnostics, and let the user pick another path.
|
|
target_link_libraries(audiocap-service PRIVATE
|
|
${LUNASERVICE_LIBRARIES}
|
|
${GLIB_LIBRARIES}
|
|
${GTHREAD_LIBRARIES}
|
|
${PMLOG_LIBRARIES}
|
|
pthread
|
|
dl
|
|
m
|
|
)
|
|
|
|
target_link_directories(audiocap-service PRIVATE
|
|
${LUNASERVICE_LIBRARY_DIRS}
|
|
${GLIB_LIBRARY_DIRS}
|
|
${GTHREAD_LIBRARY_DIRS}
|
|
${PMLOG_LIBRARY_DIRS}
|
|
)
|
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
|
|
# webOS 5/6 TVs are Cortex-A9 (and A53 on later chassis, which runs A9 code
|
|
# fine). softfp matches the SDK's ABI.
|
|
target_compile_options(audiocap-service PRIVATE
|
|
-mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=neon -ffast-math
|
|
)
|
|
endif()
|
|
|
|
# Homebrew services are unpacked to an arbitrary directory, so anything we ship
|
|
# alongside the binary has to be found relative to it.
|
|
set_target_properties(audiocap-service PROPERTIES
|
|
BUILD_RPATH "$ORIGIN"
|
|
INSTALL_RPATH "$ORIGIN"
|
|
)
|
|
|
|
install(TARGETS audiocap-service RUNTIME DESTINATION .)
|