Merge pull request #538 from Portisch/Amlogic_Grabber

Amlogic Grabber fix/upgrade
This commit is contained in:
Rick164
2019-02-14 21:34:09 +01:00
committed by GitHub
16 changed files with 314 additions and 230 deletions

View File

@@ -2,9 +2,9 @@
// Hyperion-AmLogic includes
#include "AmlogicWrapper.h"
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) :
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const unsigned ge2d_mode, const QString device) :
_timer(this),
_grabber(grabWidth, grabHeight)
_grabber(grabWidth, grabHeight, ge2d_mode, device)
{
_timer.setSingleShot(false);
_timer.setInterval(updateRate_Hz);

View File

@@ -9,7 +9,7 @@ class AmlogicWrapper : public QObject
{
Q_OBJECT
public:
AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz);
AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const unsigned ge2d_mode, const QString device);
const Image<ColorRgb> & getScreenshot();

View File

@@ -41,6 +41,8 @@ int main(int argc, char ** argv)
IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "160", 160, 4096);
IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Height of the captured image [default: %1]", "160", 160, 4096);
BooleanOption & argScreenshot = parser.add<BooleanOption>(0x0, "screenshot", "Take a single screenshot, save it to file and quit");
IntOption & argge2d_mode = parser.add<IntOption> (0x0, "ge2d-mode", "ge2d ioctl mode, 0 single ioctl, 1 combined ioctl [default: %1]", "0");
Option & argDevice = parser.add<Option> (0x0, "device", "The Amlogic device to use [default: %1]", "amvideocap0");
Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
@@ -55,7 +57,7 @@ int main(int argc, char ** argv)
parser.showHelp(0);
}
AmlogicWrapper amlWrapper(argWidth.getInt(parser), argHeight.getInt(parser), 1000 / argFps.getInt(parser));
AmlogicWrapper amlWrapper(argWidth.getInt(parser), argHeight.getInt(parser), 1000 / argFps.getInt(parser), argge2d_mode.getInt(parser), argDevice.value(parser));
if (parser.isSet(argScreenshot))
{

View File

@@ -250,6 +250,9 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJso
_grabber_cropTop = grabberConfig["cropTop"].toInt(0);
_grabber_cropBottom = grabberConfig["cropBottom"].toInt(0);
_grabber_ge2d_mode = grabberConfig["ge2d_mode"].toInt(0);
_grabber_device = grabberConfig["amlogic_grabber"].toString("amvideocap0");
#ifdef ENABLE_OSX
QString type = "osx";
#else
@@ -265,9 +268,12 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJso
type = "dispmanx";
}
// amlogic -> /dev/amvideo exists
else if ( QFile::exists("/dev/amvideo") && ( QFile::exists("/dev/amvideocap0") || QFile::exists("/dev/ge2d") ) )
else if ( QFile::exists("/dev/amvideo") )
{
type = "amlogic";
if ( !QFile::exists("/dev/" + _grabber_device) )
{ Error( _log, "grabber device '%s' for type amlogic not found!", QSTRING_CSTR(_grabber_device)); }
}
// x11 -> if DISPLAY is set
else if (getenv("DISPLAY") != NULL )
@@ -440,7 +446,7 @@ void HyperionDaemon::createGrabberDispmanx()
void HyperionDaemon::createGrabberAmlogic()
{
#ifdef ENABLE_AMLOGIC
_amlGrabber = new AmlogicWrapper(_grabber_width, _grabber_height, _grabber_frequency);
_amlGrabber = new AmlogicWrapper(_grabber_width, _grabber_height, _grabber_frequency, _grabber_ge2d_mode, _grabber_device);
_amlGrabber->setCropping(_grabber_cropLeft, _grabber_cropRight, _grabber_cropTop, _grabber_cropBottom);
// connect to HyperionDaemon signal

View File

@@ -155,6 +155,8 @@ private:
unsigned _grabber_cropRight;
unsigned _grabber_cropTop;
unsigned _grabber_cropBottom;
int _grabber_ge2d_mode;
QString _grabber_device;
QString _prevType;