[WASAPI] fix stream types and frequencies enumeration
[xbmc.git] / xbmc / video / Teletext.h
blob35c32589e6dc1efdefdf13a153c07678d6bf68ba
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "TeletextDefines.h"
12 #include "guilib/GUITexture.h"
13 #include "utils/ColorUtils.h"
15 // stuff for freetype
16 #include <ft2build.h>
18 #ifdef TARGET_WINDOWS_STORE
19 #define generic GenericFromFreeTypeLibrary
20 #endif
22 #include FT_FREETYPE_H
23 #include FT_CACHE_H
24 #include FT_CACHE_SMALL_BITMAPS_H
26 class CAction;
28 typedef enum /* object type */
30 OBJ_PASSIVE,
31 OBJ_ACTIVE,
32 OBJ_ADAPTIVE
33 } tObjType;
35 class CTeletextDecoder
37 public:
38 CTeletextDecoder();
39 virtual ~CTeletextDecoder(void);
41 bool NeedRendering() { return m_updateTexture; }
42 void RenderingDone() { m_updateTexture = false; }
43 KODI::UTILS::COLOR::Color* GetTextureBuffer()
45 return m_TextureBuffer + (m_RenderInfo.Width * m_YOffset);
47 int GetHeight() { return m_RenderInfo.Height; }
48 int GetWidth() { return m_RenderInfo.Width; }
50 /*!
51 \brief Checks if the data in the decoder has changed
52 \return true if the data in the decoder has changed, false otherwise
54 bool Changed();
56 bool InitDecoder();
57 void EndDecoder();
58 void RenderPage();
59 bool HandleAction(const CAction &action);
61 private:
62 void PageInput(int Number);
63 void GetNextPageOne(bool up);
64 void GetNextSubPage(int offset);
65 bool IsSubtitlePage(int pageNumber) const;
66 void SwitchZoomMode();
67 void SwitchTranspMode();
68 void SwitchHintMode();
69 void ColorKey(int target);
70 void StartPageCatching();
71 void StopPageCatching();
72 void CatchNextPage(int firstlineinc, int inc);
73 void RenderCatchedPage();
74 void DoFlashing(int startrow);
75 void DoRenderPage(int startrow, int national_subset_bak);
76 void Decode_BTT();
77 void Decode_ADIP();
78 int TopText_GetNext(int startpage, int up, int findgroup);
79 void Showlink(int column, int linkpage);
80 void CreateLine25();
81 void RenderCharFB(int Char, TextPageAttr_t *Attribute);
82 void RenderCharBB(int Char, TextPageAttr_t *Attribute);
83 void CopyBB2FB();
84 void SetFontWidth(int newWidth);
85 int GetCurFontWidth();
86 void SetPosX(int column);
87 void ClearBB(KODI::UTILS::COLOR::Color Color);
88 void ClearFB(KODI::UTILS::COLOR::Color Color);
89 void FillBorder(KODI::UTILS::COLOR::Color Color);
90 void FillRect(KODI::UTILS::COLOR::Color* buffer,
91 int xres,
92 int x,
93 int y,
94 int w,
95 int h,
96 KODI::UTILS::COLOR::Color Color);
97 void DrawVLine(KODI::UTILS::COLOR::Color* lfb,
98 int xres,
99 int x,
100 int y,
101 int l,
102 KODI::UTILS::COLOR::Color color);
103 void DrawHLine(KODI::UTILS::COLOR::Color* lfb,
104 int xres,
105 int x,
106 int y,
107 int l,
108 KODI::UTILS::COLOR::Color color);
109 void FillRectMosaicSeparated(KODI::UTILS::COLOR::Color* lfb,
110 int xres,
111 int x,
112 int y,
113 int w,
114 int h,
115 KODI::UTILS::COLOR::Color fgcolor,
116 KODI::UTILS::COLOR::Color bgcolor,
117 int set);
118 void FillTrapez(KODI::UTILS::COLOR::Color* lfb,
119 int xres,
120 int x0,
121 int y0,
122 int l0,
123 int xoffset1,
124 int h,
125 int l1,
126 KODI::UTILS::COLOR::Color color);
127 void FlipHorz(KODI::UTILS::COLOR::Color* lfb, int xres, int x, int y, int w, int h);
128 void FlipVert(KODI::UTILS::COLOR::Color* lfb, int xres, int x, int y, int w, int h);
129 int ShapeCoord(int param, int curfontwidth, int curfontheight);
130 void DrawShape(KODI::UTILS::COLOR::Color* lfb,
131 int xres,
132 int x,
133 int y,
134 int shapenumber,
135 int curfontwidth,
136 int fontheight,
137 int curfontheight,
138 KODI::UTILS::COLOR::Color fgcolor,
139 KODI::UTILS::COLOR::Color bgcolor,
140 bool clear);
141 void RenderDRCS(
142 int xres,
143 unsigned char* s, /* pointer to char data, parity undecoded */
144 KODI::UTILS::COLOR::Color* d, /* pointer to frame buffer of top left pixel */
145 unsigned char* ax, /* array[0..12] of x-offsets, array[0..10] of y-offsets for each pixel */
146 KODI::UTILS::COLOR::Color fgcolor,
147 KODI::UTILS::COLOR::Color bgcolor);
148 void RenderCharIntern(TextRenderInfo_t* RenderInfo, int Char, TextPageAttr_t *Attribute, int zoom, int yoffset);
149 int RenderChar(
150 KODI::UTILS::COLOR::Color* buffer, // pointer to render buffer, min. fontheight*2*xres
151 int xres, // length of 1 line in render buffer
152 int Char, // character to render
153 int*
154 pPosX, // left border for rendering relative to *buffer, will be set to right border after rendering
155 int PosY, // vertical position of char in *buffer
156 TextPageAttr_t* Attribute, // Attributes of Char
157 bool zoom, // 1= character will be rendered in double height
158 int curfontwidth, // rendering width of character
159 int curfontwidth2, // rendering width of next character (needed for doublewidth)
160 int fontheight, // height of character
161 bool transpmode, // 1= transparent display
162 unsigned char* axdrcs, // width and height of DRCS-chars
163 int Ascender);
164 TextPageinfo_t* DecodePage(bool showl25, // 1=decode Level2.5-graphics
165 unsigned char* PageChar, // page buffer, min. 25*40
166 TextPageAttr_t *PageAtrb, // attribute buffer, min 25*40
167 bool HintMode, // 1=show hidden information
168 bool showflof); // 1=decode FLOF-line
169 void Eval_l25(unsigned char* page_char, TextPageAttr_t *PageAtrb, bool HintMode);
170 void Eval_Object(int iONr, TextCachedPage_t *pstCachedPage,
171 unsigned char *pAPx, unsigned char *pAPy,
172 unsigned char *pAPx0, unsigned char *pAPy0,
173 tObjType ObjType, unsigned char* pagedata, unsigned char* page_char, TextPageAttr_t* PageAtrb);
174 void Eval_NumberedObject(int p, int s, int packet, int triplet, int high,
175 unsigned char *pAPx, unsigned char *pAPy,
176 unsigned char *pAPx0, unsigned char *pAPy0, unsigned char* page_char, TextPageAttr_t* PageAtrb);
177 int Eval_Triplet(int iOData, TextCachedPage_t *pstCachedPage,
178 unsigned char *pAPx, unsigned char *pAPy,
179 unsigned char *pAPx0, unsigned char *pAPy0,
180 unsigned char *drcssubp, unsigned char *gdrcssubp,
181 signed char *endcol, TextPageAttr_t *attrPassive, unsigned char* pagedata, unsigned char* page_char, TextPageAttr_t* PageAtrb);
182 int iTripletNumber2Data(int iONr, TextCachedPage_t *pstCachedPage, unsigned char* pagedata);
183 int SetNational(unsigned char sec);
184 int NextHex(int i);
185 void SetColors(const unsigned short *pcolormap, int offset, int number);
186 KODI::UTILS::COLOR::Color GetColorRGB(enumTeletextColor ttc);
188 static FT_Error MyFaceRequester(FTC_FaceID face_id, FT_Library library, FT_Pointer request_data, FT_Face *aface);
190 std::string m_teletextFont; /* Path to teletext font */
191 int m_YOffset; /* Swap position for Front buffer and Back buffer */
192 KODI::UTILS::COLOR::Color* m_TextureBuffer; /* Texture buffer to hold generated data */
193 bool m_updateTexture; /* Update the texture if set */
194 char prevHeaderPage; /* Needed for texture update if header is changed */
195 char prevTimeSec; /* Needed for Time string update */
197 int m_CatchRow; /* for page catching */
198 int m_CatchCol; /* " " " */
199 int m_CatchedPage; /* " " " */
200 int m_PCOldRow; /* " " " */
201 int m_PCOldCol; /* " " " */
203 FT_Library m_Library; /* FreeType 2 data */
204 FTC_Manager m_Manager; /* " " " */
205 FTC_SBitCache m_Cache; /* " " " */
206 FTC_SBit m_sBit; /* " " " */
207 FT_Face m_Face; /* " " " */
208 /*! An opaque handle to a cache node object. Each cache node is reference-counted. */
209 FTC_Node m_anode{nullptr};
210 FTC_ImageTypeRec m_TypeTTF; /* " " " */
211 int m_Ascender; /* " " " */
213 int m_TempPage; /* Temporary page number for number input */
214 int m_LastPage; /* Last selected Page */
215 std::shared_ptr<TextCacheStruct_t> m_txtCache; /* Text cache generated by the VideoPlayer if Teletext present */
216 TextRenderInfo_t m_RenderInfo; /* Rendering information of displayed Teletext page */