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,26 +4,27 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Qt includes
|
||||
#include <QObject>
|
||||
#include <QSocketNotifier>
|
||||
|
||||
// util includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <utils/VideoMode.h>
|
||||
|
||||
/// Capture class for V4L2 devices
|
||||
///
|
||||
/// @see http://linuxtv.org/downloads/v4l-dvb-apis/capture-example.html
|
||||
class V4L2Grabber
|
||||
class V4L2Grabber : public QObject
|
||||
{
|
||||
public:
|
||||
typedef void (*ImageCallback)(void * arg, const Image<ColorRgb> & image);
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum VideoStandard {
|
||||
PAL, NTSC, NO_CHANGE
|
||||
};
|
||||
|
||||
enum Mode3D {
|
||||
MODE_NONE, MODE_3DSBS, MODE_3DTAB
|
||||
};
|
||||
|
||||
public:
|
||||
V4L2Grabber(
|
||||
const std::string & device,
|
||||
@@ -36,21 +37,24 @@ public:
|
||||
int verticalPixelDecimation);
|
||||
virtual ~V4L2Grabber();
|
||||
|
||||
public slots:
|
||||
void setCropping(int cropLeft,
|
||||
int cropRight,
|
||||
int cropTop,
|
||||
int cropBottom);
|
||||
|
||||
void set3D(Mode3D mode);
|
||||
|
||||
void setCallback(ImageCallback callback, void * arg);
|
||||
void set3D(VideoMode mode);
|
||||
|
||||
void start();
|
||||
|
||||
void capture(int frameCount = -1);
|
||||
|
||||
void stop();
|
||||
|
||||
signals:
|
||||
void newFrame(const Image<ColorRgb> & image);
|
||||
|
||||
private slots:
|
||||
int read_frame();
|
||||
|
||||
private:
|
||||
void open_device();
|
||||
|
||||
@@ -70,8 +74,6 @@ private:
|
||||
|
||||
void stop_capturing();
|
||||
|
||||
int read_frame();
|
||||
|
||||
bool process_image(const void *p, int size);
|
||||
|
||||
void process_image(const uint8_t *p);
|
||||
@@ -111,10 +113,9 @@ private:
|
||||
int _horizontalPixelDecimation;
|
||||
int _verticalPixelDecimation;
|
||||
|
||||
Mode3D _mode3D;
|
||||
VideoMode _mode3D;
|
||||
|
||||
int _currentFrame;
|
||||
|
||||
ImageCallback _callback;
|
||||
void * _callbackArg;
|
||||
QSocketNotifier * _streamNotifier;
|
||||
};
|
||||
|
Reference in New Issue
Block a user