enable components at runtime + grabber refactoring (#160)

* implement enable/disable on runtime for:
- smoothing
- kodi
- udplistener
- boblight

* implement enable/disable for forwarder
refactor component

* - implement grabber enable/disable at runtime
- big grabber refactoring. now with common base class for all grabbers

* implement enable/disable at runtime for bb detector

* osx fix

* try to fix cutted travis output for osx build
This commit is contained in:
redPanther
2016-08-11 07:13:55 +02:00
committed by GitHub
parent 0d3f6c7ba1
commit f1cc82b8c7
36 changed files with 471 additions and 495 deletions

View File

@@ -1,15 +1,12 @@
#pragma once
// QT includes
#include <QObject>
#include <QTimer>
// Utils includes
#include <utils/Image.h>
#include <utils/ColorBgr.h>
#include <utils/ColorRgb.h>
#include <utils/GrabbingMode.h>
#include <utils/VideoMode.h>
#include <hyperion/GrabberWrapper.h>
// Forward class declaration
class AmlogicGrabber;
@@ -21,7 +18,7 @@ class ImageProcessor;
/// displayed content. This ImageRgb is processed to a ColorRgb for each led and commmited to the
/// attached Hyperion.
///
class AmlogicWrapper : public QObject
class AmlogicWrapper : public GrabberWrapper
{
Q_OBJECT
public:
@@ -41,20 +38,10 @@ public:
virtual ~AmlogicWrapper();
public slots:
///
/// Starts the grabber wich produces led values with the specified update rate
///
void start();
///
/// Performs a single frame grab and computes the led-colors
///
void action();
///
/// Stops the grabber
///
void stop();
virtual void action();
///
/// Set the grabbing mode
@@ -68,33 +55,17 @@ public slots:
///
void setVideoMode(const VideoMode videoMode);
signals:
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
private:
/// The update rate [Hz]
const int _updateInterval_ms;
/// The timeout of the led colors [ms]
const int _timeout_ms;
/// The priority of the led colors
const int _priority;
/// The timer for generating events with the specified update rate
QTimer _timer;
/// The image used for grabbing frames
Image<ColorBgr> _image;
/// The actual grabber
AmlogicGrabber * _frameGrabber;
/// The processor for transforming images to led colors
ImageProcessor * _processor;
AmlogicGrabber * _grabber;
/// The list with computed led colors
std::vector<ColorRgb> _ledColors;
/// Pointer to Hyperion for writing led values
Hyperion * _hyperion;
// forwarding enabled
bool _forward;
};

View File

@@ -1,19 +1,15 @@
#pragma once
// QT includes
#include <QObject>
#include <QTimer>
// Utils includes
#include <utils/Image.h>
#include <utils/ColorRgb.h>
#include <utils/ColorRgba.h>
#include <utils/GrabbingMode.h>
#include <utils/VideoMode.h>
#include <hyperion/GrabberWrapper.h>
// Forward class declaration
class DispmanxFrameGrabber;
class Hyperion;
class ImageProcessor;
///
@@ -21,7 +17,7 @@ class ImageProcessor;
/// displayed content. This ImageRgb is processed to a ColorRgb for each led and commmited to the
/// attached Hyperion.
///
class DispmanxWrapper: public QObject
class DispmanxWrapper: public GrabberWrapper
{
Q_OBJECT
public:
@@ -41,20 +37,10 @@ public:
virtual ~DispmanxWrapper();
public slots:
///
/// Starts the grabber wich produces led values with the specified update rate
///
void start();
///
/// Performs a single frame grab and computes the led-colors
///
void action();
///
/// Stops the grabber
///
void stop();
virtual void action();
void setCropping(const unsigned cropLeft, const unsigned cropRight,
const unsigned cropTop, const unsigned cropBottom);
@@ -71,9 +57,6 @@ public slots:
///
void setVideoMode(const VideoMode videoMode);
signals:
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
private:
/// The update rate [Hz]
const int _updateInterval_ms;
@@ -82,22 +65,11 @@ private:
/// The priority of the led colors
const int _priority;
/// The timer for generating events with the specified update rate
QTimer _timer;
/// The image used for grabbing frames
Image<ColorRgba> _image;
/// The actual grabber
DispmanxFrameGrabber * _frameGrabber;
/// The processor for transforming images to led colors
ImageProcessor * _processor;
DispmanxFrameGrabber * _grabber;
/// The list with computed led colors
std::vector<ColorRgb> _ledColors;
/// Pointer to Hyperion for writing led values
Hyperion * _hyperion;
// forwarding enabled
bool _forward;
};

View File

@@ -1,18 +1,14 @@
#pragma once
// QT includes
#include <QObject>
#include <QTimer>
// Utils includes
#include <utils/Image.h>
#include <utils/ColorRgb.h>
#include <utils/GrabbingMode.h>
#include <utils/VideoMode.h>
#include <hyperion/GrabberWrapper.h>
// Forward class declaration
class FramebufferFrameGrabber;
class Hyperion;
class ImageProcessor;
///
@@ -20,7 +16,7 @@ class ImageProcessor;
/// displayed content. This ImageRgb is processed to a ColorRgb for each led and commmited to the
/// attached Hyperion.
///
class FramebufferWrapper: public QObject
class FramebufferWrapper: public GrabberWrapper
{
Q_OBJECT
public:
@@ -40,20 +36,10 @@ public:
virtual ~FramebufferWrapper();
public slots:
///
/// Starts the grabber wich produces led values with the specified update rate
///
void start();
///
/// Performs a single frame grab and computes the led-colors
///
void action();
///
/// Stops the grabber
///
void stop();
virtual void action();
///
/// Set the grabbing mode
@@ -67,30 +53,17 @@ public slots:
///
void setVideoMode(const VideoMode videoMode);
signals:
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
private:
/// The update rate [Hz]
const int _updateInterval_ms;
/// The timeout of the led colors [ms]
const int _timeout_ms;
/// The priority of the led colors
const int _priority;
/// The timer for generating events with the specified update rate
QTimer _timer;
/// The image used for grabbing frames
Image<ColorRgb> _image;
/// The actual grabber
FramebufferFrameGrabber * _frameGrabber;
/// The processor for transforming images to led colors
ImageProcessor * _processor;
FramebufferFrameGrabber * _grabber;
/// The list with computed led colors
std::vector<ColorRgb> _ledColors;
/// Pointer to Hyperion for writing led values
Hyperion * _hyperion;
};

View File

@@ -1,19 +1,15 @@
#pragma once
// QT includes
#include <QObject>
#include <QTimer>
// Utils includes
#include <utils/Image.h>
#include <utils/ColorRgb.h>
#include <utils/ColorRgba.h>
#include <utils/GrabbingMode.h>
#include <utils/VideoMode.h>
#include <hyperion/GrabberWrapper.h>
// Forward class declaration
class OsxFrameGrabber;
class Hyperion;
class ImageProcessor;
///
@@ -21,7 +17,7 @@ class ImageProcessor;
/// displayed content. This ImageRgb is processed to a ColorRgb for each led and commmited to the
/// attached Hyperion.
///
class OsxWrapper: public QObject
class OsxWrapper: public GrabberWrapper
{
Q_OBJECT
public:
@@ -42,20 +38,10 @@ public:
virtual ~OsxWrapper();
public slots:
///
/// Starts the grabber wich produces led values with the specified update rate
///
void start();
///
/// Performs a single frame grab and computes the led-colors
///
void action();
///
/// Stops the grabber
///
void stop();
virtual void action();
///
/// Set the grabbing mode
@@ -69,30 +55,17 @@ public slots:
///
void setVideoMode(const VideoMode videoMode);
signals:
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
private:
/// The update rate [Hz]
const int _updateInterval_ms;
/// The timeout of the led colors [ms]
const int _timeout_ms;
/// The priority of the led colors
const int _priority;
/// The timer for generating events with the specified update rate
QTimer _timer;
/// The image used for grabbing frames
Image<ColorRgb> _image;
/// The actual grabber
OsxFrameGrabber * _frameGrabber;
/// The processor for transforming images to led colors
ImageProcessor * _processor;
OsxFrameGrabber * _grabber;
/// The list with computed led colors
std::vector<ColorRgb> _ledColors;
/// Pointer to Hyperion for writing led values
Hyperion * _hyperion;
};

View File

@@ -1,16 +1,14 @@
#pragma once
// Qt includes
#include <QTimer>
// Hyperion includes
#include <hyperion/Hyperion.h>
#include <hyperion/ImageProcessor.h>
#include <hyperion/GrabberWrapper.h>
// Grabber includes
#include <grabber/V4L2Grabber.h>
class V4L2Wrapper : public QObject
class V4L2Wrapper : public GrabberWrapper
{
Q_OBJECT
@@ -26,7 +24,7 @@ public:
double redSignalThreshold,
double greenSignalThreshold,
double blueSignalThreshold,
int hyperionPriority);
const int priority);
virtual ~V4L2Wrapper();
public slots:
@@ -41,34 +39,22 @@ public slots:
void set3D(VideoMode mode);
signals:
void emitColors(int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms);
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
// signals:
// void emitColors(int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms);
private slots:
void newFrame(const Image<ColorRgb> & image);
virtual void action();
void checkSources();
private:
/// The timeout of the led colors [ms]
const int _timeout_ms;
/// The priority of the led colors
const int _priority;
/// The V4L2 grabber
V4L2Grabber _grabber;
/// The processor for transforming images to led colors
ImageProcessor * _processor;
/// The Hyperion instance
Hyperion * _hyperion;
/// The list with computed led colors
std::vector<ColorRgb> _ledColors;
/// Timer which tests if a higher priority source is active
QTimer _timer;
};

