Added frame buffer grabber support

Former-commit-id: a73767a1abb2cac977492bd8c6cc593fb21840e1
This commit is contained in:
Gamadril
2015-01-18 00:04:45 +01:00
parent 391ccf4738
commit c89e1fcefa
11 changed files with 453 additions and 2 deletions

View File

@@ -14,6 +14,10 @@ if (ENABLE_DISPMANX)
target_link_libraries(hyperiond dispmanx-grabber)
endif (ENABLE_DISPMANX)
if (ENABLE_FB)
target_link_libraries(hyperiond framebuffer-grabber)
endif (ENABLE_FB)
if (ENABLE_V4L2)
target_link_libraries(hyperiond v4l2-grabber)
endif (ENABLE_V4L2)

View File

@@ -1,7 +1,6 @@
// C++ includes
#include <cassert>
#include <csignal>
#include <clocale>
// QT includes
#include <QCoreApplication>
@@ -27,6 +26,11 @@
#include <grabber/V4L2Wrapper.h>
#endif
#ifdef ENABLE_FB
// Framebuffer grabber includes
#include <grabber/FramebufferWrapper.h>
#endif
// XBMC Video checker includes
#include <xbmcvideochecker/XBMCVideoChecker.h>
@@ -183,11 +187,13 @@ int main(int argc, char** argv)
std::cout << "Frame grabber created and started" << std::endl;
}
#else
#ifndef ENABLE_FB
if (config.isMember("framegrabber"))
{
std::cerr << "The dispmanx framegrabber can not be instantiated, becuse it has been left out from the build" << std::endl;
}
#endif
#endif
#ifdef ENABLE_V4L2
// construct and start the v4l2 grabber if the configuration is present
@@ -225,6 +231,38 @@ int main(int argc, char** argv)
std::cerr << "The v4l2 grabber can not be instantiated, becuse it has been left out from the build" << std::endl;
}
#endif
#ifdef ENABLE_FB
// Construct and start the framebuffer grabber if the configuration is present
FramebufferWrapper * fbGrabber = nullptr;
if (config.isMember("framegrabber"))
{
const Json::Value & grabberConfig = config["framegrabber"];
// TODO get device from config
fbGrabber = new FramebufferWrapper(
grabberConfig.get("device", "/dev/fb0").asString(),
grabberConfig["width"].asUInt(),
grabberConfig["height"].asUInt(),
grabberConfig["frequency_Hz"].asUInt(),
&hyperion);
if (xbmcVideoChecker != nullptr)
{
QObject::connect(xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), fbGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), fbGrabber, SLOT(setVideoMode(VideoMode)));
}
fbGrabber->start();
std::cout << "Framebuffer grabber created and started" << std::endl;
}
#else
#ifndef ENABLE_DISPMANX
if (config.isMember("framegrabber"))
{
std::cerr << "The framebuffer grabber can not be instantiated, becuse it has been left out from the build" << std::endl;
}
#endif
#endif
// Create Json server if configuration is present
JsonServer * jsonServer = nullptr;
@@ -263,6 +301,9 @@ int main(int argc, char** argv)
#ifdef ENABLE_DISPMANX
delete dispmanx;
#endif
#ifdef ENABLE_FB
delete fbGrabber;
#endif
#ifdef ENABLE_V4L2
delete v4l2Grabber;
#endif