Merge remote-tracking branch 'origin/master' into temperture

This commit is contained in:
LordGrey
2024-02-25 17:06:35 +01:00
319 changed files with 12512 additions and 6462 deletions

View File

@@ -2,6 +2,7 @@
// parent class
#include <api/API.h>
#include <events/EventEnum.h>
// hyperion includes
#include <utils/Components.h>
@@ -88,6 +89,11 @@ private slots:
///
void handleInstanceStateChange(InstanceState state, quint8 instance, const QString &name = QString());
///
/// @brief Stream a new LED Colors update
///
void streamLedColorsUpdate();
signals:
///
/// Signal emits with the reply message provided with handleMessage()
@@ -100,24 +106,9 @@ signals:
void forwardJsonMessage(QJsonObject);
///
/// Signal emits whenever a suspend/resume request for all instances should be forwarded
/// Signal emits whenever a hyperion event request for all instances should be forwarded
///
void suspendAll(bool isSuspend);
///
/// Signal emits whenever a toggle suspend/resume request for all instances should be forwarded
///
void toggleSuspendAll();
///
/// Signal emits whenever a idle mode request for all instances should be forwarded
///
void idleAll(bool isIdle);
///
/// Signal emits whenever a toggle idle/working mode request for all instances should be forwarded
///
void toggleIdleAll();
void signalEvent(Event event);
private:
// true if further callbacks are forbidden (http)

View File

@@ -1,4 +1,7 @@
#pragma once
#ifndef BLACK_BORDER_PROCESSOR_H
#define BLACK_BORDER_PROCESSOR_H
#include <memory>
// QT includes
#include <QJsonObject>
@@ -24,7 +27,7 @@ namespace hyperion
Q_OBJECT
public:
BlackBorderProcessor(Hyperion* hyperion, QObject* parent);
~BlackBorderProcessor() override;
///
/// Return the current (detected) border
/// @return The current border
@@ -141,7 +144,7 @@ namespace hyperion
QString _detectionMode;
/// The black-border detector
BlackBorderDetector* _detector;
std::unique_ptr<BlackBorderDetector> _detector;
/// The current detected border
BlackBorder _currentBorder;
@@ -162,3 +165,5 @@ namespace hyperion
};
} // end namespace hyperion
#endif // BLACK_BORDER_PROCESSOR_H

View File

@@ -1,8 +0,0 @@
#pragma once
enum class CECEvent
{
On,
Off
};

View File

@@ -2,12 +2,14 @@
#include <QObject>
#include <QVector>
#include <QMap>
#include <iostream>
#include <libcec/cec.h>
#include <cec/CECEvent.h>
#include <utils/settings.h>
#include <events/EventEnum.h>
using CECCallbacks = CEC::ICECCallbacks;
using CECAdapter = CEC::ICECAdapter;
@@ -30,19 +32,28 @@ class CECHandler : public QObject
{
Q_OBJECT
public:
CECHandler();
CECHandler(const QJsonDocument& config, QObject * parent = nullptr);
~CECHandler() override;
QString scan() const;
public slots:
bool start();
void stop();
signals:
void cecEvent(CECEvent event);
virtual void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
private:
signals:
void signalEvent(Event event);
private:
bool enable();
void disable();
/* CEC Callbacks */
static void onCecLogMessage (void * context, const CECLogMessage * message);
static void onCecKeyPress (void * context, const CECKeyPress * key);
@@ -57,6 +68,11 @@ private:
bool openAdapter(const CECAdapterDescriptor & descriptor);
void printAdapter(const CECAdapterDescriptor & descriptor) const;
// CEC Event Strings per https://github.com/Pulse-Eight/libcec/blob/master/src/libcec/CECTypeUtils.h
void triggerAction(const QString& cecEvent);
QJsonDocument _config;
/* CEC Helpers */
CECCallbacks getCallbacks() const;
CECConfig getConfig() const;
@@ -65,5 +81,15 @@ private:
CECCallbacks _cecCallbacks {};
CECConfig _cecConfig {};
bool _isInitialised;
bool _isOpen;
bool _isEnabled;
int _buttonReleaseDelayMs;
int _buttonRepeatRateMs;
int _doubleTapTimeoutMs;
QMap<QString,Event> _cecEventActionMap;
Logger * _logger {};
};

View File

@@ -36,6 +36,11 @@ public:
: Option(other), validator(validator)
{}
~ValidatorOption()
{
delete validator;
}
virtual const QValidator *getValidator() const;
virtual bool validate(Parser & parser, QString &value) override;
};

View File

@@ -112,6 +112,8 @@ public:
list << "jsonServer" << "protoServer" << "flatbufServer" << "forwarder" << "webConfig" << "network"
// capture
<< "framegrabber" << "grabberV4L2" << "grabberAudio"
//Events
<< "osEvents" << "cecEvents" << "schedEvents"
// other
<< "logger" << "general";

View File

@@ -0,0 +1,50 @@
#ifndef EVENTENUM_H
#define EVENTENUM_H
#include <QString>
enum class Event
{
Unknown,
Suspend,
Resume,
ToggleSuspend,
Idle,
ResumeIdle,
ToggleIdle,
Reload,
Restart
};
inline const char* eventToString(Event event)
{
switch (event)
{
case Event::Suspend: return "Suspend";
case Event::Resume: return "Resume";
case Event::ToggleSuspend: return "ToggleSuspend";
case Event::Idle: return "Idle";
case Event::ResumeIdle: return "ResumeIdle";
case Event::ToggleIdle: return "ToggleIdle";
case Event::Reload: return "Reload";
case Event::Restart: return "Restart";
case Event::Unknown:
default: return "Unknown";
}
}
inline Event stringToEvent(const QString& event)
{
if (event.compare("Suspend")==0) return Event::Suspend;
if (event.compare("Resume")==0) return Event::Resume;
if (event.compare("ToggleSuspend")==0) return Event::ToggleSuspend;
if (event.compare("Idle")==0) return Event::Idle;
if (event.compare("ResumeIdle")==0) return Event::ResumeIdle;
if (event.compare("ToggleIdle")==0) return Event::ToggleIdle;
if (event.compare("Reload")==0) return Event::Reload;
if (event.compare("Restart")==0) return Event::Restart;
return Event::Unknown;
}
#endif // EVENTENUM_H

View File

@@ -0,0 +1,49 @@
#ifndef EVENTHANDLER_H
#define EVENTHANDLER_H
#include <utils/settings.h>
#include <events/EventEnum.h>
#include <QObject>
class Logger;
class EventHandler : public QObject
{
Q_OBJECT
public:
EventHandler();
~EventHandler() override;
static EventHandler* getInstance();
public slots:
void suspend(bool sleep);
void suspend();
void resume();
void toggleSuspend();
void idle(bool isIdle);
void idle();
void resumeIdle();
void toggleIdle();
void handleEvent(Event event);
signals:
void signalEvent(Event event);
protected:
Logger * _log {};
private:
bool _isSuspended;
bool _isIdle;
};
#endif // EVENTHANDLER_H

