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:
tt2468 2021-04-20 22:24:33 -07:00 • committed by Jim
commit 0698eeda94
3 changed files with 43 additions and 4 deletions

View file

@ -66,6 +66,18 @@ static bool decklink_output_start(void *data)
DeckLinkDeviceMode *mode = device->FindOutputMode(decklink->modeID);
struct obs_video_info ovi;
if (!obs_get_video_info(&ovi)) {
LOG(LOG_ERROR,
"Start failed: could not retrieve obs_video_info!");
return false;
}
if (!mode->IsEqualFrameRate(ovi.fps_num, ovi.fps_den)) {
LOG(LOG_ERROR, "Start failed: FPS mismatch!");
return false;
}
decklink->SetSize(mode->GetWidth(), mode->GetHeight());
struct video_scale_info to = {};
@ -204,10 +216,17 @@ static bool decklink_output_device_changed(obs_properties_t *props,
const std::vector<DeckLinkDeviceMode *> &modes =
device->GetOutputModes();
for (DeckLinkDeviceMode *mode : modes) {
obs_property_list_add_int(modeList,
mode->GetName().c_str(),
mode->GetId());
struct obs_video_info ovi;
if (obs_get_video_info(&ovi)) {
for (DeckLinkDeviceMode *mode : modes) {
if (mode->IsEqualFrameRate(ovi.fps_num,
ovi.fps_den)) {
obs_property_list_add_int(
modeList,
mode->GetName().c_str(),
mode->GetId());
}
}
}
obs_property_list_add_int(keyerList, "Disabled", 0);