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"
38 #include "staticartwork.h"
39 #ifdef PICTURE_DECODER_OMX
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
78 class OsdOpenVG : public OsdVector
79 #ifdef PICTURE_DECODER_OMX
80 , public EGLPictureCreator
91 bool screenShotInternal(void* buffer, int width, int height, bool includeOSD);
93 float getFontHeight();
94 float getCharWidth(wchar_t c);
96 int getFontNames(const char*** names, const char*** names_keys);
98 virtual void setFont(const char* fontname);
100 virtual float getPixelAspect() {return aspect_correction;};
102 bool getEGLPicture(struct OsdVector::PictureInfo& info, EGLDisplay* display);
104 void updateBackgroundColor(DrawStyle bg);
107 /*osd vector implementation*/
108 void destroyImageRef(ImageIndex index);
109 // ImageIndex createJpeg(const char* fileName, int *width,int *height);
110 ImageIndex createMonoBitmap(void* base, int width, int height);
111 ImageIndex createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data);
112 void createPicture(struct PictureInfo& pict_inf);
113 void destroyDrawStyleHandle(VectorHandle index);
114 VectorHandle createDrawStyleHandle(const DrawStyle& c);
115 bool getStaticImageData(unsigned int static_id, UCHAR** userdata, ULONG* length);
117 void drawSetTrans(SurfaceInfo& sc);
118 void executeDrawCommand(SVGCommand& command);
122 VGPath std_paths[PIPoint + 1];
123 long long lastrendertime;
124 void InternalRendering();
125 void getScreenSize(int& width, int& height);
126 void getRealScreenSize(int& width, int& height);
129 std::mutex taskmutex;
131 std::deque<OpenVGCommand> vgcommands;
132 bool processOpenVGCommands();
133 unsigned int putOpenVGCommand(OpenVGCommand& comm, bool wait);
134 unsigned int handleOpenVGCommand(OpenVGCommand& command);
135 //void purgeAllReferences();
137 FT_Library ft_library;
142 int loadFont(bool fontchange);
143 std::map<unsigned int, float> font_exp_x;
144 std::vector<char*> fontnames;
145 std::vector<char*> fontnames_keys;
151 unsigned int loadTTchar(cTeletextChar c);
152 std::map<unsigned int, int> tt_font_chars;
154 std::thread renderThread;
155 std::mutex renderThreadMutex; // used for start-protect, go-around signal, quit signal
156 std::condition_variable renderThreadCond;
157 int renderThreadReq; // 1 - do update, 2 - stop
159 void renderThreadStop();
163 int32_t display_height{};
164 int32_t display_width{};
165 DISPMANX_DISPLAY_HANDLE_T bcm_display;
166 DISPMANX_ELEMENT_HANDLE_T bcm_element;
167 DISPMANX_ELEMENT_HANDLE_T bcm_background;
168 DISPMANX_RESOURCE_HANDLE_T bcm_backres{};
172 EGLDisplay egl_display;
173 EGLSurface egl_surface;
174 EGLContext egl_context;
175 EGLConfig egl_ourconfig;
177 float aspect_correction{1.};
178 bool freetype_inited{};
180 uint8_t* static_artwork_begin[sa_MAX];
181 uint8_t* static_artwork_end[sa_MAX];
183 #ifdef PICTURE_DECODER_OMX