View File

@@ -0,0 +1,55 @@
#ifndef EVENTSCHEDULER_H
#define EVENTSCHEDULER_H
#include <QObject>
#include <QJsonDocument>
#include <QTime>
#include <QTimer>
#include <events/EventEnum.h>
#include <utils/settings.h>
class Logger;
class EventScheduler : public QObject
{
Q_OBJECT
public:
EventScheduler();
~EventScheduler() override;
virtual void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
signals:
void signalEvent(Event event);
private slots:
void handleEvent(int timerIndex);
private:
struct timeEvent
{
QTime time;
Event action;
};
bool enable();
void disable();
int getMillisecondsToNextScheduledTime(const QTime& time);
void clearTimers();
QJsonDocument _config;
bool _isEnabled;
QList<timeEvent> _scheduledEvents;
QList<QTimer*> _timers;
Logger * _log {};
};
#endif // EVENTSCHEDULER_H

View File

@@ -0,0 +1,141 @@
#ifndef OSEVENTHANDLER_H
#define OSEVENTHANDLER_H
#include <QObject>
#include <QJsonDocument>
#include <events/EventEnum.h>
#if defined(_WIN32)
#include <QAbstractNativeEventFilter>
#include <QAbstractEventDispatcher>
#include <QWidget>
#include <windows.h>
#include <powrprof.h>
#endif
#include <utils/settings.h>
class Logger;
class OsEventHandlerBase : public QObject
{
Q_OBJECT
public:
OsEventHandlerBase();
virtual ~OsEventHandlerBase();
public slots:
void suspend(bool sleep);
void lock(bool isLocked);
virtual void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
signals:
void signalEvent(Event event);
protected:
virtual bool registerOsEventHandler() { return true; }
virtual void unregisterOsEventHandler() {}
virtual bool registerLockHandler() { return true; }
virtual void unregisterLockHandler() {}
bool _isSuspendEnabled;
bool _isLockEnabled;
bool _isSuspendOnLock;
bool _isSuspendRegistered;
bool _isLockRegistered;
bool _isService;
Logger* _log{};
};
#if defined(_WIN32)
class OsEventHandlerWindows : public OsEventHandlerBase, public QAbstractNativeEventFilter
{
public:
OsEventHandlerWindows();
~OsEventHandlerWindows();
void handleSuspendResumeEvent(bool sleep);
protected:
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
bool nativeEventFilter(const QByteArray& eventType, void* message, qintptr* result) override;
#else
bool nativeEventFilter(const QByteArray& eventType, void* message, long int* result) override;
#endif
bool registerOsEventHandler() override;
void unregisterOsEventHandler() override;
bool registerLockHandler() override;
void unregisterLockHandler() override;
private:
static OsEventHandlerWindows* getInstance();
static DEVICE_NOTIFY_CALLBACK_ROUTINE handlePowerNotifications;
QWidget* _widget;
HPOWERNOTIFY _notifyHandle;
};
using OsEventHandler = OsEventHandlerWindows;
#elif defined(__linux__)
class OsEventHandlerLinux : public OsEventHandlerBase
{
Q_OBJECT
static void static_signaleHandler(int signum)
{
OsEventHandlerLinux::getInstance()->handleSignal(signum);
}
public:
OsEventHandlerLinux();
void handleSignal(int signum);
private:
static OsEventHandlerLinux* getInstance();
#if defined(HYPERION_HAS_DBUS)
bool registerOsEventHandler() override;
void unregisterOsEventHandler() override;
bool registerLockHandler() override;
void unregisterLockHandler() override;
#endif
};
using OsEventHandler = OsEventHandlerLinux;
#elif defined(__APPLE__)
class OsEventHandlerMacOS : public OsEventHandlerBase
{
Q_OBJECT
public:
OsEventHandlerMacOS();
private:
bool registerOsEventHandler() override;
void unregisterOsEventHandler() override;
bool registerLockHandler() override;
void unregisterLockHandler() override;
void* _sleepEventHandler;
void* _lockEventHandler;
};
using OsEventHandler = OsEventHandlerMacOS;
#else
using OsEventHandler = OsEventHandlerBase;
#endif
#endif // OSEVENTHANDLER_H

View File

@@ -1,93 +0,0 @@
#pragma once
#ifndef __APPLE__
/*
* this is a mock up for compiling and testing osx wrapper on no osx platform.
* this will show a test image and rotate the colors.
*
* see https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.8.sdk/System/Library/Frameworks/CoreGraphics.framework/Versions/A/Headers
*
*/
#include <utils/Image.h>
#include <utils/ColorRgb.h>
enum _CGError {
kCGErrorSuccess = 0,
kCGErrorFailure = 1000,
kCGErrorIllegalArgument = 1001,
kCGErrorInvalidConnection = 1002,
kCGErrorInvalidContext = 1003,
kCGErrorCannotComplete = 1004,
kCGErrorNotImplemented = 1006,
kCGErrorRangeCheck = 1007,
kCGErrorTypeCheck = 1008,
kCGErrorInvalidOperation = 1010,
kCGErrorNoneAvailable = 1011,
/* Obsolete errors. */
kCGErrorNameTooLong = 1005,
kCGErrorNoCurrentPoint = 1009,
kCGErrorApplicationRequiresNewerSystem = 1015,
kCGErrorApplicationNotPermittedToExecute = 1016,
kCGErrorApplicationIncorrectExecutableFormatFound = 1023,
kCGErrorApplicationIsLaunching = 1024,
kCGErrorApplicationAlreadyRunning = 1025,
kCGErrorApplicationCanOnlyBeRunInOneSessionAtATime = 1026,
kCGErrorClassicApplicationsMustBeLaunchedByClassic = 1027,
kCGErrorForkFailed = 1028,
kCGErrorRetryRegistration = 1029,
kCGErrorFirst = 1000,
kCGErrorLast = 1029
};
typedef int32_t CGError;
typedef double CGFloat;
struct CGSize {
CGFloat width;
CGFloat height;
};
typedef struct CGSize CGSize;
struct CGPoint {
float x;
float y;
};
typedef struct CGPoint CGPoint;
struct CGRect {
CGPoint origin;
CGSize size;
};
typedef struct CGRect CGRect;
typedef CGError CGDisplayErr;
typedef uint32_t CGDirectDisplayID;
typedef uint32_t CGDisplayCount;;
typedef struct CGDisplayMode *CGDisplayModeRef;
typedef Image<ColorRgb> CGImage;
typedef CGImage* CGImageRef;
typedef unsigned char CFData;
typedef CFData* CFDataRef;
const int kCGDirectMainDisplay = 0;
CGError CGGetActiveDisplayList(uint32_t maxDisplays, CGDirectDisplayID *activeDisplays, uint32_t *displayCount);
CGDisplayModeRef CGDisplayCopyDisplayMode(CGDirectDisplayID display);
CGRect CGDisplayBounds(CGDirectDisplayID display);
void CGDisplayModeRelease(CGDisplayModeRef mode);
CGImageRef CGDisplayCreateImage(CGDirectDisplayID display);
void CGImageRelease(CGImageRef image);
CGImageRef CGImageGetDataProvider(CGImageRef image);
CFDataRef CGDataProviderCopyData(CGImageRef image);
unsigned char* CFDataGetBytePtr(CFDataRef imgData);
unsigned CGImageGetWidth(CGImageRef image);
unsigned CGImageGetHeight(CGImageRef image);
unsigned CGImageGetBitsPerPixel(CGImageRef image);
unsigned CGImageGetBytesPerRow(CGImageRef image);
void CFRelease(CFDataRef imgData);
#endif

