ca682eaf0a
- NodeBase, Signal, FlowDef, V210 shared headers - testpattern node: SMPTE 75% color bars writer at 25fps - fakesink node: non-blocking MXL reader with per-second stats - studio-manager: FlowGraph data model, graph-driven fork/exec launcher - mxl pinned as submodule at 0ae1dc5 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.3 KiB
2.3 KiB
DMF Studio — AI Context
Read ARCHITECTURE.md first for the full picture. This file adds guidance specific to working in this codebase.
Project in one sentence
Node-based media signal processing system: each node is a separate C++ process, nodes exchange video/audio via MXL shared memory, studio-manager orchestrates them, Vue.js frontend planned.
Current state
- Core built: testpattern node (color bars writer), fakesink node (reader/logger), studio-manager (fork/exec orchestrator)
- Not built yet: real processing nodes, Vue frontend, graph.json persistence, WebSocket API
Key conventions
- Node configuration comes from
NODE_CONFIGenv var (JSON). Never hardcode flow UUIDs. - MXL domain comes from
MXL_DOMAINenv var. Default:/dev/shm/dmf-studio(Linux) or/tmp/dmf-studio(macOS). - All shared utilities live in
shared/as header-only files. New nodes add a subdirectory undernodes/. - Timing always goes through MXL time API (
mxlGetCurrentIndex,mxlGetNsUntilIndex,mxlSleepForNs). Do not usestd::chrono::system_clockfor frame timing — MXL uses TAI. - V210 line stride comes from
configInfo.discrete.sliceSizes[0]aftermxlCreateFlowWriter. Never hardcode 5120.
What the user cares about
- Dmitry is not a very experienced C++ developer. Prefer architectural discussion before implementation.
- Keep code minimal and clear. No premature abstractions.
- When adding a new node type, follow the patterns in
nodes/testpattern/main.cppandnodes/fakesink/main.cpp.
MXL API quick reference
mxlCreateInstance(domain, nullptr)
mxlCreateFlowWriter(inst, flow_def_json, nullptr, &writer, &configInfo, &created)
mxlCreateFlowReader(inst, flow_id, nullptr, &reader)
mxlFlowWriterOpenGrain(writer, index, &grain, &buf)
mxlFlowWriterCommitGrain(writer, &grain)
mxlFlowReaderGetGrain(reader, index, timeout_ns, &grain, &buf)
mxlGetCurrentIndex(&rate)
mxlGetNsUntilIndex(next_index, &rate) → ns to sleep
mxlSleepForNs(ns)
mxlIsFlowActive(inst, flow_id, &active)
mxlFlowSynchronizationGroup — for multi-input nodes (PiP)
MXL error codes to handle in readers
MXL_STATUS_OK— grain readyMXL_ERR_TIMEOUT— writer stalled, log and retry same indexMXL_ERR_OUT_OF_RANGE_TOO_LATE— fell behind ring buffer, callmxlGetCurrentIndexand jump