| 1466 | } |
| 1467 | |
| 1468 | static void UpdateFPSLabels(OBSFrameRatePropertyWidget *w) |
| 1469 | { |
| 1470 | UpdateMinMaxLabels(w); |
| 1471 | |
| 1472 | unique_ptr<obs_data_item_t> obj{ |
| 1473 | obs_data_item_byname(w->settings, w->name)}; |
| 1474 | |
| 1475 | media_frames_per_second fps{}; |
| 1476 | media_frames_per_second *valid_fps = nullptr; |
| 1477 | PRAGMA_WARN_PUSH |
| 1478 | PRAGMA_DISABLE_DEPRECATION |
| 1479 | if (obs_data_item_get_autoselect_frames_per_second(obj.get(), &fps, |
| 1480 | nullptr) || |
| 1481 | obs_data_item_get_frames_per_second(obj.get(), &fps, nullptr)) |
| 1482 | valid_fps = &fps; |
| 1483 | PRAGMA_WARN_POP |
| 1484 | |
| 1485 | const char *option = nullptr; |
| 1486 | obs_data_item_get_frames_per_second(obj.get(), nullptr, &option); |
| 1487 | |
| 1488 | if (!valid_fps) { |
| 1489 | w->currentFPS->setHidden(true); |
| 1490 | w->timePerFrame->setHidden(true); |
| 1491 | if (!option) |
| 1492 | w->warningLabel->setObjectName("errorLabel"); |
| 1493 | |
| 1494 | return; |
| 1495 | } |
| 1496 | |
| 1497 | w->currentFPS->setHidden(false); |
| 1498 | w->timePerFrame->setHidden(false); |
| 1499 | |
| 1500 | media_frames_per_second match{}; |
| 1501 | if (!option && !matches_ranges(match, *valid_fps, w->fps_ranges, true)) |
| 1502 | w->warningLabel->setObjectName("errorLabel"); |
| 1503 | else |
| 1504 | w->warningLabel->setObjectName(""); |
| 1505 | |
| 1506 | auto convert_to_fps = media_frames_per_second_to_fps; |
| 1507 | auto convert_to_frame_interval = |
| 1508 | media_frames_per_second_to_frame_interval; |
| 1509 | |
| 1510 | w->currentFPS->setText( |
| 1511 | QString("FPS: %1").arg(convert_to_fps(*valid_fps))); |
| 1512 | w->timePerFrame->setText( |
| 1513 | QString("Frame Interval: %1 ms") |
| 1514 | .arg(convert_to_frame_interval(*valid_fps) * 1000)); |
| 1515 | } |
| 1516 | |
| 1517 | void OBSPropertiesView::AddFrameRate(obs_property_t *prop, bool &warning, |
| 1518 | QFormLayout *layout, QLabel *&label) |
no test coverage detected