View File

@@ -4,7 +4,7 @@
#include <utils/ColorBgr.h>
#include <utils/ColorRgba.h>
#include <hyperion/Grabber.h>
#include <grabber/FramebufferFrameGrabber.h>
#include <grabber/framebuffer/FramebufferFrameGrabber.h>
///
///

View File

@@ -1,7 +1,7 @@
#pragma once
#include <hyperion/GrabberWrapper.h>
#include <grabber/AmlogicGrabber.h>
#include <grabber/amlogic/AmlogicGrabber.h>
///
/// The Amlogic uses an instance of the AmlogicGrabber to obtain ImageRgb's from the

View File

@@ -6,7 +6,7 @@
#include <alsa/asoundlib.h>
// Hyperion-utils includes
#include <grabber/AudioGrabber.h>
#include <grabber/audio/AudioGrabber.h>
///
/// @brief The Linux Audio capture implementation
@@ -18,74 +18,69 @@ class AudioGrabberLinux : public AudioGrabber
AudioGrabberLinux();
~AudioGrabberLinux() override;
///
///
/// Process audio buffer
///
void processAudioBuffer(snd_pcm_sframes_t frames);
///
///
/// Is Running Flag
///
std::atomic<bool> _isRunning;
///
///
/// Current capture device
///
snd_pcm_t * _captureDevice;
public slots:
///
///
/// Start audio capturing session
///
/// @returns true if successful
bool start() override;
///
///
/// Stop audio capturing session
///
void stop() override;
///
///
/// Discovery audio devices
///
QJsonArray discover(const QJsonObject& params) override;
private:
///
///
/// Refresh audio devices
///
void refreshDevices();
///
///
/// Configure current audio capture interface
///
bool configureCaptureInterface();
///
///
/// Get device name from path
///
QString getDeviceName(const QString& devicePath) const;
///
///
/// Current sample rate
///
unsigned int _sampleRate;
///
///
/// Audio capture thread
///
pthread_t _audioThread;
///
///
/// ALSA device configuration parameters
///
snd_pcm_hw_params_t * _captureDeviceConfig;
};
///
/// Audio processing thread function
///
static void* AudioThreadRunner(void* params);
#endif // AUDIOGRABBERLINUX_H

View File

