Merge remote-tracking branch 'origin/grabberDiscovery' into mediafoundation

This commit is contained in:
Paulchen Panther
2021-04-04 12:43:29 +02:00
committed by LordGrey
187 changed files with 3716 additions and 15430 deletions

View File

@@ -1,22 +1,25 @@
#include <hyperion/Grabber.h>
Grabber::Grabber(const QString& grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom)
: _imageResampler()
: _grabberName(grabberName)
, _imageResampler()
, _useImageResampler(true)
, _videoMode(VideoMode::VIDEO_2D)
, _videoStandard(VideoStandard::NO_CHANGE)
, _pixelDecimation(8)
, _flipMode(FlipMode::NO_CHANGE)
, _width(width)
, _height(height)
, _fps(15)
, _fpsSoftwareDecimation(0)
, _input(-1)
, _cropLeft(0)
, _cropRight(0)
, _cropTop(0)
, _cropBottom(0)
, _enabled(true)
, _log(Logger::getInstance(grabberName.toUpper()))
, _log(Logger::getInstance(_grabberName.toUpper()))
{
Grabber::setVideoMode(VideoMode::VIDEO_2D);
Grabber::setCropping(cropLeft, cropRight, cropTop, cropBottom);
}
@@ -36,6 +39,27 @@ void Grabber::setVideoMode(VideoMode mode)
}
}
void Grabber::setVideoStandard(VideoStandard videoStandard)
{
if (_videoStandard != videoStandard)
_videoStandard = videoStandard;
}
bool Grabber::setPixelDecimation(int pixelDecimation)
{
if (_pixelDecimation != pixelDecimation)
{
Debug(_log,"Set image size decimation to %d", pixelDecimation);
_pixelDecimation = pixelDecimation;
_imageResampler.setHorizontalPixelDecimation(pixelDecimation);
_imageResampler.setVerticalPixelDecimation(pixelDecimation);
return true;
}
return false;
}
void Grabber::setFlipMode(FlipMode mode)
{
Debug(_log,"Set flipmode to %s", QSTRING_CSTR(flipModeToString(mode)));
@@ -111,9 +135,20 @@ bool Grabber::setFramerate(int fps)
{
if((fps > 0) && (_fps != fps))
{
Debug(_log,"Set new frames per second to: %i fps", fps);
_fps = fps;
return true;
}
return false;
}
void Grabber::setFpsSoftwareDecimation(int decimation)
{
if((_fpsSoftwareDecimation != decimation))
{
_fpsSoftwareDecimation = decimation;
if(decimation > 0)
Debug(_log,"Skip %i frame per second", decimation);
}
}

View File

@@ -44,14 +44,19 @@ GrabberWrapper::~GrabberWrapper()
bool GrabberWrapper::start()
{
if (!_timer->isActive())
bool rc = false;
if ( open() )
{
// Start the timer with the pre configured interval
Debug(_log,"Grabber start()");
_timer->start();
}
if (!_timer->isActive())
{
// Start the timer with the pre configured interval
Debug(_log,"Grabber start()");
_timer->start();
}
return _timer->isActive();
rc = _timer->isActive();
}
return rc;
}
void GrabberWrapper::stop()
@@ -129,11 +134,16 @@ void GrabberWrapper::setVideoMode(VideoMode mode)
{
if (_ggrabber != nullptr)
{
Info(_log,"setvideomode");
Info(_log,"setVideoMode");
_ggrabber->setVideoMode(mode);
}
}
void GrabberWrapper::setFlipMode(QString flipMode)
{
_ggrabber->setFlipMode(parseFlipMode(flipMode));
}
void GrabberWrapper::setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom)
{
_ggrabber->setCropping(cropLeft, cropRight, cropTop, cropBottom);
@@ -165,7 +175,7 @@ void GrabberWrapper::handleSettingsUpdate(settings::type type, const QJsonDocume
_ggrabber->setWidthHeight(obj["width"].toInt(96), obj["height"].toInt(96));
// display index for MAC
_ggrabber->setDisplayIndex(obj["display"].toInt(0));
_ggrabber->setDisplayIndex(obj["input"].toInt(0));
// device path for Framebuffer
_ggrabber->setDevicePath(obj["device"].toString("/dev/fb0"));
@@ -181,7 +191,7 @@ void GrabberWrapper::handleSettingsUpdate(settings::type type, const QJsonDocume
obj["cropBottom"].toInt(0));
// eval new update time
updateTimer(1000/obj["frequency_Hz"].toInt(10));
updateTimer(1000/obj["fps"].toInt(10));
}
}
@@ -221,59 +231,3 @@ void GrabberWrapper::tryStart()
start();
}
}
QStringList GrabberWrapper::getDevices() const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getDevices();
return QStringList();
}
QString GrabberWrapper::getDeviceName(const QString& devicePath) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getDeviceName(devicePath);
return QString();
}
QMultiMap<QString, int> GrabberWrapper::getDeviceInputs(const QString& devicePath) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getDeviceInputs(devicePath);
return QMultiMap<QString, int>();
}
QList<VideoStandard> GrabberWrapper::getAvailableDeviceStandards(const QString& devicePath, const int& deviceInput) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getAvailableDeviceStandards(devicePath, deviceInput);
return QList<VideoStandard>();
}
QStringList GrabberWrapper::getAvailableEncodingFormats(const QString& devicePath, const int& deviceInput) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getAvailableEncodingFormats(devicePath, deviceInput);
return QStringList();
}
QMultiMap<int, int> GrabberWrapper::getAvailableDeviceResolutions(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getAvailableDeviceResolutions(devicePath, deviceInput, encFormat);
return QMultiMap<int, int>();
}
QIntList GrabberWrapper::getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getAvailableDeviceFramerates(devicePath, deviceInput, encFormat, width, height);
return QIntList();
}

