12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef PLAYEROPENGLWIDGET_H
- #define PLAYEROPENGLWIDGET_H
- #include <QOpenGLWidget>
- #include <QOpenGLFunctions>
- #include <QOpenGLShaderProgram>
- #include <QOpenGLTexture>
- #include <QTimer>
- #include "PlayerGlobalInfo.h"
- class PlayerGLWidget : public QOpenGLWidget , public QOpenGLFunctions
- {
- Q_OBJECT
- public:
- explicit PlayerGLWidget(QWidget *parent = nullptr);
- ~PlayerGLWidget();
- /* 刷新一帧 */
- void updateFrame(Image_YUV420& image);
- public slots:
- void updateYUVData(const QByteArray &y, const QByteArray &u, const QByteArray &v) {
- yData = y;
- uData = u;
- vData = v;
- update();
- }
- private:
- void initShaders();
- void initTextures();
- void initVertex();
- void initFrameBuffer();
- void renderYUV420P();
- protected:
- void initializeGL() override;
- void resizeGL(int w, int h) override;
- void paintGL() override;
- private:
- QOpenGLShaderProgram program;
- QOpenGLTexture *textureY = nullptr;
- QOpenGLTexture *textureU = nullptr;
- QOpenGLTexture *textureV = nullptr;
- QByteArray yData;
- QByteArray uData;
- QByteArray vData;
- };
- #endif /* PLAYEROPENGLWIDGET_H */
|