From d72a59e981e87211924d4572e3fc2f1b2b35d15e Mon Sep 17 00:00:00 2001 From: Paulchen Panther Date: Thu, 31 Dec 2020 11:12:29 +0100 Subject: [PATCH] Active grabber fix --- libsrc/hyperion/CaptureCont.cpp | 2 ++ libsrc/hyperion/GrabberWrapper.cpp | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/libsrc/hyperion/CaptureCont.cpp b/libsrc/hyperion/CaptureCont.cpp index 7389f37d..cd5a68a3 100644 --- a/libsrc/hyperion/CaptureCont.cpp +++ b/libsrc/hyperion/CaptureCont.cpp @@ -47,6 +47,7 @@ void CaptureCont::handleV4lImage(const QString& name, const Image & im { _hyperion->registerInput(_v4lCaptPrio, hyperion::COMP_V4L, "System", name); _v4lCaptName = name; + emit GlobalSignals::getInstance()->requestSource(hyperion::COMP_V4L, int(_hyperion->getInstanceIndex()), _v4lCaptEnabled); } _v4lInactiveTimer->start(); _hyperion->setInputImage(_v4lCaptPrio, image); @@ -58,6 +59,7 @@ void CaptureCont::handleSystemImage(const QString& name, const Image& { _hyperion->registerInput(_systemCaptPrio, hyperion::COMP_GRABBER, "System", name); _systemCaptName = name; + emit GlobalSignals::getInstance()->requestSource(hyperion::COMP_GRABBER, int(_hyperion->getInstanceIndex()), _systemCaptEnabled); } _systemInactiveTimer->start(); _hyperion->setInputImage(_systemCaptPrio, image); diff --git a/libsrc/hyperion/GrabberWrapper.cpp b/libsrc/hyperion/GrabberWrapper.cpp index f7123cf6..3ea4793c 100644 --- a/libsrc/hyperion/GrabberWrapper.cpp +++ b/libsrc/hyperion/GrabberWrapper.cpp @@ -44,10 +44,13 @@ GrabberWrapper::~GrabberWrapper() bool GrabberWrapper::start() { - // Start the timer with the pre configured interval - Debug(_log,"Grabber start()"); - _timer->start(); - return _timer->isActive(); + if (!_timer->isActive()) + { + // Start the timer with the pre configured interval + Debug(_log,"Grabber start()"); + _timer->start(); + return _timer->isActive(); + } } void GrabberWrapper::stop() @@ -185,9 +188,9 @@ void GrabberWrapper::handleSourceRequest(hyperion::Components component, int hyp { if(component == hyperion::Components::COMP_GRABBER && !_grabberName.startsWith("V4L")) { - if(listen && !GRABBER_SYS_CLIENTS.contains(hyperionInd)) + if(listen) GRABBER_SYS_CLIENTS.insert(hyperionInd, _grabberName); - else if (!listen) + else GRABBER_SYS_CLIENTS.remove(hyperionInd); if(GRABBER_SYS_CLIENTS.empty()) @@ -197,9 +200,9 @@ void GrabberWrapper::handleSourceRequest(hyperion::Components component, int hyp } else if(component == hyperion::Components::COMP_V4L && _grabberName.startsWith("V4L")) { - if(listen && !GRABBER_V4L_CLIENTS.contains(hyperionInd)) + if(listen) GRABBER_V4L_CLIENTS.insert(hyperionInd, _grabberName); - else if (!listen) + else GRABBER_V4L_CLIENTS.remove(hyperionInd); if(GRABBER_V4L_CLIENTS.empty())