]> git.vomp.tv Git - vompclient.git/blob - osdopengl.h
Rename TCP class to TCPOld
[vompclient.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, see <https://www.gnu.org/licenses/>.
18 */
19
20 #ifndef OSDOPENGL_H
21 #define OSDOPENGL_H
22
23 #include <stdio.h>
24 #include <mutex>
25
26 #include <GLES2/gl2.h>
27 #include <EGL/egl.h>
28 #include <EGL/eglext.h>
29
30 #include "osd.h"
31 #include "defines.h"
32 #include "log.h"
33 #include "threadp.h"
34 #include "videoomx.h"
35
36 #include "glosdshader.h"
37
38 struct OSDCOLOR{
39         GLfloat r;
40         GLfloat g;
41         GLfloat b;
42         GLfloat a;
43 };
44
45
46 struct OSDVERTEX {
47         GLfloat x;
48         GLfloat y;
49         GLfloat z;
50 /*      OSDCOLOR c;*/
51         GLfloat u;
52         GLfloat v;
53 };
54
55 class OsdOpenGL : public Osd, public Thread_TYPE
56 {
57   public:
58     OsdOpenGL();
59     virtual ~OsdOpenGL();
60
61     int init();
62     int shutdown();
63
64     int getFD();
65
66     void screenShot(const char* fileName);
67
68     Surface * createNewSurface();
69
70
71         void BeginPainting();
72         void EndPainting();
73
74         void Blank();
75
76         void getEGLObjs(EGLDisplay *i_egl_display,EGLSurface *i_egl_surface,EGLContext *i_egl_context, EGLConfig *i_egl_config){
77                 *i_egl_display=egl_display;
78                 *i_egl_surface=egl_surface;
79                 *i_egl_context=egl_context;
80                 *i_egl_config=egl_ourconfig;
81         };
82
83         EGLConfig getEGLConfig() {return egl_ourconfig;};
84
85         void AdviseAboutNewFrame() {threadSignal();};
86
87
88
89
90 private:
91
92         //Maybe move the following stuff to a generic opengl object also for boosting DCT etc.
93
94
95
96         void threadMethod();
97
98         // This indicates, that currently a video is played, thus the osd updates are driven by the Videosystem
99         bool external_driving;
100         std::mutex glmutex;
101         long long  lastrendertime;
102         void InternalRendering();
103         void InitVertexBuffer(float  scalex,float scaley);
104         OSDVERTEX osdvertices[4];
105         GLubyte osdindices[6];
106
107         GLOsdShader osd_shader;
108
109          /* BCM specific */
110
111     uint32_t display_height;
112         uint32_t display_width;
113         DISPMANX_DISPLAY_HANDLE_T bcm_display;
114         DISPMANX_ELEMENT_HANDLE_T bcm_element;
115
116         uint32_t mode;
117
118         EGLDisplay egl_display;
119         EGLSurface egl_surface;
120         EGLContext egl_context;
121         EGLConfig egl_ourconfig;
122 #ifdef BENCHMARK_FPS
123         long long last_benchmark_time;
124         unsigned int num_benchmark_frames;
125 #endif
126
127 };
128
129 #endif