mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
v4l grabber wont crash hyperiond anymore (#168)
* v4l errors won't lead to crash hyperiond (exceptions are catched) v4l auto device mode with better log messages createV4l in hyperiond.cpp refactored, now v4l is always available as long as it is compiled in * change back, code accidently altered * fix compile of dispmanx grabber
This commit is contained in:
@@ -535,42 +535,36 @@ void HyperionDaemon::createGrabberOsx(const QJsonObject & grabberConfig)
|
||||
void HyperionDaemon::createGrabberV4L2()
|
||||
{
|
||||
// construct and start the v4l2 grabber if the configuration is present
|
||||
if (_qconfig.contains("grabber-v4l2"))
|
||||
{
|
||||
const QJsonObject & grabberConfig = _qconfig["grabber-v4l2"].toObject();
|
||||
#ifdef ENABLE_V4L2
|
||||
_v4l2Grabber = new V4L2Wrapper(
|
||||
grabberConfig["device"].toString("/dev/video0").toStdString(),
|
||||
grabberConfig["input"].toInt(0),
|
||||
parseVideoStandard(grabberConfig["standard"].toString("no-change").toStdString()),
|
||||
parsePixelFormat(grabberConfig["pixelFormat"].toString("no-change").toStdString()),
|
||||
grabberConfig["width"].toInt(-1),
|
||||
grabberConfig["height"].toInt(-1),
|
||||
grabberConfig["frameDecimation"].toInt(2),
|
||||
grabberConfig["sizeDecimation"].toInt(8),
|
||||
grabberConfig["redSignalThreshold"].toDouble(0.0),
|
||||
grabberConfig["greenSignalThreshold"].toDouble(0.0),
|
||||
grabberConfig["blueSignalThreshold"].toDouble(0.0),
|
||||
grabberConfig["priority"].toInt(890));
|
||||
_v4l2Grabber->set3D(parse3DMode(grabberConfig["mode"].toString("2D").toStdString()));
|
||||
_v4l2Grabber->setCropping(
|
||||
grabberConfig["cropLeft"].toInt(0),
|
||||
grabberConfig["cropRight"].toInt(0),
|
||||
grabberConfig["cropTop"].toInt(0),
|
||||
grabberConfig["cropBottom"].toInt(0));
|
||||
Debug(_log, "V4L2 grabber created");
|
||||
bool v4lConfigured = _qconfig.contains("grabber-v4l2");
|
||||
const QJsonObject & grabberConfig = _qconfig["grabber-v4l2"].toObject();
|
||||
bool enableV4l = v4lConfigured && grabberConfig["enable"].toBool(true);
|
||||
|
||||
QObject::connect(_v4l2Grabber, SIGNAL(emitImage(int,
|
||||
const Image<ColorRgb>&, const int)), _protoServer,
|
||||
SLOT(sendImageToProtoSlaves(int,
|
||||
const Image<ColorRgb>&, const int)));
|
||||
if (grabberConfig["enable"].toBool(true) && _v4l2Grabber->start()) {
|
||||
Info(_log, "V4L2 grabber started");
|
||||
}
|
||||
#else
|
||||
if (grabberConfig["enable"].toBool(true)) {
|
||||
Error(_log, "The v4l2 grabber can not be instantiated, because it has been left out from the build");
|
||||
}
|
||||
#ifdef ENABLE_V4L2
|
||||
_v4l2Grabber = new V4L2Wrapper(
|
||||
grabberConfig["device"].toString("auto").toStdString(),
|
||||
grabberConfig["input"].toInt(0),
|
||||
parseVideoStandard(grabberConfig["standard"].toString("no-change").toStdString()),
|
||||
parsePixelFormat(grabberConfig["pixelFormat"].toString("no-change").toStdString()),
|
||||
grabberConfig["width"].toInt(-1),
|
||||
grabberConfig["height"].toInt(-1),
|
||||
grabberConfig["frameDecimation"].toInt(2),
|
||||
grabberConfig["sizeDecimation"].toInt(8),
|
||||
grabberConfig["redSignalThreshold"].toDouble(0.0),
|
||||
grabberConfig["greenSignalThreshold"].toDouble(0.0),
|
||||
grabberConfig["blueSignalThreshold"].toDouble(0.0),
|
||||
grabberConfig["priority"].toInt(890));
|
||||
_v4l2Grabber->set3D(parse3DMode(grabberConfig["mode"].toString("2D").toStdString()));
|
||||
_v4l2Grabber->setCropping(
|
||||
grabberConfig["cropLeft"].toInt(0),
|
||||
grabberConfig["cropRight"].toInt(0),
|
||||
grabberConfig["cropTop"].toInt(0),
|
||||
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)));
|
||||
InfoIf( enableV4l && _v4l2Grabber->start(), _log, "V4L2 grabber started");
|
||||
#endif
|
||||
}
|
||||
|
||||
ErrorIf(enableV4l && _v4l2Grabber==nullptr, _log, "The v4l2 grabber can not be instantiated, because it has been left out from the build");
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user