Skip to content
Merged

Video #1614

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions/run-clang-format/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ runs:
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
echo "/home/linuxbrew/.linuxbrew/opt/clang-format@16/bin" >> $GITHUB_PATH
brew update
brew install --quiet zsh
echo ::endgroup::

Expand All @@ -52,6 +53,7 @@ runs:

if (( ${changes[(I)(*.c|*.h|*.cpp|*.hpp|*.m|*.mm)]} )) {
echo ::group::Install clang-format-16
brew update
brew install --quiet obsproject/tools/clang-format@16
echo ::endgroup::

Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/.Wingetfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package 'cmake', path: 'Cmake\bin', bin: 'cmake'
package 'innosetup', path: 'Inno Setup 6', bin: 'iscc'
package 'OpenSSL', path: 'OpenSSL', bin: 'openssl'
package 'OpenSSL', path: 'OpenSSL', bin: 'openssl', version: '3.6.2'
package 'Microsoft.VisualStudio.Locator', path: 'vswhere', bin: 'vswhere'
2 changes: 1 addition & 1 deletion .github/workflows/build-project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
description: "Project name detected by parsing build spec file"
value: ${{ jobs.check-event.outputs.pluginName }}
env:
DEP_DIR: .deps/advss-build-dependencies-4
DEP_DIR: .deps/advss-build-dependencies-5
jobs:
check-event:
name: Check GitHub Event Data 🔎
Expand Down
8 changes: 8 additions & 0 deletions data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2352,6 +2352,14 @@ AdvSceneSwitcher.tempVar.video.similarity="Similarity Rating"
AdvSceneSwitcher.tempVar.video.similarity.description="Values range from 0 to 1, where 0 means dissimilar and 1 means highly similar."
AdvSceneSwitcher.tempVar.video.patternCount="Pattern count"
AdvSceneSwitcher.tempVar.video.patternCount.description="The number of times the given pattern has been found in a given video input frame."
AdvSceneSwitcher.tempVar.video.matchX="Match X coordinate"
AdvSceneSwitcher.tempVar.video.matchX.description="The X coordinate of the top-left corner of the best pattern match.\nIf the 'check area' option is enabled, the coordinate is relative to the video source, not the area.\nSet to -1 if no match was found."
AdvSceneSwitcher.tempVar.video.matchY="Match Y coordinate"
AdvSceneSwitcher.tempVar.video.matchY.description="The Y coordinate of the top-left corner of the best pattern match.\nIf the 'check area' option is enabled, the coordinate is relative to the video source, not the area.\nSet to -1 if no match was found."
AdvSceneSwitcher.tempVar.video.matchWidth="Match width"
AdvSceneSwitcher.tempVar.video.matchWidth.description="The width of the matched pattern in pixels."
AdvSceneSwitcher.tempVar.video.matchHeight="Match height"
AdvSceneSwitcher.tempVar.video.matchHeight.description="The height of the matched pattern in pixels."
AdvSceneSwitcher.tempVar.video.objectCount="Object count"
AdvSceneSwitcher.tempVar.video.objectCount.description="The number of objects the given model has identified in a given video input frame."
AdvSceneSwitcher.tempVar.video.brightness="Average brightness"
Expand Down
2 changes: 1 addition & 1 deletion deps/leptonica
Submodule leptonica updated 220 files
2 changes: 1 addition & 1 deletion deps/libusb
Submodule libusb updated 71 files
+5 −3 .clang-tidy
+55 −0 .github/workflows/android.yml
+46 −14 .github/workflows/linux.yml
+29 −0 .github/workflows/msys2_clang64-aarch64.yml
+49 −0 .github/workflows/windows.yml
+4 −0 .gitignore
+5 −1 .private/ci-build.sh
+12 −0 AUTHORS
+15 −2 ChangeLog
+8 −5 README
+4 −0 Xcode/libusb.xcodeproj/project.pbxproj
+10 −0 configure.ac
+19 −11 examples/hotplugtest.c
+41 −3 examples/listdevs.c
+6 −1 examples/xusb.c
+4 −0 libusb/Makefile.am
+175 −14 libusb/core.c
+163 −14 libusb/descriptor.c
+7 −3 libusb/io.c
+10 −0 libusb/libusb-1.0.def
+59 −9 libusb/libusb.h
+89 −25 libusb/libusbi.h
+122 −46 libusb/os/darwin_usb.c
+10 −8 libusb/os/darwin_usb.h
+31 −10 libusb/os/emscripten_webusb.cpp
+4 −0 libusb/os/haiku_usb_raw.cpp
+73 −25 libusb/os/linux_usbfs.c
+2 −0 libusb/os/netbsd_usb.c
+2 −0 libusb/os/openbsd_usb.c
+2 −0 libusb/os/sunos_usb.c
+3 −3 libusb/os/threads_posix.c
+8 −2 libusb/os/threads_posix.h
+2 −1 libusb/os/threads_windows.h
+82 −1 libusb/os/windows_common.c
+20 −1 libusb/os/windows_common.h
+321 −0 libusb/os/windows_hotplug.c
+28 −0 libusb/os/windows_hotplug.h
+16 −8 libusb/os/windows_usbdk.c
+753 −41 libusb/os/windows_winusb.c
+5 −0 libusb/os/windows_winusb.h
+2 −2 libusb/version.h
+1 −1 libusb/version_nano.h
+1 −1 msvc/Base.props
+2 −1 msvc/Configuration.Base.props
+12 −0 msvc/Configuration.DynamicLibrary.props
+69 −16 msvc/ProjectConfigurations.Base.props
+2 −2 msvc/build_all.ps1
+4 −0 msvc/config.h
+11 −4 msvc/getopt.vcxproj
+96 −0 msvc/getopt/bits/getopt_core.h
+77 −0 msvc/getopt/bits/getopt_ext.h
+21 −0 msvc/getopt/features.h
+456 −705 msvc/getopt/getopt.c
+16 −158 msvc/getopt/getopt.h
+40 −69 msvc/getopt/getopt1.c
+118 −0 msvc/getopt/getopt_int.h
+7 −0 msvc/getopt/gettext.h
+5 −0 msvc/getopt/unistd.h
+515 −268 msvc/libusb.sln
+2 −0 msvc/libusb_dll.vcxproj
+2 −0 msvc/libusb_static.vcxproj
+1 −1 msvc/xusb.vcxproj
+10 −1 tests/Makefile.am
+ tests/fuzz/corpus/bos/min.bos
+ tests/fuzz/corpus/descriptor_parsers/min_valid_config.bin
+ tests/fuzz/corpus/descriptor_parsers/regression_bug_a_endpoint_null.bin
+ tests/fuzz/corpus/descriptor_parsers/regression_bug_b_iad_oob.bin
+49 −0 tests/fuzz/fuzz_bos_descriptor.c
+83 −0 tests/fuzz/fuzz_descriptor_parsers.c
+2 −1 tests/stress_mt.c
+6 −5 tests/webusb-test-shim/index.js
13 changes: 13 additions & 0 deletions lib/macro/macro-segment-copy-paste.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ void MacroEdit::PasteMacroSegment()
OBSDataAutoRelease data = obs_data_create();
copyInfo.segment->Save(data);

const MacroSegment *const original = copyInfo.segment.get();

switch (copyInfo.type) {
case MacroSegmentCopyInfo::Type::CONDITION: {
const auto condition = std::static_pointer_cast<MacroCondition>(
Expand All @@ -72,15 +74,26 @@ void MacroEdit::PasteMacroSegment()
}
AddMacroCondition(macro.get(), macro->Conditions().size(),
copyInfo.segment->GetId(), data.Get(), logic);
if (!macro->Conditions().empty()) {
macro->Conditions().back()->FixupVarMappingRefs(
original);
}
break;
}
case MacroSegmentCopyInfo::Type::ACTION:
AddMacroAction(macro.get(), macro->Actions().size(),
copyInfo.segment->GetId(), data.Get());
if (!macro->Actions().empty()) {
macro->Actions().back()->FixupVarMappingRefs(original);
}
break;
case MacroSegmentCopyInfo::Type::ELSE:
AddMacroElseAction(macro.get(), macro->ElseActions().size(),
copyInfo.segment->GetId(), data.Get());
if (!macro->ElseActions().empty()) {
macro->ElseActions().back()->FixupVarMappingRefs(
original);
}
break;
default:
break;
Expand Down
17 changes: 17 additions & 0 deletions lib/macro/macro-segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ const std::vector<VarMapping> &MacroSegment::GetVarMappings() const
void MacroSegment::SetVarMappings(const std::vector<VarMapping> &mappings)
{
_varMappings = mappings;
IncrementTempVarInUseGeneration();
}

void MacroSegment::FixupVarMappingRefs(const MacroSegment *originalSegment)
{
for (auto &mapping : _varMappings) {
auto refSeg = mapping.tempVar._segment.lock();
if (refSeg.get() != originalSegment) {
continue;
}
for (const auto &var : _tempVariables) {
if (var.ID() == mapping.tempVar._id) {
mapping.tempVar = var.GetRef();
break;
}
}
}
}

std::vector<TempVariable> MacroSegment::GetOwnTempVars() const
Expand Down
1 change: 1 addition & 0 deletions lib/macro/macro-segment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class EXPORT MacroSegment : public Lockable {
const std::vector<VarMapping> &GetVarMappings() const;
void SetVarMappings(const std::vector<VarMapping> &mappings);
std::vector<TempVariable> GetOwnTempVars() const;
void FixupVarMappingRefs(const MacroSegment *originalSegment);

protected:
friend bool SupportsVariableValue(MacroSegment *);
Expand Down
5 changes: 3 additions & 2 deletions lib/utils/source-helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,12 @@ void SourceActiveKeeper::SetActive(bool active)
if (_active == active) {
return;
}
_active = active;
if (_active) {
if (active) {
_active = true;
AcquireRef();
} else {
ReleaseRef();
_active = false;
}
}

Expand Down
1 change: 1 addition & 0 deletions lib/utils/temp-variable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class TempVariableRef {

friend TempVariable;
friend TempVariableSelection;
friend MacroSegment;
};

class ADVSS_EXPORT TempVariableSelection : public QWidget {
Expand Down
3 changes: 3 additions & 0 deletions plugins/base/utils/profile-helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ void PopulateProfileSelection(QComboBox *box)
std::string GetPathInProfileDir(const char *filePath)
{
auto path = obs_frontend_get_current_profile_path();
if (!path) {
return "";
}
std::string result(path);
bfree(path);
return result + "/" + filePath;
Expand Down
56 changes: 56 additions & 0 deletions plugins/video/macro-condition-video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ void MacroConditionVideo::UpdateActiveKeeper()
if (_video.type == VideoInput::Type::OBS_MAIN_OUTPUT) {
return;
}
if (!_keepActive) {
_lastActiveKeeperSource = nullptr;
return;
}
auto videoSource = _video.GetVideo();
if (videoSource == _lastActiveKeeperSource) {
return;
Expand Down Expand Up @@ -296,13 +300,41 @@ bool MacroConditionVideo::ScreenshotContainsPattern()
_patternMatchParameters.threshold, result,
_patternMatchParameters.useAlphaAsMask,
_patternMatchParameters.matchMode);

if (result.total() == 0) {
SetTempVarValue("similarity", std::to_string(bestMatchValue));
SetTempVarValue("patternCount", "0");
SetTempVarValue("matchX", "-1");
SetTempVarValue("matchY", "-1");
SetTempVarValue("matchWidth", "0");
SetTempVarValue("matchHeight", "0");
return false;
}

SetTempVarValue("similarity", std::to_string(bestMatchValue));
SetTempVarValue("matchWidth",
std::to_string(_patternImageData.rgbaPattern.cols));
SetTempVarValue("matchHeight",
std::to_string(_patternImageData.rgbaPattern.rows));

if (IsTempVarInUse("matchX") || IsTempVarInUse("matchY")) {
double maxVal;
cv::Point maxLoc;
cv::minMaxLoc(result, nullptr, &maxVal, nullptr, &maxLoc);
if (maxVal > 0.0) {
int matchX = maxLoc.x;
int matchY = maxLoc.y;
if (_areaParameters.enable) {
matchX += _areaParameters.area.x;
matchY += _areaParameters.area.y;
}
SetTempVarValue("matchX", std::to_string(matchX));
SetTempVarValue("matchY", std::to_string(matchY));
} else {
SetTempVarValue("matchX", "-1");
SetTempVarValue("matchY", "-1");
}
}

if (IsTempVarInUse("patternCount")) {
const auto count = CountPatternMatches(
Expand Down Expand Up @@ -473,6 +505,30 @@ void MacroConditionVideo::SetupTempVars()
"AdvSceneSwitcher.tempVar.video.patternCount"),
obs_module_text(
"AdvSceneSwitcher.tempVar.video.patternCount.description"));
AddTempvar(
"matchX",
obs_module_text(
"AdvSceneSwitcher.tempVar.video.matchX"),
obs_module_text(
"AdvSceneSwitcher.tempVar.video.matchX.description"));
AddTempvar(
"matchY",
obs_module_text(
"AdvSceneSwitcher.tempVar.video.matchY"),
obs_module_text(
"AdvSceneSwitcher.tempVar.video.matchY.description"));
AddTempvar(
"matchWidth",
obs_module_text(
"AdvSceneSwitcher.tempVar.video.matchWidth"),
obs_module_text(
"AdvSceneSwitcher.tempVar.video.matchWidth.description"));
AddTempvar(
"matchHeight",
obs_module_text(
"AdvSceneSwitcher.tempVar.video.matchHeight"),
obs_module_text(
"AdvSceneSwitcher.tempVar.video.matchHeight.description"));
break;
case VideoCondition::OBJECT:
AddTempvar(
Expand Down
3 changes: 1 addition & 2 deletions plugins/video/opencv-helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,9 @@ std::optional<std::string> RunOCR(tesseract::TessBaseAPI *ocr,
const QImage &image, const QColor &color,
double colorDiff)
{
(void)ocr;
(void)color;
(void)colorDiff;
if (image.isNull()) {
if (!ocr || image.isNull()) {
return {};
}

Expand Down
5 changes: 4 additions & 1 deletion plugins/video/parameter-wrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ class OCRParameters {
void SetCustomConfigFile(const std::string &);
std::string GetCustomConfigFile() const { return configFile; }
tesseract::PageSegMode GetPageMode() const { return pageSegMode; }
tesseract::TessBaseAPI *GetOCR() const { return ocr.get(); }
tesseract::TessBaseAPI *GetOCR() const
{
return initDone ? ocr.get() : nullptr;
}

StringVariable text = obs_module_text("AdvSceneSwitcher.enterText");
RegexConfig regex = RegexConfig::PartialMatchRegexConfig();
Expand Down
1 change: 1 addition & 0 deletions plugins/video/preview-dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ void PreviewImage::MarkOCRMatch(QImage &screenshot,
if (!text) {
emit StatusUpdate(obs_module_text(
"AdvSceneSwitcher.condition.video.ocrMatchFail"));
return;
}

QString status(obs_module_text(
Expand Down
Loading