View File

@@ -5,7 +5,6 @@
// qt incl
#include <QDateTime>
#include <QTimer>
#include <QDebug>
// Hyperion includes
#include <hyperion/PriorityMuxer.h>
@@ -13,6 +12,8 @@
// utils
#include <utils/Logger.h>
const int PriorityMuxer::FG_PRIORITY = 1;
const int PriorityMuxer::BG_PRIORITY = 254;
const int PriorityMuxer::LOWEST_PRIORITY = std::numeric_limits<uint8_t>::max();
PriorityMuxer::PriorityMuxer(int ledCount, QObject * parent)
@@ -322,7 +323,7 @@ void PriorityMuxer::setCurrentTime()
newPriority = qMin(newPriority, infoIt->priority);
// call timeTrigger when effect or color is running with timeout > 0, blacklist prio 255
if(infoIt->priority < 254 && infoIt->timeoutTime_ms > 0 && (infoIt->componentId == hyperion::COMP_EFFECT || infoIt->componentId == hyperion::COMP_COLOR || infoIt->componentId == hyperion::COMP_IMAGE))
if(infoIt->priority < BG_PRIORITY && infoIt->timeoutTime_ms > 0 && (infoIt->componentId == hyperion::COMP_EFFECT || infoIt->componentId == hyperion::COMP_COLOR || infoIt->componentId == hyperion::COMP_IMAGE))
emit signalTimeTrigger(); // as signal to prevent Threading issues
++infoIt;

View File

@@ -16,7 +16,6 @@
"title" : "edt_dev_general_hardwareLedCount_title",
"minimum" : 1,
"default" : 1,
"access" : "expert",
"propertyOrder" : 2
},
"colorOrder" :
@@ -25,9 +24,11 @@
"title" : "edt_dev_general_colorOrder_title",
"enum" : ["rgb", "bgr", "rbg", "brg", "gbr", "grb"],
"default" : "rgb",
"options" : {
"enum_titles" : ["edt_conf_enum_rgb", "edt_conf_enum_bgr", "edt_conf_enum_rbg", "edt_conf_enum_brg", "edt_conf_enum_gbr", "edt_conf_enum_grb"]
"required" : true,
"options": {
"enum_titles": [ "edt_conf_enum_rgb", "edt_conf_enum_bgr", "edt_conf_enum_rbg", "edt_conf_enum_brg", "edt_conf_enum_gbr", "edt_conf_enum_grb" ]
},
"access" : "expert",
"propertyOrder" : 3
}
},

View File

