-
Notifications
You must be signed in to change notification settings - Fork 17
/
QFFmpegGLWidget.h
67 lines (48 loc) · 1.28 KB
/
QFFmpegGLWidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef QFFMPEGGLWidget_H
#define QFFMPEGGLWidget_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QOpenGLBuffer>
#include <QVector3D>
#include <QMatrix4x4>
#include <QTime>
#include <QVector>
#include <QOpenGLTexture>
QT_FORWARD_DECLARE_CLASS(QOpenGLTexture)
QT_FORWARD_DECLARE_CLASS(QOpenGLShader)
QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
#define BUF_SIZE 2
class QFFmpegGLWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
Q_OBJECT
public:
QFFmpegGLWidget();
~QFFmpegGLWidget();
void updateData(unsigned char*);
void updateData(unsigned char**);
void initShader(int w,int h);
public slots:
void setTransparent(bool transparent);
protected:
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
void paintGL() Q_DECL_OVERRIDE;
void initializeGL() Q_DECL_OVERRIDE;
private:
QTimer *timer;
//--------------------
QOpenGLShader *m_vshaderA;
QOpenGLShader *m_fshaderA;
QOpenGLShaderProgram *m_programA;
QOpenGLBuffer m_vboA;
//-------------------
QOpenGLTexture *m_texture;
bool m_transparent;
QColor m_background;
bool isShaderInited;
int width;
int height;
quint8 *buffer[BUF_SIZE];
int bufIndex;
void InitializeTexture( int id, int width, int height);
};
#endif