1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/test/videotest5/qqtv4l2videomanager.h

60 lines
1.3 KiB
C
Raw Normal View History

#ifndef QQTV4L2VIDEOMANAGER_H
#define QQTV4L2VIDEOMANAGER_H
//#include <qqt-local.h>
#define QQTSHARED_EXPORT
#include <QObject>
2019-09-08 08:56:49 +08:00
#include <QTimer>
#include <QSize>
#include <libv4l2capture.h>
#include <QImage>
/**
* @brief The QQtV4L2VideoManager class
*
*/
class QQTSHARED_EXPORT QQtV4L2VideoManager : public QObject
{
Q_OBJECT
public:
explicit QQtV4L2VideoManager ( QObject* parent = 0 );
virtual ~QQtV4L2VideoManager();
2019-09-08 08:56:49 +08:00
//基础设置
void setDeviceName ( const QString& devName = "/dev/video0" );
void setPixmapSize ( const QSize& size );
void setPixmapFormat ( quint32 format );
void setVideoRate ( int rate );
2019-09-08 08:56:49 +08:00
public slots:
void startCapture();
void stopCapture();
signals:
void readyRead ( const QImage& image );
2019-09-08 08:56:49 +08:00
protected:
int convert_yuv_to_rgb_pixel ( int y, int u, int v );
int convert_yuv_to_rgb_buffer ( unsigned char* yuv, unsigned char* rgb, unsigned int width,
unsigned int height );
private slots:
void slotGetCapture();
private:
QString mDevName;
QSize mSize;
quint32 mFormat;
int mRate;
2019-09-08 08:56:49 +08:00
QTimer* timer;
struct cap_handle* handler;
uchar* pp;
uchar* p;
QImage* frame;
};
#endif // QQTV4L2VIDEOMANAGER_H