mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Details coming soon.
This commit is contained in:
@@ -1,27 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Components.h>
|
||||
#include <hyperion/Hyperion.h>
|
||||
#include <hyperion/ImageProcessor.h>
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <utils/VideoMode.h>
|
||||
#include <utils/settings.h>
|
||||
|
||||
class ImageProcessor;
|
||||
class Grabber;
|
||||
class DispmanxFrameGrabber;
|
||||
class QTimer;
|
||||
|
||||
///
|
||||
/// This class will be inherted by FramebufferWrapper and others which contains the real capture interface
|
||||
///
|
||||
class GrabberWrapper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, const unsigned updateRate_Hz, const int priority, hyperion::Components grabberComponentId=hyperion::COMP_GRABBER);
|
||||
GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, const unsigned updateRate_Hz);
|
||||
|
||||
virtual ~GrabberWrapper();
|
||||
|
||||
@@ -35,8 +37,6 @@ public:
|
||||
///
|
||||
virtual void stop();
|
||||
|
||||
void setImageProcessorEnabled(bool enable);
|
||||
|
||||
static QStringList availableGrabbers();
|
||||
|
||||
public:
|
||||
@@ -45,18 +45,15 @@ public:
|
||||
{
|
||||
unsigned w = grabber.getImageWidth();
|
||||
unsigned h = grabber.getImageHeight();
|
||||
if (_imageProcessorEnabled && ( _image.width() != w || _image.height() != h))
|
||||
if ( _image.width() != w || _image.height() != h)
|
||||
{
|
||||
_processor->setSize(w, h);
|
||||
_image.resize(w, h);
|
||||
}
|
||||
|
||||
int ret = grabber.grabFrame(_image);
|
||||
if (ret >= 0)
|
||||
{
|
||||
emit emitImage(_priority, _image, _timeout_ms);
|
||||
_processor->process(_image, _ledColors);
|
||||
setColors(_ledColors, _timeout_ms);
|
||||
emit systemImage(_image);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -64,46 +61,51 @@ public:
|
||||
|
||||
|
||||
public slots:
|
||||
void componentStateChanged(const hyperion::Components component, bool enable);
|
||||
|
||||
///
|
||||
/// virtual method, should perform single frame grab and computes the led-colors
|
||||
///
|
||||
virtual void action() = 0;
|
||||
|
||||
void actionWrapper();
|
||||
|
||||
///
|
||||
/// Set the video mode (2D/3D)
|
||||
/// @param[in] mode The new video mode
|
||||
///
|
||||
virtual void setVideoMode(const VideoMode videoMode);
|
||||
virtual void setVideoMode(const VideoMode& videoMode);
|
||||
|
||||
///
|
||||
/// Set the crop values
|
||||
/// @param cropLeft Left pixel crop
|
||||
/// @param cropRight Right pixel crop
|
||||
/// @param cropTop Top pixel crop
|
||||
/// @param cropBottom Bottom pixel crop
|
||||
///
|
||||
virtual void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom);
|
||||
|
||||
///
|
||||
/// @brief Handle settings update from HyperionDaemon Settingsmanager emit
|
||||
/// @param type settingyType from enum
|
||||
/// @param config configuration object
|
||||
///
|
||||
virtual void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
|
||||
|
||||
signals:
|
||||
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
|
||||
///
|
||||
/// @brief Emit the final processed image
|
||||
///
|
||||
void systemImage(const Image<ColorRgb>& image);
|
||||
|
||||
protected:
|
||||
|
||||
void setColors(const std::vector<ColorRgb> &ledColors, const int timeout_ms);
|
||||
|
||||
QString _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;
|
||||
QTimer* _timer;
|
||||
|
||||
/// The update rate [Hz]
|
||||
const int _updateInterval_ms;
|
||||
|
||||
/// The timeout of the led colors [ms]
|
||||
const int _timeout_ms;
|
||||
/// The calced update rate [ms]
|
||||
int _updateInterval_ms;
|
||||
|
||||
/// The Logger instance
|
||||
Logger * _log;
|
||||
@@ -111,18 +113,8 @@ protected:
|
||||
// forwarding enabled
|
||||
bool _forward;
|
||||
|
||||
/// The processor for transforming images to led colors
|
||||
ImageProcessor * _processor;
|
||||
|
||||
hyperion::Components _grabberComponentId;
|
||||
|
||||
Grabber *_ggrabber;
|
||||
|
||||
/// The image used for grabbing frames
|
||||
Image<ColorRgb> _image;
|
||||
|
||||
/// The list with computed led colors
|
||||
std::vector<ColorRgb> _ledColors;
|
||||
|
||||
bool _imageProcessorEnabled;
|
||||
};
|
||||
|
Reference in New Issue
Block a user