amlogic refactoring (#464)

* - grabber auto off when not set as active prio
- join aml and fb - on aml platform both grabbers are needed, so they joind in one module and share one prio. user don't the the nasty magic behind
- aml: preparation for direct ge2d access

* just save it, in the middle of ge2d impl

* fix compile issues

* now grabbing works basicly

* add 3d support for ge2d

* next step, we got some video from aml

* switch back to rgba

* remove unfinished ge2d stuff

* commit missing changes

* some urgent fixes, needs some beautifying, but it works now

* fixes and refctoring
This commit is contained in:
redPanther
2017-09-01 08:50:37 +02:00
committed by GitHub
parent 8644672296
commit 2aa4df92a9
24 changed files with 291 additions and 142 deletions

View File

@@ -1,16 +1,19 @@
// STL includes
#include <algorithm>
#include <stdexcept>
#include <limits>
// Hyperion includes
#include <hyperion/PriorityMuxer.h>
const int PriorityMuxer::LOWEST_PRIORITY = std::numeric_limits<uint8_t>::max();
PriorityMuxer::PriorityMuxer(int ledCount)
: _currentPriority(LOWEST_PRIORITY)
: _currentPriority(PriorityMuxer::LOWEST_PRIORITY)
, _activeInputs()
, _lowestPriorityInfo()
{
_lowestPriorityInfo.priority = LOWEST_PRIORITY;
_lowestPriorityInfo.priority = PriorityMuxer::LOWEST_PRIORITY;
_lowestPriorityInfo.timeoutTime_ms = 0;
_lowestPriorityInfo.ledColors = std::vector<ColorRgb>(ledCount, {0, 0, 0});
_lowestPriorityInfo.componentId = hyperion::COMP_COLOR;
@@ -40,7 +43,7 @@ QList<int> PriorityMuxer::getPriorities() const
bool PriorityMuxer::hasPriority(const int priority) const
{
return (priority == LOWEST_PRIORITY) ? true : _activeInputs.contains(priority);
return (priority == PriorityMuxer::LOWEST_PRIORITY) ? true : _activeInputs.contains(priority);
}
const PriorityMuxer::InputInfo& PriorityMuxer::getInputInfo(const int priority) const
@@ -48,7 +51,11 @@ const PriorityMuxer::InputInfo& PriorityMuxer::getInputInfo(const int priority)
auto elemIt = _activeInputs.find(priority);
if (elemIt == _activeInputs.end())
{
throw std::runtime_error("HYPERION (prioritymuxer) ERROR: no such priority");
elemIt = _activeInputs.find(PriorityMuxer::LOWEST_PRIORITY);
if (elemIt == _activeInputs.end())
{
throw std::runtime_error("HYPERION (prioritymuxer) ERROR: no such priority");
}
}
return elemIt.value();
}
@@ -67,7 +74,7 @@ void PriorityMuxer::setInput(const int priority, const std::vector<ColorRgb>& le
void PriorityMuxer::clearInput(const int priority)
{
if (priority < LOWEST_PRIORITY)
if (priority < PriorityMuxer::LOWEST_PRIORITY)
{
_activeInputs.remove(priority);
if (_currentPriority == priority)
@@ -83,14 +90,14 @@ void PriorityMuxer::clearAll(bool forceClearAll)
if (forceClearAll)
{
_activeInputs.clear();
_currentPriority = LOWEST_PRIORITY;
_currentPriority = PriorityMuxer::LOWEST_PRIORITY;
_activeInputs[_currentPriority] = _lowestPriorityInfo;
}
else
{
for(auto key : _activeInputs.keys())
{
if (key < LOWEST_PRIORITY-1)
if (key < PriorityMuxer::LOWEST_PRIORITY-1)
{
_activeInputs.remove(key);
}
@@ -100,7 +107,7 @@ void PriorityMuxer::clearAll(bool forceClearAll)
void PriorityMuxer::setCurrentTime(const int64_t& now)
{
_currentPriority = LOWEST_PRIORITY;
_currentPriority = PriorityMuxer::LOWEST_PRIORITY;
for (auto infoIt = _activeInputs.begin(); infoIt != _activeInputs.end();)
{