diff --git a/config/hyperion.config.json.commented b/config/hyperion.config.json.commented index 0734e54c..34266542 100644 --- a/config/hyperion.config.json.commented +++ b/config/hyperion.config.json.commented @@ -188,7 +188,7 @@ "greenSignalThreshold" : 0.0, "blueSignalThreshold" : 0.0 } - ] + ], /// The configuration for the frame-grabber, contains the following items: /// * enable : true if the framegrabber (platform grabber) should be activated diff --git a/config/hyperion.config.json.default b/config/hyperion.config.json.default index 1c406fb0..c5758253 100644 --- a/config/hyperion.config.json.default +++ b/config/hyperion.config.json.default @@ -117,7 +117,7 @@ "greenSignalThreshold" : 0.0, "blueSignalThreshold" : 0.0 } - ] + ], "framegrabber" : { diff --git a/include/hyperion/GrabberWrapper.h b/include/hyperion/GrabberWrapper.h index e6459899..fd8ef327 100644 --- a/include/hyperion/GrabberWrapper.h +++ b/include/hyperion/GrabberWrapper.h @@ -15,7 +15,7 @@ class GrabberWrapper : public QObject { Q_OBJECT public: - GrabberWrapper(std::string grabberName, const int priority); + GrabberWrapper(std::string grabberName, const int priority, hyperion::Components grabberComponentId=hyperion::COMP_GRABBER); virtual ~GrabberWrapper(); @@ -72,4 +72,5 @@ protected: /// The processor for transforming images to led colors ImageProcessor * _processor; + hyperion::Components _grabberComponentId; }; diff --git a/include/utils/Components.h b/include/utils/Components.h index b865d249..52729b89 100644 --- a/include/utils/Components.h +++ b/include/utils/Components.h @@ -15,7 +15,8 @@ enum Components COMP_FORWARDER, COMP_UDPLISTENER, COMP_BOBLIGHTSERVER, - COMP_GRABBER + COMP_GRABBER, + COMP_V4L }; inline const char* componentToString(Components c) @@ -29,6 +30,7 @@ inline const char* componentToString(Components c) case COMP_UDPLISTENER: return "UDP listener"; case COMP_BOBLIGHTSERVER:return "Boblight server"; case COMP_GRABBER: return "Framegrabber"; + case COMP_V4L: return "V4l Capture device"; default: return ""; } } @@ -43,6 +45,7 @@ inline Components stringToComponent(QString component) if (component == "UDPLISTENER") return COMP_UDPLISTENER; if (component == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER; if (component == "GRABBER") return COMP_GRABBER; + if (component == "V4L") return COMP_V4L; return COMP_INVALID; } diff --git a/libsrc/grabber/v4l2/V4L2Wrapper.cpp b/libsrc/grabber/v4l2/V4L2Wrapper.cpp index cdae5ea8..423cc793 100644 --- a/libsrc/grabber/v4l2/V4L2Wrapper.cpp +++ b/libsrc/grabber/v4l2/V4L2Wrapper.cpp @@ -16,7 +16,7 @@ V4L2Wrapper::V4L2Wrapper(const std::string &device, double greenSignalThreshold, double blueSignalThreshold, const int priority) - : GrabberWrapper("V4L2:"+device, priority) + : GrabberWrapper("V4L2:"+device, priority, hyperion::COMP_V4L) , _timeout_ms(1000) , _grabber(device, input, diff --git a/libsrc/hyperion/GrabberWrapper.cpp b/libsrc/hyperion/GrabberWrapper.cpp index c75fa942..989b9716 100644 --- a/libsrc/hyperion/GrabberWrapper.cpp +++ b/libsrc/hyperion/GrabberWrapper.cpp @@ -4,7 +4,7 @@ #include -GrabberWrapper::GrabberWrapper(std::string grabberName, const int priority) +GrabberWrapper::GrabberWrapper(std::string grabberName, const int priority, hyperion::Components grabberComponentId) : _grabberName(grabberName) , _hyperion(Hyperion::getInstance()) , _priority(priority) @@ -12,6 +12,7 @@ GrabberWrapper::GrabberWrapper(std::string grabberName, const int priority) , _log(Logger::getInstance(grabberName.c_str())) , _forward(true) , _processor(ImageProcessorFactory::getInstance().newImageProcessor()) + , _grabberComponentId(grabberComponentId) { _timer.setSingleShot(false); @@ -44,7 +45,7 @@ void GrabberWrapper::stop() void GrabberWrapper::componentStateChanged(const hyperion::Components component, bool enable) { - if (component == hyperion::COMP_GRABBER && _timer.isActive() != enable) + if (component == _grabberComponentId && _timer.isActive() != enable) { if (enable) start(); else stop(); diff --git a/libsrc/jsonserver/schema/schema-componentstate.json b/libsrc/jsonserver/schema/schema-componentstate.json index 3a0dfabd..28a8a362 100644 --- a/libsrc/jsonserver/schema/schema-componentstate.json +++ b/libsrc/jsonserver/schema/schema-componentstate.json @@ -21,7 +21,7 @@ "component": { "type" : "string", - "enum" : ["SMOOTHING", "BLACKBORDER", "KODICHECKER", "FORWARDER", "UDPLISTENER", "BOBLIGHTSERVER", "GRABBER"], + "enum" : ["SMOOTHING", "BLACKBORDER", "KODICHECKER", "FORWARDER", "UDPLISTENER", "BOBLIGHTSERVER", "GRABBER", "V4L"], "required": true }, "state": diff --git a/src/hyperion-remote/hyperion-remote.cpp b/src/hyperion-remote/hyperion-remote.cpp index a5aaa669..2f0c3cff 100644 --- a/src/hyperion-remote/hyperion-remote.cpp +++ b/src/hyperion-remote/hyperion-remote.cpp @@ -65,8 +65,8 @@ int main(int argc, char * argv[]) BooleanOption & argServerInfo = parser.add ('l', "list" , "List server info and active effects with priority and duration"); BooleanOption & argClear = parser.add ('x', "clear" , "Clear data for the priority channel provided by the -p option"); BooleanOption & argClearAll = parser.add (0x0, "clearall" , "Clear data for all active priority channels"); - Option & argEnableComponent = parser.add