Captures the TV's audio and sends it out over several transports. The
primary one is HyperHDR: RTP/L16 to a host-side loopback device, since
HyperHDR has no network audio input of its own. A second route renders
the spectrum on the TV and sends FlatBuffers images to port 19400
instead, for setups where touching the host's sound config is not an
option.
native/ the service: capture backends (PulseAudio, ALSA, exec,
test tone, all dlopen-based), DSP, and one file per sink
frontend/ D-pad driven UI at a fixed 1920x1080
servicefiles/ native service manifest plus the boot script
host/ RTP receiver and the loopback installer for the HyperHDR
machine
tools/ build/package, asset generation, Homebrew Channel
manifest, on-TV probe
test/ host-side suites: FlatBuffers and RTP verified against
real decoders, the engine end to end, the page in jsdom
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
50 lines
1.7 KiB
C
50 lines
1.7 KiB
C
// A small FlatBuffers builder.
|
|
//
|
|
// HyperHDR's image input speaks the hyperion.ng FlatBuffers schema. The
|
|
// upstream client generates code with flatcc and carries it as a submodule;
|
|
// that is a lot of build machinery for four message shapes, so this
|
|
// implements the builder algorithm directly. It follows the same back-to-front
|
|
// construction as the reference implementations, so buffers it produces are
|
|
// byte-comparable with flatc-generated output (minus vtable deduplication,
|
|
// which is an optimisation, not a format requirement).
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#define FB_MAX_FIELDS 8
|
|
|
|
typedef struct {
|
|
uint8_t* bytes; // full allocation; live data is bytes[head..cap)
|
|
size_t cap;
|
|
size_t head;
|
|
size_t minalign;
|
|
|
|
uint16_t vtable[FB_MAX_FIELDS];
|
|
int vtable_count;
|
|
size_t object_end; // fb_offset() captured at fb_start_table
|
|
bool nested;
|
|
bool failed;
|
|
} fb_t;
|
|
|
|
bool fb_init(fb_t* b, size_t initial_capacity);
|
|
void fb_free(fb_t* b);
|
|
|
|
// Offsets are distances from the end of the buffer, matching the reference
|
|
// builders. Zero means "absent".
|
|
uint32_t fb_create_uint8_vector(fb_t* b, const uint8_t* data, size_t count);
|
|
uint32_t fb_create_string(fb_t* b, const char* s);
|
|
|
|
void fb_start_table(fb_t* b, int num_fields);
|
|
void fb_add_offset(fb_t* b, int slot, uint32_t offset);
|
|
void fb_add_int32(fb_t* b, int slot, int32_t value, int32_t default_value);
|
|
void fb_add_uint8(fb_t* b, int slot, uint8_t value, uint8_t default_value);
|
|
uint32_t fb_end_table(fb_t* b);
|
|
|
|
void fb_finish(fb_t* b, uint32_t root);
|
|
|
|
// Valid until the next mutation or fb_free.
|
|
const uint8_t* fb_data(const fb_t* b, size_t* len);
|
|
bool fb_ok(const fb_t* b);
|