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

@@ -11,6 +11,7 @@ Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int c
, _cropRight(0)
, _cropTop(0)
, _cropBottom(0)
, _enabled(true)
, _log(Logger::getInstance(grabberName))
{
@@ -22,6 +23,10 @@ Grabber::~Grabber()
{
}
void Grabber::setEnabled(bool enable)
{
_enabled = enable;
}
void Grabber::setVideoMode(VideoMode mode)
{

View File

@@ -37,7 +37,7 @@ GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned
connect(_hyperion, SIGNAL(grabbingMode(GrabbingMode)), this, SLOT(setGrabbingMode(GrabbingMode)));
connect(_hyperion, SIGNAL(videoMode(VideoMode)), this, SLOT(setVideoMode(VideoMode)));
connect(this, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _hyperion, SLOT(setImage(int, const Image<ColorRgb>&, const int)) );
connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
connect(&_timer, SIGNAL(timeout()), this, SLOT(actionWrapper()));
}
@@ -64,6 +64,12 @@ void GrabberWrapper::stop()
_hyperion->unRegisterPriority(_grabberName);
}
void GrabberWrapper::actionWrapper()
{
_ggrabber->setEnabled(_hyperion->isCurrentPriority(_priority));
action();
}
void GrabberWrapper::componentStateChanged(const hyperion::Components component, bool enable)
{
if (component == _grabberComponentId)
@@ -100,20 +106,13 @@ void GrabberWrapper::componentStateChanged(const hyperion::Components component,
void GrabberWrapper::setGrabbingMode(const GrabbingMode mode)
{
switch (mode)
if (mode == GRABBINGMODE_OFF)
{
case GRABBINGMODE_VIDEO:
case GRABBINGMODE_PAUSE:
case GRABBINGMODE_AUDIO:
case GRABBINGMODE_PHOTO:
case GRABBINGMODE_MENU:
case GRABBINGMODE_SCREENSAVER:
case GRABBINGMODE_INVALID:
start();
break;
case GRABBINGMODE_OFF:
stop();
break;
}
else
{
start();
}
}

View File

@@ -759,6 +759,11 @@ int Hyperion::getCurrentPriority() const
return _sourceAutoSelectEnabled || !_muxer.hasPriority(_currentSourcePriority) ? _muxer.getCurrentPriority() : _currentSourcePriority;
}
bool Hyperion::isCurrentPriority(const int priority) const
{
return getCurrentPriority() == priority;
}
QList<int> Hyperion::getActivePriorities() const
{
return _muxer.getPriorities();

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();)
{