mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
multi bugfix pr ... (#348)
* move name to general add a version for config file * start impl. config migrator * fix typo amd set access level * fix schemaa name * fix schema * add structure for config migrator * add more structural things for config migrator * fix not all grabber provide live video * add schema for trails
This commit is contained in:
parent
8ed8823033
commit
3746f643af
@ -39,3 +39,5 @@
|
|||||||
#define HYPERION_VERSION "${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}"
|
#define HYPERION_VERSION "${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}"
|
||||||
|
|
||||||
#define HYPERION_JSON_VERSION "1.0.0"
|
#define HYPERION_JSON_VERSION "1.0.0"
|
||||||
|
|
||||||
|
#define CURRENT_CONFIG_VERSION 2
|
||||||
|
@ -428,6 +428,10 @@
|
|||||||
"edt_eff_enableshutdown_title" : "Echtes herunterfahren",
|
"edt_eff_enableshutdown_title" : "Echtes herunterfahren",
|
||||||
"edt_eff_length_title" : "Länge",
|
"edt_eff_length_title" : "Länge",
|
||||||
"edt_eff_frequency_title" : "Frequenz",
|
"edt_eff_frequency_title" : "Frequenz",
|
||||||
|
"edt_eff_tails_header_title" : "Trails",
|
||||||
|
"edt_eff_min_len_title" : "Minimale Länge",
|
||||||
|
"edt_eff_max_len_title" : "Maximale Länge",
|
||||||
|
"edt_eff_height_title" : "Höhe",
|
||||||
"edt_append_ns" : "ns",
|
"edt_append_ns" : "ns",
|
||||||
"edt_append_ms" : "ms",
|
"edt_append_ms" : "ms",
|
||||||
"edt_append_s" : "s",
|
"edt_append_s" : "s",
|
||||||
|
@ -429,6 +429,10 @@
|
|||||||
"edt_eff_enableshutdown_title" : "Real shutdown",
|
"edt_eff_enableshutdown_title" : "Real shutdown",
|
||||||
"edt_eff_length_title" : "Length",
|
"edt_eff_length_title" : "Length",
|
||||||
"edt_eff_frequency_title" : "Frequency",
|
"edt_eff_frequency_title" : "Frequency",
|
||||||
|
"edt_eff_tails_header_title" : "Trails",
|
||||||
|
"edt_eff_min_len_title" : "Minimal length",
|
||||||
|
"edt_eff_max_len_title" : "Maximal length",
|
||||||
|
"edt_eff_height_title" : "Height",
|
||||||
"edt_append_ns" : "ns",
|
"edt_append_ns" : "ns",
|
||||||
"edt_append_ms" : "ms",
|
"edt_append_ms" : "ms",
|
||||||
"edt_append_s" : "s",
|
"edt_append_s" : "s",
|
||||||
|
65
effects/schema/trails.json
Normal file
65
effects/schema/trails.json
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
"type":"object",
|
||||||
|
"script" : "trails.py",
|
||||||
|
"title":"edt_eff_trails_header_title",
|
||||||
|
"required":true,
|
||||||
|
"properties":{
|
||||||
|
"min_len": {
|
||||||
|
"type": "integer",
|
||||||
|
"title":"edt_eff_min_len_title",
|
||||||
|
"default": 2,
|
||||||
|
"minimum" : 1,
|
||||||
|
"propertyOrder" : 1
|
||||||
|
},
|
||||||
|
"max_len": {
|
||||||
|
"type": "integer",
|
||||||
|
"title":"edt_eff_max_len_title",
|
||||||
|
"default": 7,
|
||||||
|
"minimum" : 1,
|
||||||
|
"propertyOrder" : 2
|
||||||
|
},
|
||||||
|
"height": {
|
||||||
|
"type": "integer",
|
||||||
|
"title":"edt_eff_height_title",
|
||||||
|
"default": 8,
|
||||||
|
"minimum" : 1,
|
||||||
|
"propertyOrder" : 3
|
||||||
|
},
|
||||||
|
"trails": {
|
||||||
|
"type": "integer",
|
||||||
|
"title":"edt_eff_trails_title",
|
||||||
|
"default": 3,
|
||||||
|
"minimum" : 1,
|
||||||
|
"propertyOrder" : 4
|
||||||
|
},
|
||||||
|
"speed": {
|
||||||
|
"type": "number",
|
||||||
|
"title":"edt_eff_speed_title",
|
||||||
|
"default": 1.0,
|
||||||
|
"minimum" : 0.1,
|
||||||
|
"propertyOrder" : 5
|
||||||
|
},
|
||||||
|
"random": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title":"edt_eff_random_header_title",
|
||||||
|
"default": false,
|
||||||
|
"propertyOrder" : 6
|
||||||
|
},
|
||||||
|
"color": {
|
||||||
|
"type": "array",
|
||||||
|
"title":"edt_eff_color_title",
|
||||||
|
"format":"colorpicker",
|
||||||
|
"default": [255,0,0],
|
||||||
|
"items" : {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 255
|
||||||
|
},
|
||||||
|
"minItems": 3,
|
||||||
|
"maxItems": 3,
|
||||||
|
"propertyOrder" : 7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
|
@ -39,12 +39,9 @@ void AmlogicWrapper::action()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( _forward )
|
|
||||||
{
|
|
||||||
Image<ColorRgb> image_rgb;
|
Image<ColorRgb> image_rgb;
|
||||||
_image.toRgb(image_rgb);
|
_image.toRgb(image_rgb);
|
||||||
emit emitImage(_priority, image_rgb, _timeout_ms);
|
emit emitImage(_priority, image_rgb, _timeout_ms);
|
||||||
}
|
|
||||||
|
|
||||||
_processor->process(_image, _ledColors);
|
_processor->process(_image, _ledColors);
|
||||||
setColors(_ledColors, _timeout_ms);
|
setColors(_ledColors, _timeout_ms);
|
||||||
|
@ -35,12 +35,9 @@ void DispmanxWrapper::action()
|
|||||||
// Grab frame into the allocated image
|
// Grab frame into the allocated image
|
||||||
_grabber->grabFrame(_image);
|
_grabber->grabFrame(_image);
|
||||||
|
|
||||||
if ( _forward )
|
|
||||||
{
|
|
||||||
Image<ColorRgb> image_rgb;
|
Image<ColorRgb> image_rgb;
|
||||||
_image.toRgb(image_rgb);
|
_image.toRgb(image_rgb);
|
||||||
emit emitImage(_priority, image_rgb, _timeout_ms);
|
emit emitImage(_priority, image_rgb, _timeout_ms);
|
||||||
}
|
|
||||||
|
|
||||||
_processor->process(_image, _ledColors);
|
_processor->process(_image, _ledColors);
|
||||||
setColors(_ledColors, _timeout_ms);
|
setColors(_ledColors, _timeout_ms);
|
||||||
|
@ -31,10 +31,7 @@ void FramebufferWrapper::action()
|
|||||||
// Grab frame into the allocated image
|
// Grab frame into the allocated image
|
||||||
_grabber->grabFrame(_image);
|
_grabber->grabFrame(_image);
|
||||||
|
|
||||||
if ( _forward )
|
|
||||||
{
|
|
||||||
emit emitImage(_priority, _image, _timeout_ms);
|
emit emitImage(_priority, _image, _timeout_ms);
|
||||||
}
|
|
||||||
|
|
||||||
_processor->process(_image, _ledColors);
|
_processor->process(_image, _ledColors);
|
||||||
setColors(_ledColors, _timeout_ms);
|
setColors(_ledColors, _timeout_ms);
|
||||||
|
@ -31,10 +31,7 @@ void OsxWrapper::action()
|
|||||||
// Grab frame into the allocated image
|
// Grab frame into the allocated image
|
||||||
_grabber->grabFrame(_image);
|
_grabber->grabFrame(_image);
|
||||||
|
|
||||||
if ( _forward )
|
|
||||||
{
|
|
||||||
emit emitImage(_priority, _image, _timeout_ms);
|
emit emitImage(_priority, _image, _timeout_ms);
|
||||||
}
|
|
||||||
|
|
||||||
_processor->process(_image, _ledColors);
|
_processor->process(_image, _ledColors);
|
||||||
setColors(_ledColors, _timeout_ms);
|
setColors(_ledColors, _timeout_ms);
|
||||||
|
@ -87,11 +87,7 @@ void V4L2Wrapper::set3D(VideoMode mode)
|
|||||||
|
|
||||||
void V4L2Wrapper::newFrame(const Image<ColorRgb> &image)
|
void V4L2Wrapper::newFrame(const Image<ColorRgb> &image)
|
||||||
{
|
{
|
||||||
// forward to other hyperions
|
|
||||||
//if ( _forward )
|
|
||||||
//{
|
|
||||||
emit emitImage(_priority, image, _timeout_ms);
|
emit emitImage(_priority, image, _timeout_ms);
|
||||||
//}
|
|
||||||
|
|
||||||
// process the new image
|
// process the new image
|
||||||
_processor->process(image, _ledColors);
|
_processor->process(image, _ledColors);
|
||||||
|
@ -64,10 +64,7 @@ void X11Wrapper::action()
|
|||||||
// Grab frame into the allocated image
|
// Grab frame into the allocated image
|
||||||
_grabber->grabFrame(_image);
|
_grabber->grabFrame(_image);
|
||||||
|
|
||||||
//if ( _forward )
|
|
||||||
//{
|
|
||||||
emit emitImage(_priority, _image, _timeout_ms);
|
emit emitImage(_priority, _image, _timeout_ms);
|
||||||
//}
|
|
||||||
|
|
||||||
_processor->process(_image, _ledColors);
|
_processor->process(_image, _ledColors);
|
||||||
setColors(_ledColors, _timeout_ms);
|
setColors(_ledColors, _timeout_ms);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
add_executable(hyperiond
|
add_executable(hyperiond
|
||||||
|
configMigratorBase.cpp
|
||||||
|
configMigratorBase.h
|
||||||
configMigrator.cpp
|
configMigrator.cpp
|
||||||
configMigrator.h
|
configMigrator.h
|
||||||
hyperiond.cpp
|
hyperiond.cpp
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
|
|
||||||
ConfigMigrator::ConfigMigrator()
|
ConfigMigrator::ConfigMigrator()
|
||||||
: _log(Logger::getInstance("ConfigMigrator"))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13,7 +12,23 @@ ConfigMigrator::~ConfigMigrator()
|
|||||||
bool ConfigMigrator::migrate(QString configFile, int fromVersion,int toVersion)
|
bool ConfigMigrator::migrate(QString configFile, int fromVersion,int toVersion)
|
||||||
{
|
{
|
||||||
Debug(_log, "migrate config %s from version %d to %d.", configFile.toLocal8Bit().constData(), fromVersion, toVersion);
|
Debug(_log, "migrate config %s from version %d to %d.", configFile.toLocal8Bit().constData(), fromVersion, toVersion);
|
||||||
throw std::runtime_error("ERROR: config migration not implemented");
|
|
||||||
|
for (int v=fromVersion; v<toVersion; v++)
|
||||||
|
{
|
||||||
|
switch(v)
|
||||||
|
{
|
||||||
|
case 1: migrateFrom1(); break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw std::runtime_error("ERROR: config migration - unknown version");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigMigrator::migrateFrom1()
|
||||||
|
{
|
||||||
|
throw std::runtime_error("ERROR: config migration not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <utils/Logger.h>
|
#include "configMigratorBase.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class ConfigMigrator
|
///
|
||||||
|
/// class that contains migration code
|
||||||
|
/// helper code goeas to base class
|
||||||
|
class ConfigMigrator : public ConfigMigratorBase
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -12,6 +15,7 @@ public:
|
|||||||
~ConfigMigrator();
|
~ConfigMigrator();
|
||||||
|
|
||||||
bool migrate(QString configFile, int fromVersion,int toVersion);
|
bool migrate(QString configFile, int fromVersion,int toVersion);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Logger * _log;
|
void migrateFrom1();
|
||||||
};
|
};
|
11
src/hyperiond/configMigratorBase.cpp
Normal file
11
src/hyperiond/configMigratorBase.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "configMigratorBase.h"
|
||||||
|
|
||||||
|
ConfigMigratorBase::ConfigMigratorBase()
|
||||||
|
: _log(Logger::getInstance("ConfigMigrator"))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigMigratorBase::~ConfigMigratorBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
16
src/hyperiond/configMigratorBase.h
Normal file
16
src/hyperiond/configMigratorBase.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <utils/Logger.h>
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class ConfigMigratorBase
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
ConfigMigratorBase();
|
||||||
|
~ConfigMigratorBase();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Logger * _log;
|
||||||
|
};
|
@ -414,7 +414,7 @@ void HyperionDaemon::createSystemFrameGrabber()
|
|||||||
if (_qconfig.contains("framegrabber"))
|
if (_qconfig.contains("framegrabber"))
|
||||||
{
|
{
|
||||||
const QJsonObject & grabberConfig = _qconfig["framegrabber"].toObject();
|
const QJsonObject & grabberConfig = _qconfig["framegrabber"].toObject();
|
||||||
if (grabberConfig["enable"].toBool(true))
|
// if (grabberConfig["enable"].toBool(true))
|
||||||
{
|
{
|
||||||
_grabber_width = grabberConfig["width"].toInt(96);
|
_grabber_width = grabberConfig["width"].toInt(96);
|
||||||
_grabber_height = grabberConfig["height"].toInt(96);
|
_grabber_height = grabberConfig["height"].toInt(96);
|
||||||
@ -464,7 +464,7 @@ void HyperionDaemon::createSystemFrameGrabber()
|
|||||||
Info( _log, "set screen capture device to '%s'", type.toUtf8().constData());
|
Info( _log, "set screen capture device to '%s'", type.toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool grabberCompState = true;
|
bool grabberCompState = grabberConfig["enable"].toBool(true);
|
||||||
if (type == "") { Info( _log, "screen capture device disabled"); grabberCompState = false; }
|
if (type == "") { Info( _log, "screen capture device disabled"); grabberCompState = false; }
|
||||||
else if (type == "framebuffer") createGrabberFramebuffer(grabberConfig);
|
else if (type == "framebuffer") createGrabberFramebuffer(grabberConfig);
|
||||||
else if (type == "dispmanx") createGrabberDispmanx();
|
else if (type == "dispmanx") createGrabberDispmanx();
|
||||||
@ -474,6 +474,7 @@ void HyperionDaemon::createSystemFrameGrabber()
|
|||||||
else { Warning( _log, "unknown framegrabber type '%s'", type.toUtf8().constData()); grabberCompState = false; }
|
else { Warning( _log, "unknown framegrabber type '%s'", type.toUtf8().constData()); grabberCompState = false; }
|
||||||
|
|
||||||
_hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_GRABBER, grabberCompState);
|
_hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_GRABBER, grabberCompState);
|
||||||
|
_hyperion->setComponentState(hyperion::COMP_GRABBER, grabberCompState );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
const int CURRENT_CONFIG_VERSION = 2;
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#ifdef ENABLE_DISPMANX
|
#ifdef ENABLE_DISPMANX
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
// hyperion includes
|
// hyperion includes
|
||||||
#include <hyperion/LedString.h>
|
#include <hyperion/LedString.h>
|
||||||
|
#include "HyperionConfig.h"
|
||||||
|
|
||||||
bool loadConfig(const QString & configFile)
|
bool loadConfig(const QString & configFile)
|
||||||
{
|
{
|
||||||
@ -21,7 +22,7 @@ bool loadConfig(const QString & configFile)
|
|||||||
// read and set the json schema from the resource
|
// read and set the json schema from the resource
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
QFile schemaData(":/hyperion-schema");
|
QFile schemaData(":/hyperion-schema-"+QString::number(CURRENT_CONFIG_VERSION));
|
||||||
|
|
||||||
if (!schemaData.open(QIODevice::ReadOnly))
|
if (!schemaData.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user