@@ -2,7 +2,7 @@
#define AUDIOGRABBERWINDOWS_H
// Hyperion-utils includes
#include <grabber/AudioGrabber.h>
#include <grabber/audio/AudioGrabber.h>
#include <DSound.h>
///
@@ -14,7 +14,7 @@ class AudioGrabberWindows : public AudioGrabber
AudioGrabberWindows();
~AudioGrabberWindows() override;
public slots:
bool start() override;
void stop() override;
@@ -39,8 +39,8 @@ class AudioGrabberWindows : public AudioGrabber
HANDLE notificationEvent;
std::atomic<bool> isRunning{ false };
static BOOL CALLBACK DirectSoundEnumProcessor(LPGUID deviceIdGuid, LPCTSTR deviceDescStr,
LPCTSTR deviceModelStr, LPVOID context)
static BOOL CALLBACK DirectSoundEnumProcessor(LPGUID deviceIdGuid, LPCWSTR deviceDescStr,
LPCWSTR deviceModelStr, LPVOID context)
{
// Skip undefined audio devices
if (deviceIdGuid == NULL)
@@ -50,12 +50,15 @@ static BOOL CALLBACK DirectSoundEnumProcessor(LPGUID deviceIdGuid, LPCTSTR devic
AudioGrabber::DeviceProperties device;
// Process Device Information
QString deviceName = QString::fromWCharArray(deviceDescStr);
// Process Device ID
LPOLESTR deviceIdStr;
HRESULT res = StringFromCLSID(*deviceIdGuid, &deviceIdStr);
if (FAILED(res))
{
Error(Logger::getInstance("AUDIOGRABBER"), "Failed to get CLSID-string for %s with error: 0x%08x: %s", deviceDescStr, res, std::system_category().message(res).c_str());
Error(Logger::getInstance("AUDIOGRABBER"), "Failed to get CLSID-string for %s with error: 0x%08x: %s", QSTRING_CSTR(deviceName), res, std::system_category().message(res).c_str());
return FALSE;
}
@@ -63,10 +66,7 @@ static BOOL CALLBACK DirectSoundEnumProcessor(LPGUID deviceIdGuid, LPCTSTR devic
CoTaskMemFree(deviceIdStr);
// Process Device Information
QString deviceName = QString::fromLocal8Bit(deviceDescStr);
Debug(Logger::getInstance("AUDIOGRABBER"), "Found Audio Device: %s", deviceDescStr);
Debug(Logger::getInstance("AUDIOGRABBER"), "Found Audio Device: %s", QSTRING_CSTR(deviceName));
device.id = deviceId;
device.name = deviceName;

View File

@@ -3,14 +3,14 @@
#include <hyperion/GrabberWrapper.h>
#ifdef WIN32
#include <grabber/AudioGrabberWindows.h>
#include <grabber/audio/AudioGrabberWindows.h>
#endif
#ifdef __linux__
#include <grabber/AudioGrabberLinux.h>
#include <grabber/audio/AudioGrabberLinux.h>
#endif
///
///
/// Audio Grabber wrapper
///
class AudioWrapper : public GrabberWrapper
@@ -32,7 +32,7 @@ class AudioWrapper : public GrabberWrapper
///
~AudioWrapper() override;
///
///
/// Settings update handler
///
void handleSettingsUpdate(settings::type type, const QJsonDocument& config) override;
@@ -43,13 +43,13 @@ class AudioWrapper : public GrabberWrapper
///
void action() override;
///
///
/// Start audio capturing session
///
/// @returns true if successful
bool start() override;
///
///
/// Stop audio capturing session
///
void stop() override;

View File

@@ -1,7 +1,7 @@
#pragma once
#include <hyperion/GrabberWrapper.h>
#include <grabber/DirectXGrabber.h>
#include <grabber/directx/DirectXGrabber.h>
class DirectXWrapper: public GrabberWrapper
{

View File

@@ -3,7 +3,7 @@
// Utils includes
#include <utils/ColorRgba.h>
#include <hyperion/GrabberWrapper.h>
#include <grabber/DispmanxFrameGrabber.h>
#include <grabber/dispmanx/DispmanxFrameGrabber.h>
///
/// The DispmanxWrapper uses an instance of the DispmanxFrameGrabber to obtain ImageRgb's from the

View File

@@ -1,7 +1,7 @@
#pragma once
#include <hyperion/GrabberWrapper.h>
#include <grabber/FramebufferFrameGrabber.h>
#include <grabber/framebuffer/FramebufferFrameGrabber.h>
///
/// The FramebufferWrapper uses an instance of the FramebufferFrameGrabber to obtain ImageRgb's from the

View File

@@ -1,11 +1,7 @@
#pragma once
// OSX includes
#ifdef __APPLE__
#include <CoreGraphics/CoreGraphics.h>
#else
#include <grabber/OsxFrameGrabberMock.h>
#endif
// Utils includes
#include <utils/ColorRgb.h>

View File

@@ -1,7 +1,7 @@
#pragma once
#include <hyperion/GrabberWrapper.h>
#include <grabber/OsxFrameGrabber.h>
#include <grabber/osx/OsxFrameGrabber.h>
///
/// The OsxWrapper uses an instance of the OsxFrameGrabber to obtain ImageRgb's from the displayed content.

View File

@@ -113,8 +113,8 @@ private:
int _display;
int _numberOfSDisplays;
int _calculatedWidth;
int _calculatedHeight;
int _screenWidth;
int _screenHeight;
int _src_x;
int _src_y;
int _src_x_max;

View File

@@ -1,7 +1,7 @@
#pragma once
#include <hyperion/GrabberWrapper.h>
#include <grabber/QtGrabber.h>
#include <grabber/qt/QtGrabber.h>
///
/// The QtWrapper uses QtFramework API's to get a picture from system

View File

@@ -136,11 +136,11 @@ class EncoderThreadManager : public QObject
public:
explicit EncoderThreadManager(QObject *parent = nullptr)
: QObject(parent)
, _threadCount(static_cast<unsigned long>(qMax(QThread::idealThreadCount(), DEFAULT_THREAD_COUNT)))
, _threadCount(qMax(QThread::idealThreadCount(), DEFAULT_THREAD_COUNT))
, _threads(nullptr)
{
_threads = new Thread<EncoderThread>*[_threadCount];
for (unsigned long i = 0; i < _threadCount; i++)
for (int i = 0; i < _threadCount; i++)
{
_threads[i] = new Thread<EncoderThread>(new EncoderThread, this);
_threads[i]->setObjectName("Encoder " + QString::number(i));
@@ -151,7 +151,7 @@ public:
{
if (_threads != nullptr)
{
for(unsigned long i = 0; i < _threadCount; i++)
for(int i = 0; i < _threadCount; i++)
{
_threads[i]->deleteLater();
_threads[i] = nullptr;
@@ -165,18 +165,18 @@ public:
void start()
{
if (_threads != nullptr)
for (unsigned long i = 0; i < _threadCount; i++)
for (int i = 0; i < _threadCount; i++)
connect(_threads[i]->thread(), &EncoderThread::newFrame, this, &EncoderThreadManager::newFrame);
}
void stop()
{
if (_threads != nullptr)
for(unsigned long i = 0; i < _threadCount; i++)
for(int i = 0; i < _threadCount; i++)
disconnect(_threads[i]->thread(), nullptr, nullptr, nullptr);
}
unsigned long _threadCount;
int _threadCount;
Thread<EncoderThread>** _threads;
signals:

View File

@@ -4,13 +4,9 @@
#include <hyperion/GrabberWrapper.h>
#if defined(ENABLE_MF)
#include <grabber/MFGrabber.h>
#include <grabber/video/mediafoundation/MFGrabber.h>
#elif defined(ENABLE_V4L2)
#include <grabber/V4L2Grabber.h>
#endif
#if defined(ENABLE_CEC)
#include <cec/CECEvent.h>
#include <grabber/video/v4l2/V4L2Grabber.h>
#endif
class VideoWrapper : public GrabberWrapper
@@ -25,10 +21,6 @@ public slots:
bool start() override;
void stop() override;
#if defined(ENABLE_CEC)
void handleCecEvent(CECEvent event);
#endif
void handleSettingsUpdate(settings::type type, const QJsonDocument& config) override;
private slots:

View File

@@ -21,7 +21,7 @@
#include <hyperion/Grabber.h>
// decoder thread includes
#include <grabber/EncoderThread.h>
#include <grabber/video/EncoderThread.h>
/// Forward class declaration
class SourceReaderCB;

View File

@@ -19,14 +19,12 @@
#include <utils/Components.h>
// decoder thread includes
#include <grabber/EncoderThread.h>
#include <grabber/video/EncoderThread.h>
// Determine the cmake options
#include <HyperionConfig.h>
#if defined(ENABLE_CEC)
#include <cec/CECEvent.h>
#endif
#include <events/EventEnum.h>
///
/// Capture class for V4L2 devices
@@ -77,13 +75,10 @@ public:
void setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold, int noSignalCounterThreshold = 50);
void setSignalDetectionOffset( double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
void setSignalDetectionEnable(bool enable);
void setCecDetectionEnable(bool enable);
bool reload(bool force = false);
QRectF getSignalDetectionOffset() const { return QRectF(_x_frac_min, _y_frac_min, _x_frac_max, _y_frac_max); } //used from hyperion-v4l2
///
/// @brief Discover available V4L2 USB devices (for configuration).
/// @param[in] params Parameters used to overwrite discovery default behaviour
@@ -97,10 +92,6 @@ public slots:
void stop();
void newThreadFrame(Image<ColorRgb> image);
#if defined(ENABLE_CEC)
void handleCecEvent(CECEvent event);
#endif
signals:
void newFrame(const Image<ColorRgb> & image);
void readError(const char* err);
@@ -167,7 +158,7 @@ private:
// signal detection
int _noSignalCounterThreshold;
ColorRgb _noSignalThresholdColor;
bool _cecDetectionEnabled, _cecStandbyActivated, _signalDetectionEnabled, _noSignalDetected;
bool _standbyActivated, _signalDetectionEnabled, _noSignalDetected;
int _noSignalCounter;
int _brightness, _contrast, _saturation, _hue;
double _x_frac_min;

View File

@@ -57,7 +57,7 @@ public:
///
/// @brief Apply new width/height values, overwrite Grabber.h implementation as X11 doesn't use width/height, just pixelDecimation to calc dimensions
///
bool setWidthHeight(int width, int height) override { return true; }
bool setWidthHeight(int /*width*/, int /*height*/) override { return true; }
///
/// @brief Apply new pixelDecimation
@@ -109,19 +109,19 @@ private:
Picture _srcPicture;
Picture _dstPicture;
int _XRandREventBase;
int _xRandREventBase;
XTransform _transform;
unsigned _calculatedWidth;
unsigned _calculatedHeight;
unsigned _src_x;
unsigned _src_y;
int _screenWidth;
int _screenHeight;
int _src_x;
int _src_y;
bool _XShmAvailable;
bool _XShmPixmapAvailable;
bool _XRenderAvailable;
bool _XRandRAvailable;
bool _xShmAvailable;
bool _xShmPixmapAvailable;
bool _xRenderAvailable;
bool _xRandRAvailable;
bool _isWayland;
Logger * _logger;

View File

@@ -1,7 +1,7 @@
#pragma once
#include <hyperion/GrabberWrapper.h>
#include <grabber/X11Grabber.h>
#include <grabber/x11/X11Grabber.h>
// some include of xorg defines "None" this is also used by QT and has to be undefined to avoid collisions
#ifdef None
#undef None

View File

@@ -1,7 +1,7 @@
#pragma once
#include <hyperion/GrabberWrapper.h>
#include <grabber/XcbGrabber.h>
#include <grabber/xcb/XcbGrabber.h>
// some include of xorg defines "None" this is also used by QT and has to be undefined to avoid collisions
#ifdef None

View File

@@ -43,6 +43,16 @@ public:
handleSettingsUpdate(settings::BGEFFECT, _hyperion->getSetting(settings::BGEFFECT));
}
///
/// @brief Disconnect from connected signals
/// Disconnect should be done before other priorities invoke methods during shutdown
///
void disconnect()
{
QObject::disconnect(_prioMuxer, &PriorityMuxer::prioritiesChanged, nullptr, nullptr);
QObject::disconnect(_hyperion, nullptr, nullptr, nullptr);
}
///
/// @brief Check, if background effect processing is enabled.
/// @return True, background effect processing is enabled.

View File

@@ -16,21 +16,21 @@ public:
QString _id;
/// The BLACK (RGB-Channel) adjustment
RgbChannelAdjustment _rgbBlackAdjustment;
RgbChannelAdjustment _rgbBlackAdjustment {0, 0, 0, "black"};
/// The WHITE (RGB-Channel) adjustment
RgbChannelAdjustment _rgbWhiteAdjustment;
RgbChannelAdjustment _rgbWhiteAdjustment{255, 255, 255, "white"};
/// The RED (RGB-Channel) adjustment
RgbChannelAdjustment _rgbRedAdjustment;
RgbChannelAdjustment _rgbRedAdjustment {255, 0, 0 , "red"};
/// The GREEN (RGB-Channel) adjustment
RgbChannelAdjustment _rgbGreenAdjustment;
RgbChannelAdjustment _rgbGreenAdjustment {0, 255, 0, "green"};
/// The BLUE (RGB-Channel) adjustment
RgbChannelAdjustment _rgbBlueAdjustment;
RgbChannelAdjustment _rgbBlueAdjustment {0, 0, 255, "blue"};
/// The CYAN (RGB-Channel) adjustment
RgbChannelAdjustment _rgbCyanAdjustment;
RgbChannelAdjustment _rgbCyanAdjustment {0, 255, 255, "cyan"};
/// The MAGENTA (RGB-Channel) adjustment
RgbChannelAdjustment _rgbMagentaAdjustment;
RgbChannelAdjustment _rgbMagentaAdjustment {255, 0, 255, "magenta"};
/// The YELLOW (RGB-Channel) adjustment
RgbChannelAdjustment _rgbYellowAdjustment;
RgbChannelAdjustment _rgbYellowAdjustment {255, 255, 0, "yellow"};
RgbTransform _rgbTransform;
OkhsvTransform _okhsvTransform;

View File

@@ -11,6 +11,8 @@
#include <utils/Logger.h>
#include <utils/Components.h>
#include <events/EventEnum.h>
///
/// @brief The Grabber class is responsible to apply image resizes (with or without ImageResampler)
@@ -111,6 +113,10 @@ public:
QString getGrabberName() const { return _grabberName; }
public slots:
virtual void handleEvent(Event event) {}
protected slots:
///
/// @brief Set device in error state

View File

@@ -6,6 +6,7 @@
#include <QString>
#include <QStringList>
#include <QMultiMap>
#include <QScopedPointer>
#include <utils/Logger.h>
#include <utils/Components.h>
@@ -18,6 +19,8 @@
#include <grabber/GrabberType.h>
#include <events/EventEnum.h>
class Grabber;
class GlobalSignals;
class QTimer;
@@ -89,8 +92,8 @@ public:
template <typename Grabber_T>
bool transferFrame(Grabber_T &grabber)
{
unsigned w = grabber.getImageWidth();
unsigned h = grabber.getImageHeight();
int w = grabber.getImageWidth();
int h = grabber.getImageHeight();
if ( _image.width() != w || _image.height() != h)
{
_image.resize(w, h);
@@ -139,6 +142,8 @@ public slots:
///
virtual void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
void handleEvent(Event event);
signals:
///
/// @brief Emit the final processed image
@@ -181,7 +186,7 @@ protected:
Logger * _log;
/// The timer for generating events with the specified update rate
QTimer* _timer;
QScopedPointer<QTimer> _timer;
/// The calculated update rate [ms]
int _updateInterval_ms;

View File

@@ -5,6 +5,7 @@
#include <utils/VideoMode.h>
#include <utils/settings.h>
#include <utils/Components.h>
#include <events/EventEnum.h>
// qt
#include <QMap>
@@ -74,20 +75,10 @@ public slots:
bool stopInstance(quint8 inst);
///
/// @brief Suspend (disable) all Hyperion instances
/// @brief Handle an Hyperion Event
/// @param event Event to be processed
///
void suspend();
///
/// @brief Resume (resume) all Hyperion instances
///
void resume();
///
/// @brief Toggle the state of all Hyperion instances for an idle sceanrio (user is not interacting with the system
/// @param isIdle, If true all instances toggle to idle, else to resume
///
void toggleIdle(bool isIdle);
void handleEvent(Event event);
///
/// @brief Toggle the state of all Hyperion instances
@@ -141,10 +132,6 @@ signals:
///
void startInstanceResponse(QObject *caller, const int &tan);
void triggerSuspend(bool isSuspend);
void triggerToggleSuspend();
void triggerIdle(bool isIdle);
void triggerToggleIdle();
signals:
///////////////////////////////////////
@@ -186,6 +173,18 @@ private slots:
///
void handleFinished();
///
/// @brief Toggle the state of all Hyperion instances for a suspend sceanrio (user is not interacting with the system)
/// @param isSuspend, If true all instances toggle to suspend, else to resume
///
void toggleSuspend(bool isSuspend);
///
/// @brief Toggle the state of all Hyperion instances for an idle sceanrio
/// @param isIdle, If true all instances toggle to idle, else to resume
///
void toggleIdle(bool isIdle);
private:
friend class HyperionDaemon;
///

View File

@@ -413,9 +413,13 @@ namespace hyperion
}
// Compute the average of each color channel
const uint8_t avgRed = uint8_t(std::min(std::lround(sqrt(static_cast<double>(cummRed/pixelNum))), 255L));
const uint8_t avgGreen = uint8_t(std::min(std::lround(sqrt(static_cast<double>(cummGreen/pixelNum))), 255L));
const uint8_t avgBlue = uint8_t(std::min(std::lround(sqrt(static_cast<double>(cummBlue/pixelNum))), 255L));
#ifdef WIN32
#undef min
#endif
const uint8_t avgRed = static_cast<uint8_t>(std::min(std::lround(std::sqrt(static_cast<double>(cummRed / pixelNum))), 255L));
const uint8_t avgGreen = static_cast<uint8_t>(std::min(std::lround(sqrt(static_cast<double>(cummGreen / pixelNum))), 255L));
const uint8_t avgBlue = static_cast<uint8_t>(std::min(std::lround(sqrt(static_cast<double>(cummBlue / pixelNum))), 255L));
// Return the computed color
return {avgRed, avgGreen, avgBlue};
@@ -551,7 +555,7 @@ namespace hyperion
if (pixelNum > 0)
{
// initial cluster with different colors
auto clusters = std::unique_ptr< ColorCluster<ColorRgbScalar> >(new ColorCluster<ColorRgbScalar>[_clusterCount]);
std::unique_ptr<ColorCluster<ColorRgbScalar>[]> clusters(new ColorCluster<ColorRgbScalar>[_clusterCount]);
for(int k = 0; k < _clusterCount; ++k)
{
clusters.get()[k].newColor = DEFAULT_CLUSTER_COLORS[k];

View File

@@ -10,6 +10,7 @@
// QT includes
#include <QString>
#include <QJsonArray>
// Forward class declarations
namespace Json { class Value; }
@@ -73,7 +74,7 @@ inline ColorOrder stringToColorOrder(const QString & order)
}
///
/// The Led structure contains the definition of the image portion used to determine a single led's
/// The Led structure contains the definition of the image portion used to determine a single LED's
/// color.
/// @verbatim
/// |--------------------image--|
@@ -89,39 +90,66 @@ inline ColorOrder stringToColorOrder(const QString & order)
///
struct Led
{
/// The minimum vertical scan line included for this leds color
/// The minimum vertical scan line included for this LEDs color
double minX_frac;
/// The maximum vertical scan line included for this leds color
/// The maximum vertical scan line included for this LEDs color
double maxX_frac;
/// The minimum horizontal scan line included for this leds color
/// The minimum horizontal scan line included for this LEDs color
double minY_frac;
/// The maximum horizontal scan line included for this leds color
/// The maximum horizontal scan line included for this LEDs color
double maxY_frac;
/// A LEDs at {0,0,0,0} is not visible and therefore treated as blacklisted
bool isBlacklisted {false};
/// the color order
ColorOrder colorOrder;
};
///
/// The LedString contains the image integration information of the leds
/// The LedString contains the image integration information of the LEDs
///
class LedString
{
public:
///
/// Returns the led specifications
/// Returns the LED specifications
///
/// @return The list with led specifications
///
std::vector<Led>& leds();
///
/// Returns the led specifications
/// Returns the LED specifications
///
/// @return The list with led specifications
///
const std::vector<Led>& leds() const;
///
/// Returns the IDs of blacklisted LEDs
///
/// @return ID List of blacklisted LEDs
///
std::vector<int>& blacklistedLedIds();
///
/// Returns the IDs of blacklisted LEDs
///
/// @return ID List of blacklisted LEDs
///
const std::vector<int>& blacklistedLedIds() const;
///
/// Check, if teh layout has blacklisted LEDs configured
///
/// @return True, if blacklisted LEDs are configured
///
bool hasBlackListedLeds ();
static LedString createLedString(const QJsonArray& ledConfigArray, const ColorOrder deviceOrder);
private:
/// The list with led specifications
std::vector<Led> mLeds;
/// The list with LED specifications
std::vector<Led> _leds;
/// The list containing IDs of blacklisted LED
std::vector<int> _blacklistedLedIds;
};

View File

@@ -2,7 +2,6 @@
#define MDNS_BROWSER_H
#include <chrono>
#include <type_traits>
#include <qmdnsengine/server.h>
#include <qmdnsengine/service.h>
@@ -16,6 +15,9 @@
// Qt includes
#include <QObject>
#include <QByteArray>
#include <QMap>
#include <QJsonArray>
#include <QSharedPointer>
// Utility includes
#include <utils/Logger.h>
@@ -24,15 +26,12 @@
namespace {
constexpr std::chrono::milliseconds DEFAULT_DISCOVER_TIMEOUT{ 500 };
constexpr std::chrono::milliseconds DEFAULT_ADDRESS_RESOLVE_TIMEOUT{ 1000 };
} //End of constants
} // End of constants
class MdnsBrowser : public QObject
{
Q_OBJECT
// Run MdnsBrowser as singleton
private:
///
/// @brief Browse for hyperion services in bonjour, constructed from HyperionDaemon
@@ -58,7 +57,6 @@ public:
QMdnsEngine::Service getFirstService(const QByteArray& serviceType, const QString& filter = ".*", const std::chrono::milliseconds waitTime = DEFAULT_DISCOVER_TIMEOUT) const;
QJsonArray getServicesDiscoveredJson(const QByteArray& serviceType, const QString& filter = ".*", const std::chrono::milliseconds waitTime = std::chrono::milliseconds{ 0 }) const;
void printCache(const QByteArray& name = QByteArray(), quint16 type = QMdnsEngine::ANY) const;
public slots:
@@ -109,8 +107,9 @@ private:
QMdnsEngine::Server _server;
QMdnsEngine::Cache _cache;
QSharedPointer<QMdnsEngine::Resolver> _resolver;
QMap<QByteArray, QMdnsEngine::Browser*> _browsedServiceTypes;
QMap<QByteArray, QSharedPointer<QMdnsEngine::Browser>> _browsedServiceTypes;
};
#endif // MDNSBROWSER_H

View File

@@ -9,6 +9,7 @@
// Qt includes
#include <QObject>
#include <QByteArray>
#include <QScopedPointer>
// Utility includes
#include <utils/Logger.h>
@@ -41,11 +42,11 @@ private:
/// The logger instance for mDNS-Service
Logger* _log;
QMdnsEngine::Server* _server;
QMdnsEngine::Hostname* _hostname;
QScopedPointer<QMdnsEngine::Server> _server;
QScopedPointer<QMdnsEngine::Hostname> _hostname;
/// map of services provided
QMap<QByteArray, QMdnsEngine::Provider*> _providedServiceTypes;
QMap<QByteArray, QSharedPointer<QMdnsEngine::Provider>> _providedServiceTypes;
};
#endif // MDNSPROVIDER_H

View File

@@ -15,9 +15,8 @@ public:
{
}
Image(unsigned width, unsigned height) :
Image(int width, int height) :
Image(width, height, Pixel_T())
{
}
@@ -28,7 +27,7 @@ public:
/// @param height The height of the image
/// @param background The color of the image
///
Image(unsigned width, unsigned height, const Pixel_T background) :
Image(int width, int height, const Pixel_T background) :
_d_ptr(new ImageData<Pixel_T>(width, height, background))
{
}
@@ -78,7 +77,7 @@ public:
///
/// @return The width of the image
///
inline unsigned width() const
inline int width() const
{
return _d_ptr->width();
}
@@ -88,7 +87,7 @@ public:
///
/// @return The height of the image
///
inline unsigned height() const
inline int height() const
{
return _d_ptr->height();
}
@@ -111,7 +110,7 @@ public:
///
/// @return const reference to specified pixel
///
uint8_t blue(unsigned pixel) const
uint8_t blue(int pixel) const
{
return _d_ptr->blue(pixel);
}
@@ -121,7 +120,7 @@ public:
///
/// @param x The x index
/// @param y The y index
const Pixel_T& operator()(unsigned x, unsigned y) const
const Pixel_T& operator()(int x, int y) const
{
return _d_ptr->operator()(x, y);
}
@@ -129,7 +128,7 @@ public:
///
/// @return reference to specified pixel
///
Pixel_T& operator()(unsigned x, unsigned y)
Pixel_T& operator()(int x, int y)
{
return _d_ptr->operator()(x, y);
}
@@ -137,7 +136,7 @@ public:
/// Resize the image
/// @param width The width of the image
/// @param height The height of the image
void resize(unsigned width, unsigned height)
void resize(int width, int height)
{
_d_ptr->resize(width, height);
}
@@ -198,12 +197,11 @@ private:
///
/// @return The index into the underlying data-vector
///
inline unsigned toIndex(unsigned x, unsigned y) const
inline int toIndex(int x, int y) const
{
return _d_ptr->toIndex(x, y);
}
private:
QSharedDataPointer<ImageData<Pixel_T>> _d_ptr;
};

View File

@@ -1,12 +1,9 @@
#pragma once
// STL includes
#include <vector>
#include <cstdint>
#include <cstring>
#include <algorithm>
#include <cassert>
#include <type_traits>
#include <utils/ColorRgb.h>
// QT includes
@@ -24,10 +21,10 @@ class ImageData : public QSharedData
public:
typedef Pixel_T pixel_type;
ImageData(unsigned width, unsigned height, const Pixel_T background) :
ImageData(int width, int height, const Pixel_T background) :
_width(width),
_height(height),
_pixels(new Pixel_T[width * height + 1])
_pixels(new Pixel_T[static_cast<size_t>(width) * static_cast<size_t>(height)])
{
std::fill(_pixels, _pixels + width * height, background);
}
@@ -36,9 +33,9 @@ public:
QSharedData(other),
_width(other._width),
_height(other._height),
_pixels(new Pixel_T[other._width * other._height + 1])
_pixels(new Pixel_T[static_cast<size_t>(other._width) * static_cast<size_t>(other._height)])
{
memcpy(_pixels, other._pixels, static_cast<ulong>(other._width) * static_cast<ulong>(other._height) * sizeof(Pixel_T));
memcpy(_pixels, other._pixels, static_cast<size_t>(other._width) * static_cast<size_t>(other._height) * sizeof(Pixel_T));
}
ImageData& operator=(ImageData rhs)
@@ -74,52 +71,57 @@ public:
delete[] _pixels;
}
inline unsigned width() const
inline int width() const
{
return _width;
}
inline unsigned height() const
inline int height() const
{
return _height;
}
uint8_t red(unsigned pixel) const
uint8_t red(int pixel) const
{
return (_pixels + pixel)->red;
}
uint8_t green(unsigned pixel) const
uint8_t green(int pixel) const
{
return (_pixels + pixel)->green;
}
uint8_t blue(unsigned pixel) const
uint8_t blue(int pixel) const
{
return (_pixels + pixel)->blue;
}
const Pixel_T& operator()(unsigned x, unsigned y) const
const Pixel_T& operator()(int x, int y) const
{
return _pixels[toIndex(x,y)];
}
Pixel_T& operator()(unsigned x, unsigned y)
Pixel_T& operator()(int x, int y)
{
return _pixels[toIndex(x,y)];
}
void resize(unsigned width, unsigned height)
void resize(int width, int height)
{
if (width == _width && height == _height)
return;
if ((width * height) > unsigned((_width * _height)))
{
delete[] _pixels;
_pixels = new Pixel_T[width*height + 1];
return;
}
// Allocate a new buffer without initializing the content
Pixel_T* newPixels = new Pixel_T[static_cast<size_t>(width) * static_cast<size_t>(height)];
// Release the old buffer without copying data
delete[] _pixels;
// Update the pointer to the new buffer
_pixels = newPixels;
_width = width;
_height = height;
}
@@ -137,11 +139,13 @@ public:
void toRgb(ImageData<ColorRgb>& image) const
{
if (image.width() != _width || image.height() != _height)
{
image.resize(_width, _height);
}
const unsigned imageSize = _width * _height;
const int imageSize = _width * _height;
for (unsigned idx = 0; idx < imageSize; idx++)
for (int idx = 0; idx < imageSize; idx++)
{
const Pixel_T & color = _pixels[idx];
image.memptr()[idx] = ColorRgb{color.red, color.green, color.blue};
@@ -157,26 +161,22 @@ public:
{
if (_width != 1 || _height != 1)
{
_width = 1;
_height = 1;
delete[] _pixels;
_pixels = new Pixel_T[2];
resize(1,1);
}
memset(_pixels, 0, static_cast<unsigned long>(_width) * static_cast<unsigned long>(_height) * sizeof(Pixel_T));
// Set the single pixel to the default background
_pixels[0] = Pixel_T();
}
private:
inline unsigned toIndex(unsigned x, unsigned y) const
inline int toIndex(int x, int y) const
{
return y * _width + x;
}
private:
/// The width of the image
unsigned _width;
int _width;
/// The height of the image
unsigned _height;
int _height;
/// The pixels of the image
Pixel_T* _pixels;
};

View File

@@ -6,6 +6,7 @@
#include <QMap>
#include <QAtomicInteger>
#include <QList>
#include <QJsonArray>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
#include <QRecursiveMutex>
@@ -14,8 +15,6 @@
#endif
// stl includes
#include <stdio.h>
#include <stdarg.h>
#ifdef _WIN32
#include <stdexcept>
#endif
@@ -59,7 +58,7 @@ public:
QString function;
unsigned int line;
QString fileName;
uint64_t utime;
qint64 utime;
QString message;
LogLevel level;
QString levelString;
@@ -74,7 +73,7 @@ public:
void setMinLevel(LogLevel level) { _minLevel = static_cast<int>(level); }
LogLevel getMinLevel() const { return static_cast<LogLevel>(int(_minLevel)); }
QString getName() const { return _name; }
QString getSubName() const { return _subname; }
QString getSubName() const { return _subName; }
signals:
void newLogMessage(Logger::T_LOG_MESSAGE);
@@ -95,7 +94,7 @@ private:
static QAtomicInteger<int> GLOBAL_MIN_LOG_LEVEL;
const QString _name;
const QString _subname;
const QString _subName;
const bool _syslogEnabled;
const unsigned _loggerId;
@@ -109,15 +108,15 @@ class LoggerManager : public QObject
public:
static LoggerManager* getInstance();
const QList<Logger::T_LOG_MESSAGE>* getLogMessageBuffer() const { return &_logMessageBuffer; }
public slots:
void handleNewLogMessage(const Logger::T_LOG_MESSAGE&);
QJsonArray getLogMessageBuffer(Logger::LogLevel filter=Logger::UNSET) const;
signals:
void newLogMessage(const Logger::T_LOG_MESSAGE&);
protected:
private:
LoggerManager();
QList<Logger::T_LOG_MESSAGE> _logMessageBuffer;

View File

@@ -1,4 +1,5 @@
#pragma once
#ifndef PIXELFORMAT_H
#define PIXELFORMAT_H
#include <QString>
@@ -14,9 +15,7 @@ enum class PixelFormat {
BGR32,
NV12,
I420,
#ifdef HAVE_TURBO_JPEG
MJPEG,
#endif
NO_CHANGE
};
@@ -57,12 +56,10 @@ inline PixelFormat parsePixelFormat(const QString& pixelFormat)
{
return PixelFormat::NV12;
}
#ifdef HAVE_TURBO_JPEG
else if (format.compare("mjpeg") == 0)
{
return PixelFormat::MJPEG;
}
#endif
// return the default NO_CHANGE
return PixelFormat::NO_CHANGE;
@@ -103,12 +100,10 @@ inline QString pixelFormatToString(const PixelFormat& pixelFormat)
{
return "NV12";
}
#ifdef HAVE_TURBO_JPEG
else if (pixelFormat == PixelFormat::MJPEG)
{
return "MJPEG";
}
#endif
// return the default NO_CHANGE
return "NO_CHANGE";
@@ -166,3 +161,5 @@ inline QString flipModeToString(const FlipMode& flipMode)
// return the default NO_CHANGE
return "NO_CHANGE";
}
#endif // PIXELFORMAT_H

View File

@@ -3,9 +3,8 @@
#include <QString>
#include <QByteArray>
namespace Process {
void restartHyperion(int exitCode = 0);
QByteArray command_exec(const QString& cmd, const QByteArray& data = {});
namespace Process
{
void restartHyperion(int exitCode = 0);
QByteArray command_exec(const QString& cmd, const QByteArray& data = {});
}

View File

@@ -1,6 +1,6 @@
#pragma once
#define QSTRING_CSTR(str) str.toLocal8Bit().constData()
#define QSTRING_CSTR(str) str.toUtf8().constData()
typedef QList< int > QIntList;

View File

@@ -98,7 +98,7 @@ namespace hyperion {
static_cast<uint8_t>(channelConfig[0].toInt(defaultR)),
static_cast<uint8_t>(channelConfig[1].toInt(defaultG)),
static_cast<uint8_t>(channelConfig[2].toInt(defaultB)),
"ChannelAdjust_" + channelName.toUpper()
channelName
);
}

View File

@@ -30,6 +30,9 @@ namespace settings {
NETWORK,
FLATBUFSERVER,
PROTOSERVER,
OSEVENTS,
CECEVENTS,
SCHEDEVENTS,
INVALID
};
@@ -42,29 +45,32 @@ namespace settings {
{
switch (type)
{
case BGEFFECT: return "backgroundEffect";
case FGEFFECT: return "foregroundEffect";
case BLACKBORDER: return "blackborderdetector";
case BOBLSERVER: return "boblightServer";
case COLOR: return "color";
case DEVICE: return "device";
case EFFECTS: return "effects";
case NETFORWARD: return "forwarder";
case SYSTEMCAPTURE: return "framegrabber";
case GENERAL: return "general";
case V4L2: return "grabberV4L2";
case AUDIO: return "grabberAudio";
case JSONSERVER: return "jsonServer";
case LEDCONFIG: return "ledConfig";
case LEDS: return "leds";
case LOGGER: return "logger";
case SMOOTHING: return "smoothing";
case WEBSERVER: return "webConfig";
case INSTCAPTURE: return "instCapture";
case NETWORK: return "network";
case FLATBUFSERVER: return "flatbufServer";
case PROTOSERVER: return "protoServer";
default: return "invalid";
case BGEFFECT: return "backgroundEffect";
case FGEFFECT: return "foregroundEffect";
case BLACKBORDER: return "blackborderdetector";
case BOBLSERVER: return "boblightServer";
case COLOR: return "color";
case DEVICE: return "device";
case EFFECTS: return "effects";
case NETFORWARD: return "forwarder";
case SYSTEMCAPTURE: return "framegrabber";
case GENERAL: return "general";
case V4L2: return "grabberV4L2";
case AUDIO: return "grabberAudio";
case JSONSERVER: return "jsonServer";
case LEDCONFIG: return "ledConfig";
case LEDS: return "leds";
case LOGGER: return "logger";
case SMOOTHING: return "smoothing";
case WEBSERVER: return "webConfig";
case INSTCAPTURE: return "instCapture";
case NETWORK: return "network";
case FLATBUFSERVER: return "flatbufServer";
case PROTOSERVER: return "protoServer";
case OSEVENTS: return "osEvents";
case CECEVENTS: return "cecEvents";
case SCHEDEVENTS: return "schedEvents";
default: return "invalid";
}
}
@@ -97,6 +103,9 @@ namespace settings {
else if (type == "network") return NETWORK;
else if (type == "flatbufServer") return FLATBUFSERVER;
else if (type == "protoServer") return PROTOSERVER;
else if (type == "osEvents") return OSEVENTS;
else if (type == "cecEvents") return CECEVENTS;
else if (type == "schedEvents") return SCHEDEVENTS;
else return INVALID;
}
}

View File

@@ -92,11 +92,6 @@ private:
StaticFileServing* _staticFileServing;
QtHttpServer* _server;
bool _inited = false;
const QString WEBSERVER_DEFAULT_PATH = ":/webconfig";
const QString WEBSERVER_DEFAULT_CRT_PATH = ":/hyperion.crt";
const QString WEBSERVER_DEFAULT_KEY_PATH = ":/hyperion.key";
quint16 WEBSERVER_DEFAULT_PORT = 8090;
};
#endif // WEBSERVER_H