Feature/ndi out node #2

Merged
itten merged 6 commits from feature/ndi-out-node into main 2026-07-03 10:13:26 +03:00

6 Commits

Author SHA1 Message Date
JohannesItten 5504b8983e feat: ndiout supports audio-only mode (video optional)
flow_id is now optional (config().contains). When absent: skip the
MXL reader, active-wait, and NDI video path entirely. Video buffers
and NDI video frames are heap-allocated only when has_video.

Loop pacing: video branch sleeps 1ms on TOO_EARLY as before; audio-only
path sleeps 1ms when no chunk was available (audio_advanced == false)
to avoid busy-spinning.

NDI sender name changed from the video flow UUID to node_id(), which
is stable and human-readable for both video and audio-only modes.

To use audio-only: wire only audio_flow_id in build_graph, omit flow_id.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-03 10:11:06 +03:00
JohannesItten 9fd41b0312 fix: samples_per_frame must multiply fps_den for fractional framerates
sample_rate / fps_num gave 48000/30000 = 1 for 29.97 fps, producing
silence. Correct formula is sample_rate * fps_den / fps_num, matching
the calculation already used in testpattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-03 10:06:43 +03:00
JohannesItten 2b11411423 fix: set p216_frame FourCC; scope audio_rate to has_audio branch
ndiout: p216_frame.FourCC was zero-initialized — NDI needs it explicitly
set to NDIlib_FourCC_video_type_P216 to send the correct format.

All three nodes: audio_rate = {sample_rate, 1} was always declared even
when has_audio is false (sample_rate = 0 in ndiout). Scoped into the
has_audio block so the bad rate can never be passed to mxlGetCurrentIndex.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-03 10:01:39 +03:00
JohannesItten 2a5d3758b6 refactor: align testpattern naming with ndiin/ndiout
cfg_info → video_cfg, stride → video_stride, writer → video_writer,
grain/buf → video_grain/video_buf, index → video_index, st → vst,
audio_info/audio_id → audio_flow_info/audio_flow_id.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-03 09:59:36 +03:00
JohannesItten b7fb54e2bc refactor: clean up ndiout — fix hardcoded 1920, consistent naming
Fix: c * 1920 → c * samples_per_frame (broke non-25fps or non-48kHz).
Fix: audio channel loop now iterates `channels` not `audio_slices.count`.

Rename: mxl_stride → video_stride, no_samples → samples_per_frame,
ndi_frame_10bit/16bit → v210_frame/p216_frame, ndi_audio_frame → ndi_audio.
Scope `ast` locally to its use block.
Drop unused #include "V210.hpp" and #include "FlowDef.hpp".
ndi_audio struct zero-initialized then filled only when has_audio.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-03 09:58:06 +03:00
itten ba3c2994ee ndi out before refactoring 2026-07-03 09:52:29 +03:00