NDI related tests

This commit is contained in:
2026-05-22 16:34:20 +10:00
parent cec8b76f61
commit 4e6b37304f
5 changed files with 118 additions and 29 deletions

View File

@@ -0,0 +1,35 @@
#include "NdiInputFormat.h"
#include <array>
#include <cstdint>
namespace RenderCadenceCompositor
{
const char* NdiFourCcName(NDIlib_FourCC_video_type_e fourCc)
{
static thread_local std::array<char, 5> text = {};
const auto value = static_cast<uint32_t>(fourCc);
text[0] = static_cast<char>(value & 0xff);
text[1] = static_cast<char>((value >> 8) & 0xff);
text[2] = static_cast<char>((value >> 16) & 0xff);
text[3] = static_cast<char>((value >> 24) & 0xff);
text[4] = '\0';
return text.data();
}
bool MapNdiFourCcToVideoIOPixelFormat(NDIlib_FourCC_video_type_e fourCc, VideoIOPixelFormat& pixelFormat)
{
switch (fourCc)
{
case NDIlib_FourCC_video_type_BGRA:
case NDIlib_FourCC_video_type_BGRX:
pixelFormat = VideoIOPixelFormat::Bgra8;
return true;
case NDIlib_FourCC_video_type_UYVY:
pixelFormat = VideoIOPixelFormat::Uyvy8;
return true;
default:
return false;
}
}
}