Add enable option to grabbers (#113)

* update

* .

* update

* update
This commit is contained in:
brindosch 2016-07-13 12:14:02 +02:00 committed by GitHub
parent 5a2ef6c4a3
commit 904aad5f1c
3 changed files with 76 additions and 60 deletions

View File

@ -58,6 +58,7 @@
/// Next to the list with color transforms there is also a smoothing option.
/// * 'smoothing' : Smoothing of the colors in the time-domain with the following tuning
/// parameters:
/// - 'enable' Enable or disable the smoothing (true/false)
/// - 'type' The type of smoothing algorithm ('linear' or 'none')
/// - 'time_ms' The time constant for smoothing algorithm in milliseconds
/// - 'updateFrequency' The update frequency of the leds in Hz
@ -137,7 +138,7 @@
"enable" : true,
"type" : "linear",
"time_ms" : 200,
"updateFrequency" : 20.0000,
"updateFrequency" : 25.0000,
"updateDelay" : 0,
"continuousOutput" : true
}
@ -183,6 +184,7 @@
},
/// The configuration for the frame-grabber, contains the following items:
/// * enable : true if the framegrabber (platform grabber) should be activated
/// * width : The width of the grabbed frames [pixels]
/// * height : The height of the grabbed frames [pixels]
/// * frequency_Hz : The frequency of the frame grab [Hz]
@ -190,8 +192,9 @@
/// * ATTENTION : Power-of-Two resolution is not supported and leads to unexpected behaviour!
"framegrabber" :
{
"width" : 64,
"height" : 64,
"enable" : true,
"width" : 96,
"height" : 96,
"frequency_Hz" : 10.0,
"priority" : 890
},

View File

