2 Copyright 2004-2005 Chris Tallon, 2006,2011-2012 Marten Richter
4 This file is part of VOMP.
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.
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.
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/>.
27 #include <condition_variable>
30 #include <EGL/eglext.h>
31 #include <VG/openvg.h>
35 #include "osdvector.h"
37 #include "staticartwork.h"
38 #ifdef PICTURE_DECODER_OMX
39 //#include "imageomx.h"
40 #include "imageomx2.h"
44 #include FT_FREETYPE_H
50 OVGcreateImagePalette,
65 std::condition_variable doneCond;
73 unsigned int param1, param2, param3;
75 struct OpenVGResponse* response{}; // If !NULL, a thread is waiting
80 #include "eglpicturecreator.h"
83 class OsdOpenVG : public OsdVector
84 #ifdef PICTURE_DECODER_OMX
85 , public EGLPictureCreator
96 bool screenShotInternal(void* buffer, int width, int height, bool includeOSD);
98 float getFontHeight();
99 float getCharWidth(wchar_t c);
101 int getFontNames(const char*** names, const char*** names_keys);
103 virtual void setFont(const char* fontname);
105 virtual float getPixelAspect() {return aspect_correction;};
107 bool getEGLPicture(struct OsdVector::PictureInfo& info, EGLDisplay* display);
109 void updateBackgroundColor(DrawStyle bg);
113 // OSDOVG-ROD-EXPERIMENT
116 /*osd vector implementation*/
117 void destroyImageRef(VectorHandleImage handle);
118 // VectorHandleImage createJpeg(const char* fileName, int *width,int *height);
119 VectorHandleImage createMonoBitmap(void* base, int width, int height);
120 VectorHandleImage createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data);
121 void createPicture(struct PictureInfo& pict_inf);
122 void destroyDrawStyleHandle(VectorHandle index);
123 VectorHandle createDrawStyleHandle(const DrawStyle& c);
124 bool getStaticImageData(unsigned int static_id, UCHAR** userdata, ULONG* length);
126 void drawSetTrans(SurfaceInfo& sc);
127 void executeDrawCommand(SVGCommand& command);
131 VGPath std_paths[PIPoint + 1];
132 long long lastrendertime;
133 void InternalRendering();
134 void getScreenSize(int& width, int& height);
135 void getRealScreenSize(int& width, int& height);
138 std::mutex taskmutex;
140 std::deque<OpenVGCommand> vgcommands;
141 bool processOpenVGCommands();
142 unsigned int putOpenVGCommand(OpenVGCommand& comm, bool wait);
143 unsigned int handleOpenVGCommand(OpenVGCommand& command);
144 //void purgeAllReferences();
146 FT_Library ft_library;
151 int loadFont(bool fontchange);
152 std::map<unsigned int, float> font_exp_x;
153 std::vector<char*> fontnames;
154 std::vector<char*> fontnames_keys;
160 unsigned int loadTTchar(cTeletextChar c);
161 std::map<unsigned int, int> tt_font_chars;
163 std::thread renderThread;
164 std::mutex renderThreadMutex; // used for start-protect, go-around signal, quit signal
165 std::condition_variable renderThreadCond;
166 int renderThreadReq; // 1 - do update, 2 - stop
168 void renderThreadStop();
172 int32_t display_height{};
173 int32_t display_width{};
174 DISPMANX_DISPLAY_HANDLE_T bcm_display;
175 DISPMANX_ELEMENT_HANDLE_T bcm_element;
176 DISPMANX_ELEMENT_HANDLE_T bcm_background;
177 DISPMANX_RESOURCE_HANDLE_T bcm_backres{};
181 EGLDisplay egl_display;
182 EGLSurface egl_surface;
183 EGLContext egl_context;
184 EGLConfig egl_ourconfig;
186 float aspect_correction{1.};
187 bool freetype_inited{};
189 uint8_t* static_artwork_begin[sa_MAX];
190 uint8_t* static_artwork_end[sa_MAX];
192 #ifdef PICTURE_DECODER_OMX
193 //ImageOMX* imageomx;
194 ImageOMX2* imageomx2;