From 293a2e7c198a6b1312f13d3b4529124cad9da323 Mon Sep 17 00:00:00 2001 From: johan Date: Sun, 20 Oct 2013 22:27:05 +0200 Subject: [PATCH] Added reading the enable flag for the border detector Former-commit-id: d2cf4df9a7684107b30f9bc01d5aa90b321ce1b5 --- config/hyperion.config.json | 7 +++++++ deploy/hyperiond.REMOVED.git-id | 2 +- include/hyperion/ImageProcessor.h | 2 +- include/hyperion/ImageProcessorFactory.h | 5 ++++- libsrc/hyperion/Hyperion.cpp | 2 +- libsrc/hyperion/ImageProcessor.cpp | 4 ++-- libsrc/hyperion/ImageProcessorFactory.cpp | 5 +++-- libsrc/hyperion/hyperion.schema.json | 12 ++++++++++++ 8 files changed, 31 insertions(+), 8 deletions(-) diff --git a/config/hyperion.config.json b/config/hyperion.config.json index a6f7ff8d..9ec5ae49 100644 --- a/config/hyperion.config.json +++ b/config/hyperion.config.json @@ -319,6 +319,13 @@ } ], + /// The black border configuration, contains the following items: + /// * enable : true if the detector should be activated + "blackborderdetector" : + { + "enable" : true + }, + /// The boot-sequence configuration, contains the following items: /// * type : The type of the boot-sequence ('rainbow', 'knight_rider', 'none') /// * duration_ms : The length of the boot-sequence [ms] diff --git a/deploy/hyperiond.REMOVED.git-id b/deploy/hyperiond.REMOVED.git-id index 665b1468..c26545c9 100644 --- a/deploy/hyperiond.REMOVED.git-id +++ b/deploy/hyperiond.REMOVED.git-id @@ -1 +1 @@ -26cfdb6da8079e91839e80a45e15486504df6eb3 \ No newline at end of file +71c14781ce343776ab00db70f9d2493e3e2feead \ No newline at end of file diff --git a/include/hyperion/ImageProcessor.h b/include/hyperion/ImageProcessor.h index 4a64bbff..b1b03de3 100644 --- a/include/hyperion/ImageProcessor.h +++ b/include/hyperion/ImageProcessor.h @@ -62,7 +62,7 @@ private: /// /// @param[in] ledString The led-string specification /// - ImageProcessor(const LedString &ledString); + ImageProcessor(const LedString &ledString, bool enableBlackBorderDetector); /// /// Performs black-border detection (if enabled) on the given image diff --git a/include/hyperion/ImageProcessorFactory.h b/include/hyperion/ImageProcessorFactory.h index 3431065b..a377bafa 100644 --- a/include/hyperion/ImageProcessorFactory.h +++ b/include/hyperion/ImageProcessorFactory.h @@ -31,7 +31,7 @@ public: /// /// @param[in] ledString The led configuration /// - void init(const LedString& ledString); + void init(const LedString& ledString, bool enableBlackBorderDetector); /// /// Creates a new ImageProcessor. The onwership of the processor is transferred to the caller. @@ -43,4 +43,7 @@ public: private: /// The Led-string specification LedString _ledString; + + /// Flag indicating if the black border detector should be used + bool _enableBlackBorderDetector; }; diff --git a/libsrc/hyperion/Hyperion.cpp b/libsrc/hyperion/Hyperion.cpp index e8963de3..a5af70f6 100644 --- a/libsrc/hyperion/Hyperion.cpp +++ b/libsrc/hyperion/Hyperion.cpp @@ -99,7 +99,7 @@ Hyperion::Hyperion(const Json::Value &jsonConfig) : _device(constructDevice(jsonConfig["device"])), _timer() { - ImageProcessorFactory::getInstance().init(_ledString); + ImageProcessorFactory::getInstance().init(_ledString, jsonConfig["blackborderdetector"].get("enable", true).asBool()); _timer.setSingleShot(true); QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(update())); diff --git a/libsrc/hyperion/ImageProcessor.cpp b/libsrc/hyperion/ImageProcessor.cpp index 4df8301d..8e78cb6a 100644 --- a/libsrc/hyperion/ImageProcessor.cpp +++ b/libsrc/hyperion/ImageProcessor.cpp @@ -10,9 +10,9 @@ using namespace hyperion; -ImageProcessor::ImageProcessor(const LedString& ledString) : +ImageProcessor::ImageProcessor(const LedString& ledString, bool enableBlackBorderDetector) : mLedString(ledString), - _enableBlackBorderRemoval(true), + _enableBlackBorderRemoval(enableBlackBorderDetector), _borderProcessor(new BlackBorderProcessor(600, 50, 1)), mImageToLeds(nullptr) { diff --git a/libsrc/hyperion/ImageProcessorFactory.cpp b/libsrc/hyperion/ImageProcessorFactory.cpp index 52837c6a..a5a7fb06 100644 --- a/libsrc/hyperion/ImageProcessorFactory.cpp +++ b/libsrc/hyperion/ImageProcessorFactory.cpp @@ -10,12 +10,13 @@ ImageProcessorFactory& ImageProcessorFactory::getInstance() return instance; } -void ImageProcessorFactory::init(const LedString& ledString) +void ImageProcessorFactory::init(const LedString& ledString, bool enableBlackBorderDetector) { _ledString = ledString; + _enableBlackBorderDetector = enableBlackBorderDetector; } ImageProcessor* ImageProcessorFactory::newImageProcessor() const { - return new ImageProcessor(_ledString); + return new ImageProcessor(_ledString, _enableBlackBorderDetector); } diff --git a/libsrc/hyperion/hyperion.schema.json b/libsrc/hyperion/hyperion.schema.json index 7924961e..443287da 100644 --- a/libsrc/hyperion/hyperion.schema.json +++ b/libsrc/hyperion/hyperion.schema.json @@ -169,6 +169,18 @@ "additionalProperties" : false } }, + "blackborderdetector" : + { + "type" : "object", + "required" : false, + "properties" : { + "enable" : { + "type" : "boolean", + "required" : true + } + }, + "additionalProperties" : false + }, "xbmcVideoChecker" : { "type" : "object",