Phonon  4.7.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
glpainter.h
1 /*
2  Copyright (C) 2011 Harald Sitter <sitter@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) version 3, or any
8  later version accepted by the membership of KDE e.V. (or its
9  successor approved by the membership of KDE e.V.), Nokia Corporation
10  (or its successors, if any) and the KDE Free Qt Foundation, which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef PHONON_GLPAINTER_H
23 #define PHONON_GLPAINTER_H
24 
25 #include <QtGui/QMatrix4x4>
26 // Not forward included, because we need platform specific GL typedefs for structs.
27 #include <QtOpenGL/QGLContext>
28 
29 #include "abstractvideographicspainter.h"
30 #include "videoframe.h"
31 
32 namespace Phonon {
33 
35 {
36  typedef struct {
37  GLenum target;
38  GLint internalFormat;
39 // GLint border;
40  GLenum format;
41  GLenum type;
42  } GlTextureDescriptor;
43 
44  typedef struct {
45  GLsizei width;
46  GLsizei height;
47  } GlTextureSize;
48 
49 public:
51  virtual ~GlPainter();
52 
54  void setContext(QGLContext *context);
55 
57  void initRgb32();
58 
60  void initYv12();
61 
63  void initColorMatrix();
64 
69  void initTextures();
70 
71 protected:
72  GlPainter();
73 
74  QGLContext *m_context;
75  int m_textureCount;
76  GLuint m_textureIds[3];
77 
78  GlTextureDescriptor m_texDescriptor;
79  GlTextureSize m_texSize[3];
80 
81  QMatrix4x4 m_colorMatrix;
82 
83  bool m_texturesInited;
84 };
85 
86 } // namespace Phonon
87 
88 #endif // PHONON_GLPAINTER_H