forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenGLWidgetRenderer.h
84 lines (75 loc) · 4.11 KB
/
OpenGLWidgetRenderer.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/******************************************************************************
QtAV: Multimedia framework based on Qt and FFmpeg
Copyright (C) 2012-2016 Wang Bin <[email protected]>
* This file is part of QtAV (from 2014)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
******************************************************************************/
#ifndef QTAV_OPENGLWIDGETRENDERER_H
#define QTAV_OPENGLWIDGETRENDERER_H
#include <QtAVWidgets/global.h>
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
#include <QtWidgets/QOpenGLWidget>
#else
#include <QtAVWidgets/QOpenGLWidget.h>
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
#include <QtAV/OpenGLRendererBase.h>
namespace QtAV {
// do not define QOpenGLWidget here with ifdef to avoid moc error
class OpenGLWidgetRendererPrivate;
class Q_AVWIDGETS_EXPORT OpenGLWidgetRenderer : public QOpenGLWidget, public OpenGLRendererBase
{
Q_OBJECT
DPTR_DECLARE_PRIVATE(OpenGLWidgetRenderer)
Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
Q_PROPERTY(qreal contrast READ contrast WRITE setContrast NOTIFY contrastChanged)
Q_PROPERTY(qreal hue READ hue WRITE setHue NOTIFY hueChanged)
Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
Q_PROPERTY(QRectF regionOfInterest READ regionOfInterest WRITE setRegionOfInterest NOTIFY regionOfInterestChanged)
Q_PROPERTY(qreal sourceAspectRatio READ sourceAspectRatio NOTIFY sourceAspectRatioChanged)
Q_PROPERTY(qreal outAspectRatio READ outAspectRatio WRITE setOutAspectRatio NOTIFY outAspectRatioChanged)
//fillMode
// TODO: how to use enums in base class as property or Q_ENUM
Q_PROPERTY(OutAspectRatioMode outAspectRatioMode READ outAspectRatioMode WRITE setOutAspectRatioMode NOTIFY outAspectRatioModeChanged)
Q_ENUMS(OutAspectRatioMode)
Q_PROPERTY(int orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
Q_PROPERTY(QRect videoRect READ videoRect NOTIFY videoRectChanged)
Q_PROPERTY(QSize videoFrameSize READ videoFrameSize NOTIFY videoFrameSizeChanged)
Q_ENUMS(Quality)
public:
explicit OpenGLWidgetRenderer(QWidget* parent = 0, Qt::WindowFlags f = 0);
virtual VideoRendererId id() const Q_DECL_OVERRIDE;
virtual QWidget* widget() Q_DECL_OVERRIDE { return this; }
Q_SIGNALS:
void sourceAspectRatioChanged(qreal value) Q_DECL_OVERRIDE Q_DECL_FINAL;
void regionOfInterestChanged() Q_DECL_OVERRIDE;
void outAspectRatioChanged() Q_DECL_OVERRIDE;
void outAspectRatioModeChanged() Q_DECL_OVERRIDE;
void brightnessChanged(qreal value) Q_DECL_OVERRIDE;
void contrastChanged(qreal) Q_DECL_OVERRIDE;
void hueChanged(qreal) Q_DECL_OVERRIDE;
void saturationChanged(qreal) Q_DECL_OVERRIDE;
void orientationChanged() Q_DECL_OVERRIDE;
void videoRectChanged() Q_DECL_OVERRIDE;
void videoFrameSizeChanged() Q_DECL_OVERRIDE;
void backgroundColorChanged() Q_DECL_OVERRIDE;
protected:
virtual void initializeGL() Q_DECL_OVERRIDE;
virtual void paintGL() Q_DECL_OVERRIDE;
virtual void resizeGL(int w, int h) Q_DECL_OVERRIDE;
virtual void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
};
typedef OpenGLWidgetRenderer VideoRendererOpenGLWidget;
} //namespace QtAV
#endif // QTAV_OPENGLWIDGETRENDERER_H