even more changes

Signed-off-by: Paulchen-Panther <Paulchen--Panter@gmx.net>
This commit is contained in:
Paulchen-Panther
2018-12-28 18:12:45 +01:00
parent 3700566d10
commit 2a77f6f012
99 changed files with 2610 additions and 673 deletions

View File

@@ -17,6 +17,7 @@ target_link_libraries(hyperion
hyperion-utils
leddevice
bonjour
boblightserver
effectengine
${QT_LIBRARIES}
)

View File

@@ -1,12 +1,14 @@
#include <hyperion/CaptureCont.h>
#include <hyperion/Hyperion.h>
#include <QTimer>
CaptureCont::CaptureCont(Hyperion* hyperion)
: QObject()
, _hyperion(hyperion)
, _systemCaptEnabled(false)
, _v4lCaptEnabled(false)
, _v4lInactiveTimer(new QTimer(this))
{
// settings changes
connect(_hyperion, &Hyperion::settingsChanged, this, &CaptureCont::handleSettingsUpdate);
@@ -14,6 +16,11 @@ CaptureCont::CaptureCont(Hyperion* hyperion)
// comp changes
connect(_hyperion, &Hyperion::componentStateChanged, this, &CaptureCont::componentStateChanged);
// inactive timer v4l
connect(_v4lInactiveTimer, &QTimer::timeout, this, &CaptureCont::setV4lInactive);
_v4lInactiveTimer->setSingleShot(true);
_v4lInactiveTimer->setInterval(1000);
// init
handleSettingsUpdate(settings::INSTCAPTURE, _hyperion->getSetting(settings::INSTCAPTURE));
}
@@ -25,6 +32,7 @@ CaptureCont::~CaptureCont()
void CaptureCont::handleV4lImage(const Image<ColorRgb> & image)
{
_v4lInactiveTimer->start();
_hyperion->setInputImage(_v4lCaptPrio, image);
}
@@ -40,7 +48,7 @@ void CaptureCont::setSystemCaptureEnable(const bool& enable)
{
if(enable)
{
_hyperion->registerInput(_systemCaptPrio, hyperion::COMP_GRABBER, "System", "DoNotKnow");
_hyperion->registerInput(_systemCaptPrio, hyperion::COMP_GRABBER);
connect(_hyperion, &Hyperion::systemImage, this, &CaptureCont::handleSystemImage);
}
else
@@ -59,13 +67,14 @@ void CaptureCont::setV4LCaptureEnable(const bool& enable)
{
if(enable)
{
_hyperion->registerInput(_v4lCaptPrio, hyperion::COMP_V4L, "System", "DoNotKnow");
_hyperion->registerInput(_v4lCaptPrio, hyperion::COMP_V4L);
connect(_hyperion, &Hyperion::v4lImage, this, &CaptureCont::handleV4lImage);
}
else
{
disconnect(_hyperion, &Hyperion::v4lImage, this, &CaptureCont::handleV4lImage);
_hyperion->clear(_v4lCaptPrio);
_v4lInactiveTimer->stop();
}
_v4lCaptEnabled = enable;
_hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_V4L, enable);
@@ -104,3 +113,8 @@ void CaptureCont::componentStateChanged(const hyperion::Components component, bo
setV4LCaptureEnable(enable);
}
}
void CaptureCont::setV4lInactive()
{
_hyperion->setInputInactive(_v4lCaptPrio);
}

View File

@@ -55,9 +55,9 @@ bool ComponentRegister::setHyperionEnable(const bool& state)
return false;
}
bool ComponentRegister::isComponentEnabled(const hyperion::Components& comp) const
int ComponentRegister::isComponentEnabled(const hyperion::Components& comp) const
{
return _componentStates.at(comp);
return (_componentStates.count(comp)) ? _componentStates.at(comp) : -1;
}
void ComponentRegister::componentStateChanged(const hyperion::Components comp, const bool activated)

View File

@@ -24,12 +24,13 @@ Grabber::~Grabber()
void Grabber::setEnabled(bool enable)
{
Info(_log,"Capture interface is now %s", enable ? "enabled" : "disabled");
_enabled = enable;
}
void Grabber::setVideoMode(VideoMode mode)
{
Debug(_log,"setvideomode %d", mode);
Debug(_log,"Set videomode to %d", mode);
_videoMode = mode;
if ( _useImageResampler )
{
@@ -68,18 +69,20 @@ void Grabber::setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTo
}
}
void Grabber::setWidthHeight(int width, int height)
bool Grabber::setWidthHeight(int width, int height)
{
// eval changes with crop
if (width>0 && height>0)
if ( (width>0 && height>0) && (_width != width || _height != height) )
{
if (_cropLeft + _cropRight >= width || _cropTop + _cropBottom >= height)
{
Error(_log, "Rejecting invalid width/height values as it collides with image cropping: width: %d, height: %d", width, height);
return;
return false;
}
Debug(_log, "Set new width: %d, height: %d for capture", width, height);
_width = width;
_height = height;
return true;
}
return false;
}

