diff --git a/include/grabber/AmlogicWrapper.h b/include/grabber/AmlogicWrapper.h index 56821604..0673933b 100644 --- a/include/grabber/AmlogicWrapper.h +++ b/include/grabber/AmlogicWrapper.h @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -43,12 +42,6 @@ public slots: /// virtual void action(); - /// - /// Set the grabbing mode - /// @param[in] mode The new grabbing mode - /// - void setGrabbingMode(const GrabbingMode mode); - /// /// Set the video mode (2D/3D) /// @param[in] mode The new video mode diff --git a/include/grabber/DispmanxWrapper.h b/include/grabber/DispmanxWrapper.h index ab47b1a0..2dd7fa58 100644 --- a/include/grabber/DispmanxWrapper.h +++ b/include/grabber/DispmanxWrapper.h @@ -45,11 +45,8 @@ public slots: void setCropping(const unsigned cropLeft, const unsigned cropRight, const unsigned cropTop, const unsigned cropBottom); - /// - /// Set the grabbing mode - /// @param[in] mode The new grabbing mode - /// - void setGrabbingMode(const GrabbingMode mode); + virtual void kodiPlay(); + virtual void kodiPause(); /// /// Set the video mode (2D/3D) diff --git a/include/grabber/FramebufferWrapper.h b/include/grabber/FramebufferWrapper.h index 0e388d09..e0aa9602 100644 --- a/include/grabber/FramebufferWrapper.h +++ b/include/grabber/FramebufferWrapper.h @@ -41,12 +41,6 @@ public slots: /// virtual void action(); - /// - /// Set the grabbing mode - /// @param[in] mode The new grabbing mode - /// - void setGrabbingMode(const GrabbingMode mode); - /// /// Set the video mode (2D/3D) /// @param[in] mode The new video mode diff --git a/include/grabber/OsxWrapper.h b/include/grabber/OsxWrapper.h index 007a8579..e14daf4d 100644 --- a/include/grabber/OsxWrapper.h +++ b/include/grabber/OsxWrapper.h @@ -43,12 +43,6 @@ public slots: /// virtual void action(); - /// - /// Set the grabbing mode - /// @param[in] mode The new grabbing mode - /// - void setGrabbingMode(const GrabbingMode mode); - /// /// Set the video mode (2D/3D) /// @param[in] mode The new video mode diff --git a/include/grabber/V4L2Wrapper.h b/include/grabber/V4L2Wrapper.h index 41daf033..e49c7d83 100644 --- a/include/grabber/V4L2Wrapper.h +++ b/include/grabber/V4L2Wrapper.h @@ -32,10 +32,7 @@ public slots: void stop(); - void setCropping(int cropLeft, - int cropRight, - int cropTop, - int cropBottom); + void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom); void set3D(VideoMode mode); diff --git a/include/grabber/X11Wrapper.h b/include/grabber/X11Wrapper.h index 9120712e..51adb34b 100644 --- a/include/grabber/X11Wrapper.h +++ b/include/grabber/X11Wrapper.h @@ -3,7 +3,6 @@ // Utils includes #include #include -#include #include #include @@ -46,12 +45,6 @@ public slots: /// virtual void action(); - /// - /// Set the grabbing mode - /// @param[in] mode The new grabbing mode - /// - void setGrabbingMode(const GrabbingMode mode); - /// /// Set the video mode (2D/3D) /// @param[in] mode The new video mode diff --git a/include/hyperion/GrabberWrapper.h b/include/hyperion/GrabberWrapper.h index 463047a8..e6459899 100644 --- a/include/hyperion/GrabberWrapper.h +++ b/include/hyperion/GrabberWrapper.h @@ -6,6 +6,7 @@ #include #include +#include #include class ImageProcessor; @@ -18,17 +19,39 @@ public: virtual ~GrabberWrapper(); + /// + /// Starts the grabber wich produces led values with the specified update rate + /// virtual bool start(); + + /// + /// Stop grabber + /// virtual void stop(); public slots: void componentStateChanged(const hyperion::Components component, bool enable); + + /// + /// virtual method, should perform single frame grab and computes the led-colors + /// virtual void action() = 0; + /// + /// Set the grabbing mode + /// @param[in] mode The new grabbing mode + /// + void setGrabbingMode(const GrabbingMode mode); + signals: void emitImage(int priority, const Image & image, const int timeout_ms); protected: + + virtual void kodiPlay(); + virtual void kodiOff(); + virtual void kodiPause(); + std::string _grabberName; /// Pointer to Hyperion for writing led values diff --git a/libsrc/grabber/amlogic/AmlogicWrapper.cpp b/libsrc/grabber/amlogic/AmlogicWrapper.cpp index 1ab0c256..7705e1a0 100644 --- a/libsrc/grabber/amlogic/AmlogicWrapper.cpp +++ b/libsrc/grabber/amlogic/AmlogicWrapper.cpp @@ -50,29 +50,6 @@ void AmlogicWrapper::action() _hyperion->setColors(_priority, _ledColors, _timeout_ms); } -void AmlogicWrapper::setGrabbingMode(const GrabbingMode mode) -{ - switch (mode) - { - case GRABBINGMODE_VIDEO: - case GRABBINGMODE_PAUSE: -// _grabber->setFlags(DISPMANX_SNAPSHOT_NO_RGB|DISPMANX_SNAPSHOT_FILL); - start(); - break; - case GRABBINGMODE_AUDIO: - case GRABBINGMODE_PHOTO: - case GRABBINGMODE_MENU: - case GRABBINGMODE_SCREENSAVER: - case GRABBINGMODE_INVALID: -// _grabber->setFlags(0); - start(); - break; - case GRABBINGMODE_OFF: - stop(); - break; - } -} - void AmlogicWrapper::setVideoMode(const VideoMode mode) { _grabber->setVideoMode(mode); diff --git a/libsrc/grabber/dispmanx/DispmanxWrapper.cpp b/libsrc/grabber/dispmanx/DispmanxWrapper.cpp index 65583ab7..ad977a94 100644 --- a/libsrc/grabber/dispmanx/DispmanxWrapper.cpp +++ b/libsrc/grabber/dispmanx/DispmanxWrapper.cpp @@ -46,27 +46,17 @@ void DispmanxWrapper::action() _hyperion->setColors(_priority, _ledColors, _timeout_ms); } -void DispmanxWrapper::setGrabbingMode(const GrabbingMode mode) +void DispmanxWrapper::kodiPlay() { - switch (mode) - { - case GRABBINGMODE_VIDEO: - case GRABBINGMODE_PAUSE: - _grabber->setFlags(DISPMANX_SNAPSHOT_NO_RGB|DISPMANX_SNAPSHOT_FILL); - start(); - break; - case GRABBINGMODE_AUDIO: - case GRABBINGMODE_PHOTO: - case GRABBINGMODE_MENU: - case GRABBINGMODE_SCREENSAVER: - case GRABBINGMODE_INVALID: - _grabber->setFlags(0); - start(); - break; - case GRABBINGMODE_OFF: - stop(); - break; - } + _grabber->setFlags(DISPMANX_SNAPSHOT_NO_RGB|DISPMANX_SNAPSHOT_FILL); + GrabberWrapper::kodiPlay(); + +} + +void DispmanxWrapper::kodiPause() +{ + _grabber->setFlags(0); + GrabberWrapper::kodiPause(); } void DispmanxWrapper::setVideoMode(const VideoMode mode) diff --git a/libsrc/grabber/framebuffer/FramebufferWrapper.cpp b/libsrc/grabber/framebuffer/FramebufferWrapper.cpp index 1de8d586..c09a909b 100644 --- a/libsrc/grabber/framebuffer/FramebufferWrapper.cpp +++ b/libsrc/grabber/framebuffer/FramebufferWrapper.cpp @@ -40,25 +40,6 @@ void FramebufferWrapper::action() _hyperion->setColors(_priority, _ledColors, _timeout_ms); } -void FramebufferWrapper::setGrabbingMode(const GrabbingMode mode) -{ - switch (mode) - { - case GRABBINGMODE_VIDEO: - case GRABBINGMODE_PAUSE: - case GRABBINGMODE_AUDIO: - case GRABBINGMODE_PHOTO: - case GRABBINGMODE_MENU: - case GRABBINGMODE_SCREENSAVER: - case GRABBINGMODE_INVALID: - start(); - break; - case GRABBINGMODE_OFF: - stop(); - break; - } -} - void FramebufferWrapper::setVideoMode(const VideoMode mode) { _grabber->setVideoMode(mode); diff --git a/libsrc/grabber/osx/OsxWrapper.cpp b/libsrc/grabber/osx/OsxWrapper.cpp index 9e94fa08..8504c41d 100644 --- a/libsrc/grabber/osx/OsxWrapper.cpp +++ b/libsrc/grabber/osx/OsxWrapper.cpp @@ -40,24 +40,6 @@ void OsxWrapper::action() _hyperion->setColors(_priority, _ledColors, _timeout_ms); } -void OsxWrapper::setGrabbingMode(const GrabbingMode mode) -{ - switch (mode) - { - case GRABBINGMODE_VIDEO: - case GRABBINGMODE_PAUSE: - case GRABBINGMODE_AUDIO: - case GRABBINGMODE_PHOTO: - case GRABBINGMODE_MENU: - case GRABBINGMODE_SCREENSAVER: - case GRABBINGMODE_INVALID: - start(); - break; - case GRABBINGMODE_OFF: - stop(); - break; - } -} void OsxWrapper::setVideoMode(const VideoMode mode) { diff --git a/libsrc/grabber/x11/X11Wrapper.cpp b/libsrc/grabber/x11/X11Wrapper.cpp index 915562c1..a8ef91d3 100644 --- a/libsrc/grabber/x11/X11Wrapper.cpp +++ b/libsrc/grabber/x11/X11Wrapper.cpp @@ -73,24 +73,6 @@ void X11Wrapper::action() _hyperion->setColors(_priority, _ledColors, _timeout_ms); } -void X11Wrapper::setGrabbingMode(const GrabbingMode mode) -{ - switch (mode) - { - case GRABBINGMODE_VIDEO: - case GRABBINGMODE_PAUSE: - case GRABBINGMODE_AUDIO: - case GRABBINGMODE_PHOTO: - case GRABBINGMODE_MENU: - case GRABBINGMODE_SCREENSAVER: - case GRABBINGMODE_INVALID: - start(); - break; - case GRABBINGMODE_OFF: - stop(); - break; - } -} void X11Wrapper::setVideoMode(const VideoMode mode) { diff --git a/libsrc/hyperion/GrabberWrapper.cpp b/libsrc/hyperion/GrabberWrapper.cpp index 8e3eb455..c75fa942 100644 --- a/libsrc/hyperion/GrabberWrapper.cpp +++ b/libsrc/hyperion/GrabberWrapper.cpp @@ -67,3 +67,41 @@ void GrabberWrapper::componentStateChanged(const hyperion::Components component, Info(_log, "bb detector change state to %s", (_processor->blackBorderDetectorEnabled() ? "enabled" : "disabled") ); } } + +void GrabberWrapper::kodiPlay() +{ + start(); +} + +void GrabberWrapper::kodiPause() +{ + start(); +} + +void GrabberWrapper::kodiOff() +{ + stop(); +} + + +void GrabberWrapper::setGrabbingMode(const GrabbingMode mode) +{ + switch (mode) + { + case GRABBINGMODE_VIDEO: + case GRABBINGMODE_PAUSE: + kodiPause(); + break; + case GRABBINGMODE_AUDIO: + case GRABBINGMODE_PHOTO: + case GRABBINGMODE_MENU: + case GRABBINGMODE_SCREENSAVER: + case GRABBINGMODE_INVALID: + kodiPlay(); + break; + case GRABBINGMODE_OFF: + kodiOff(); + break; + } +} + diff --git a/libsrc/hyperion/hyperion.schema.json b/libsrc/hyperion/hyperion.schema.json index 1bc3eb82..54e27711 100644 --- a/libsrc/hyperion/hyperion.schema.json +++ b/libsrc/hyperion/hyperion.schema.json @@ -400,93 +400,79 @@ "grabber-v4l2" : { "type" : "object", - "required" : false, "properties" : { "enable" : { - "type" : "boolean", - "required" : true + "type" : "boolean" }, "device" : { - "type" : "string", - "required" : true + "type" : "string" }, "input" : { - "type" : "integer", - "required" : true + "type" : "integer" }, "standard" : { - "type" : "string", - "required" : true + "type" : "string" }, "width" : { - "type" : "integer", - "required" : true + "type" : "integer" }, "height" : { - "type" : "integer", - "required" : true + "type" : "integer" }, "frameDecimation" : { - "type" : "integer", - "required" : true + "type" : "integer" }, "sizeDecimation" : { - "type" : "integer", - "required" : true + "type" : "integer" }, "priority" : { - "type" : "integer", - "required" : true + "type" : "integer" }, "mode" : { - "type" : "string", - "required" : true + "type" : "string" + }, + "useKodiChecker" : + { + "type" : "boolean" }, "cropLeft" : { - "type" : "integer", - "required" : true + "type" : "integer" }, "cropRight" : { - "type" : "integer", - "required" : true + "type" : "integer" }, "cropTop" : { - "type" : "integer", - "required" : true + "type" : "integer" }, "cropBottom" : { - "type" : "integer", - "required" : true + "type" : "integer" }, "redSignalThreshold" : { - "type" : "number", - "required" : true + "type" : "number" }, "greenSignalThreshold" : { - "type" : "number", - "required" : true + "type" : "number" }, "blueSignalThreshold" : { - "type" : "number", - "required" : true + "type" : "number" } }, "additionalProperties" : false diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index ddd2d73c..52fb71fb 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -562,6 +562,10 @@ void HyperionDaemon::createGrabberV4L2() Debug(_log, "V4L2 grabber created"); QObject::connect(_v4l2Grabber, SIGNAL(emitImage(int, const Image&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image&, const int))); + if (grabberConfig["useKodiChecker"].toBool(false)) + { + QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _v4l2Grabber, SLOT(setGrabbingMode(GrabbingMode))); + } InfoIf( enableV4l && _v4l2Grabber->start(), _log, "V4L2 grabber started"); #endif