Miam-Player  0.8.0
A nice music player
OpenGLVideo.h
Go to the documentation of this file.
1 /******************************************************************************
2  QtAV: Multimedia framework based on Qt and FFmpeg
3  Copyright (C) 2012-2016 Wang Bin <wbsecg1@gmail.com>
4 
5 * This file is part of QtAV (from 2014)
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 ******************************************************************************/
21 
22 #ifndef QTAV_OPENGLVIDEO_H
23 #define QTAV_OPENGLVIDEO_H
24 #ifndef QT_NO_OPENGL
25 #include <QtAV/QtAV_Global.h>
26 #include <QtAV/VideoFormat.h>
27 #include <QtCore/QHash>
28 #include <QtGui/QMatrix4x4>
29 #include <QtCore/QObject>
30 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
31 #include <QtGui/QOpenGLContext>
32 #else
33 #include <QtOpenGL/QGLContext>
34 #define QOpenGLContext QGLContext
35 #endif
36 QT_BEGIN_NAMESPACE
37 class QColor;
38 QT_END_NAMESPACE
39 
40 namespace QtAV {
41 
42 class VideoFrame;
43 class VideoShader;
44 class OpenGLVideoPrivate;
51 class Q_AV_EXPORT OpenGLVideo : public QObject
52 {
53  Q_OBJECT
55 public:
56  static bool isSupported(VideoFormat::PixelFormat pixfmt);
57  OpenGLVideo();
68  void setOpenGLContext(QOpenGLContext *ctx);
69  QOpenGLContext* openGLContext();
70  void setCurrentFrame(const VideoFrame& frame);
71  void fill(const QColor& color);
80  void render(const QRectF& target = QRectF(), const QRectF& roi = QRectF(), const QMatrix4x4& transform = QMatrix4x4());
85  void setProjectionMatrixToRect(const QRectF& v);
86 
87  void setBrightness(qreal value);
88  void setContrast(qreal value);
89  void setHue(qreal value);
90  void setSaturation(qreal value);
91 
92  void setUserShader(VideoShader* shader);
93  VideoShader* userShader() const;
94 Q_SIGNALS:
95  void beforeRendering();
101  void afterRendering();
102 protected:
104 
105 private slots:
106  /* used by Qt5 whose QOpenGLContext is QObject and we can call this when context is about to destroy.
107  * shader manager and material will be reset
108  */
109  void resetGL();
110 };
111 
112 
113 } //namespace QtAV
114 #endif //QT_NO_OPENGL
115 #endif // QTAV_OPENGLVIDEO_H
#define Q_AV_EXPORT
Definition: QtAV_Global.h:40
#define DPTR_DECLARE_PRIVATE(Class)
Definition: dptr.h:107
PixelFormat
The PixelFormat enum 32 bit rgba format enum name indicates it&#39;s channel layout.
Definition: VideoFormat.h:51
The VideoShader class Represents a shader for rendering a video frame.
Definition: VideoShader.h:53
Definition: VideoFrame.h:32
#define DPTR_DECLARE(Class)
Definition: dptr.h:105
AudioOutput ao; ao.setAudioFormat(fmt); ao.open(); while (has_data) { data = read_data(ao->bufferSize...
Definition: AudioDecoder.h:31
The OpenGLVideo class high level api for renderering a video frame.
Definition: OpenGLVideo.h:51