initial commit
This commit is contained in:
+75
@@ -0,0 +1,75 @@
|
||||
#include "MxlFeed.hpp"
|
||||
#include "PixelFormat.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr uint32_t MxlPlaceholderUpdateIntervalFrames = 6;
|
||||
}
|
||||
|
||||
MxlFeed::MxlFeed(
|
||||
uint32_t frameWidth,
|
||||
uint32_t frameHeight)
|
||||
{
|
||||
frame.width = frameWidth;
|
||||
frame.height = frameHeight;
|
||||
frame.pixels.resize(frame.width * frame.height);
|
||||
}
|
||||
|
||||
bool MxlFeed::isUsingRealSdk() const
|
||||
{
|
||||
return MXL_MULTIVIEWER_ENABLE_MXL_SDK != 0;
|
||||
}
|
||||
|
||||
const VideoFrame& MxlFeed::getFrame(uint32_t frameCounter)
|
||||
{
|
||||
if (lastGeneratedFrame != UINT32_MAX &&
|
||||
frameCounter - lastGeneratedFrame <
|
||||
MxlPlaceholderUpdateIntervalFrames)
|
||||
{
|
||||
return frame;
|
||||
}
|
||||
|
||||
++animationFrame;
|
||||
lastGeneratedFrame = frameCounter;
|
||||
++version;
|
||||
|
||||
for (uint32_t y = 0; y < frame.height; ++y)
|
||||
{
|
||||
for (uint32_t x = 0; x < frame.width; ++x)
|
||||
{
|
||||
const bool stripe =
|
||||
((x + animationFrame) / 16) % 2 == 0;
|
||||
|
||||
const bool border =
|
||||
x < 4 ||
|
||||
y < 4 ||
|
||||
x >= frame.width - 4 ||
|
||||
y >= frame.height - 4;
|
||||
|
||||
const uint8_t r = border ? 255 : stripe ? 40 : 10;
|
||||
const uint8_t g = border ? 80 : stripe ? 40 : 10;
|
||||
const uint8_t b = border ? 255 : stripe ? 60 : 20;
|
||||
const RgbColor color =
|
||||
{
|
||||
r,
|
||||
g,
|
||||
b
|
||||
};
|
||||
|
||||
frame.pixels[y * frame.width + x] =
|
||||
packRgba8(color);
|
||||
}
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
FeedRuntimeStatus MxlFeed::status() const
|
||||
{
|
||||
return FeedRuntimeStatus::Placeholder;
|
||||
}
|
||||
|
||||
std::string MxlFeed::displayName() const
|
||||
{
|
||||
return "MXL PLACEHOLDER";
|
||||
}
|
||||
Reference in New Issue
Block a user