@@ -2,79 +2,87 @@
"type" : "object",
"title" : "edt_conf_fg_heading_title",
"properties": {
"type": {
"available_devices": {
"type": "string",
"title": "edt_conf_fg_type_title",
"enum": [ "auto", "amlogic", "dispmanx", "dx", "framebuffer", "osx", "qt", "x11", "xcb" ],
"options": {
"enum_titles": [ "edt_conf_enum_automatic", "AMLogic", "DispmanX", "DirectX9", "Framebuffer", "OSX", "QT", "X11", "XCB" ]
},
"default": "auto",
"propertyOrder": 1
"title": "edt_conf_v4l2_device_title",
"propertyOrder": 1,
"required": false
},
"display": {
"device": {
"type": "string",
"title": "edt_conf_enum_custom",
"options": {
"hidden": true
},
"required": true,
"comment": "The 'available_devices' settings are dynamically inserted into the WebUI under PropertyOrder '1'.",
"propertyOrder": 2
},
"device_inputs": {
"type": "string",
"title": "edt_conf_v4l2_input_title",
"propertyOrder": 3,
"required": false
},
"input": {
"type": "integer",
"title": "edt_conf_fg_display_title",
"title": "edt_conf_enum_custom",
"minimum": 0,
"default": 0,
"propertyOrder": 2
"options": {
"hidden": true
},
"required": true,
"propertyOrder": 4,
"comment": "The 'device_inputs' settings are dynamically inserted into the WebUI under PropertyOrder '3'."
},
"resolutions": {
"type": "string",
"title": "edt_conf_v4l2_resolution_title",
"propertyOrder": 5,
"required": false
},
"width": {
"type": "integer",
"title": "edt_conf_fg_width_title",
"title": "edt_conf_enum_custom",
"minimum": 10,
"default": 80,
"append": "edt_append_pixel",
"propertyOrder": 3
"options": {
"hidden": true
},
"required": true,
"propertyOrder": 8,
"comment": "The 'resolutions' settings are dynamically inserted into the WebUI under PropertyOrder '5'."
},
"height": {
"type": "integer",
"title": "edt_conf_fg_height_title",
"minimum": 10,
"default": 45,
"title": "edt_conf_enum_custom",
"append": "edt_append_pixel",
"propertyOrder": 4
"options": {
"hidden": true
},
"required": true,
"propertyOrder": 9,
"comment": "The 'resolutions' settings are dynamically inserted into the WebUI under PropertyOrder '5'."
},
"frequency_Hz": {
"type": "integer",
"framerates": {
"type": "string",
"title": "edt_conf_fg_frequency_Hz_title",
"propertyOrder": 10,
"required": false
},
"fps": {
"type": "integer",
"title": "edt_conf_enum_custom",
"minimum": 1,
"default": 10,
"append": "edt_append_hz",
"propertyOrder": 5
},
"cropLeft": {
"type": "integer",
"title": "edt_conf_v4l2_cropLeft_title",
"minimum": 0,
"default": 0,
"append": "edt_append_pixel",
"propertyOrder": 6
},
"cropRight": {
"type": "integer",
"title": "edt_conf_v4l2_cropRight_title",
"minimum": 0,
"default": 0,
"append": "edt_append_pixel",
"propertyOrder": 7
},
"cropTop": {
"type": "integer",
"title": "edt_conf_v4l2_cropTop_title",
"minimum": 0,
"default": 0,
"append": "edt_append_pixel",
"propertyOrder": 8
},
"cropBottom": {
"type": "integer",
"title": "edt_conf_v4l2_cropBottom_title",
"minimum": 0,
"default": 0,
"append": "edt_append_pixel",
"propertyOrder": 9
"append": "fps",
"options": {
"hidden": true
},
"required": true,
"propertyOrder": 11,
"comment": "The 'framerates' setting is dynamically inserted into the WebUI under PropertyOrder '10'."
},
"pixelDecimation": {
"type": "integer",
@@ -82,9 +90,41 @@
"minimum": 1,
"maximum": 30,
"default": 8,
"propertyOrder": 10
"required": true,
"propertyOrder": 12
},
"cropLeft": {
"type": "integer",
"title": "edt_conf_v4l2_cropLeft_title",
"minimum": 0,
"default": 0,
"append": "edt_append_pixel",
"propertyOrder": 13
},
"cropRight": {
"type": "integer",
"title": "edt_conf_v4l2_cropRight_title",
"minimum": 0,
"default": 0,
"append": "edt_append_pixel",
"propertyOrder": 14
},
"cropTop": {
"type": "integer",
"title": "edt_conf_v4l2_cropTop_title",
"minimum": 0,
"default": 0,
"append": "edt_append_pixel",
"propertyOrder": 15
},
"cropBottom": {
"type": "integer",
"title": "edt_conf_v4l2_cropBottom_title",
"minimum": 0,
"default": 0,
"append": "edt_append_pixel",
"propertyOrder": 16
}
},
"additionalProperties" : false
}