mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
grabber api and feature unification (#462)
* move setvideomode to common place * implement more croping and 3d support * more api unification * more refactoring * osx fix * next step * add a mock for osx grabber. Now it is possible to test compile on none osx platforms. * more unifications ... * remove obsolete includes and grabbers are not dyn allocated. dispmanx needs rework an probaly not work atm * first version of dispmanx mock. it compiles, but outputs a black image * now dispmanx mock works! * activate mocks in travis linux build prepare dispmanx to rgb image out * dispmanx now with image rgb output fix deadlock with w/h -1 in grabber v4l cleanups * fix json * fix some runtime stuff * Update FramebufferWrapper.cpp fix missing code * unify grabframe * 3d and croping for amlogic * fix setimage not working * make use of templates save some codelines * save more code lines
This commit is contained in:
@@ -16,7 +16,7 @@ AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeig
|
||||
const Image<ColorRgb> & AmlogicWrapper::getScreenshot()
|
||||
{
|
||||
capture();
|
||||
return _screenshot_rgb;
|
||||
return _screenshot;
|
||||
}
|
||||
|
||||
void AmlogicWrapper::start()
|
||||
@@ -32,7 +32,5 @@ void AmlogicWrapper::stop()
|
||||
void AmlogicWrapper::capture()
|
||||
{
|
||||
_grabber.grabFrame(_screenshot);
|
||||
_screenshot.toRgb(_screenshot_rgb);
|
||||
|
||||
emit sig_screenshot(_screenshot_rgb);
|
||||
emit sig_screenshot(_screenshot);
|
||||
}
|
||||
|
@@ -37,7 +37,6 @@ private:
|
||||
AmlogicGrabber _grabber;
|
||||
|
||||
// image buffers
|
||||
Image<ColorRgb> _screenshot_rgb;
|
||||
Image<ColorBgr> _screenshot;
|
||||
Image<ColorRgb> _screenshot;
|
||||
|
||||
};
|
||||
|
@@ -2,7 +2,12 @@ cmake_minimum_required(VERSION 2.8.12)
|
||||
project(hyperion-dispmanx)
|
||||
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(BCM REQUIRED)
|
||||
IF ( "${PLATFORM}" MATCHES rpi)
|
||||
find_package(BCM REQUIRED)
|
||||
ELSE()
|
||||
SET(BCM_INCLUDE_DIRS "")
|
||||
SET(BCM_LIBRARIES "")
|
||||
ENDIF()
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver
|
||||
|
@@ -22,7 +22,7 @@ DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHe
|
||||
const Image<ColorRgb> & DispmanxWrapper::getScreenshot()
|
||||
{
|
||||
capture();
|
||||
return _screenshot_rgb;
|
||||
return _screenshot;
|
||||
}
|
||||
|
||||
void DispmanxWrapper::start()
|
||||
@@ -38,7 +38,5 @@ void DispmanxWrapper::stop()
|
||||
void DispmanxWrapper::capture()
|
||||
{
|
||||
_grabber.grabFrame(_screenshot);
|
||||
_screenshot.toRgb(_screenshot_rgb);
|
||||
|
||||
emit sig_screenshot(_screenshot_rgb);
|
||||
emit sig_screenshot(_screenshot);
|
||||
}
|
||||
|
@@ -40,7 +40,5 @@ private:
|
||||
|
||||
/// The grabber for creating screenshots
|
||||
DispmanxFrameGrabber _grabber;
|
||||
Image<ColorRgb> _screenshot_rgb;
|
||||
Image<ColorRgba> _screenshot;
|
||||
|
||||
Image<ColorRgb> _screenshot;
|
||||
};
|
||||
|
@@ -15,8 +15,8 @@ X11Wrapper::X11Wrapper(int grabInterval, bool useXGetImage, int cropLeft, int cr
|
||||
|
||||
const Image<ColorRgb> & X11Wrapper::getScreenshot()
|
||||
{
|
||||
const Image<ColorRgb> & screenshot = _grabber.grab();
|
||||
return screenshot;
|
||||
_grabber.grabFrame(_screenshot, true);
|
||||
return _screenshot;
|
||||
}
|
||||
|
||||
void X11Wrapper::start()
|
||||
@@ -36,8 +36,8 @@ bool X11Wrapper::displayInit()
|
||||
|
||||
void X11Wrapper::capture()
|
||||
{
|
||||
const Image<ColorRgb> & screenshot = _grabber.grab();
|
||||
emit sig_screenshot(screenshot);
|
||||
_grabber.grabFrame(_screenshot, true);
|
||||
emit sig_screenshot(_screenshot);
|
||||
}
|
||||
|
||||
void X11Wrapper::setGrabbingMode(const GrabbingMode mode)
|
||||
|
@@ -55,4 +55,6 @@ private:
|
||||
|
||||
/// The grabber for creating screenshots
|
||||
X11Grabber _grabber;
|
||||
|
||||
Image<ColorRgb> _screenshot;
|
||||
};
|
||||
|
@@ -98,7 +98,7 @@ int main(int argc, char ** argv)
|
||||
catch (const std::runtime_error & e)
|
||||
{
|
||||
// An error occured. Display error and quit
|
||||
Error(Logger::getInstance("X11GRABBER"), "%s", e.what());
|
||||
Error(Logger::getInstance("X11GRABBER"), "%s", e.what());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -86,6 +86,7 @@ HyperionDaemon::~HyperionDaemon()
|
||||
|
||||
void HyperionDaemon::freeObjects()
|
||||
{
|
||||
_hyperion->clearall(true);
|
||||
Debug(_log, "destroy grabbers and network stuff");
|
||||
delete _amlGrabber;
|
||||
delete _dispmanx;
|
||||
@@ -117,7 +118,6 @@ void HyperionDaemon::freeObjects()
|
||||
|
||||
void HyperionDaemon::run()
|
||||
{
|
||||
startInitialEffect();
|
||||
createKODIVideoChecker();
|
||||
|
||||
// ---- network services -----
|
||||
@@ -133,6 +133,8 @@ void HyperionDaemon::run()
|
||||
Info(_log, "Hyperion started");
|
||||
|
||||
connect(_hyperion,SIGNAL(closing()),this,SLOT(freeObjects()));
|
||||
|
||||
startInitialEffect();
|
||||
}
|
||||
|
||||
void HyperionDaemon::loadConfig(const QString & configFile)
|
||||
@@ -499,6 +501,7 @@ void HyperionDaemon::createGrabberX11(const QJsonObject & grabberConfig)
|
||||
grabberConfig["horizontalPixelDecimation"].toInt(8),
|
||||
grabberConfig["verticalPixelDecimation"].toInt(8),
|
||||
_grabber_frequency, _grabber_priority );
|
||||
_x11Grabber->setCropping(_grabber_cropLeft, _grabber_cropRight, _grabber_cropTop, _grabber_cropBottom);
|
||||
|
||||
QObject::connect(_x11Grabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
||||
|
||||
@@ -517,7 +520,7 @@ void HyperionDaemon::createGrabberFramebuffer(const QJsonObject & grabberConfig)
|
||||
_fbGrabber = new FramebufferWrapper(
|
||||
grabberConfig["device"].toString("/dev/fb0"),
|
||||
_grabber_width, _grabber_height, _grabber_frequency, _grabber_priority);
|
||||
|
||||
_fbGrabber->setCropping(_grabber_cropLeft, _grabber_cropRight, _grabber_cropTop, _grabber_cropBottom);
|
||||
QObject::connect(_fbGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
||||
|
||||
_fbGrabber->start();
|
||||
@@ -570,8 +573,8 @@ void HyperionDaemon::createGrabberV4L2()
|
||||
grabberConfig["input"].toInt(0),
|
||||
parseVideoStandard(grabberConfig["standard"].toString("no-change")),
|
||||
parsePixelFormat(grabberConfig["pixelFormat"].toString("no-change")),
|
||||
grabberConfig["width"].toInt(-1),
|
||||
grabberConfig["height"].toInt(-1),
|
||||
grabberConfig["width"].toInt(0),
|
||||
grabberConfig["height"].toInt(0),
|
||||
grabberConfig["frameDecimation"].toInt(2),
|
||||
grabberConfig["sizeDecimation"].toInt(8),
|
||||
grabberConfig["redSignalThreshold"].toDouble(0.0)/100.0,
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QJsonObject>
|
||||
|
||||
#ifdef ENABLE_DISPMANX
|
||||
#include <grabber/DispmanxWrapper.h>
|
||||
@@ -46,7 +47,7 @@
|
||||
#include <boblightserver/BoblightServer.h>
|
||||
#include <udplistener/UDPListener.h>
|
||||
#include <utils/Stats.h>
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
class SysTray;
|
||||
|
||||
|
Reference in New Issue
Block a user