Initial commit: testpattern → fakesink pipeline over MXL shared memory
- 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>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace dmf {
|
||||
|
||||
// A node instance in the pipeline graph.
|
||||
struct NodeDef {
|
||||
std::string id; // unique instance id; becomes node_id in NODE_CONFIG
|
||||
std::string type; // binary suffix: "testpattern" → "dmf-node-testpattern"
|
||||
nlohmann::json params; // node-specific config (width, height, fps_num, ...)
|
||||
};
|
||||
|
||||
// A directed edge between two nodes, carried by one MXL flow.
|
||||
//
|
||||
// from_port / to_port are the NODE_CONFIG keys each end receives the flow descriptor under.
|
||||
// The injected value is a JSON object: { "id": "<uuid>", ...format fields }.
|
||||
// Nodes read the UUID as cfg["flow_id"]["id"] and format fields as cfg["flow_id"]["fps_num"] etc.
|
||||
//
|
||||
// format examples:
|
||||
// video: { "kind":"video", "width":1920, "height":1080, "fps_num":25, "fps_den":1 }
|
||||
// audio: { "kind":"audio", "sample_rate":48000, "channels":2, "bit_depth":24 }
|
||||
//
|
||||
// PiP sink example: two edges with to_port "input_a_flow_id" and "input_b_flow_id".
|
||||
struct FlowEdge {
|
||||
std::string id; // UUID for the MXL flow (set by build_graph)
|
||||
std::string from_node;
|
||||
std::string from_port; // key injected into source's NODE_CONFIG
|
||||
std::string to_node;
|
||||
std::string to_port; // key injected into sink's NODE_CONFIG
|
||||
nlohmann::json format; // flow format metadata (kind, width, height, fps_num, ...)
|
||||
};
|
||||
|
||||
// The complete pipeline description.
|
||||
struct FlowGraph {
|
||||
std::vector<NodeDef> nodes;
|
||||
std::vector<FlowEdge> edges;
|
||||
|
||||
// Returns the full NODE_CONFIG JSON for one node.
|
||||
// Each connected edge injects a flow descriptor object under the port key:
|
||||
// cfg[port] = { "id": "<uuid>", ...format fields }
|
||||
nlohmann::json node_config(const std::string& node_id) const {
|
||||
const NodeDef* nd = nullptr;
|
||||
for (const auto& n : nodes)
|
||||
if (n.id == node_id) { nd = &n; break; }
|
||||
if (!nd) return {};
|
||||
|
||||
nlohmann::json cfg = nd->params;
|
||||
cfg["node_id"] = nd->id;
|
||||
for (const auto& e : edges) {
|
||||
nlohmann::json port = e.format;
|
||||
port["id"] = e.id;
|
||||
if (e.from_node == node_id) cfg[e.from_port] = port;
|
||||
if (e.to_node == node_id) cfg[e.to_port] = port;
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace dmf
|
||||
Reference in New Issue
Block a user