mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Support Events for Grabbers generically
This commit is contained in:
parent
77b5bb633d
commit
c3daeef077
@ -68,7 +68,7 @@ protected:
|
|||||||
#else
|
#else
|
||||||
bool nativeEventFilter(const QByteArray& eventType, void* message, long int* result) override;
|
bool nativeEventFilter(const QByteArray& eventType, void* message, long int* result) override;
|
||||||
#endif
|
#endif
|
||||||
^
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool registerOsEventHandler() override;
|
bool registerOsEventHandler() override;
|
||||||
|
@ -92,7 +92,7 @@ public slots:
|
|||||||
void stop();
|
void stop();
|
||||||
void newThreadFrame(Image<ColorRgb> image);
|
void newThreadFrame(Image<ColorRgb> image);
|
||||||
|
|
||||||
void handleEvent(Event event);
|
void handleEvent(Event event) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newFrame(const Image<ColorRgb> & image);
|
void newFrame(const Image<ColorRgb> & image);
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
#include <grabber/V4L2Grabber.h>
|
#include <grabber/V4L2Grabber.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <events/Event.h>
|
|
||||||
|
|
||||||
class VideoWrapper : public GrabberWrapper
|
class VideoWrapper : public GrabberWrapper
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -23,8 +21,6 @@ public slots:
|
|||||||
bool start() override;
|
bool start() override;
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
void handleEvent(Event event);
|
|
||||||
|
|
||||||
void handleSettingsUpdate(settings::type type, const QJsonDocument& config) override;
|
void handleSettingsUpdate(settings::type type, const QJsonDocument& config) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include <utils/Logger.h>
|
#include <utils/Logger.h>
|
||||||
#include <utils/Components.h>
|
#include <utils/Components.h>
|
||||||
|
|
||||||
|
#include <events/Event.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief The Grabber class is responsible to apply image resizes (with or without ImageResampler)
|
/// @brief The Grabber class is responsible to apply image resizes (with or without ImageResampler)
|
||||||
|
|
||||||
@ -111,6 +113,10 @@ public:
|
|||||||
|
|
||||||
QString getGrabberName() const { return _grabberName; }
|
QString getGrabberName() const { return _grabberName; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
virtual void handleEvent(Event event) {}
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
///
|
///
|
||||||
/// @brief Set device in error state
|
/// @brief Set device in error state
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include <grabber/GrabberType.h>
|
#include <grabber/GrabberType.h>
|
||||||
|
|
||||||
|
#include <events/Event.h>
|
||||||
|
|
||||||
class Grabber;
|
class Grabber;
|
||||||
class GlobalSignals;
|
class GlobalSignals;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
@ -139,6 +141,8 @@ public slots:
|
|||||||
///
|
///
|
||||||
virtual void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
|
virtual void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
|
||||||
|
|
||||||
|
void handleEvent(Event event);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
///
|
///
|
||||||
/// @brief Emit the final processed image
|
/// @brief Emit the final processed image
|
||||||
|
@ -23,3 +23,8 @@ endif(UNIX)
|
|||||||
target_include_directories(events PUBLIC
|
target_include_directories(events PUBLIC
|
||||||
${CURRENT_HEADER_DIR}
|
${CURRENT_HEADER_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_libraries(events
|
||||||
|
Qt${QT_VERSION_MAJOR}::Core
|
||||||
|
Qt${QT_VERSION_MAJOR}::Widgets
|
||||||
|
)
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#include <grabber/VideoWrapper.h>
|
#include <grabber/VideoWrapper.h>
|
||||||
|
|
||||||
#include <events/EventHandler.h>
|
|
||||||
|
|
||||||
// qt includes
|
// qt includes
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
@ -24,8 +22,6 @@ VideoWrapper::VideoWrapper()
|
|||||||
connect(&_grabber, SIGNAL(readError(const char*)), this, SLOT(readError(const char*)), Qt::DirectConnection);
|
connect(&_grabber, SIGNAL(readError(const char*)), this, SLOT(readError(const char*)), Qt::DirectConnection);
|
||||||
|
|
||||||
connect(&_grabber, SIGNAL(readError(const char*)), this, SLOT(readError(const char*)), Qt::DirectConnection);
|
connect(&_grabber, SIGNAL(readError(const char*)), this, SLOT(readError(const char*)), Qt::DirectConnection);
|
||||||
|
|
||||||
QObject::connect(EventHandler::getInstance(), &EventHandler::signalEvent, this, &VideoWrapper::handleEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoWrapper::~VideoWrapper()
|
VideoWrapper::~VideoWrapper()
|
||||||
@ -44,11 +40,6 @@ void VideoWrapper::stop()
|
|||||||
GrabberWrapper::stop();
|
GrabberWrapper::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoWrapper::handleEvent(Event event)
|
|
||||||
{
|
|
||||||
_grabber.handleEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VideoWrapper::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
void VideoWrapper::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||||
{
|
{
|
||||||
if(type == settings::V4L2 && _grabberName.startsWith("V4L2"))
|
if(type == settings::V4L2 && _grabberName.startsWith("V4L2"))
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
// utils includes
|
// utils includes
|
||||||
#include <utils/GlobalSignals.h>
|
#include <utils/GlobalSignals.h>
|
||||||
|
#include <events/EventHandler.h>
|
||||||
|
|
||||||
// qt
|
// qt
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@ -49,6 +50,8 @@ GrabberWrapper::GrabberWrapper(const QString& grabberName, Grabber * ggrabber, i
|
|||||||
|
|
||||||
// listen for source requests
|
// listen for source requests
|
||||||
connect(GlobalSignals::getInstance(), &GlobalSignals::requestSource, this, &GrabberWrapper::handleSourceRequest);
|
connect(GlobalSignals::getInstance(), &GlobalSignals::requestSource, this, &GrabberWrapper::handleSourceRequest);
|
||||||
|
|
||||||
|
QObject::connect(EventHandler::getInstance(), &EventHandler::signalEvent, this, &GrabberWrapper::handleEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
GrabberWrapper::~GrabberWrapper()
|
GrabberWrapper::~GrabberWrapper()
|
||||||
@ -83,6 +86,11 @@ void GrabberWrapper::stop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GrabberWrapper::handleEvent(Event event)
|
||||||
|
{
|
||||||
|
_ggrabber->handleEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
bool GrabberWrapper::isActive() const
|
bool GrabberWrapper::isActive() const
|
||||||
{
|
{
|
||||||
return _timer->isActive();
|
return _timer->isActive();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user