ReviewOS

also looking at this

home-lang/home

feat(media): add bounded PCM capture, owned snapshots and A/V streaming

#917
Merged chris wants to merge feat/pcm-av-streaming into main
11 files +683 -0
packages/audio/src/io/native_capture.hadded+13-0
Changes to packages/audio/src/io/native_capture.h
@@ -0,0 +1,13 @@
1/* Home ALSA capture bridge, MIT. Opaque system ABI; S16LE interleaved PCM. */
2#ifndef HOME_NATIVE_CAPTURE_H
3#define HOME_NATIVE_CAPTURE_H
4#include <stdint.h>
5typedef struct home_audio_capture home_audio_capture;
6typedef struct { uint32_t sample_rate,channels,block_frames; } home_capture_config;
7int home_audio_open(const home_capture_config *,const char *device,home_audio_capture **);
8/* 0 success, 1 timeout, negative error. timestamp is first sample in CLOCK_BOOTTIME
9 * ns. Anchored sample counting avoids scheduler jitter; measured error is returned.
10 * XRUNs/disconnects or clock error >100 ms fail explicitly; no silent recovery. */
11int home_audio_read(home_audio_capture *,uint8_t *,uint32_t capacity_frames,uint32_t timeout_ms,uint32_t *frames,uint64_t *timestamp_ns,int64_t *clock_error_ns);
12void home_audio_close(home_audio_capture *);
13#endif