[mmap] partial revert of 8cef8db4 to disable using mmap file reader
[videoplayer.git] / GLvideo_rt.h
blob0df6e92bb36ce8bef54c74798e1b65a620ca66f2
1 /* ***** BEGIN LICENSE BLOCK *****
3 * The MIT License
5 * Copyright (c) 2008 BBC Research
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
25 * ***** END LICENSE BLOCK ***** */
27 #ifndef GLVIDEO_RT_H_
28 #define GLVIDEO_RT_H_
30 #include <GL/glew.h>
32 #ifdef Q_OS_WIN32
33 #include <GL/wglew.h>
34 #endif
36 #ifdef Q_WS_X11
37 #include <GL/glxew.h>
38 #endif
40 #include <QtGui>
42 #include "GLvideo_renderer.h"
44 class GLvideo_mt;
45 class FTFont;
46 class VideoData;
47 namespace GLVideoRenderer
49 class GLVideoRenderer;
51 class GLvideo_params;
52 class GLvideo_osd;
54 class GLvideo_rt : public QThread {
55 public:
57 GLvideo_rt(GLvideo_mt &glWidget, GLvideo_params& params);
58 ~GLvideo_rt();
59 void resizeViewport(int w, int h);
60 void run();
62 private:
63 enum ShaderPrograms {
64 Progressive = 0x0,
65 Deinterlace = 0x1,
66 shaderUYVY = 0,
67 shaderPlanar = 2,
68 /* Increment in steps of 2 */
69 shaderBogus,
70 shaderMax};
72 void compileFragmentShaders();
73 void compileFragmentShader(int n, const char *src);
74 void updateShaderVars(int program, VideoData *videoData, GLvideo_params& params, float colourMatrix[4][4]);
75 #ifdef WITH_OSD
76 void renderOSD(VideoData *videoData, FTFont *font, float fps, int osd,
77 float osdScale);
78 void renderPerf(VideoData *videoData, FTFont *font);
79 #endif
81 bool doRendering;
83 GLuint programs[shaderMax]; //handles for the shaders and programs
84 GLuint shaders[shaderMax];
85 GLint compiled[shaderMax];
86 GLint linked[shaderMax]; //flags for success
87 GLvideo_mt &glw; //parent widget
89 QMutex mutex;
91 GLvideo_osd *osd;
92 GLVideoRenderer::GLVideoRenderer *renderer[2];
93 GLvideo_params& params;
95 bool doResize;
96 int displaywidth;
97 int displayheight;
100 #endif /*GLVIDEO_RT_H_*/