mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Create image callback using Qt signal
Former-commit-id: cf469ba01ffd26d286e6fb8d9f081cf126042e50
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <clocale>
|
||||
|
||||
// QT includes
|
||||
#include <QImage>
|
||||
#include <QCoreApplication>
|
||||
|
||||
// getoptPlusPLus includes
|
||||
#include <getoptPlusPlus/getoptpp.h>
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "ProtoConnection.h"
|
||||
#include "VideoStandardParameter.h"
|
||||
#include "ImageHandler.h"
|
||||
#include "ScreenshotHandler.h"
|
||||
|
||||
using namespace vlofgren;
|
||||
|
||||
@@ -32,8 +33,11 @@ void saveScreenshot(void *, const Image<ColorRgb> & image)
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
|
||||
// force the locale
|
||||
setlocale(LC_ALL, "C");
|
||||
QLocale::setDefault(QLocale::c());
|
||||
|
||||
try
|
||||
{
|
||||
@@ -113,31 +117,30 @@ int main(int argc, char** argv)
|
||||
// set 3D mode if applicable
|
||||
if (arg3DSBS.isSet())
|
||||
{
|
||||
grabber.set3D(V4L2Grabber::MODE_3DSBS);
|
||||
grabber.set3D(VIDEO_3DSBS);
|
||||
}
|
||||
else if (arg3DTAB.isSet())
|
||||
{
|
||||
grabber.set3D(V4L2Grabber::MODE_3DTAB);
|
||||
grabber.set3D(VIDEO_3DTAB);
|
||||
}
|
||||
|
||||
// start the grabber
|
||||
grabber.start();
|
||||
|
||||
// run the grabber
|
||||
if (argScreenshot.isSet())
|
||||
{
|
||||
grabber.setCallback(&saveScreenshot, nullptr);
|
||||
grabber.capture(1);
|
||||
ScreenshotHandler handler("screenshot.png");
|
||||
QObject::connect(&grabber, SIGNAL(newFrame(Image<ColorRgb>)), &handler, SLOT(receiveImage(Image<ColorRgb>)));
|
||||
grabber.start();
|
||||
QCoreApplication::exec();
|
||||
grabber.stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
ImageHandler handler(argAddress.getValue(), argPriority.getValue(), argSignalThreshold.getValue(), argSkipReply.isSet());
|
||||
grabber.setCallback(&ImageHandler::imageCallback, &handler);
|
||||
grabber.capture();
|
||||
QObject::connect(&grabber, SIGNAL(newFrame(Image<ColorRgb>)), &handler, SLOT(receiveImage(Image<ColorRgb>)));
|
||||
grabber.start();
|
||||
QCoreApplication::exec();
|
||||
grabber.stop();
|
||||
}
|
||||
|
||||
// stop the grabber
|
||||
grabber.stop();
|
||||
}
|
||||
catch (const std::runtime_error & e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user