mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-01 05:44:43 +08:00
decklink: Don't show incompatible formats
Changes the formats dropdown for decklink output to only show formats using the same framerate as OBS does. OBS cannot perform framerate conversions, meaning that if OBS's framerate is set to 45fps, and decklink output is set to 60fps, the output will either lag heavily or simply not function.
This commit is contained in:
@@ -66,6 +66,24 @@ const std::string &DeckLinkDeviceMode::GetName(void) const
|
||||
return name;
|
||||
}
|
||||
|
||||
bool DeckLinkDeviceMode::IsEqualFrameRate(int64_t num, int64_t den)
|
||||
{
|
||||
if (!mode)
|
||||
return false;
|
||||
|
||||
BMDTimeValue timeValue;
|
||||
BMDTimeScale timeScale;
|
||||
if (mode->GetFrameRate(&timeValue, &timeScale) != S_OK)
|
||||
return false;
|
||||
|
||||
// Calculate greatest common divisor of both values to properly compare framerates
|
||||
int decklinkGcd = std::gcd(timeScale, timeValue);
|
||||
int inputGcd = std::gcd(num, den);
|
||||
|
||||
return ((timeScale / decklinkGcd) == (num / inputGcd) &&
|
||||
(timeValue / decklinkGcd) == (den / inputGcd));
|
||||
}
|
||||
|
||||
void DeckLinkDeviceMode::SetMode(IDeckLinkDisplayMode *mode_)
|
||||
{
|
||||
IDeckLinkDisplayMode *old = mode;
|
||||
|
||||
Reference in New Issue
Block a user