mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
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:
@@ -10,6 +10,7 @@
|
||||
// Hyperion includes
|
||||
#include <hyperion/Hyperion.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Components.h>
|
||||
|
||||
class BoblightClientConnection;
|
||||
|
||||
@@ -37,7 +38,8 @@ public:
|
||||
/// @return true if server is active (bind to a port)
|
||||
///
|
||||
bool active() { return _isActive; };
|
||||
|
||||
bool componentState() { return active(); };
|
||||
|
||||
public slots:
|
||||
///
|
||||
/// bind server to network
|
||||
@@ -49,6 +51,8 @@ public slots:
|
||||
///
|
||||
void stop();
|
||||
|
||||
void componentStateChanged(const hyperion::Components component, bool enable);
|
||||
|
||||
signals:
|
||||
void statusChanged(bool isActive);
|
||||
|
||||
|
@@ -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;
|
||||
};
|
||||
|
@@ -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;
|
||||
};
|
||||
|
@@ -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;
|
||||
};
|
||||
|
@@ -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;
|
||||
};
|
||||
|
@@ -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;
|
||||
};
|
||||
|
@@ -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;
|
||||
};
|
||||
|
52
include/hyperion/GrabberWrapper.h
Normal file
52
include/hyperion/GrabberWrapper.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <string>
|
||||
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Components.h>
|
||||
#include <hyperion/Hyperion.h>
|
||||
|
||||
class ImageProcessor;
|
||||
|
||||
class GrabberWrapper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GrabberWrapper(std::string grabberName, const int priority);
|
||||
|
||||
virtual ~GrabberWrapper();
|
||||
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
public slots:
|
||||
void componentStateChanged(const hyperion::Components component, bool enable);
|
||||
virtual void action() = 0;
|
||||
|
||||
signals:
|
||||
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
|
||||
|
||||
protected:
|
||||
std::string _grabberName;
|
||||
|
||||
/// Pointer to Hyperion for writing led values
|
||||
Hyperion * _hyperion;
|
||||
|
||||
/// The priority of the led colors
|
||||
const int _priority;
|
||||
|
||||
/// The timer for generating events with the specified update rate
|
||||
QTimer _timer;
|
||||
|
||||
/// The Logger instance
|
||||
Logger * _log;
|
||||
|
||||
// forwarding enabled
|
||||
bool _forward;
|
||||
|
||||
/// The processor for transforming images to led colors
|
||||
ImageProcessor * _processor;
|
||||
|
||||
};
|
@@ -156,7 +156,7 @@ public:
|
||||
/// @param component The component [SMOOTHING, BLACKBORDER, KODICHECKER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER]
|
||||
/// @param state The state of the component [true | false]
|
||||
///
|
||||
void setComponentState(const Components component, const bool state);
|
||||
void setComponentState(const hyperion::Components component, const bool state);
|
||||
public slots:
|
||||
///
|
||||
/// Writes a single color to all the leds for the given time and priority
|
||||
@@ -294,6 +294,8 @@ signals:
|
||||
/// This signal will not be emitted when a priority channel time out
|
||||
void allChannelsCleared();
|
||||
|
||||
void componentStateChanged(const hyperion::Components component, bool enabled);
|
||||
|
||||
private slots:
|
||||
///
|
||||
/// Updates the priority muxer with the current time and (re)writes the led color with applied
|
||||
|
@@ -41,6 +41,9 @@ public:
|
||||
/// Enable or disable the black border detector
|
||||
void enableBlackBorderDetector(bool enable);
|
||||
|
||||
/// Returns starte of black border detector
|
||||
bool blackBorderDetectorEnabled();
|
||||
|
||||
///
|
||||
/// Processes the image to a list of led colors. This will update the size of the buffer-image
|
||||
/// if required and call the image-to-leds mapping to determine the mean color per led.
|
||||
@@ -104,7 +107,6 @@ private:
|
||||
/// given led-string specification
|
||||
///
|
||||
/// @param[in] ledString The led-string specification
|
||||
/// @param[in] enableBlackBorderDetector Flag indicating if the blacborder detector should be enabled
|
||||
/// @param[in] blackborderThreshold The threshold which the blackborder detector should use
|
||||
///
|
||||
ImageProcessor(const LedString &ledString, const Json::Value &blackborderConfig);
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <utils/GrabbingMode.h>
|
||||
#include <utils/VideoMode.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Components.h>
|
||||
|
||||
///
|
||||
/// This class will check if KODI is playing something. When it does not, this class will send all black data to Hyperion.
|
||||
@@ -36,6 +37,8 @@ public:
|
||||
~KODIVideoChecker();
|
||||
void setConfig(const QString & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection);
|
||||
|
||||
bool componentState() { return _active; }
|
||||
|
||||
public slots:
|
||||
///
|
||||
/// Start polling KODI
|
||||
@@ -47,6 +50,8 @@ public slots:
|
||||
///
|
||||
void stop();
|
||||
|
||||
void componentStateChanged(const hyperion::Components component, bool enable);
|
||||
|
||||
signals:
|
||||
/// Signal emitted when the grabbing mode changes
|
||||
void grabbingMode(GrabbingMode grabbingMode);
|
||||
|
@@ -52,6 +52,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void sendImageToProtoSlaves(int priority, const Image<ColorRgb> & image, int duration_ms);
|
||||
void componentStateChanged(const hyperion::Components component, bool enable);
|
||||
|
||||
signals:
|
||||
///
|
||||
@@ -87,6 +88,10 @@ private:
|
||||
|
||||
/// Hyperion proto connection object for forwarding
|
||||
QList<ProtoConnection*> _proxy_connections;
|
||||
|
||||
|
||||
/// Logger instance
|
||||
Logger * _log;
|
||||
|
||||
/// flag if forwarder is enabled
|
||||
bool _forwarder_enabled;
|
||||
};
|
||||
|
@@ -11,6 +11,7 @@
|
||||
// Hyperion includes
|
||||
#include <hyperion/Hyperion.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Components.h>
|
||||
|
||||
class UDPClientConnection;
|
||||
|
||||
@@ -39,6 +40,7 @@ public:
|
||||
/// @return true if server is active (bind to a port)
|
||||
///
|
||||
bool active() { return _isActive; };
|
||||
bool componentState() { return active(); };
|
||||
|
||||
public slots:
|
||||
///
|
||||
@@ -51,6 +53,8 @@ public slots:
|
||||
///
|
||||
void stop();
|
||||
|
||||
void componentStateChanged(const hyperion::Components component, bool enable);
|
||||
|
||||
signals:
|
||||
void statusChanged(bool isActive);
|
||||
|
||||
|
@@ -1,30 +1,50 @@
|
||||
#pragma once
|
||||
#include <QString>
|
||||
|
||||
namespace hyperion
|
||||
{
|
||||
/**
|
||||
* Enumeration of components in Hyperion.
|
||||
*/
|
||||
enum Components
|
||||
{
|
||||
SMOOTHING,
|
||||
BLACKBORDER,
|
||||
KODICHECKER,
|
||||
FORWARDER,
|
||||
UDPLISTENER,
|
||||
BOBLIGHTSERVER,
|
||||
GRABBER
|
||||
COMP_INVALID,
|
||||
COMP_SMOOTHING,
|
||||
COMP_BLACKBORDER,
|
||||
COMP_KODICHECKER,
|
||||
COMP_FORWARDER,
|
||||
COMP_UDPLISTENER,
|
||||
COMP_BOBLIGHTSERVER,
|
||||
COMP_GRABBER
|
||||
};
|
||||
|
||||
inline const char* componentToString(Components c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case SMOOTHING: return "Smoothing option";
|
||||
case BLACKBORDER: return "Blackborder detector";
|
||||
case KODICHECKER: return "KodiVideoChecker";
|
||||
case FORWARDER: return "Json/Proto forwarder";
|
||||
case UDPLISTENER: return "UDP listener";
|
||||
case BOBLIGHTSERVER: return "Boblight server";
|
||||
case GRABBER: return "Framegrabber";
|
||||
default: return "";
|
||||
case COMP_SMOOTHING: return "Smoothing";
|
||||
case COMP_BLACKBORDER: return "Blackborder detector";
|
||||
case COMP_KODICHECKER: return "KodiVideoChecker";
|
||||
case COMP_FORWARDER: return "Json/Proto forwarder";
|
||||
case COMP_UDPLISTENER: return "UDP listener";
|
||||
case COMP_BOBLIGHTSERVER:return "Boblight server";
|
||||
case COMP_GRABBER: return "Framegrabber";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline Components stringToComponent(QString component)
|
||||
{
|
||||
component = component.toUpper();
|
||||
if (component == "SMOOTHING") return COMP_SMOOTHING;
|
||||
if (component == "BLACKBORDER") return COMP_BLACKBORDER;
|
||||
if (component == "KODICHECKER") return COMP_KODICHECKER;
|
||||
if (component == "FORWARDER") return COMP_FORWARDER;
|
||||
if (component == "UDPLISTENER") return COMP_UDPLISTENER;
|
||||
if (component == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER;
|
||||
if (component == "GRABBER") return COMP_GRABBER;
|
||||
|
||||
return COMP_INVALID;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user