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:
parent
4fad39cdc4
commit
0698eeda94
3 changed files with 43 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue