Video format refactor
This commit is contained in:
@@ -14,6 +14,17 @@ std::string NormalizeModeToken(const std::string& value)
|
||||
}
|
||||
|
||||
bool ResolveConfiguredDisplayMode(const std::string& videoFormat, const std::string& frameRate, BMDDisplayMode& displayMode, std::string& displayModeName)
|
||||
{
|
||||
VideoFormat videoMode;
|
||||
if (!ResolveConfiguredVideoFormat(videoFormat, frameRate, videoMode))
|
||||
return false;
|
||||
|
||||
displayMode = videoMode.displayMode;
|
||||
displayModeName = videoMode.displayName;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ResolveConfiguredVideoFormat(const std::string& videoFormat, const std::string& frameRate, VideoFormat& videoMode)
|
||||
{
|
||||
const std::string formatToken = NormalizeModeToken(videoFormat);
|
||||
const std::string frameToken = NormalizeModeToken(frameRate);
|
||||
@@ -78,8 +89,8 @@ bool ResolveConfiguredDisplayMode(const std::string& videoFormat, const std::str
|
||||
{
|
||||
if (combinedToken == option.token || (frameToken.empty() && formatToken == option.token))
|
||||
{
|
||||
displayMode = option.mode;
|
||||
displayModeName = option.displayName;
|
||||
videoMode.displayMode = option.mode;
|
||||
videoMode.displayName = option.displayName;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -87,6 +98,31 @@ bool ResolveConfiguredDisplayMode(const std::string& videoFormat, const std::str
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ResolveConfiguredVideoFormats(
|
||||
const std::string& inputVideoFormat,
|
||||
const std::string& inputFrameRate,
|
||||
const std::string& outputVideoFormat,
|
||||
const std::string& outputFrameRate,
|
||||
VideoFormatSelection& videoModes,
|
||||
std::string& error)
|
||||
{
|
||||
if (!ResolveConfiguredVideoFormat(inputVideoFormat, inputFrameRate, videoModes.input))
|
||||
{
|
||||
error = "Unsupported DeckLink inputVideoFormat/inputFrameRate in config/runtime-host.json: " +
|
||||
inputVideoFormat + " / " + inputFrameRate;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ResolveConfiguredVideoFormat(outputVideoFormat, outputFrameRate, videoModes.output))
|
||||
{
|
||||
error = "Unsupported DeckLink outputVideoFormat/outputFrameRate in config/runtime-host.json: " +
|
||||
outputVideoFormat + " / " + outputFrameRate;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FindDeckLinkDisplayMode(IDeckLinkDisplayModeIterator* iterator, BMDDisplayMode targetMode, IDeckLinkDisplayMode** foundMode)
|
||||
{
|
||||
if (!iterator || !foundMode)
|
||||
|
||||
Reference in New Issue
Block a user