NDI discovery
This commit is contained in:
@@ -7,8 +7,10 @@
|
||||
#include "RuntimeLayerController.h"
|
||||
#include "../logging/Logger.h"
|
||||
#include "../control/RuntimeStateJson.h"
|
||||
#include "../json/JsonWriter.h"
|
||||
#include "../preview/PreviewWindowThread.h"
|
||||
#include "../telemetry/TelemetryHealthMonitor.h"
|
||||
#include "../video/ndi/NdiSourceDiscovery.h"
|
||||
#include "VideoIOEdges.h"
|
||||
#include "VideoOutputThread.h"
|
||||
|
||||
@@ -20,6 +22,7 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace RenderCadenceCompositor
|
||||
{
|
||||
@@ -250,6 +253,9 @@ private:
|
||||
callbacks.getConfigJson = [this]() {
|
||||
return BuildConfigJson();
|
||||
};
|
||||
callbacks.getNdiSourcesJson = [this]() {
|
||||
return BuildNdiSourcesJson();
|
||||
};
|
||||
callbacks.addLayer = [this](const std::string& body) {
|
||||
return mRuntimeLayers.HandleAddLayer(body);
|
||||
};
|
||||
@@ -341,6 +347,31 @@ private:
|
||||
return SerializeJson(root);
|
||||
}
|
||||
|
||||
std::string BuildNdiSourcesJson() const
|
||||
{
|
||||
std::vector<NdiSourceInfo> sources;
|
||||
std::string error;
|
||||
const bool discovered = DiscoverNdiSources(sources, error);
|
||||
|
||||
JsonWriter writer;
|
||||
writer.BeginObject();
|
||||
writer.KeyBool("ok", discovered);
|
||||
if (!error.empty())
|
||||
writer.KeyString("error", error);
|
||||
writer.Key("sources");
|
||||
writer.BeginArray();
|
||||
for (const NdiSourceInfo& source : sources)
|
||||
{
|
||||
writer.BeginObject();
|
||||
writer.KeyString("name", source.name);
|
||||
writer.KeyString("urlAddress", source.urlAddress);
|
||||
writer.EndObject();
|
||||
}
|
||||
writer.EndArray();
|
||||
writer.EndObject();
|
||||
return writer.StringValue();
|
||||
}
|
||||
|
||||
ControlActionResult HandleConfigSave(const std::string& body)
|
||||
{
|
||||
AppConfig nextConfig;
|
||||
|
||||
Reference in New Issue
Block a user