]> git.vomp.tv Git - vompclient.git/blob - osdopengl.h
Add files specific for raspberry pi
[vompclient.git] / osdopengl.h
1 /*\r
2     Copyright 2004-2005 Chris Tallon, 2006,2011-2012 Marten Richter\r
3 \r
4     This file is part of VOMP.\r
5 \r
6     VOMP is free software; you can redistribute it and/or modify\r
7     it under the terms of the GNU General Public License as published by\r
8     the Free Software Foundation; either version 2 of the License, or\r
9     (at your option) any later version.\r
10 \r
11     VOMP is distributed in the hope that it will be useful,\r
12     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14     GNU General Public License for more details.\r
15 \r
16     You should have received a copy of the GNU General Public License\r
17     along with VOMP; if not, write to the Free Software\r
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
19 */\r
20 \r
21 #ifndef OSDOPENGL_H\r
22 #define OSDOPENGL_H\r
23 \r
24 #include <stdio.h>\r
25 \r
26 #include <bcm_host.h>\r
27 \r
28 #include <GLES2/gl2.h>\r
29 #include <EGL/egl.h>\r
30 #include <EGL/eglext.h>\r
31 \r
32 #include "osd.h"\r
33 #include "defines.h"\r
34 #include "log.h"\r
35 #include "threadp.h"\r
36 #include "mutex.h"\r
37 \r
38 \r
39 \r
40 \r
41 \r
42 \r
43 struct OSDCOLOR{\r
44         GLfloat r;\r
45         GLfloat g;\r
46         GLfloat b;\r
47         GLfloat a;\r
48 };\r
49 \r
50 \r
51 struct OSDVERTEX {\r
52         GLfloat x;\r
53         GLfloat y;\r
54         GLfloat z;\r
55 /*      OSDCOLOR c;*/\r
56         GLfloat u;\r
57         GLfloat v;\r
58 };\r
59 \r
60 \r
61 \r
62 \r
63 \r
64 \r
65 class OsdOpenGL : public Osd, public Thread_TYPE\r
66 {\r
67   public:\r
68     OsdOpenGL();\r
69     virtual ~OsdOpenGL();\r
70 \r
71     int init(void* device);\r
72     int shutdown();\r
73 \r
74     int getFD();\r
75 \r
76     void screenShot(const char* fileName);\r
77 \r
78     Surface * createNewSurface();\r
79 \r
80 \r
81 \r
82 \r
83         // This function is called from the threadMethod function in order to get Screen updates\r
84         void Render();\r
85         void RenderDS(GLuint  present);\r
86         void BeginPainting();\r
87         void EndPainting();\r
88 \r
89         void setExternalDriving(/*DsAllocator* dsall,*/ unsigned int width, unsigned int height);\r
90         void Blank();\r
91 \r
92 \r
93 \r
94 \r
95 private:\r
96 \r
97         //Maybe move the following stuff to a generic opengl object also for boosting DCT etc.\r
98 \r
99    GLuint CreateShader(const GLchar * source, GLenum type);\r
100 \r
101         void threadMethod();\r
102     void threadPostStopCleanup();\r
103 \r
104         // This indicates, that currently a video is played, thus the osd updates are driven by the Videosystem\r
105         bool external_driving;\r
106         Mutex glmutex;\r
107         long long  lastrendertime;\r
108         void InternalRendering(GLuint present);\r
109         bool DoLost();\r
110         void InitVertexBuffer(float  scalex,float scaley);\r
111         OSDVERTEX osdvertices[4];\r
112         GLubyte osdindices[6];\r
113 \r
114 \r
115         GLuint osd_shader;\r
116         GLuint gen_shader;\r
117 \r
118         GLuint osd_program;\r
119 \r
120         GLint osd_sampler_loc;\r
121 \r
122          /* BCM specific */\r
123 \r
124     uint32_t display_height;\r
125         uint32_t display_width;\r
126 \r
127         EGLDisplay egl_display;\r
128         EGLSurface egl_surface;\r
129         EGLContext egl_context;\r
130 \r
131 };\r
132 \r
133 #endif\r