View File

@@ -3,19 +3,14 @@
#include <hyperion/Grabber.h>
#include <HyperionConfig.h>
//forwarder
#include <hyperion/MessageForwarder.h>
// qt
#include <QTimer>
GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, const unsigned updateRate_Hz)
: _grabberName(grabberName)
, _hyperion(Hyperion::getInstance())
, _timer(new QTimer(this))
, _updateInterval_ms(1000/updateRate_Hz)
, _log(Logger::getInstance(grabberName))
, _forward(true)
, _ggrabber(ggrabber)
, _image(0,0)
{
@@ -24,8 +19,6 @@ GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned
_image.resize(width, height);
_forward = _hyperion->getForwarder()->protoForwardingEnabled();
connect(_timer, &QTimer::timeout, this, &GrabberWrapper::action);
}
@@ -105,7 +98,7 @@ void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJso
else
obj = config.object();
if(type == settings::SYSTEMCAPTURE)
if(type == settings::SYSTEMCAPTURE && !_grabberName.startsWith("V4L"))
{
// width/height
_ggrabber->setWidthHeight(obj["width"].toInt(96), obj["height"].toInt(96));
@@ -138,7 +131,8 @@ void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJso
}
}
if(type == settings::V4L2)
// v4l instances only!
if(type == settings::V4L2 && _grabberName.startsWith("V4L"))
{
// pixel decimation for v4l
_ggrabber->setPixelDecimation(obj["sizeDecimation"].toInt(8));
@@ -160,8 +154,8 @@ void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJso
obj["redSignalThreshold"].toDouble(0.0)/100.0,
obj["greenSignalThreshold"].toDouble(0.0)/100.0,
obj["blueSignalThreshold"].toDouble(0.0)/100.0);
_ggrabber->setInputVideoStandard(
obj["input"].toInt(0),
_ggrabber->setDeviceVideoStandard(
obj["device"].toString("auto"),
parseVideoStandard(obj["standard"].toString("no-change")));
}

View File

@@ -47,6 +47,9 @@
// CaptureControl (Daemon capture)
#include <hyperion/CaptureCont.h>
// Boblight
#include <boblightserver/BoblightServer.h>
Hyperion* Hyperion::_hyperion = nullptr;
Hyperion* Hyperion::initInstance( HyperionDaemon* daemon, const quint8& instance, const QString configFile, const QString rootPath)
@@ -122,7 +125,7 @@ Hyperion::Hyperion(HyperionDaemon* daemon, const quint8& instance, const QString
const QJsonObject color = getSetting(settings::COLOR).object();
// initialize leddevices
const QJsonObject ledDevice = getSetting(settings::DEVICE).object();
QJsonObject ledDevice = getSetting(settings::DEVICE).object();
ledDevice["currentLedCount"] = int(_hwLedCount); // Inject led count info
_device = LedDeviceFactory::construct(ledDevice);
@@ -159,6 +162,11 @@ Hyperion::Hyperion(HyperionDaemon* daemon, const quint8& instance, const QString
// if there is no startup / background eff and no sending capture interface we probably want to push once BLACK (as PrioMuxer won't emit a prioritiy change)
update();
// boblight, can't live in global scope as it depends on layout
_boblightServer = new BoblightServer(this, getSetting(settings::BOBLSERVER));
connect(this, &Hyperion::settingsChanged, _boblightServer, &BoblightServer::handleSettingsUpdate);
}
Hyperion::~Hyperion()
@@ -178,6 +186,7 @@ void Hyperion::freeObjects(bool emitCloseSignal)
}
// delete components on exit of hyperion core
delete _boblightServer;
delete _captureCont;
delete _effectEngine;
//delete _deviceSmooth;
@@ -249,7 +258,7 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
else if(type == settings::DEVICE)
{
_lockUpdate = true;
const QJsonObject dev = config.object();
QJsonObject dev = config.object();
// handle hwLedCount update
_hwLedCount = qMax(unsigned(dev["hardwareLedCount"].toInt(getLedCount())), getLedCount());
@@ -281,7 +290,7 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
_deviceSmooth->startTimerDelayed();
_lockUpdate = false;
}
// update once to push single color sets / adjustments/ ledlayout resizes and update ledBuffer
// update once to push single color sets / adjustments/ ledlayout resizes and update ledBuffer color
update();
}
@@ -421,6 +430,11 @@ const bool Hyperion::setInputImage(const int priority, const Image<ColorRgb>& im
return false;
}
const bool Hyperion::setInputInactive(const quint8& priority)
{
return _muxer.setInputInactive(priority);
}
void Hyperion::setColor(int priority, const ColorRgb &color, const int timeout_ms, const QString& origin, bool clearEffects)
{
// clear effect if this call does not come from an effect
@@ -602,7 +616,7 @@ void Hyperion::update()
// disable the black border detector for effects and ledmapping to 0
if(compChanged)
{
_imageProcessor->setBlackbarDetectDisable((_prevCompId == hyperion::COMP_EFFECT || _prevCompId == hyperion::COMP_GRABBER));
_imageProcessor->setBlackbarDetectDisable((_prevCompId == hyperion::COMP_EFFECT));
_imageProcessor->setHardLedMappingType((_prevCompId == hyperion::COMP_EFFECT) ? 0 : -1);
}
_imageProcessor->process(image, _ledBuffer);

View File

@@ -228,7 +228,7 @@ bool LinearColorSmoothing::selectConfig(unsigned cfg, const bool& force)
}
_currentConfigId = cfg;
//DebugIf( enabled() && !_pause, _log, "set smoothing cfg: %d, interval: %d ms, settlingTime: %d ms, updateDelay: %d frames", _currentConfigId, _updateInterval, _settlingTime, _outputDelay );
InfoIf( _pause, _log, "set smoothing cfg: %d, pause", _currentConfigId );
DebugIf( _pause, _log, "set smoothing cfg: %d, pause", _currentConfigId );
return true;
}

