diff --git a/deploy/hyperion.tar.gz.REMOVED.git-id b/deploy/hyperion.tar.gz.REMOVED.git-id index e3115d3b..440b9e4d 100644 --- a/deploy/hyperion.tar.gz.REMOVED.git-id +++ b/deploy/hyperion.tar.gz.REMOVED.git-id @@ -1 +1 @@ -f3afa39f64294a9ce71af8e424e4bab72d2b29cb \ No newline at end of file +8f880f994b0855ace23e27818896fc34ba1677a8 \ No newline at end of file diff --git a/include/grabber/V4L2Grabber.h b/include/grabber/V4L2Grabber.h index 40de0870..c2f61f16 100644 --- a/include/grabber/V4L2Grabber.h +++ b/include/grabber/V4L2Grabber.h @@ -13,6 +13,9 @@ #include #include +// grabber includes +#include + /// Capture class for V4L2 devices /// /// @see http://linuxtv.org/downloads/v4l-dvb-apis/capture-example.html @@ -20,11 +23,6 @@ class V4L2Grabber : public QObject { Q_OBJECT -public: - enum VideoStandard { - PAL, NTSC, NO_CHANGE - }; - public: V4L2Grabber( const std::string & device, diff --git a/include/grabber/VideoStandard.h b/include/grabber/VideoStandard.h new file mode 100644 index 00000000..56636af8 --- /dev/null +++ b/include/grabber/VideoStandard.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include + +/** + * Enumeration of the possible video standards the grabber can be set to + */ +enum VideoStandard { + VIDEOSTANDARD_PAL, + VIDEOSTANDARD_NTSC, + VIDEOSTANDARD_NO_CHANGE +}; + +inline VideoStandard parseVideoStandard(std::string videoStandard) +{ + // convert to lower case + std::transform(videoStandard.begin(), videoStandard.end(), videoStandard.begin(), ::tolower); + + if (videoStandard == "pal") + { + return VIDEOSTANDARD_PAL; + } + else if (videoStandard == "ntsc") + { + return VIDEOSTANDARD_NTSC; + } + + // return the default NO_CHANGE + return VIDEOSTANDARD_NO_CHANGE; +} diff --git a/include/utils/VideoMode.h b/include/utils/VideoMode.h index 16c75b37..f5cae94f 100644 --- a/include/utils/VideoMode.h +++ b/include/utils/VideoMode.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + /** * Enumeration of the possible modes in which video can be playing (2D, 3D) */ @@ -9,3 +12,21 @@ enum VideoMode VIDEO_3DSBS, VIDEO_3DTAB }; + +inline VideoMode parse3DMode(std::string videoMode) +{ + // convert to lower case + std::transform(videoMode.begin(), videoMode.end(), videoMode.begin(), ::tolower); + + if (videoMode == "23DTAB") + { + return VIDEO_3DTAB; + } + else if (videoMode == "3DSBS") + { + return VIDEO_3DSBS; + } + + // return the default 2D + return VIDEO_2D; +} diff --git a/libsrc/grabber/v4l2/CMakeLists.txt b/libsrc/grabber/v4l2/CMakeLists.txt index bb8e15b9..aaafd384 100644 --- a/libsrc/grabber/v4l2/CMakeLists.txt +++ b/libsrc/grabber/v4l2/CMakeLists.txt @@ -7,6 +7,7 @@ SET(V4L2_QT_HEADERS ) SET(V4L2_HEADERS + ${CURRENT_HEADER_DIR}/VideoStandard.h ) SET(V4L2_SOURCES diff --git a/libsrc/grabber/v4l2/V4L2Grabber.cpp b/libsrc/grabber/v4l2/V4L2Grabber.cpp index 341485a7..dc0e47c6 100644 --- a/libsrc/grabber/v4l2/V4L2Grabber.cpp +++ b/libsrc/grabber/v4l2/V4L2Grabber.cpp @@ -328,7 +328,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard, int input) // set the video standard if needed switch (videoStandard) { - case PAL: + case VIDEOSTANDARD_PAL: { v4l2_std_id std_id = V4L2_STD_PAL; if (-1 == xioctl(VIDIOC_S_STD, &std_id)) @@ -337,7 +337,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard, int input) } } break; - case NTSC: + case VIDEOSTANDARD_NTSC: { v4l2_std_id std_id = V4L2_STD_NTSC; if (-1 == xioctl(VIDIOC_S_STD, &std_id)) @@ -346,7 +346,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard, int input) } } break; - case NO_CHANGE: + case VIDEOSTANDARD_NO_CHANGE: default: // No change to device settings break; diff --git a/libsrc/leddevice/LedDeviceLpd6803.cpp b/libsrc/leddevice/LedDeviceLpd6803.cpp index bfaa010b..09d5f838 100644 --- a/libsrc/leddevice/LedDeviceLpd6803.cpp +++ b/libsrc/leddevice/LedDeviceLpd6803.cpp @@ -19,11 +19,12 @@ LedDeviceLpd6803::LedDeviceLpd6803(const std::string& outputDevice, const unsign int LedDeviceLpd6803::write(const std::vector &ledValues) { + unsigned messageLength = 4 + 2*ledValues.size() + ledValues.size()/8 + 1; // Reconfigure if the current connfiguration does not match the required configuration - if (4 + 2*ledValues.size() != _ledBuffer.size()) + if (messageLength != _ledBuffer.size()) { // Initialise the buffer - _ledBuffer.resize(4 + 2*ledValues.size(), 0x00); + _ledBuffer.resize(messageLength, 0x00); } // Copy the colors from the ColorRgb vector to the Ldp6803 data vector diff --git a/src/hyperion-v4l2/VideoStandardParameter.h b/src/hyperion-v4l2/VideoStandardParameter.h index 7d711ccf..c5b1f733 100644 --- a/src/hyperion-v4l2/VideoStandardParameter.h +++ b/src/hyperion-v4l2/VideoStandardParameter.h @@ -1,10 +1,13 @@ // getoptPlusPLus includes #include +// grabber includes +#include + using namespace vlofgren; /// Data parameter for the video standard -typedef vlofgren::PODParameter VideoStandardParameter; +typedef vlofgren::PODParameter VideoStandardParameter; namespace vlofgren { /// Translates a string (as passed on the commandline) to a color standard @@ -13,24 +16,24 @@ namespace vlofgren { /// @return The color standard /// @throws Parameter::ParameterRejected If the string did not result in a video standard template<> - V4L2Grabber::VideoStandard VideoStandardParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) + VideoStandard VideoStandardParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) { QString input = QString::fromStdString(s).toLower(); if (input == "pal") { - return V4L2Grabber::PAL; + return VIDEOSTANDARD_PAL; } else if (input == "ntsc") { - return V4L2Grabber::NTSC; + return VIDEOSTANDARD_NTSC; } else if (input == "no-change") { - return V4L2Grabber::NO_CHANGE; + return VIDEOSTANDARD_NO_CHANGE; } throw Parameter::ParameterRejected("Invalid value for video standard. Valid values are: PAL, NTSC, and NO-CHANGE"); - return V4L2Grabber::NO_CHANGE; + return VIDEOSTANDARD_NO_CHANGE; } } diff --git a/src/hyperion-v4l2/hyperion-v4l2.cpp b/src/hyperion-v4l2/hyperion-v4l2.cpp index 2268a033..4d7ff9d3 100644 --- a/src/hyperion-v4l2/hyperion-v4l2.cpp +++ b/src/hyperion-v4l2/hyperion-v4l2.cpp @@ -69,7 +69,7 @@ int main(int argc, char** argv) // set defaults argDevice.setDefault("/dev/video0"); - argVideoStandard.setDefault(V4L2Grabber::NO_CHANGE); + argVideoStandard.setDefault(VIDEOSTANDARD_NO_CHANGE); argInput.setDefault(-1); argWidth.setDefault(-1); argHeight.setDefault(-1); diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index 536bf27e..4541ca20 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -179,13 +179,13 @@ int main(int argc, char** argv) v4l2Grabber = new V4L2Grabber( grabberConfig.get("device", "/dev/video0").asString(), grabberConfig.get("input", 0).asInt(), - grabberConfig.get("standard", V4L2Grabber::NONE), + parseVideoStandard(grabberConfig.get("standard", "NONE").asString()), grabberConfig.get("width", -1).asInt(), grabberConfig.get("height", -1).asInt(), grabberConfig.get("frameDecimation", 2).asInt(), grabberConfig.get("sizeDecimation", 8).asInt(), grabberConfig.get("sizeDecimation", 8).asInt()); - v4l2Grabber->set3D(grabberConfig.get("mode", VIDEO_2D)); + v4l2Grabber->set3D(parse3DMode(grabberConfig.get("mode", "2D").asString())); v4l2Grabber->setCropping( grabberConfig.get("cropLeft", 0).asInt(), grabberConfig.get("cropRight", 0).asInt(),