fix V4L2 grabber enable

This commit is contained in:
Portisch 2019-02-13 09:09:34 +01:00
parent a72ee0027a
commit 553fdc20a1
4 changed files with 15 additions and 3 deletions

View File

@ -24,6 +24,7 @@ public slots:
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom); void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom);
void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax); void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
void setSignalDetectionEnable(bool enable); void setSignalDetectionEnable(bool enable);
void setDeviceVideoStandard(QString device, VideoStandard videoStandard);
private slots: private slots:
void newFrame(const Image<ColorRgb> & image); void newFrame(const Image<ColorRgb> & image);

View File

@ -54,9 +54,6 @@ V4L2Grabber::V4L2Grabber(const QString & device
{ {
setPixelDecimation(pixelDecimation); setPixelDecimation(pixelDecimation);
getV4Ldevices(); getV4Ldevices();
// init
setDeviceVideoStandard(device, videoStandard);
} }
V4L2Grabber::~V4L2Grabber() V4L2Grabber::~V4L2Grabber()

View File

@ -76,3 +76,8 @@ bool V4L2Wrapper::getSignalDetectionEnable()
{ {
return _grabber.getSignalDetectionEnabled(); return _grabber.getSignalDetectionEnabled();
} }
void V4L2Wrapper::setDeviceVideoStandard(QString device, VideoStandard videoStandard)
{
_grabber.setDeviceVideoStandard(device, videoStandard);
}

View File

@ -376,6 +376,7 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJso
#ifdef ENABLE_V4L2 #ifdef ENABLE_V4L2
const QJsonObject & grabberConfig = v4lArray.at(idx).toObject(); const QJsonObject & grabberConfig = v4lArray.at(idx).toObject();
bool enableV4l = grabberConfig["enable"].toBool(true);
V4L2Wrapper* grabber = new V4L2Wrapper( V4L2Wrapper* grabber = new V4L2Wrapper(
grabberConfig["device"].toString("auto"), grabberConfig["device"].toString("auto"),
@ -403,6 +404,14 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJso
connect(this, &HyperionDaemon::videoMode, grabber, &V4L2Wrapper::setVideoMode); connect(this, &HyperionDaemon::videoMode, grabber, &V4L2Wrapper::setVideoMode);
connect(this, &HyperionDaemon::settingsChanged, grabber, &V4L2Wrapper::handleSettingsUpdate); connect(this, &HyperionDaemon::settingsChanged, grabber, &V4L2Wrapper::handleSettingsUpdate);
if (enableV4l)
{
v4lEnableCount++;
// init
grabber->setDeviceVideoStandard(grabberConfig["device"].toString("auto"), parseVideoStandard(grabberConfig["standard"].toString("no-change")));
}
_v4l2Grabbers.push_back(grabber); _v4l2Grabbers.push_back(grabber);
#endif #endif
} }