diff --git a/assets/webconfig/i18n/de.json b/assets/webconfig/i18n/de.json index 0edc56aa..8517a288 100644 --- a/assets/webconfig/i18n/de.json +++ b/assets/webconfig/i18n/de.json @@ -559,6 +559,10 @@ "edt_conf_v4l2_sDVOffsetMax_expl": "Signal Erkennungs-Bereich vertikal maximum (0.0-1.0)", "edt_conf_v4l2_sDHOffsetMax_title": "Signal Erkennung HMax", "edt_conf_v4l2_sDHOffsetMax_expl": "Signal Erkennungs-Bereich horizontal maximum (0.0-1.0)", + "edt_conf_v4l2_grabberFix_title": "Feste Grabber Werte", + "edt_conf_v4l2_gFWidth_title": "Breite", + "edt_conf_v4l2_gFHeight_title": "Höhe", + "edt_conf_v4l2_gFVType_title": "Pixelformat", "edt_conf_instCapture_heading_title": "Instance Aufnahme", "edt_conf_instC_systemEnable_title": "Aktiviere Plattform Aufnahme", "edt_conf_instC_systemEnable_expl": "Aktiviert die Plattform Aufnahme für diese LED Hardware Instanz", diff --git a/include/grabber/V4L2Grabber.h b/include/grabber/V4L2Grabber.h index f76c00ed..13488e81 100644 --- a/include/grabber/V4L2Grabber.h +++ b/include/grabber/V4L2Grabber.h @@ -44,6 +44,8 @@ public: bool getSignalDetectionEnabled() { return _signalDetectionEnabled; } + bool getGrabberFixEnabled() { return _grabberFixEnabled; } + int grabFrame(Image &); /// @@ -79,6 +81,12 @@ public: /// virtual void setSignalDetectionEnable(bool enable); + virtual void setGrabberFixEnable(bool enable); + virtual void setGrabberFixValues( + int width, + int height, + int vtype); + /// /// @brief overwrite Grabber.h implementation /// @@ -204,4 +212,10 @@ private: bool _initialized; bool _deviceAutoDiscoverEnabled; + // grabberfix + bool _grabberFixEnabled; + int _gf_width; + int _gf_height; + int _gf_vtype; + }; diff --git a/include/grabber/V4L2Wrapper.h b/include/grabber/V4L2Wrapper.h index c805d72d..50d6f58d 100644 --- a/include/grabber/V4L2Wrapper.h +++ b/include/grabber/V4L2Wrapper.h @@ -15,6 +15,7 @@ public: virtual ~V4L2Wrapper() {}; bool getSignalDetectionEnable(); + bool getGrabberFixEnable(); public slots: bool start(); @@ -24,6 +25,8 @@ public slots: void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom); void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax); void setSignalDetectionEnable(bool enable); + void setGrabberFixEnable(bool enable); + void setGrabberFixValues(int width, int height, string vtype); void setDeviceVideoStandard(QString device, VideoStandard videoStandard); signals: diff --git a/include/hyperion/Grabber.h b/include/hyperion/Grabber.h index cb0c3171..90bf1fea 100644 --- a/include/hyperion/Grabber.h +++ b/include/hyperion/Grabber.h @@ -66,6 +66,11 @@ public: /// @brief Apply SignalDetectionEnable (used from v4l) /// virtual void setSignalDetectionEnable(bool enable) {}; + virtual void setGrabberFixEnable(bool enable) {}; + virtual void setGrabberFixValues( + int width, + int height, + int vtype) {}; /// /// @brief Apply device and videoStanded (used from v4l) diff --git a/libsrc/grabber/v4l2/V4L2Grabber.cpp b/libsrc/grabber/v4l2/V4L2Grabber.cpp index 43db07c3..96ff26f1 100644 --- a/libsrc/grabber/v4l2/V4L2Grabber.cpp +++ b/libsrc/grabber/v4l2/V4L2Grabber.cpp @@ -54,6 +54,10 @@ V4L2Grabber::V4L2Grabber(const QString & device , _streamNotifier(nullptr) , _initialized(false) , _deviceAutoDiscoverEnabled(false) + , _grabberFixEnabled(true) + , _gf_width(0) + , _gf_height(0) + , _gf_vtype("JPEG") { setPixelDecimation(pixelDecimation); getV4Ldevices(); @@ -206,6 +210,14 @@ void V4L2Grabber::setSignalDetectionOffset(double horizontalMin, double vertical Info(_log, "Signal detection area set to: %f,%f x %f,%f", _x_frac_min, _y_frac_min, _x_frac_max, _y_frac_max ); } +void V4L2Grabber::setGrabberFixValues(int width, int height, string vtype) +{ + _gf_width = width; + _gf_height = height; + _gf_vtype = vtype; + + Warning(_log, "Grabber fix set to: %d x %d, %s", _gf_width, _gf_height, _gf_vtype); +} bool V4L2Grabber::start() { @@ -615,6 +627,19 @@ void V4L2Grabber::init_device(VideoStandard videoStandard, int input) fmtdesc.index++; } + // RPi Camera V1.3 & V2.1 workaround resolution and pixelformat + Warning(_log, "vor _grabberFixEnabled"); + if (_grabberFixEnabled) { + Warning(_log, "_grabberFixEnabled"); + //if (max_width == 2592 || max_width == 3280) { + max_width = _gf_width; + max_height = _gf_height; + fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY; + Warning(_log, "wxh %d x %d", max_width, max_height); + //} + } else { + Warning(_log, "nicht _grabberFixEnabled"); + } // set the settings if (max_width != 0 || max_height != 0) @@ -1148,6 +1173,14 @@ void V4L2Grabber::setSignalDetectionEnable(bool enable) Info(_log, "Signal detection is now %s", enable ? "enabled" : "disabled"); } } +void V4L2Grabber::setGrabberFixEnable(bool enable) +{ + if (_grabberFixEnabled != enable) + { + _grabberFixEnabled = enable; + Info(_log, "Grabber fix is now %s", enable ? "enabled" : "disabled"); + } +} void V4L2Grabber::setPixelDecimation(int pixelDecimation) { diff --git a/libsrc/grabber/v4l2/V4L2Wrapper.cpp b/libsrc/grabber/v4l2/V4L2Wrapper.cpp index a4e89192..af1c8e33 100644 --- a/libsrc/grabber/v4l2/V4L2Wrapper.cpp +++ b/libsrc/grabber/v4l2/V4L2Wrapper.cpp @@ -52,6 +52,10 @@ void V4L2Wrapper::setSignalDetectionOffset(double verticalMin, double horizontal { _grabber.setSignalDetectionOffset(verticalMin, horizontalMin, verticalMax, horizontalMax); } +void V4L2Wrapper::setGrabberFixValues(int width, int height, string vtype) +{ + _grabber.setGrabberFixValues(width, height, vtype); +} void V4L2Wrapper::newFrame(const Image &image) { @@ -78,6 +82,15 @@ bool V4L2Wrapper::getSignalDetectionEnable() { return _grabber.getSignalDetectionEnabled(); } +void V4L2Wrapper::setGrabberFixEnable(bool enable) +{ + _grabber.setGrabberFixEnable(enable); +} + +bool V4L2Wrapper::getGrabberFixEnable() +{ + return _grabber.getGrabberFixEnabled(); +} void V4L2Wrapper::setDeviceVideoStandard(QString device, VideoStandard videoStandard) { diff --git a/libsrc/hyperion/GrabberWrapper.cpp b/libsrc/hyperion/GrabberWrapper.cpp index 1e0c25fb..dd686d90 100644 --- a/libsrc/hyperion/GrabberWrapper.cpp +++ b/libsrc/hyperion/GrabberWrapper.cpp @@ -165,6 +165,10 @@ void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJso _ggrabber->setDeviceVideoStandard( obj["device"].toString("auto"), parseVideoStandard(obj["standard"].toString("no-change"))); + _ggrabber->setGrabberFixValues( + obj["gFWidth"].toInt(0), + obj["gFHeight"].toInt(0), + obj["gFVType"].toString("JPEG")); } } diff --git a/libsrc/hyperion/schema/schema-grabberV4L2.json b/libsrc/hyperion/schema/schema-grabberV4L2.json index 1808f04d..9df38e20 100644 --- a/libsrc/hyperion/schema/schema-grabberV4L2.json +++ b/libsrc/hyperion/schema/schema-grabberV4L2.json @@ -194,6 +194,64 @@ }, "required" : true, "propertyOrder" : 15 + }, + "grabberFix" : + { + "type" : "boolean", + "title" : "edt_conf_v4l2_grabberFix_title", + "default" : false, + "required" : true, + "propertyOrder" : 16 + }, + "gFWidth" : + { + "type" : "integer", + "title" : "edt_conf_v4l2_gFWidth_title", + "minimum" : 320, + "maximum" : 1980, + "default" : 1280, + "step" : 10, + "options": { + "dependencies": { + "grabberFix": true + } + }, + "required" : true, + "propertyOrder" : 17 + }, + "gFHeight" : + { + "type" : "integer", + "title" : "edt_conf_v4l2_gFHeight_title", + "minimum" : 240, + "maximum" : 1080, + "default" : 720, + "step" : 10, + "options": { + "dependencies": { + "grabberFix": true + } + }, + "required" : true, + "propertyOrder" : 18 + }, + "gFVType" : + { + "type" : "string", + "title" : "edt_conf_v4l2_gFVType_title", + "enum" : ["UYVY","YUYV","RGB32"], + "options": + { + "enum_titles": ["UYVY","YUYV","RGB32"] + }, + "default" : "UYVY", + "options": { + "dependencies": { + "grabberFix": true + } + }, + "required" : true, + "propertyOrder" : 19 } }, "additionalProperties" : false diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index 8fde0c5c..c5e19ddb 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -431,6 +431,11 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& settingsType, co grabberConfig["sDVOffsetMin"].toDouble(0.25), grabberConfig["sDHOffsetMax"].toDouble(0.75), grabberConfig["sDVOffsetMax"].toDouble(0.75)); + _v4l2Grabber->setGrabberFixEnable(grabberConfig["grabberFix"].toBool(true)); + _v4l2Grabber->setGrabberFixValues( + grabberConfig["gFWidth"].toInt(0), + grabberConfig["gFHeight"].toInt(0), + grabberConfig["gFVType"].toString("JPEG")); Debug(_log, "V4L2 grabber created"); // connect to HyperionDaemon signal