mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
made sure v4l code only initializes when needed and only errors when … (#162)
* made sure v4l code only initializes when needed and only errors when the module is enabled * fixed v4l2 as suggested by @redPanther
This commit is contained in:
parent
11441c91dc
commit
0d3f6c7ba1
@ -536,38 +536,42 @@ void HyperionDaemon::createGrabberOsx(const QJsonObject & grabberConfig)
|
|||||||
void HyperionDaemon::createGrabberV4L2()
|
void HyperionDaemon::createGrabberV4L2()
|
||||||
{
|
{
|
||||||
// construct and start the v4l2 grabber if the configuration is present
|
// construct and start the v4l2 grabber if the configuration is present
|
||||||
#ifdef ENABLE_V4L2
|
|
||||||
if (_qconfig.contains("grabber-v4l2"))
|
if (_qconfig.contains("grabber-v4l2"))
|
||||||
{
|
{
|
||||||
const QJsonObject & grabberConfig = _qconfig["grabber-v4l2"].toObject();
|
const QJsonObject & grabberConfig = _qconfig["grabber-v4l2"].toObject();
|
||||||
_v4l2Grabber = new V4L2Wrapper(
|
#ifdef ENABLE_V4L2
|
||||||
grabberConfig["device"].toString("/dev/video0").toStdString(),
|
_v4l2Grabber = new V4L2Wrapper(
|
||||||
grabberConfig["input"].toInt(0),
|
grabberConfig["device"].toString("/dev/video0").toStdString(),
|
||||||
parseVideoStandard(grabberConfig["standard"].toString("no-change").toStdString()),
|
grabberConfig["input"].toInt(0),
|
||||||
parsePixelFormat(grabberConfig["pixelFormat"].toString("no-change").toStdString()),
|
parseVideoStandard(grabberConfig["standard"].toString("no-change").toStdString()),
|
||||||
grabberConfig["width"].toInt(-1),
|
parsePixelFormat(grabberConfig["pixelFormat"].toString("no-change").toStdString()),
|
||||||
grabberConfig["height"].toInt(-1),
|
grabberConfig["width"].toInt(-1),
|
||||||
grabberConfig["frameDecimation"].toInt(2),
|
grabberConfig["height"].toInt(-1),
|
||||||
grabberConfig["sizeDecimation"].toInt(8),
|
grabberConfig["frameDecimation"].toInt(2),
|
||||||
grabberConfig["redSignalThreshold"].toDouble(0.0),
|
grabberConfig["sizeDecimation"].toInt(8),
|
||||||
grabberConfig["greenSignalThreshold"].toDouble(0.0),
|
grabberConfig["redSignalThreshold"].toDouble(0.0),
|
||||||
grabberConfig["blueSignalThreshold"].toDouble(0.0),
|
grabberConfig["greenSignalThreshold"].toDouble(0.0),
|
||||||
grabberConfig["priority"].toInt(890));
|
grabberConfig["blueSignalThreshold"].toDouble(0.0),
|
||||||
_v4l2Grabber->set3D(parse3DMode(grabberConfig["mode"].toString("2D").toStdString()));
|
grabberConfig["priority"].toInt(890));
|
||||||
_v4l2Grabber->setCropping(
|
_v4l2Grabber->set3D(parse3DMode(grabberConfig["mode"].toString("2D").toStdString()));
|
||||||
grabberConfig["cropLeft"].toInt(0),
|
_v4l2Grabber->setCropping(
|
||||||
grabberConfig["cropRight"].toInt(0),
|
grabberConfig["cropLeft"].toInt(0),
|
||||||
grabberConfig["cropTop"].toInt(0),
|
grabberConfig["cropRight"].toInt(0),
|
||||||
grabberConfig["cropBottom"].toInt(0));
|
grabberConfig["cropTop"].toInt(0),
|
||||||
Debug(_log, "V4L2 grabber created");
|
grabberConfig["cropBottom"].toInt(0));
|
||||||
|
Debug(_log, "V4L2 grabber created");
|
||||||
|
|
||||||
QObject::connect(_v4l2Grabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
QObject::connect(_v4l2Grabber, SIGNAL(emitImage(int,
|
||||||
if (grabberConfig["enable"].toBool(true) && _v4l2Grabber->start())
|
const Image<ColorRgb>&, const int)), _protoServer,
|
||||||
{
|
SLOT(sendImageToProtoSlaves(int,
|
||||||
Info(_log, "V4L2 grabber started");
|
const Image<ColorRgb>&, const int)));
|
||||||
}
|
if (grabberConfig["enable"].toBool(true) && _v4l2Grabber->start()) {
|
||||||
}
|
Info(_log, "V4L2 grabber started");
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
ErrorIf(_qconfig.contains("grabber-v4l2"), _log, "The v4l2 grabber can not be instantiated, because it has been left out from the build");
|
if (grabberConfig["enable"].toBool(true)) {
|
||||||
|
Error(_log, "The v4l2 grabber can not be instantiated, because it has been left out from the build");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user