View File

@@ -1,18 +1,14 @@
#pragma once
// QT includes
#include <QObject>
#include <QTimer>
// Utils includes
#include <utils/Image.h>
#include <utils/ColorRgb.h>
#include <utils/GrabbingMode.h>
#include <utils/VideoMode.h>
#include <hyperion/GrabberWrapper.h>
// Forward class declaration
class X11Grabber;
class Hyperion;
class ImageProcessor;
///
@@ -20,7 +16,7 @@ class ImageProcessor;
/// displayed content. This ImageRgb is processed to a ColorRgb for each led and commmited to the
/// attached Hyperion.
///
class X11Wrapper: public QObject
class X11Wrapper: public GrabberWrapper
{
Q_OBJECT
public:
@@ -43,17 +39,12 @@ public slots:
///
/// Starts the grabber wich produces led values with the specified update rate
///
void start();
bool start();
///
/// Performs a single frame grab and computes the led-colors
///
void action();
///
/// Stops the grabber
///
void stop();
virtual void action();
///
/// Set the grabbing mode
@@ -67,33 +58,22 @@ public slots:
///
void setVideoMode(const VideoMode videoMode);
signals:
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
private:
/// The update rate [Hz]
const int _updateInterval_ms;
/// The timeout of the led colors [ms]
const int _timeout_ms;
/// The priority of the led colors
const int _priority;
/// The timer for generating events with the specified update rate
QTimer _timer;
/// The image used for grabbing frames
Image<ColorRgb> _image;
/// The actual grabber
X11Grabber * _grabber;
/// The processor for transforming images to led colors
ImageProcessor * _processor;
/// The list with computed led colors
std::vector<ColorRgb> _ledColors;
/// Pointer to Hyperion for writing led values
Hyperion * _hyperion;
bool _init;
bool _x11SetupSuccess;
};