-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXPlayVideoWidget.h
44 lines (38 loc) · 1019 Bytes
/
XPlayVideoWidget.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
#ifndef XPLAYVIDEOWIDGET_H
#define XPLAYVIDEOWIDGET_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
#include <mutex>
#include "IVideoCall.h"
struct AVFrame;
class XPlayVideoWidget : public QOpenGLWidget, protected QOpenGLFunctions, public IVideoCall
{
Q_OBJECT
public:
virtual void init(int width, int height);
XPlayVideoWidget(QWidget *parent);
~XPlayVideoWidget();
// 不管成功与否,都要释放frame
virtual void repaint(AVFrame *frame);
protected:
// 初始化gl
void initializeGL();
// 窗口尺寸变化
void resizeGL(int width, int height);
// 刷新显示
void paintGL();
private:
std::mutex mux;
// shader程序
QOpenGLShaderProgram *program;
// shader中yuv变量地址
GLuint unis[3] = { 0 };
// opengl的texture地址
GLuint texs[3] = { 0 };
// 材质内存空间
unsigned char *datas[3] = { 0 };
int width = 240;
int height = 128;
};
#endif // XPLAYVIDEOWIDGET_H