Allow feed labels in config
This commit is contained in:
@@ -660,6 +660,12 @@ bool applyConfigFile(
|
||||
feed.kind = FeedKind::MxlSdk;
|
||||
}
|
||||
|
||||
if (const std::string* label =
|
||||
jsonString(objectField(*feedObject, "label")))
|
||||
{
|
||||
feed.label = *label;
|
||||
}
|
||||
|
||||
config.feeds[i] = std::move(feed);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ struct FeedConfig
|
||||
FeedKind kind = FeedKind::NoSignal;
|
||||
std::string mxlDomain;
|
||||
std::string mxlFlowId;
|
||||
std::string label;
|
||||
};
|
||||
|
||||
struct AppConfig
|
||||
|
||||
@@ -59,6 +59,16 @@ Run with an existing feed config:
|
||||
./build-sdk/mxl_multiviewer --perf --grid 4x4 --config /tmp/feeds_config.json
|
||||
```
|
||||
|
||||
Each feed object can include an optional `label` field to override the tile UI text:
|
||||
|
||||
```json
|
||||
{
|
||||
"domain": "/tmp/mxl",
|
||||
"flow": "853a9cda-0f7a-4b48-b2df-b3f628440150",
|
||||
"label": "Camera 1"
|
||||
}
|
||||
```
|
||||
|
||||
Useful probe flags:
|
||||
|
||||
```bash
|
||||
|
||||
+4
-2
@@ -7,11 +7,13 @@
|
||||
"feeds": [
|
||||
{
|
||||
"domain": "/tmp/mxl",
|
||||
"flow": "853a9cda-0f7a-4b48-b2df-b3f628440150"
|
||||
"flow": "853a9cda-0f7a-4b48-b2df-b3f628440150",
|
||||
"label": "Camera 1"
|
||||
},
|
||||
{
|
||||
"domain": "/tmp/mxl",
|
||||
"flow": "fab60e17-f721-4e12-a7dd-312f5f6e502d"
|
||||
"flow": "fab60e17-f721-4e12-a7dd-312f5f6e502d",
|
||||
"label": "Camera 2"
|
||||
},
|
||||
{
|
||||
"kind": "nosignal"
|
||||
|
||||
@@ -464,6 +464,7 @@ static ImU32 tileLabelColor(
|
||||
|
||||
static void drawTileLabels(
|
||||
const std::vector<std::unique_ptr<IVideoFeed>>& feeds,
|
||||
const std::vector<FeedConfig>& feedConfigs,
|
||||
uint32_t gridCols,
|
||||
uint32_t gridRows)
|
||||
{
|
||||
@@ -492,12 +493,20 @@ static void drawTileLabels(
|
||||
feeds[i]->status();
|
||||
const std::string sourceInfo =
|
||||
feeds[i]->sourceInfo();
|
||||
const std::string labelOverride =
|
||||
i < feedConfigs.size()
|
||||
? feedConfigs[i].label
|
||||
: "";
|
||||
const std::string labelText =
|
||||
!labelOverride.empty()
|
||||
? labelOverride
|
||||
: sourceInfo.empty()
|
||||
? feedRuntimeStatusDisplayName(status)
|
||||
: sourceInfo;
|
||||
const std::string label =
|
||||
std::to_string(i + 1) +
|
||||
": " +
|
||||
(sourceInfo.empty()
|
||||
? feedRuntimeStatusDisplayName(status)
|
||||
: sourceInfo);
|
||||
labelText;
|
||||
|
||||
const ImVec2 labelMin(
|
||||
tileRect.x0,
|
||||
@@ -716,6 +725,12 @@ int main(int argc, char* argv[])
|
||||
<< " flowId=" << config.feeds[i].mxlFlowId;
|
||||
}
|
||||
|
||||
if (!config.feeds[i].label.empty())
|
||||
{
|
||||
std::cout
|
||||
<< " label=\"" << config.feeds[i].label << "\"";
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
feeds[i] = createFeed(
|
||||
@@ -1809,6 +1824,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
drawTileLabels(
|
||||
feeds,
|
||||
config.feeds,
|
||||
config.gridCols,
|
||||
config.gridRows
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user