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