mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Details coming soon.
This commit is contained in:
@@ -4,30 +4,28 @@
|
||||
// QT includes
|
||||
#include <QJsonObject>
|
||||
|
||||
// util
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/settings.h>
|
||||
#include <utils/Components.h>
|
||||
|
||||
// Local Hyperion includes
|
||||
#include "BlackBorderDetector.h"
|
||||
|
||||
class Hyperion;
|
||||
|
||||
namespace hyperion
|
||||
{
|
||||
///
|
||||
/// The BlackBorder processor is a wrapper around the black-border detector for keeping track of
|
||||
/// detected borders and count of the type and size of detected borders.
|
||||
///
|
||||
class BlackBorderProcessor
|
||||
class BlackBorderProcessor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
///
|
||||
/// Constructor for the BlackBorderProcessor
|
||||
/// @param unknownFrameCnt The number of frames(images) that need to contain an unknown
|
||||
/// border before the current border is set to unknown
|
||||
/// @param borderFrameCnt The number of frames(images) that need to contain a vertical or
|
||||
/// horizontal border becomes the current border
|
||||
/// @param blurRemoveCnt The size to add to a horizontal or vertical border (because the
|
||||
/// outer pixels is blurred (black and color combined due to image scaling))
|
||||
/// @param[in] blackborderThreshold The threshold which the blackborder detector should use
|
||||
///
|
||||
BlackBorderProcessor(const QJsonObject &blackborderConfig);
|
||||
|
||||
BlackBorderProcessor(Hyperion* hyperion, QObject* parent);
|
||||
~BlackBorderProcessor();
|
||||
///
|
||||
/// Return the current (detected) border
|
||||
/// @return The current border
|
||||
@@ -46,6 +44,13 @@ namespace hyperion
|
||||
///
|
||||
void setEnabled(bool enable);
|
||||
|
||||
///
|
||||
/// Sets the _hardDisabled state, if True prevents the enable from COMP_BLACKBORDER state emit (mimiks wrong state to external!)
|
||||
/// It's not possible to enable bb from this method, if the user requsted a disable!
|
||||
/// @param disable The new state
|
||||
///
|
||||
void setHardDisable(const bool& disable);
|
||||
|
||||
///
|
||||
/// Processes the image. This performs detecion of black-border on the given image and
|
||||
/// updates the current border accordingly. If the current border is updated the method call
|
||||
@@ -70,11 +75,11 @@ namespace hyperion
|
||||
}
|
||||
|
||||
if (_detectionMode == "default") {
|
||||
imageBorder = _detector.process(image);
|
||||
imageBorder = _detector->process(image);
|
||||
} else if (_detectionMode == "classic") {
|
||||
imageBorder = _detector.process_classic(image);
|
||||
imageBorder = _detector->process_classic(image);
|
||||
} else if (_detectionMode == "osd") {
|
||||
imageBorder = _detector.process_osd(image);
|
||||
imageBorder = _detector->process_osd(image);
|
||||
}
|
||||
// add blur to the border
|
||||
if (imageBorder.horizontalSize > 0)
|
||||
@@ -89,8 +94,23 @@ namespace hyperion
|
||||
const bool borderUpdated = updateBorder(imageBorder);
|
||||
return borderUpdated;
|
||||
}
|
||||
private slots:
|
||||
///
|
||||
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
|
||||
/// @param type settingyType from enum
|
||||
/// @param config configuration object
|
||||
///
|
||||
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
|
||||
|
||||
///
|
||||
/// @brief Handle component state changes, it's not possible for BB to be enabled, when a hardDisable is active
|
||||
///
|
||||
void componentStateChanged(const hyperion::Components component, bool enable);
|
||||
|
||||
private:
|
||||
/// Hyperion instance
|
||||
Hyperion* _hyperion;
|
||||
|
||||
///
|
||||
/// Updates the current border based on the newly detected border. Returns true if the
|
||||
/// current border has changed.
|
||||
@@ -102,24 +122,24 @@ namespace hyperion
|
||||
|
||||
/// flag for blackborder detector usage
|
||||
bool _enabled;
|
||||
|
||||
|
||||
/// The number of unknown-borders detected before it becomes the current border
|
||||
const unsigned _unknownSwitchCnt;
|
||||
unsigned _unknownSwitchCnt;
|
||||
|
||||
/// The number of horizontal/vertical borders detected before it becomes the current border
|
||||
const unsigned _borderSwitchCnt;
|
||||
unsigned _borderSwitchCnt;
|
||||
|
||||
// The number of frames that are "ignored" before a new border gets set as _previousDetectedBorder
|
||||
const unsigned _maxInconsistentCnt;
|
||||
unsigned _maxInconsistentCnt;
|
||||
|
||||
/// The number of pixels to increase a detected border for removing blury pixels
|
||||
unsigned _blurRemoveCnt;
|
||||
|
||||
/// The border detection mode
|
||||
const QString _detectionMode;
|
||||
QString _detectionMode;
|
||||
|
||||
/// The blackborder detector
|
||||
BlackBorderDetector _detector;
|
||||
BlackBorderDetector* _detector;
|
||||
|
||||
/// The current detected border
|
||||
BlackBorder _currentBorder;
|
||||
@@ -131,5 +151,12 @@ namespace hyperion
|
||||
unsigned _consistentCnt;
|
||||
/// The number of frame the previous detected border NOT matched the incomming border
|
||||
unsigned _inconsistentCnt;
|
||||
/// old threshold
|
||||
double _oldThreshold;
|
||||
/// True when disabled in specific situations, this prevents to enable BB when the visible priority requested a disable
|
||||
bool _hardDisabled;
|
||||
/// Reflect the last component state request from user (comp change)
|
||||
bool _userEnabled;
|
||||
|
||||
};
|
||||
} // end namespace hyperion
|
||||
|
Reference in New Issue
Block a user