@ -86,7 +86,7 @@
"enable" : true,
"type" : "linear",
"time_ms" : 200,
"updateFrequency" : 20.0000,
"updateFrequency" : 25.0000,
"updateDelay" : 0,
"continuousOutput" : false
}
@ -115,8 +115,9 @@
"framegrabber" :
{
"width" : 128,
"height" : 128,
"enable" : true,
"width" : 96,
"height" : 96,
"frequency_Hz" : 10.0,
"priority" : 890
},
@ -130,7 +131,7 @@
"kodiVideoChecker" :
{
"enable" : true,
"enable" : false,
"kodiAddress" : "localhost",
"kodiTcpPort" : 9090,
"grabVideo" : true,

View File

@ -322,27 +322,30 @@ void HyperionDaemon::startNetworkServices()
void HyperionDaemon::createGrabberDispmanx()
{
#ifdef ENABLE_DISPMANX
// Construct and start the frame-grabber if the configuration is present
// Construct and start the dispmanx grabber if the configuration is present
if (_config.isMember("framegrabber"))
{
const Json::Value & frameGrabberConfig = _config["framegrabber"];
_dispmanx = new DispmanxWrapper(
frameGrabberConfig["width"].asUInt(),
frameGrabberConfig["height"].asUInt(),
frameGrabberConfig["frequency_Hz"].asUInt(),
frameGrabberConfig.get("priority",900).asInt());
_dispmanx->setCropping(
frameGrabberConfig.get("cropLeft", 0).asInt(),
frameGrabberConfig.get("cropRight", 0).asInt(),
frameGrabberConfig.get("cropTop", 0).asInt(),
frameGrabberConfig.get("cropBottom", 0).asInt());
if (frameGrabberConfig.get("enable", true).asBool())
{
_dispmanx = new DispmanxWrapper(
frameGrabberConfig["width"].asUInt(),
frameGrabberConfig["height"].asUInt(),
frameGrabberConfig["frequency_Hz"].asUInt(),
frameGrabberConfig.get("priority",900).asInt());
_dispmanx->setCropping(
frameGrabberConfig.get("cropLeft", 0).asInt(),
frameGrabberConfig.get("cropRight", 0).asInt(),
frameGrabberConfig.get("cropTop", 0).asInt(),
frameGrabberConfig.get("cropBottom", 0).asInt());
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _dispmanx, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _dispmanx, SLOT(setVideoMode(VideoMode)));
QObject::connect(_dispmanx, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _dispmanx, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _dispmanx, SLOT(setVideoMode(VideoMode)));
QObject::connect(_dispmanx, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
_dispmanx->start();
Info(_log, "Frame grabber created and started");
_dispmanx->start();
Info(_log, "DISPMANX frame grabber created and started");
}
}
#else
ErrorIf(_config.isMember("framegrabber"), _log, "The dispmanx framegrabber can not be instantiated, because it has been left out from the build");
@ -393,22 +396,25 @@ void HyperionDaemon::createGrabberV4L2()
void HyperionDaemon::createGrabberAmlogic()
{
#ifdef ENABLE_AMLOGIC
// Construct and start the framebuffer grabber if the configuration is present
// Construct and start the amlogic grabber if the configuration is present
if (_config.isMember("amlgrabber"))
{
const Json::Value & grabberConfig = _config["amlgrabber"];
_amlGrabber = new AmlogicWrapper(
grabberConfig["width"].asUInt(),
grabberConfig["height"].asUInt(),
grabberConfig["frequency_Hz"].asUInt(),
grabberConfig.get("priority",900).asInt());
if (grabberConfig.get("enable", true).asBool())
{
_amlGrabber = new AmlogicWrapper(
grabberConfig["width"].asUInt(),
grabberConfig["height"].asUInt(),
grabberConfig["frequency_Hz"].asUInt(),
grabberConfig.get("priority",900).asInt());
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _amlGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _amlGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_amlGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _amlGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _amlGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_amlGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
_amlGrabber->start();
Info(_log, "AMLOGIC grabber created and started");
_amlGrabber->start();
Info(_log, "AMLOGIC grabber created and started");
}
}
#else
ErrorIf(_config.isMember("amlgrabber"), _log, "The AMLOGIC grabber can not be instantiated, because it has been left out from the build");
@ -420,22 +426,25 @@ void HyperionDaemon::createGrabberFramebuffer()
{
#ifdef ENABLE_FB
// Construct and start the framebuffer grabber if the configuration is present
if (_config.isMember("framebuffergrabber") || _config.isMember("framegrabber"))
if (_config.isMember("framebuffergrabber"))
{
const Json::Value & grabberConfig = _config.isMember("framebuffergrabber")? _config["framebuffergrabber"] : _config["framegrabber"];
_fbGrabber = new FramebufferWrapper(
grabberConfig.get("device", "/dev/fb0").asString(),
grabberConfig["width"].asUInt(),
grabberConfig["height"].asUInt(),
grabberConfig["frequency_Hz"].asUInt(),
grabberConfig.get("priority",900).asInt());
const Json::Value & grabberConfig = _config["framebuffergrabber"];
if (grabberConfig.get("enable", true).asBool())
{
_fbGrabber = new FramebufferWrapper(
grabberConfig.get("device", "/dev/fb0").asString(),
grabberConfig["width"].asUInt(),
grabberConfig["height"].asUInt(),
grabberConfig["frequency_Hz"].asUInt(),
grabberConfig.get("priority",900).asInt());
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _fbGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _fbGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_fbGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _fbGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _fbGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_fbGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
_fbGrabber->start();
Info(_log, "Framebuffer grabber created and started");
_fbGrabber->start();
Info(_log, "Framebuffer grabber created and started");
}
}
#else
ErrorIf(_config.isMember("framebuffergrabber"), _log, "The framebuffer grabber can not be instantiated, because it has been left out from the build");
@ -447,22 +456,25 @@ void HyperionDaemon::createGrabberOsx()
{
#ifdef ENABLE_OSX
// Construct and start the osx grabber if the configuration is present
if (_config.isMember("framegrabber"))
if (_config.isMember("osxgrabber"))
{
const Json::Value & grabberConfig = _config.isMember("osxgrabber")? _config["osxgrabber"] : _config["framegrabber"];
_osxGrabber = new OsxWrapper(
grabberConfig.get("display", 0).asUInt(),
grabberConfig["width"].asUInt(),
grabberConfig["height"].asUInt(),
grabberConfig["frequency_Hz"].asUInt(),
grabberConfig.get("priority",900).asInt());
const Json::Value & grabberConfig = _config["osxgrabber"];
if (grabberConfig.get("enable", true).asBool())
{
_osxGrabber = new OsxWrapper(
grabberConfig.get("display", 0).asUInt(),
grabberConfig["width"].asUInt(),
grabberConfig["height"].asUInt(),
grabberConfig["frequency_Hz"].asUInt(),
grabberConfig.get("priority",900).asInt());
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _osxGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _osxGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_osxGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _osxGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _osxGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_osxGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
_osxGrabber->start();
Info(_log, "OSX grabber created and started");
_osxGrabber->start();
Info(_log, "OSX grabber created and started");
}
}
#else
ErrorIf(_config.isMember("osxgrabber"), _log, "The osx grabber can not be instantiated, because it has been left out from the build");