2016-06-17 01:25:40 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
2017-08-12 07:55:32 +02:00
|
|
|
#include <QJsonObject>
|
2016-06-17 01:25:40 +02:00
|
|
|
|
|
|
|
#ifdef ENABLE_DISPMANX
|
|
|
|
#include <grabber/DispmanxWrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject DispmanxWrapper;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENABLE_V4L2
|
|
|
|
#include <grabber/V4L2Wrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject V4L2Wrapper;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENABLE_FB
|
|
|
|
#include <grabber/FramebufferWrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject FramebufferWrapper;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENABLE_AMLOGIC
|
|
|
|
#include <grabber/AmlogicWrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject AmlogicWrapper;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENABLE_OSX
|
|
|
|
#include <grabber/OsxWrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject OsxWrapper;
|
|
|
|
#endif
|
|
|
|
|
2016-07-24 15:18:34 +02:00
|
|
|
#ifdef ENABLE_X11
|
|
|
|
#include <grabber/X11Wrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject X11Wrapper;
|
|
|
|
#endif
|
|
|
|
|
2019-01-06 19:49:56 +01:00
|
|
|
#ifdef ENABLE_QT
|
|
|
|
#include <grabber/QtWrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject QtWrapper;
|
|
|
|
#endif
|
|
|
|
|
2016-06-19 00:56:47 +02:00
|
|
|
#include <utils/Logger.h>
|
2018-12-27 23:11:32 +01:00
|
|
|
#include <utils/Image.h>
|
|
|
|
#include <utils/VideoMode.h>
|
2016-06-19 00:56:47 +02:00
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
// settings management
|
|
|
|
#include <utils/settings.h>
|
2016-06-19 00:56:47 +02:00
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
class Hyperion;
|
2017-08-01 17:29:47 +02:00
|
|
|
class SysTray;
|
2018-12-27 23:11:32 +01:00
|
|
|
class JsonServer;
|
|
|
|
class UDPListener;
|
|
|
|
class BonjourBrowserWrapper;
|
|
|
|
class WebServer;
|
|
|
|
class SettingsManager;
|
|
|
|
class PythonInit;
|
2018-12-30 22:07:53 +01:00
|
|
|
class SSDPHandler;
|
2018-12-28 18:12:45 +01:00
|
|
|
class FlatBufferServer;
|
2019-02-17 15:26:11 +01:00
|
|
|
class ProtoServer;
|
2017-08-01 17:29:47 +02:00
|
|
|
|
2016-06-19 00:56:47 +02:00
|
|
|
class HyperionDaemon : public QObject
|
|
|
|
{
|
2017-01-22 14:31:11 +01:00
|
|
|
Q_OBJECT
|
2017-09-02 22:26:22 +02:00
|
|
|
|
2017-08-01 17:29:47 +02:00
|
|
|
friend SysTray;
|
|
|
|
|
2016-06-19 00:56:47 +02:00
|
|
|
public:
|
2018-12-28 18:12:45 +01:00
|
|
|
HyperionDaemon(QString configFile, QString rootPath, QObject *parent, const bool& logLvlOverwrite );
|
2016-06-19 00:56:47 +02:00
|
|
|
~HyperionDaemon();
|
2017-07-30 13:32:10 +02:00
|
|
|
|
2018-12-30 22:07:53 +01:00
|
|
|
///
|
|
|
|
/// @brief Get webserver pointer (systray)
|
|
|
|
///
|
|
|
|
WebServer* getWebServerInstance() { return _webserver; };
|
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
///
|
|
|
|
/// @brief Get the current videoMode
|
|
|
|
///
|
|
|
|
const VideoMode & getVideoMode() { return _currVideoMode; };
|
|
|
|
|
|
|
|
///
|
|
|
|
/// @brief get the settings
|
|
|
|
///
|
|
|
|
const QJsonDocument getSetting(const settings::type& type);
|
2016-06-19 00:56:47 +02:00
|
|
|
|
|
|
|
void startNetworkServices();
|
2016-06-17 01:25:40 +02:00
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
static HyperionDaemon* getInstance() { return daemon; };
|
|
|
|
static HyperionDaemon* daemon;
|
2016-06-17 01:25:40 +02:00
|
|
|
|
2017-01-22 14:31:11 +01:00
|
|
|
public slots:
|
|
|
|
void freeObjects();
|
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
signals:
|
|
|
|
///
|
|
|
|
/// @brief PIPE settings events from Hyperion class to HyperionDaemon components
|
|
|
|
///
|
|
|
|
void settingsChanged(const settings::type& type, const QJsonDocument& data);
|
|
|
|
|
|
|
|
///
|
|
|
|
/// @brief After eval of setVideoMode this signal emits with a new one on change
|
|
|
|
///
|
|
|
|
void videoMode(const VideoMode& mode);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
///
|
|
|
|
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
|
|
|
|
/// @param type settingyType from enum
|
|
|
|
/// @param config configuration object
|
|
|
|
///
|
|
|
|
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
|
|
|
|
|
|
|
|
///
|
|
|
|
/// @brief Listen for videoMode changes and emit videoMode in case of a change, update _currVideoMode
|
|
|
|
/// @param mode The requested video mode
|
|
|
|
///
|
|
|
|
void setVideoMode(const VideoMode& mode);
|
|
|
|
|
2016-06-19 00:56:47 +02:00
|
|
|
private:
|
2016-07-27 22:52:59 +02:00
|
|
|
void createGrabberDispmanx();
|
|
|
|
void createGrabberAmlogic();
|
2016-08-04 10:53:26 +02:00
|
|
|
void createGrabberFramebuffer(const QJsonObject & grabberConfig);
|
|
|
|
void createGrabberOsx(const QJsonObject & grabberConfig);
|
|
|
|
void createGrabberX11(const QJsonObject & grabberConfig);
|
2019-01-06 19:49:56 +01:00
|
|
|
void createGrabberQt(const QJsonObject & grabberConfig);
|
2016-07-24 15:18:34 +02:00
|
|
|
|
2019-02-17 15:26:11 +01:00
|
|
|
Logger* _log;
|
|
|
|
BonjourBrowserWrapper* _bonjourBrowserWrapper;
|
|
|
|
PythonInit* _pyInit;
|
|
|
|
WebServer* _webserver;
|
|
|
|
JsonServer* _jsonServer;
|
|
|
|
UDPListener* _udpListener;
|
2019-05-03 17:54:43 +02:00
|
|
|
V4L2Wrapper* _v4l2Grabber;
|
2019-02-17 15:26:11 +01:00
|
|
|
DispmanxWrapper* _dispmanx;
|
|
|
|
X11Wrapper* _x11Grabber;
|
|
|
|
AmlogicWrapper* _amlGrabber;
|
|
|
|
FramebufferWrapper* _fbGrabber;
|
|
|
|
OsxWrapper* _osxGrabber;
|
|
|
|
QtWrapper* _qtGrabber;
|
|
|
|
Hyperion* _hyperion;
|
|
|
|
SSDPHandler* _ssdp;
|
|
|
|
FlatBufferServer* _flatBufferServer;
|
|
|
|
ProtoServer* _protoServer;
|
|
|
|
|
|
|
|
unsigned _grabber_width;
|
|
|
|
unsigned _grabber_height;
|
|
|
|
unsigned _grabber_frequency;
|
|
|
|
unsigned _grabber_cropLeft;
|
|
|
|
unsigned _grabber_cropRight;
|
|
|
|
unsigned _grabber_cropTop;
|
|
|
|
unsigned _grabber_cropBottom;
|
|
|
|
int _grabber_ge2d_mode;
|
|
|
|
QString _grabber_device;
|
2018-12-31 15:48:29 +01:00
|
|
|
|
|
|
|
QString _prevType;
|
2018-12-27 23:11:32 +01:00
|
|
|
|
|
|
|
VideoMode _currVideoMode;
|
|
|
|
SettingsManager* _settingsManager;
|
2016-06-19 00:56:47 +02:00
|
|
|
};
|