View File

@@ -240,6 +240,12 @@ const bool PriorityMuxer::setInputImage(const int priority, const Image<ColorRgb
return true;
}
const bool PriorityMuxer::setInputInactive(const quint8& priority)
{
Image<ColorRgb> image;
return setInputImage(priority, image, -100);
}
const bool PriorityMuxer::clearInput(const uint8_t priority)
{
if (priority < PriorityMuxer::LOWEST_PRIORITY && _activeInputs.remove(priority))

View File

@@ -133,8 +133,6 @@ SettingsManager::~SettingsManager()
const QJsonDocument SettingsManager::getSetting(const settings::type& type)
{
//return _sTable->getSettingsRecord(settings::typeToString(type));
QString key = settings::typeToString(type);
if(_qconfig[key].isObject())
return QJsonDocument(_qconfig[key].toObject());
@@ -168,6 +166,23 @@ const bool SettingsManager::saveSettings(QJsonObject config, const bool& correct
return false;
}
// compare old data with new data to emit/save changes accordingly
for(const auto key : config.keys())
{
QString newData, oldData;
_qconfig[key].isObject()
? oldData = QString(QJsonDocument(_qconfig[key].toObject()).toJson(QJsonDocument::Compact))
: oldData = QString(QJsonDocument(_qconfig[key].toArray()).toJson(QJsonDocument::Compact));
config[key].isObject()
? newData = QString(QJsonDocument(config[key].toObject()).toJson(QJsonDocument::Compact))
: newData = QString(QJsonDocument(config[key].toArray()).toJson(QJsonDocument::Compact));
if(oldData != newData)
emit settingsChanged(settings::stringToType(key), QJsonDocument::fromJson(newData.toLocal8Bit()));
}
// store the current state
_qconfig = config;

View File

@@ -55,6 +55,10 @@
{
"$ref": "schema-protoServer.json"
},
"flatbufServer":
{
"$ref": "schema-flatbufServer.json"
},
"boblightServer" :
{
"$ref": "schema-boblightServer.json"

View File

@@ -16,6 +16,7 @@
<file alias="schema-forwarder.json">schema/schema-forwarder.json</file>
<file alias="schema-jsonServer.json">schema/schema-jsonServer.json</file>
<file alias="schema-protoServer.json">schema/schema-protoServer.json</file>
<file alias="schema-flatbufServer.json">schema/schema-flatbufServer.json</file>
<file alias="schema-boblightServer.json">schema/schema-boblightServer.json</file>
<file alias="schema-udpListener.json">schema/schema-udpListener.json</file>
<file alias="schema-webConfig.json">schema/schema-webConfig.json</file>

View File

@@ -2,18 +2,21 @@
"type" : "object",
"title" : "edt_dev_general_heading_title",
"required" : true,
"defaultProperties": ["ledCount","colorOrder","rewriteTime","minimumWriteTime"],
"defaultProperties": ["hardwareLedCount","colorOrder","rewriteTime"],
"properties" :
{
"type" :
{
"type" : "string"
"type" : "string",
"propertyOrder" : 1
},
"ledCount" :
"hardwareLedCount" :
{
"type" : "integer",
"minimum" : 0,
"title" : "edt_dev_general_ledCount_title",
"title" : "edt_dev_general_hardwareLedCount_title",
"minimum" : 1,
"default" : 1,
"access" : "expert",
"propertyOrder" : 2
},
"colorOrder" :

View File

@@ -3,7 +3,7 @@
"required" : true,
"title" : "edt_conf_v4l2_heading_title",
"minItems": 1,
"maxItems": 2,
"maxItems": 1,
"items":
{
"type" : "object",
@@ -16,17 +16,9 @@
"type" : "string",
"title" : "edt_conf_v4l2_device_title",
"default" : "auto",
"minLength" : 4,
"required" : true,
"propertyOrder" : 2
},
"input" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_input_title",
"minimum" : 0,
"default" : 0,
"required" : true,
"propertyOrder" : 3
"propertyOrder" : 1
},
"standard" :
{
@@ -38,7 +30,7 @@
"enum_titles" : ["edt_conf_enum_PAL", "edt_conf_enum_NTSC", "edt_conf_enum_SECAM", "edt_conf_enum_NO_CHANGE"]
},
"required" : true,
"propertyOrder" : 4
"propertyOrder" : 2
},
"sizeDecimation" :
{
@@ -48,7 +40,7 @@
"maximum" : 30,
"default" : 6,
"required" : true,
"propertyOrder" : 8
"propertyOrder" : 3
},
"cropLeft" :
{
@@ -58,7 +50,7 @@
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 11
"propertyOrder" : 4
},
"cropRight" :
{
@@ -68,7 +60,7 @@
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 12
"propertyOrder" : 5
},
"cropTop" :
{
@@ -78,7 +70,7 @@
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 13
"propertyOrder" : 6
},
"cropBottom" :
{
@@ -88,7 +80,7 @@
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 14
"propertyOrder" : 7
},
"signalDetection" :
{
@@ -96,7 +88,7 @@
"title" : "edt_conf_v4l2_signalDetection_title",
"default" : false,
"required" : true,
"propertyOrder" : 15
"propertyOrder" : 8
},
"redSignalThreshold" :
{
@@ -112,7 +104,7 @@
}
},
"required" : true,
"propertyOrder" : 16
"propertyOrder" : 9
},
"greenSignalThreshold" :
{
@@ -128,7 +120,7 @@
}
},
"required" : true,
"propertyOrder" : 17
"propertyOrder" : 10
},
"blueSignalThreshold" :
{
@@ -144,7 +136,7 @@
}
},
"required" : true,
"propertyOrder" : 18
"propertyOrder" : 11
},
"sDVOffsetMin" :
{
@@ -160,7 +152,7 @@
}
},
"required" : true,
"propertyOrder" : 19
"propertyOrder" : 12
},
"sDVOffsetMax" :
{
@@ -176,7 +168,7 @@
}
},
"required" : true,
"propertyOrder" : 20
"propertyOrder" : 13
},
"sDHOffsetMin" :
{
@@ -192,7 +184,7 @@
}
},
"required" : true,
"propertyOrder" : 21
"propertyOrder" : 14
},
"sDHOffsetMax" :
{
@@ -208,7 +200,7 @@
}
},
"required" : true,
"propertyOrder" : 22
"propertyOrder" : 15
}
},
"additionalProperties" : false

View File

@@ -8,7 +8,7 @@
{
"type" : "boolean",
"required" : true,
"title" : "edt_conf_instC_systemEnable",
"title" : "edt_conf_instC_systemEnable_title",
"default" : true,
"propertyOrder" : 1
},
@@ -26,7 +26,7 @@
{
"type" : "boolean",
"required" : true,
"title" : "edt_conf_instC_v4lEnable",
"title" : "edt_conf_instC_v4lEnable_title",
"default" : false,
"propertyOrder" : 3
},

View File

@@ -3,14 +3,6 @@
"title" : "edt_conf_webc_heading_title",
"properties" :
{
"enable" :
{
"type" : "boolean",
"title" : "edt_conf_general_enable_title",
"default" : true,
"access" : "expert",
"propertyOrder" : 1
},
"document_root" :
{
"type" : "string",