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

@@ -3,10 +3,10 @@
// Utils includes
#include <utils/ColorBgr.h>
#include <hyperion/Grabber.h>
#include <grabber/FramebufferFrameGrabber.h>
///
/// The DispmanxFrameGrabber is used for creating snapshots of the display (screenshots) with a
/// downsized and scaled resolution.
///
class AmlogicGrabber : public Grabber
{
@@ -37,9 +37,18 @@ private:
* @return True if video is playing else false
*/
bool isVideoPlaying();
int grabFrame_amvideocap(Image<ColorRgb> & image);
void closeDev(int &fd);
bool openDev(int &fd, const char* dev, int flags);
/** The snapshot/capture device of the amlogic video chip */
int _amlogicCaptureDev;
int _captureDev;
int _videoDev;
Image<ColorBgr> _image_bgr;
Image<ColorBgr> _image;
int _lastError;
bool _videoPlaying;
FramebufferFrameGrabber _fbGrabber;
int _grabbingModeNotification;
};

View File

@@ -33,6 +33,7 @@ public:
/// gets resulting width of image
virtual const int getImageHeight() { return _height; };
void setEnabled(bool enable);
protected:
ImageResampler _imageResampler;
@@ -51,6 +52,7 @@ protected:
// number of pixels to crop after capturing
int _cropLeft, _cropRight, _cropTop, _cropBottom;
bool _enabled;
/// logger instance
Logger * _log;

View File

@@ -40,10 +40,9 @@ public:
static QStringList availableGrabbers();
public:
template <typename Grabber_T>
void transferFrame(Grabber_T &grabber)
bool transferFrame(Grabber_T &grabber)
{
unsigned w = grabber.getImageWidth();
unsigned h = grabber.getImageHeight();
@@ -53,12 +52,15 @@ public:
_image.resize(w, h);
}
if (grabber.grabFrame(_image) >= 0)
int ret = grabber.grabFrame(_image);
if (ret >= 0)
{
emit emitImage(_priority, _image, _timeout_ms);
_processor->process(_image, _ledColors);
setColors(_ledColors, _timeout_ms);
return true;
}
return false;
}
@@ -70,6 +72,8 @@ public slots:
///
virtual void action() = 0;
void actionWrapper();
///
/// Set the grabbing mode
/// @param[in] mode The new grabbing mode

View File

@@ -97,6 +97,13 @@ public:
///
int getCurrentPriority() const;
///
/// Returns true if current priority is given priority
///
/// @return bool
///
bool isCurrentPriority(const int priority) const;
///
/// Returns a list of active priorities
///

View File

@@ -2,14 +2,14 @@
// STL includes
#include <vector>
#include <map>
#include <cstdint>
#include <limits>
// QT includes
#include <QMap>
#include <QObject>
#include <QTimer>
#include <QMap>
#include <QVector>
// Utils includes
#include <utils/ColorRgb.h>
@@ -50,7 +50,7 @@ public:
};
/// The lowest possible priority, which is used when no priority channels are active
const static int LOWEST_PRIORITY = std::numeric_limits<uint8_t>::max();
const static int LOWEST_PRIORITY;
///
/// Constructs the PriorityMuxer for the given number of leds (used to switch to black when

View File

@@ -34,7 +34,7 @@ struct ColorBgr
};
/// Assert to ensure that the size of the structure is 'only' 3 bytes
static_assert(sizeof(ColorBgr) == 3, "Incorrect size of ColorRgb");
static_assert(sizeof(ColorBgr) == 3, "Incorrect size of ColorBgr");
///
/// Stream operator to write ColorRgb to an outputstream (format "'{'[red]','[green]','[blue]'}'")

View File

@@ -205,6 +205,14 @@ public:
}
}
///
/// get size of buffer
//
ssize_t size()
{
return _width * _height * sizeof(Pixel_T);
}
private:
///