mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Added v4l2 to hyperiond (partial)
Former-commit-id: 06684261ec3ac7bb4e8ff0479e5b1472823648ae
This commit is contained in:
parent
69d6e47328
commit
22472d8f95
@ -69,6 +69,11 @@ V4L2Grabber::V4L2Grabber(
|
||||
|
||||
V4L2Grabber::~V4L2Grabber()
|
||||
{
|
||||
// stop if the grabber was not stopped
|
||||
if (_streamNotifier != nullptr && _streamNotifier->isEnabled()) {
|
||||
stop();
|
||||
}
|
||||
|
||||
uninit_device();
|
||||
close_device();
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ target_link_libraries(hyperiond
|
||||
effectengine
|
||||
jsonserver
|
||||
protoserver
|
||||
boblightserver)
|
||||
boblightserver
|
||||
v4l2-grabber
|
||||
)
|
||||
|
||||
if (ENABLE_DISPMANX)
|
||||
target_link_libraries(hyperiond dispmanx-grabber)
|
||||
|
@ -22,6 +22,11 @@
|
||||
#include <grabber/DispmanxWrapper.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_V4L2
|
||||
// v4l2 grabber
|
||||
#include <grabber/V4L2Grabber.h>
|
||||
#endif
|
||||
|
||||
// XBMC Video checker includes
|
||||
#include <xbmcvideochecker/XBMCVideoChecker.h>
|
||||
|
||||
@ -165,6 +170,39 @@ int main(int argc, char** argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_V4L2
|
||||
// construct and start the v4l2 grabber if the configuration is present
|
||||
V4L2Grabber * v4l2Grabber = nullptr;
|
||||
if (config.isMember("grabber-v4l2"))
|
||||
{
|
||||
const Json::Value & grabberConfig = config["grabber-v4l2"];
|
||||
v4l2Grabber = new V4L2Grabber(
|
||||
grabberConfig.get("device", "/dev/video0").asString(),
|
||||
grabberConfig.get("input", 0).asInt(),
|
||||
grabberConfig.get("standard", V4L2Grabber::NONE),
|
||||
grabberConfig.get("width", -1).asInt(),
|
||||
grabberConfig.get("height", -1).asInt(),
|
||||
grabberConfig.get("frameDecimation", 2).asInt(),
|
||||
grabberConfig.get("sizeDecimation", 8).asInt(),
|
||||
grabberConfig.get("sizeDecimation", 8).asInt());
|
||||
v4l2Grabber->set3D(grabberConfig.get("mode", VIDEO_2D));
|
||||
v4l2Grabber->setCropping(
|
||||
grabberConfig.get("cropLeft", 0).asInt(),
|
||||
grabberConfig.get("cropRight", 0).asInt(),
|
||||
grabberConfig.get("cropTop", 0).asInt(),
|
||||
grabberConfig.get("cropBottom", 0).asInt());
|
||||
|
||||
// TODO: create handler
|
||||
v4l2Grabber->start();
|
||||
std::cout << "V4l2 grabber created and started" << std::endl;
|
||||
}
|
||||
#else
|
||||
if (config.isMember("grabber-v4l2"))
|
||||
{
|
||||
std::cerr << "The v4l2 grabber can not be instantiated, becuse it has been left out from the build" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Create Json server if configuration is present
|
||||
JsonServer * jsonServer = nullptr;
|
||||
if (config.isMember("jsonServer"))
|
||||
@ -199,6 +237,9 @@ int main(int argc, char** argv)
|
||||
// Delete all component
|
||||
#ifdef ENABLE_DISPMANX
|
||||
delete dispmanx;
|
||||
#endif
|
||||
#ifdef ENABLE_V4L2
|
||||
delete v4l2Grabber;
|
||||
#endif
|
||||
delete xbmcVideoChecker;
|
||||
delete jsonServer;
|
||||
|
Loading…
Reference in New Issue
Block a user