Read info about source from source/flow_def

This commit is contained in:
JohannesItten
2026-07-09 12:43:10 +03:00
parent d3ef011319
commit d2095d14d3
8 changed files with 172 additions and 54 deletions
+17 -7
View File
@@ -30,10 +30,10 @@ class NDIInNode : public dmf::NodeBase {
if (!config().contains("video_flow_id")) { log("no video output connected — exiting"); return; }
const auto video_flow_info = config().at("video_flow_id");
const auto video_flow_id = video_flow_info.at("id").get<std::string>();
const int width = video_flow_info.value("width", src.width);
const int height = video_flow_info.value("height", src.height);
const int fps_num = video_flow_info.value("fps_num", src.fps_num);
const int fps_den = video_flow_info.value("fps_den", src.fps_den);
const int width = src.width;
const int height = src.height;
const int fps_num = src.fps_num;
const int fps_den = src.fps_den;
log("video flow=%s %dx%d @ %d/%d fps", video_flow_id.c_str(), width, height, fps_num, fps_den);
@@ -61,9 +61,19 @@ class NDIInNode : public dmf::NodeBase {
if (has_audio) {
const auto audio_flow_info = config().at("audio_flow_id");
const auto audio_flow_id = audio_flow_info.at("id").get<std::string>();
sample_rate = audio_flow_info.value("sample_rate", 48000);
channels = audio_flow_info.value("channels", 2);
bit_depth = audio_flow_info.value("bit_depth", 32);
bit_depth = audio_flow_info.value("bit_depth", 32);
log("probing audio format from NDI source...");
try {
const auto ap = ndi.probe_audio();
sample_rate = ap.sample_rate;
channels = ap.channels;
log("detected audio: %d Hz %dch", sample_rate, channels);
} catch (const std::runtime_error& e) {
log("audio probe failed (%s) — using config defaults", e.what());
sample_rate = audio_flow_info.value("sample_rate", 48000);
channels = audio_flow_info.value("channels", 2);
}
log("audio flow=%s %d Hz %dch %d-bit", audio_flow_id.c_str(), sample_rate, channels, bit_depth);