2014-02-23 22:39:23 +01:00
|
|
|
#pragma once
|
|
|
|
|
2014-03-22 15:35:25 +01:00
|
|
|
// Qt includes
|
|
|
|
#include <QTimer>
|
|
|
|
|
2014-02-23 22:39:23 +01:00
|
|
|
// Hyperion includes
|
|
|
|
#include <hyperion/Hyperion.h>
|
|
|
|
#include <hyperion/ImageProcessor.h>
|
|
|
|
|
|
|
|
// Grabber includes
|
|
|
|
#include <grabber/V4L2Grabber.h>
|
|
|
|
|
|
|
|
class V4L2Wrapper : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
V4L2Wrapper(const std::string & device,
|
|
|
|
int input,
|
|
|
|
VideoStandard videoStandard,
|
2014-03-31 17:36:36 +02:00
|
|
|
PixelFormat pixelFormat,
|
2014-02-23 22:39:23 +01:00
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int frameDecimation,
|
|
|
|
int pixelDecimation,
|
2014-03-04 22:04:15 +01:00
|
|
|
double redSignalThreshold,
|
|
|
|
double greenSignalThreshold,
|
|
|
|
double blueSignalThreshold,
|
2014-02-23 22:39:23 +01:00
|
|
|
int hyperionPriority);
|
|
|
|
virtual ~V4L2Wrapper();
|
|
|
|
|
|
|
|
public slots:
|
2016-07-14 23:40:10 +02:00
|
|
|
bool start();
|
2014-02-23 22:39:23 +01:00
|
|
|
|
|
|
|
void stop();
|
|
|
|
|
|
|
|
void setCropping(int cropLeft,
|
|
|
|
int cropRight,
|
|
|
|
int cropTop,
|
|
|
|
int cropBottom);
|
|
|
|
|
|
|
|
void set3D(VideoMode mode);
|
|
|
|
|
2014-03-04 20:32:54 +01:00
|
|
|
signals:
|
|
|
|
void emitColors(int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms);
|
2016-02-16 15:41:40 +01:00
|
|
|
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
|
2014-03-04 20:32:54 +01:00
|
|
|
|
2014-02-23 22:39:23 +01:00
|
|
|
private slots:
|
|
|
|
void newFrame(const Image<ColorRgb> & image);
|
|
|
|
|
2014-03-22 15:35:25 +01:00
|
|
|
void checkSources();
|
|
|
|
|
2014-02-23 22:39:23 +01:00
|
|
|
private:
|
|
|
|
/// The timeout of the led colors [ms]
|
|
|
|
const int _timeout_ms;
|
|
|
|
|
|
|
|
/// The priority of the led colors
|
|
|
|
const int _priority;
|
|
|
|
|
|
|
|
/// The V4L2 grabber
|
|
|
|
V4L2Grabber _grabber;
|
|
|
|
|
|
|
|
/// The processor for transforming images to led colors
|
|
|
|
ImageProcessor * _processor;
|
|
|
|
|
|
|
|
/// The Hyperion instance
|
|
|
|
Hyperion * _hyperion;
|
|
|
|
|
|
|
|
/// The list with computed led colors
|
|
|
|
std::vector<ColorRgb> _ledColors;
|
2014-03-22 15:35:25 +01:00
|
|
|
|
|
|
|
/// Timer which tests if a higher priority source is active
|
|
|
|
QTimer _timer;
|
2014-02-23 22:39:23 +01:00
|
|
|
};
|