From 7ec95e33eb564bd8d9017a60c94e1761cd8c3e92 Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Sun, 11 May 2025 19:18:57 +0200 Subject: [PATCH] Hide outdated video condition options The "throttle" and "reduce matching latency" optiohns were introduced before "short circuit evaluation" was available and are now outdated. Both don't behave as expected with this option enabled. The throttling effect can be better achieved with an additional "Timer" condition. --- plugins/video/macro-condition-video.cpp | 16 ++++++++++++++-- plugins/video/macro-condition-video.hpp | 7 ++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/plugins/video/macro-condition-video.cpp b/plugins/video/macro-condition-video.cpp index 7b5c3c51..f0dc3730 100644 --- a/plugins/video/macro-condition-video.cpp +++ b/plugins/video/macro-condition-video.cpp @@ -234,8 +234,9 @@ void MacroConditionVideo::GetScreenshot(bool blocking) _areaParameters.area.width, _areaParameters.area.height); } - new (&_screenshotData) Screenshot(source, screenshotArea, blocking, - GetIntervalValue()); + const int timeout = GetIntervalValue() < 300 ? 300 : GetIntervalValue(); + new (&_screenshotData) + Screenshot(source, screenshotArea, blocking, timeout); obs_source_release(source); _getNextScreenshot = false; } @@ -1560,6 +1561,17 @@ void MacroConditionVideoEdit::SetWidgetVisibility() _patternMatchModeLayout, _entryData->_patternMatchParameters.useForChangedCheck); } + + // TODO: + // Remove "reduce matching latency" and "reduce cpu load" options as they + // have become superfluous with short circuit evaluation + if (!_entryData->_throttleEnabled) { + SetLayoutVisible(_throttleControlLayout, false); + } + if (_entryData->_blockUntilScreenshotDone) { + _reduceLatency->hide(); + } + Resize(); } diff --git a/plugins/video/macro-condition-video.hpp b/plugins/video/macro-condition-video.hpp index 9a8d7efd..925a3831 100644 --- a/plugins/video/macro-condition-video.hpp +++ b/plugins/video/macro-condition-video.hpp @@ -60,13 +60,18 @@ public: // If not set the screenshot will be gathered in one interval and // checked in the next one. // If set both operations will happen in the same interval. - bool _blockUntilScreenshotDone = false; + // + // TODO: Remove this option in a future release as it has become + // superfluous with "short circuit" evaluation. + bool _blockUntilScreenshotDone = true; NumberVariable _brightnessThreshold = 0.5; PatternMatchParameters _patternMatchParameters; ObjDetectParameters _objMatchParameters; OCRParameters _ocrParameters; ColorParameters _colorParameters; AreaParameters _areaParameters; + // TODO: Remove this option in a future release as it has become + // superfluous with "short circuit" evaluation. bool _throttleEnabled = false; int _throttleCount = 3;