Commit Graph

4 Commits

Author SHA1 Message Date
28216999e0 Fix make sub-make staleness and stats delivery accounting
- Add 'force' phony prerequisite to all sub-make delegation rules in
  dev/cli/Makefile and src/node/Makefile so the sub-make is always
  invoked and can check source timestamps itself; previously a stale
  .o would never be rebuilt by a dependent Makefile
- Move stream_stats_record_frame inside the successful send branch in
  on_ingest_frame so stats reflect actual delivered frames rather than
  capture throughput; avoids misleading Mbps readings when the
  transport is disconnected

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 08:03:02 +00:00
6747c9e00d Wire reconciler and ingest into video node
Each ingest stream gets two reconciler resources (device, transport) with
dependencies: transport waits for device OPEN (needs format for STREAM_OPEN),
device waits for transport CONNECTED before starting capture.

START_INGEST sets wanted state and triggers a tick; the reconciler drives
device CLOSED→OPEN→STREAMING and transport DISCONNECTED→CONNECTED over
subsequent ticks. STOP_INGEST reverses both.

External events (transport drop, ingest thread error) use
reconciler_force_current to push state backward; the periodic 500ms timer
thread re-drives toward wanted state automatically.

All 8 stream slots are pre-allocated at startup. on_ingest_frame sends
VIDEO_FRAME messages over the outbound transport connection, protected by
a per-stream conn_mutex.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 02:17:16 +00:00
a1b52145d0 feat: add test_image module, xorg viewer sink, and feature flag build system
Feature flags (FEATURES= make variable):
  glfw       — GLFW + OpenGL viewer (libglfw3, libglew)
  vulkan     — future Vulkan renderer
  turbojpeg  — MJPEG decode/encode (libturbojpeg)
  xorg       — XRandR geometry + screen grab (libx11, libxrandr)
  vaapi      — VA-API hardware codec (libva)
Each flag injects -DHAVE_<FEATURE> and the relevant pkg-config flags.
Headless build: make (no FEATURES set).

test_image module (src/modules/test_image/):
  Generates test frames in YUV420, YUV422, and BGRA.
  Patterns: SMPTE 75% colour bars, greyscale ramp, white/black grid.
  BT.601 limited-range RGB→YCbCr in write_pixel().

test_image_cli (dev/cli/):
  Generates a frame and writes it as a PPM file for visual verification.
  Usage: test_image_cli [--pattern bars|ramp|grid]
                        [--width N] [--height N]
                        [--format yuv420|yuv422|bgra]
                        --out FILE.ppm

xorg module (src/modules/xorg/):
  xorg.c      — full GLFW+OpenGL implementation (compiled with FEATURES=glfw)
  xorg_stub.c — no-op stub (compiled otherwise; xorg_available() returns false)
  Renderer: full-screen quad via gl_VertexID, three GL_R8 textures for YUV,
  BT.601 matrix in fragment shader, GL_BGRA texture for packed frames.
  MJPEG path: tjDecompressToYUVPlanes → planar YUV → upload (requires turbojpeg).
  push_yuv420/push_bgra/push_mjpeg all usable independently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 20:54:07 +00:00
62c25247ef Add protocol module, video-node binary, query/web CLI tools
- Protocol module: framed binary encoding for control requests/responses
  (ENUM_DEVICES, ENUM_CONTROLS, GET/SET_CONTROL, STREAM_OPEN/CLOSE)
- video-node: scans /dev/media* and /dev/video*, serves V4L2 device
  topology and controls over TCP; uses UDP discovery for peer announce
- query_cli: auto-discovers a node, queries devices and controls
- protocol_cli: low-level protocol frame decoder for debugging
- dev/web: Express 5 ESM web inspector — live SSE discovery picker,
  REST bridge to video-node, controls UI with sliders/selects/checkboxes
- Makefile: sequential module builds before cli/node to fix make -j races
- common.mk: add DEPFLAGS (-MMD -MP) for automatic header dependencies
- All module Makefiles: split compile/link, generate .d dependency files
- discovery: replace 100ms poll loop with pthread_cond_timedwait;
  respond to all announcements (not just new peers) for instant re-discovery
- ENUM_DEVICES response: carry device_caps (V4L2_CAP_*) per video node
  so clients can distinguish capture nodes from metadata nodes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:04:56 +00:00