]> git.vomp.tv Git - vompclient.git/blob - osdopenvg.h
Implement SignalOn and SignalOff switch back to more mvp like behaviour of program...
[vompclient.git] / osdopenvg.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 OSDOPENVG_H\r
22 #define OSDOPENVG_H\r
23 \r
24 #include <stdio.h>\r
25 \r
26 \r
27 #include <EGL/egl.h>\r
28 #include <EGL/eglext.h>\r
29 #include <VG/openvg.h>\r
30 #include <VG/vgu.h>\r
31 \r
32 \r
33 \r
34 #include "osdvector.h"\r
35 #include "defines.h"\r
36 #include "log.h"\r
37 #include "threadp.h"\r
38 #include "mutex.h"\r
39 #include "videoomx.h"\r
40 \r
41 #include <deque>\r
42 \r
43 #include <ft2build.h>\r
44 #include FT_FREETYPE_H\r
45 \r
46 enum OpenVGTask {\r
47         OVGdestroyImageRef,\r
48         OVGdestroyPaint,\r
49         OVGcreateImagePalette,\r
50         OVGcreateMonoBitmap,\r
51         OVGcreateColorRef,\r
52         OVGimageUploadLine,\r
53         OVGcreateImageFile\r
54 };\r
55 \r
56 struct OpenVGCommand\r
57 {\r
58         enum OpenVGTask task;\r
59         const void *data;\r
60         const void *data2;\r
61         unsigned int param1,param2,param3;\r
62         unsigned int id; //only set an id if you are waiting\r
63 };\r
64 \r
65 struct OpenVGResponse{\r
66         unsigned int id;\r
67         unsigned int result;\r
68 };\r
69 \r
70 \r
71 class OsdOpenVG : public OsdVector, public Thread_TYPE\r
72 {\r
73   public:\r
74     OsdOpenVG();\r
75     virtual ~OsdOpenVG();\r
76 \r
77     int init(void* device);\r
78     int shutdown();\r
79 \r
80 \r
81 \r
82 \r
83     float getFontHeight();\r
84     float getCharWidth(wchar_t c);\r
85     void imageUploadLine(ImageIndex index,unsigned int j,unsigned int width,void *data);\r
86 \r
87 \r
88 protected:\r
89    /*osd vector implementation*/\r
90     void destroyImageRef(ImageIndex index);\r
91     ImageIndex createJpeg(const char* fileName, int *width,int *height);\r
92     ImageIndex createMonoBitmap(void *base,int width,int height);\r
93     ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data);\r
94     void destroyStyleRef(unsigned int index);\r
95         unsigned int createStyleRef(const DrawStyle &c);\r
96         unsigned int createColorRef(const Colour &c);\r
97 \r
98         void drawSetTrans(SurfaceCommands & sc);\r
99         void executeDrawCommand(SVGCommand & command);\r
100 \r
101         void initPaths();\r
102         void destroyPaths();\r
103         VGPath std_paths[Point+1];\r
104         long long  lastrendertime;\r
105         void InternalRendering();\r
106 \r
107 \r
108 \r
109         Mutex vgmutex;\r
110         Mutex taskmutex;\r
111     pthread_cond_t vgtaskCond;\r
112     pthread_mutex_t vgtaskCondMutex;\r
113     deque<OpenVGCommand> vgcommands;\r
114     deque<OpenVGResponse> vgresponses;\r
115     bool processTasks();\r
116     bool haveOpenVGResponse(unsigned int id,unsigned int * resp);\r
117     unsigned int  putOpenVGCommand(OpenVGCommand& comm,bool wait);\r
118     unsigned int handleTask(OpenVGCommand& command);\r
119     unsigned int wait_id;\r
120 \r
121     FT_Library  ft_library;\r
122     FT_Face     ft_face;\r
123     VGFont vgfont;\r
124     VGFont vgttfont;\r
125     VGPaint vgttpaint;\r
126     int  loadFont();\r
127     map<unsigned int,float> font_exp_x;\r
128 \r
129     unsigned int loadTTchar(cTeletextChar c);\r
130     map<unsigned int,int> tt_font_chars;\r
131 \r
132 \r
133 \r
134         void threadMethod();\r
135     void threadPostStopCleanup();\r
136 \r
137 \r
138          /* BCM specific */\r
139 \r
140     uint32_t display_height;\r
141         uint32_t display_width;\r
142         DISPMANX_DISPLAY_HANDLE_T bcm_display;\r
143         DISPMANX_ELEMENT_HANDLE_T bcm_element;\r
144 //      DISPMANX_ELEMENT_HANDLE_T bcm_background;\r
145 //      DISPMANX_RESOURCE_HANDLE_T bcm_backres;\r
146 \r
147         uint32_t mode;\r
148 \r
149 \r
150         EGLDisplay egl_display;\r
151         EGLSurface egl_surface;\r
152         EGLContext egl_context;\r
153         EGLConfig egl_ourconfig;\r
154         float font_height;\r
155         float aspect_correction;\r
156 \r
157 \r
158 };\r
159 \r
160 #endif\r