Files
mxl-multiviewer/FeedCreate.cpp
2026-05-19 14:56:13 +03:00

104 lines
2.8 KiB
C++

#include "FeedCreate.hpp"
#include "NoSignalFeed.hpp"
#include "MxlFeed.hpp"
#include "MxlSdkFeed.hpp"
#include "SmpteBarsFeed.hpp"
#include "SyntheticV210Feed.hpp"
#include <iostream>
std::unique_ptr<IVideoFeed> createFeed(
const FeedConfig& config,
uint32_t feedIndex,
uint32_t frameWidth,
uint32_t frameHeight,
bool verbose)
{
switch (config.kind)
{
case FeedKind::MxlSdk:
{
if (config.mxlDomain.empty() || config.mxlFlowId.empty())
{
std::cerr << "Feed " << (feedIndex + 1)
<< ": mxlsdk requires domain and flowId"
<< std::endl;
return std::make_unique<NoSignalFeed>(
feedIndex, frameWidth, frameHeight);
}
if (verbose)
{
std::cerr << "Feed " << (feedIndex + 1)
<< ": mxlsdk domain=" << config.mxlDomain
<< " flowId=" << config.mxlFlowId
<< std::endl;
}
return std::make_unique<MxlSdkFeed>(
config.mxlDomain,
config.mxlFlowId,
frameWidth,
frameHeight,
verbose);
}
case FeedKind::MxlPlaceholder:
{
auto feed = std::make_unique<MxlFeed>(
frameWidth,
frameHeight
);
if (verbose)
{
std::cerr
<< "MXL SDK: "
<< (feed->isUsingRealSdk()
? "enabled"
: "disabled, using placeholder")
<< std::endl;
}
return feed;
}
case FeedKind::SmpteBars:
if (verbose)
{
std::cerr << "Feed " << (feedIndex + 1)
<< ": smpte bars" << std::endl;
}
return std::make_unique<SmpteBarsFeed>(
frameWidth,
frameHeight
);
case FeedKind::SyntheticV210:
if (verbose)
{
std::cerr << "Feed " << (feedIndex + 1)
<< ": synthetic v210" << std::endl;
}
return std::make_unique<SyntheticV210Feed>(
feedIndex,
frameWidth,
frameHeight
);
case FeedKind::NoSignal:
default:
if (verbose)
{
std::cerr << "Feed " << (feedIndex + 1)
<< ": no signal" << std::endl;
}
return std::make_unique<NoSignalFeed>(
feedIndex,
frameWidth,
frameHeight
);
}
}