kodi
TeletextDefines.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "threads/CriticalSection.h"
12 
13 #include <chrono>
14 #include <string>
15 
16 #define FLOFSIZE 4
17 #define SUBTITLE_CACHESIZE 50
18 #define TELETEXT_PAGE_SIZE (40 * 25)
19 
20 #define number2char(c) ((c) + (((c) <= 9) ? '0' : ('A' - 10)))
21 
22 enum /* indices in atrtable */
23 {
24  ATR_WB, /* white on black */
25  ATR_PassiveDefault, /* Default for passive objects: white on black, ignore at Black Background Color Substitution */
26  ATR_L250, /* line25 */
27  ATR_L251, /* line25 */
28  ATR_L252, /* line25 */
29  ATR_L253, /* line25 */
30  ATR_TOPMENU0, /* topmenu */
31  ATR_TOPMENU1, /* topmenu */
32  ATR_TOPMENU2, /* topmenu */
33  ATR_TOPMENU3, /* topmenu */
34  ATR_MSG0, /* message */
35  ATR_MSG1, /* message */
36  ATR_MSG2, /* message */
37  ATR_MSG3, /* message */
38  ATR_MSGDRM0, /* message */
39  ATR_MSGDRM1, /* message */
40  ATR_MSGDRM2, /* message */
41  ATR_MSGDRM3, /* message */
42  ATR_MENUHIL0, /* highlight menu line */
43  ATR_MENUHIL1, /* highlight menu line */
44  ATR_MENUHIL2, /* highlight menu line */
45  ATR_MENU0, /* menu line */
46  ATR_MENU1, /* menu line */
47  ATR_MENU2, /* menu line */
48  ATR_MENU3, /* menu line */
49  ATR_MENU4, /* menu line */
50  ATR_MENU5, /* menu line */
51  ATR_MENU6, /* menu line */
52  ATR_CATCHMENU0, /* catch menu line */
53  ATR_CATCHMENU1 /* catch menu line */
54 };
55 
56 /* colortable */
57 enum enumTeletextColor
58 {
59  TXT_ColorBlack = 0,
60  TXT_ColorRed, /* 1 */
61  TXT_ColorGreen, /* 2 */
62  TXT_ColorYellow, /* 3 */
63  TXT_ColorBlue, /* 4 */
64  TXT_ColorMagenta, /* 5 */
65  TXT_ColorCyan, /* 6 */
66  TXT_ColorWhite, /* 7 */
67  TXT_ColorMenu1 = (4*8),
68  TXT_ColorMenu2,
69  TXT_ColorMenu3,
70  TXT_ColorTransp,
71  TXT_ColorTransp2,
72  TXT_Color_SIZECOLTABLE
73 };
74 
75 enum /* options for charset */
76 {
77  C_G0P = 0, /* primary G0 */
78  C_G0S, /* secondary G0 */
79  C_G1C, /* G1 contiguous */
80  C_G1S, /* G1 separate */
81  C_G2,
82  C_G3,
83  C_OFFSET_DRCS = 32
84  /* 32..47: 32+subpage# GDRCS (offset/20 in PageChar) */
85  /* 48..63: 48+subpage# DRCS (offset/20 in PageChar) */
86 };
87 
88 enum /* page function */
89 {
90  FUNC_LOP = 0, /* Basic Level 1 Teletext page (LOP) */
91  FUNC_DATA, /* Data broadcasting page coded according to EN 300 708 [2] clause 4 */
92  FUNC_GPOP, /* Global Object definition page (GPOP) - (see clause 10.5.1) */
93  FUNC_POP, /* Normal Object definition page (POP) - (see clause 10.5.1) */
94  FUNC_GDRCS, /* Global DRCS downloading page (GDRCS) - (see clause 10.5.2) */
95  FUNC_DRCS, /* Normal DRCS downloading page (DRCS) - (see clause 10.5.2) */
96  FUNC_MOT, /* Magazine Organization table (MOT) - (see clause 10.6) */
97  FUNC_MIP, /* Magazine Inventory page (MIP) - (see clause 11.3) */
98  FUNC_BTT, /* Basic TOP table (BTT) } */
99  FUNC_AIT, /* Additional Information Table (AIT) } (see clause 11.2) */
100  FUNC_MPT, /* Multi-page table (MPT) } */
101  FUNC_MPTEX, /* Multi-page extension table (MPT-EX) } */
102  FUNC_TRIGGER /* Page contain trigger messages defined according to [8] */
103 };
104 
105 enum
106 {
107  NAT_DEFAULT = 0,
108  NAT_CZ = 1,
109  NAT_UK = 2,
110  NAT_ET = 3,
111  NAT_FR = 4,
112  NAT_DE = 5,
113  NAT_IT = 6,
114  NAT_LV = 7,
115  NAT_PL = 8,
116  NAT_SP = 9,
117  NAT_RO = 10,
118  NAT_SR = 11,
119  NAT_SW = 12,
120  NAT_TR = 13,
121  NAT_MAX_FROM_HEADER = 13,
122  NAT_SC = 14,
123  NAT_RB = 15,
124  NAT_UA = 16,
125  NAT_GR = 17,
126  NAT_HB = 18,
127  NAT_AR = 19
128 };
129 
130 const unsigned char CountryConversionTable[] = { NAT_UK, NAT_DE, NAT_SW, NAT_IT, NAT_FR, NAT_SP, NAT_CZ, NAT_RO};
131 const unsigned char MapTblFG[] = { 0, 0, 8, 8, 16, 16, 16 };
132 const unsigned char MapTblBG[] = { 8, 16, 8, 16, 8, 16, 24 };
133 const unsigned short DefaultColors[] = /* 0x0bgr */
134 {
135  0x000, 0x00f, 0x0f0, 0x0ff, 0xf00, 0xf0f, 0xff0, 0xfff,
136  0x000, 0x007, 0x070, 0x077, 0x700, 0x707, 0x770, 0x777,
137  0x50f, 0x07f, 0x7f0, 0xbff, 0xac0, 0x005, 0x256, 0x77c,
138  0x333, 0x77f, 0x7f7, 0x7ff, 0xf77, 0xf7f, 0xff7, 0xddd,
139  0x420, 0x210, 0x420, 0x000, 0x000
140 };
141 
142 /* hamming table */
143 const unsigned char dehamming[] =
144 {
145  0x01, 0xFF, 0x01, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0xFF, 0x02, 0x01, 0xFF, 0x0A, 0xFF, 0xFF, 0x07,
146  0xFF, 0x00, 0x01, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x06, 0xFF, 0xFF, 0x0B, 0xFF, 0x00, 0x03, 0xFF,
147  0xFF, 0x0C, 0x01, 0xFF, 0x04, 0xFF, 0xFF, 0x07, 0x06, 0xFF, 0xFF, 0x07, 0xFF, 0x07, 0x07, 0x07,
148  0x06, 0xFF, 0xFF, 0x05, 0xFF, 0x00, 0x0D, 0xFF, 0x06, 0x06, 0x06, 0xFF, 0x06, 0xFF, 0xFF, 0x07,
149  0xFF, 0x02, 0x01, 0xFF, 0x04, 0xFF, 0xFF, 0x09, 0x02, 0x02, 0xFF, 0x02, 0xFF, 0x02, 0x03, 0xFF,
150  0x08, 0xFF, 0xFF, 0x05, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x02, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0x03,
151  0x04, 0xFF, 0xFF, 0x05, 0x04, 0x04, 0x04, 0xFF, 0xFF, 0x02, 0x0F, 0xFF, 0x04, 0xFF, 0xFF, 0x07,
152  0xFF, 0x05, 0x05, 0x05, 0x04, 0xFF, 0xFF, 0x05, 0x06, 0xFF, 0xFF, 0x05, 0xFF, 0x0E, 0x03, 0xFF,
153  0xFF, 0x0C, 0x01, 0xFF, 0x0A, 0xFF, 0xFF, 0x09, 0x0A, 0xFF, 0xFF, 0x0B, 0x0A, 0x0A, 0x0A, 0xFF,
154  0x08, 0xFF, 0xFF, 0x0B, 0xFF, 0x00, 0x0D, 0xFF, 0xFF, 0x0B, 0x0B, 0x0B, 0x0A, 0xFF, 0xFF, 0x0B,
155  0x0C, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0x0D, 0xFF, 0xFF, 0x0C, 0x0F, 0xFF, 0x0A, 0xFF, 0xFF, 0x07,
156  0xFF, 0x0C, 0x0D, 0xFF, 0x0D, 0xFF, 0x0D, 0x0D, 0x06, 0xFF, 0xFF, 0x0B, 0xFF, 0x0E, 0x0D, 0xFF,
157  0x08, 0xFF, 0xFF, 0x09, 0xFF, 0x09, 0x09, 0x09, 0xFF, 0x02, 0x0F, 0xFF, 0x0A, 0xFF, 0xFF, 0x09,
158  0x08, 0x08, 0x08, 0xFF, 0x08, 0xFF, 0xFF, 0x09, 0x08, 0xFF, 0xFF, 0x0B, 0xFF, 0x0E, 0x03, 0xFF,
159  0xFF, 0x0C, 0x0F, 0xFF, 0x04, 0xFF, 0xFF, 0x09, 0x0F, 0xFF, 0x0F, 0x0F, 0xFF, 0x0E, 0x0F, 0xFF,
160  0x08, 0xFF, 0xFF, 0x05, 0xFF, 0x0E, 0x0D, 0xFF, 0xFF, 0x0E, 0x0F, 0xFF, 0x0E, 0x0E, 0xFF, 0x0E
161 };
162 
163 /* odd parity table, error=0x20 (space) */
164 const unsigned char deparity[] =
165 {
166  ' ' , 0x01, 0x02, ' ' , 0x04, ' ' , ' ' , 0x07, 0x08, ' ' , ' ' , 0x0b, ' ' , 0x0d, 0x0e, ' ' ,
167  0x10, ' ' , ' ' , 0x13, ' ' , 0x15, 0x16, ' ' , ' ' , 0x19, 0x1a, ' ' , 0x1c, ' ' , ' ' , 0x1f,
168  0x20, ' ' , ' ' , 0x23, ' ' , 0x25, 0x26, ' ' , ' ' , 0x29, 0x2a, ' ' , 0x2c, ' ' , ' ' , 0x2f,
169  ' ' , 0x31, 0x32, ' ' , 0x34, ' ' , ' ' , 0x37, 0x38, ' ' , ' ' , 0x3b, ' ' , 0x3d, 0x3e, ' ' ,
170  0x40, ' ' , ' ' , 0x43, ' ' , 0x45, 0x46, ' ' , ' ' , 0x49, 0x4a, ' ' , 0x4c, ' ' , ' ' , 0x4f,
171  ' ' , 0x51, 0x52, ' ' , 0x54, ' ' , ' ' , 0x57, 0x58, ' ' , ' ' , 0x5b, ' ' , 0x5d, 0x5e, ' ' ,
172  ' ' , 0x61, 0x62, ' ' , 0x64, ' ' , ' ' , 0x67, 0x68, ' ' , ' ' , 0x6b, ' ' , 0x6d, 0x6e, ' ' ,
173  0x70, ' ' , ' ' , 0x73, ' ' , 0x75, 0x76, ' ' , ' ' , 0x79, 0x7a, ' ' , 0x7c, ' ' , ' ' , 0x7f,
174  0x00, ' ' , ' ' , 0x03, ' ' , 0x05, 0x06, ' ' , ' ' , 0x09, 0x0a, ' ' , 0x0c, ' ' , ' ' , 0x0f,
175  ' ' , 0x11, 0x12, ' ' , 0x14, ' ' , ' ' , 0x17, 0x18, ' ' , ' ' , 0x1b, ' ' , 0x1d, 0x1e, ' ' ,
176  ' ' , 0x21, 0x22, ' ' , 0x24, ' ' , ' ' , 0x27, 0x28, ' ' , ' ' , 0x2b, ' ' , 0x2d, 0x2e, ' ' ,
177  0x30, ' ' , ' ' , 0x33, ' ' , 0x35, 0x36, ' ' , ' ' , 0x39, 0x3a, ' ' , 0x3c, ' ' , ' ' , 0x3f,
178  ' ' , 0x41, 0x42, ' ' , 0x44, ' ' , ' ' , 0x47, 0x48, ' ' , ' ' , 0x4b, ' ' , 0x4d, 0x4e, ' ' ,
179  0x50, ' ' , ' ' , 0x53, ' ' , 0x55, 0x56, ' ' , ' ' , 0x59, 0x5a, ' ' , 0x5c, ' ' , ' ' , 0x5f,
180  0x60, ' ' , ' ' , 0x63, ' ' , 0x65, 0x66, ' ' , ' ' , 0x69, 0x6a, ' ' , 0x6c, ' ' , ' ' , 0x6f,
181  ' ' , 0x71, 0x72, ' ' , 0x74, ' ' , ' ' , 0x77, 0x78, ' ' , ' ' , 0x7b, ' ' , 0x7d, 0x7e, ' ' ,
182 };
183 
184 /*
185  * [AleVT]
186  *
187  * This table generates the parity checks for hamm24/18 decoding.
188  * Bit 0 is for test A, 1 for B, ...
189  *
190  * Thanks to R. Gancarz for this fine table *g*
191  */
192 const unsigned char hamm24par[3][256] =
193 {
194  {
195  /* Parities of first byte */
196  0, 33, 34, 3, 35, 2, 1, 32, 36, 5, 6, 39, 7, 38, 37, 4,
197  37, 4, 7, 38, 6, 39, 36, 5, 1, 32, 35, 2, 34, 3, 0, 33,
198  38, 7, 4, 37, 5, 36, 39, 6, 2, 35, 32, 1, 33, 0, 3, 34,
199  3, 34, 33, 0, 32, 1, 2, 35, 39, 6, 5, 36, 4, 37, 38, 7,
200  39, 6, 5, 36, 4, 37, 38, 7, 3, 34, 33, 0, 32, 1, 2, 35,
201  2, 35, 32, 1, 33, 0, 3, 34, 38, 7, 4, 37, 5, 36, 39, 6,
202  1, 32, 35, 2, 34, 3, 0, 33, 37, 4, 7, 38, 6, 39, 36, 5,
203  36, 5, 6, 39, 7, 38, 37, 4, 0, 33, 34, 3, 35, 2, 1, 32,
204  40, 9, 10, 43, 11, 42, 41, 8, 12, 45, 46, 15, 47, 14, 13, 44,
205  13, 44, 47, 14, 46, 15, 12, 45, 41, 8, 11, 42, 10, 43, 40, 9,
206  14, 47, 44, 13, 45, 12, 15, 46, 42, 11, 8, 41, 9, 40, 43, 10,
207  43, 10, 9, 40, 8, 41, 42, 11, 15, 46, 45, 12, 44, 13, 14, 47,
208  15, 46, 45, 12, 44, 13, 14, 47, 43, 10, 9, 40, 8, 41, 42, 11,
209  42, 11, 8, 41, 9, 40, 43, 10, 14, 47, 44, 13, 45, 12, 15, 46,
210  41, 8, 11, 42, 10, 43, 40, 9, 13, 44, 47, 14, 46, 15, 12, 45,
211  12, 45, 46, 15, 47, 14, 13, 44, 40, 9, 10, 43, 11, 42, 41, 8
212  }, {
213  /* Parities of second byte */
214  0, 41, 42, 3, 43, 2, 1, 40, 44, 5, 6, 47, 7, 46, 45, 4,
215  45, 4, 7, 46, 6, 47, 44, 5, 1, 40, 43, 2, 42, 3, 0, 41,
216  46, 7, 4, 45, 5, 44, 47, 6, 2, 43, 40, 1, 41, 0, 3, 42,
217  3, 42, 41, 0, 40, 1, 2, 43, 47, 6, 5, 44, 4, 45, 46, 7,
218  47, 6, 5, 44, 4, 45, 46, 7, 3, 42, 41, 0, 40, 1, 2, 43,
219  2, 43, 40, 1, 41, 0, 3, 42, 46, 7, 4, 45, 5, 44, 47, 6,
220  1, 40, 43, 2, 42, 3, 0, 41, 45, 4, 7, 46, 6, 47, 44, 5,
221  44, 5, 6, 47, 7, 46, 45, 4, 0, 41, 42, 3, 43, 2, 1, 40,
222  48, 25, 26, 51, 27, 50, 49, 24, 28, 53, 54, 31, 55, 30, 29, 52,
223  29, 52, 55, 30, 54, 31, 28, 53, 49, 24, 27, 50, 26, 51, 48, 25,
224  30, 55, 52, 29, 53, 28, 31, 54, 50, 27, 24, 49, 25, 48, 51, 26,
225  51, 26, 25, 48, 24, 49, 50, 27, 31, 54, 53, 28, 52, 29, 30, 55,
226  31, 54, 53, 28, 52, 29, 30, 55, 51, 26, 25, 48, 24, 49, 50, 27,
227  50, 27, 24, 49, 25, 48, 51, 26, 30, 55, 52, 29, 53, 28, 31, 54,
228  49, 24, 27, 50, 26, 51, 48, 25, 29, 52, 55, 30, 54, 31, 28, 53,
229  28, 53, 54, 31, 55, 30, 29, 52, 48, 25, 26, 51, 27, 50, 49, 24
230  }, {
231  /* Parities of third byte */
232  63, 14, 13, 60, 12, 61, 62, 15, 11, 58, 57, 8, 56, 9, 10, 59,
233  10, 59, 56, 9, 57, 8, 11, 58, 62, 15, 12, 61, 13, 60, 63, 14,
234  9, 56, 59, 10, 58, 11, 8, 57, 61, 12, 15, 62, 14, 63, 60, 13,
235  60, 13, 14, 63, 15, 62, 61, 12, 8, 57, 58, 11, 59, 10, 9, 56,
236  8, 57, 58, 11, 59, 10, 9, 56, 60, 13, 14, 63, 15, 62, 61, 12,
237  61, 12, 15, 62, 14, 63, 60, 13, 9, 56, 59, 10, 58, 11, 8, 57,
238  62, 15, 12, 61, 13, 60, 63, 14, 10, 59, 56, 9, 57, 8, 11, 58,
239  11, 58, 57, 8, 56, 9, 10, 59, 63, 14, 13, 60, 12, 61, 62, 15,
240  31, 46, 45, 28, 44, 29, 30, 47, 43, 26, 25, 40, 24, 41, 42, 27,
241  42, 27, 24, 41, 25, 40, 43, 26, 30, 47, 44, 29, 45, 28, 31, 46,
242  41, 24, 27, 42, 26, 43, 40, 25, 29, 44, 47, 30, 46, 31, 28, 45,
243  28, 45, 46, 31, 47, 30, 29, 44, 40, 25, 26, 43, 27, 42, 41, 24,
244  40, 25, 26, 43, 27, 42, 41, 24, 28, 45, 46, 31, 47, 30, 29, 44,
245  29, 44, 47, 30, 46, 31, 28, 45, 41, 24, 27, 42, 26, 43, 40, 25,
246  30, 47, 44, 29, 45, 28, 31, 46, 42, 27, 24, 41, 25, 40, 43, 26,
247  43, 26, 25, 40, 24, 41, 42, 27, 31, 46, 45, 28, 44, 29, 30, 47
248  }
249 };
250 
251 /*
252  * [AleVT]
253  *
254  * Table to extract the lower 4 bit from hamm24/18 encoded bytes
255  */
256 const unsigned char hamm24val[256] =
257 {
258  0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
259  2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
260  4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5,
261  6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7,
262  8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9, 9,
263  10, 10, 10, 10, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11, 11, 11,
264  12, 12, 12, 12, 13, 13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13,
265  14, 14, 14, 14, 15, 15, 15, 15, 14, 14, 14, 14, 15, 15, 15, 15,
266  0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
267  2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
268  4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5,
269  6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7,
270  8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9, 9,
271  10, 10, 10, 10, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11, 11, 11,
272  12, 12, 12, 12, 13, 13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13,
273  14, 14, 14, 14, 15, 15, 15, 15, 14, 14, 14, 14, 15, 15, 15, 15
274 };
275 
276 const signed char hamm24err[64] =
277 {
278  0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
279  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
280  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
281  0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1,
282 };
283 
284 /*
285  * [AleVT]
286  *
287  * Mapping from parity checks made by table hamm24par to faulty bit
288  * in the decoded 18 bit word.
289  */
290 const unsigned int hamm24cor[64] =
291 {
292  0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
293  0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
294  0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
295  0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
296  0x00000, 0x00000, 0x00000, 0x00001, 0x00000, 0x00002, 0x00004, 0x00008,
297  0x00000, 0x00010, 0x00020, 0x00040, 0x00080, 0x00100, 0x00200, 0x00400,
298  0x00000, 0x00800, 0x01000, 0x02000, 0x04000, 0x08000, 0x10000, 0x20000,
299  0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
300 };
301 
302 inline int IsDec(int i)
303 {
304  return ((i & 0x00F) <= 9) && ((i & 0x0F0) <= 0x90);
305 }
306 
307 /* struct for page attributes */
308 typedef struct
309 {
310  unsigned char fg :6; /* foreground color */
311  unsigned char bg :6; /* background color */
312  unsigned char charset :6; /* see enum above */
313  unsigned char doubleh :1; /* double height */
314  unsigned char doublew :1; /* double width */
315  /* ignore at Black Background Color Substitution */
316  /* black background set by New Background ($1d) instead of start-of-row default or Black Backgr. ($1c) */
317  /* or black background set by level 2.5 extensions */
318  unsigned char IgnoreAtBlackBgSubst:1;
319  unsigned char concealed:1; /* concealed information */
320  unsigned char inverted :1; /* colors inverted */
321  unsigned char flashing :5; /* flash mode */
322  unsigned char diacrit :4; /* diacritical mark */
323  unsigned char underline:1; /* Text underlined */
324  unsigned char boxwin :1; /* Text boxed/windowed */
325  unsigned char setX26 :1; /* Char is set by packet X/26 (no national subset used) */
326  unsigned char setG0G2 :7; /* G0+G2 set designation */
328 
329 /* struct for (G)POP/(G)DRCS links for level 2.5, allocated at reception of p27/4 or /5, initialized with 0 after allocation */
330 typedef struct
331 {
332  unsigned short page; /* linked page number */
333  unsigned short subpage; /* 1 bit for each needed (1) subpage */
334  unsigned char l25:1; /* 1: page required at level 2.5 */
335  unsigned char l35:1; /* 1: page required at level 3.5 */
336  unsigned char drcs:1; /* 1: link to (G)DRCS, 0: (G)POP */
337  unsigned char local:1; /* 1: global (G*), 0: local */
338 } Textp27_t;
339 
340 /* struct for extension data for level 2.5, allocated at reception, initialized with 0 after allocation */
341 typedef struct
342 {
343  unsigned char *p26[16]; /* array of pointers to max. 16 designation codes of packet 26 */
344  Textp27_t *p27; /* array of 4 structs for (G)POP/(G)DRCS links for level 2.5 */
345  unsigned short bgr[16]; /* CLUT 2+3, 2*8 colors, 0x0bgr */
346  unsigned char DefaultCharset:7; /* default G0/G2 charset + national option */
347  unsigned char LSP:1; /* 1: left side panel to be displayed */
348  unsigned char SecondCharset:7; /* second G0 charset */
349  unsigned char RSP:1; /* 1: right side panel to be displayed */
350  unsigned char DefScreenColor:5; /* default screen color (above and below lines 0..24) */
351  unsigned char ColorTableRemapping:3; /* 1: index in table of CLUTs to use */
352  unsigned char DefRowColor:5; /* default row color (left and right to lines 0..24) */
353  unsigned char BlackBgSubst:1; /* 1: substitute black background (as result of start-of-line or 1c, not 00/10+1d) */
354  unsigned char SPL25:1; /* 1: side panel required at level 2.5 */
355  unsigned char p28Received:1; /* 1: extension data valid (p28/0 received) */
356  unsigned char LSPColumns:4; /* number of columns in left side panel, 0->16, rsp=16-lsp */
357 } TextExtData_t;
358 
359 /* struct for pageinfo, max. 16 Bytes, at beginning of each cached page buffer, initialized with 0 after allocation */
360 typedef struct
361 {
362  unsigned char *p24; /* pointer to lines 25+26 (packets 24+25) (2*40 bytes) for FLOF or level 2.5 data */
363  TextExtData_t *ext; /* pointer to array[16] of data for level 2.5 */
364  unsigned char boxed :1; /* p0: boxed (newsflash or subtitle) */
365  unsigned char nationalvalid :1; /* p0: national option character subset is valid (no biterror detected) */
366  unsigned char national :3; /* p0: national option character subset */
367  unsigned char function :3; /* p28/0: page function */
369 
370 /* one cached page: struct for pageinfo, 24 lines page data */
371 typedef struct
372 {
373  TextPageinfo_t pageinfo;
374  unsigned char p0[24]; /* packet 0: center of headline */
375  unsigned char data[23*40]; /* packet 1-23 */
377 
378 typedef struct
379 {
380  short page;
381  short language;
383 
384 typedef struct
385 {
386  bool Valid;
387  std::chrono::time_point<std::chrono::steady_clock> Timestamp;
388  unsigned char PageChar[TELETEXT_PAGE_SIZE];
389  TextPageAttr_t PageAtrb[TELETEXT_PAGE_SIZE];
391 
392 /* main data structure */
393 typedef struct TextCacheStruct_t
394 {
395  int CurrentPage[9];
396  int CurrentSubPage[9];
397  TextExtData_t *astP29[9];
398  TextCachedPage_t *astCachetable[0x900][0x80];
399  unsigned char SubPageTable[0x900];
400  unsigned char BasicTop[0x900];
401  short FlofPages[0x900][FLOFSIZE];
402  char ADIPTable[0x900][13];
403  int ADIP_PgMax;
404  int ADIP_Pg[10];
405  bool BTTok;
406  int CachedPages;
407  int PageReceiving;
408  int Page;
409  int SubPage;
410  bool PageUpdate;
411  int NationalSubset;
412  int NationalSubsetSecondary;
413  bool ZapSubpageManual;
414  TextSubtitle_t SubtitlePages[8];
415  unsigned char TimeString[8];
416  int vtxtpid;
417 
418  /* cachetable for packets 29 (one for each magazine) */
419  /* cachetable */
420  unsigned char FullRowColor[25];
421  unsigned char FullScrColor;
422  unsigned char tAPx, tAPy; /* temporary offset to Active Position for objects */
423  short pop, gpop, drcs, gdrcs;
424  unsigned short *ColorTable;
425 
426  std::string line30;
427 
428  // TODO: We should get rid of this public mutex. Here are the details: https://github.com/xbmc/xbmc/pull/22226
429  CCriticalSection m_critSection;
431 
432 /* struct for all Information needed for Page Rendering */
433 typedef struct
434 {
435  bool PageCatching;
436  bool TranspMode;
437  bool HintMode;
438  bool ShowFlof;
439  bool Show39;
440  bool Showl25;
441  bool ShowHex;
442  int ZoomMode;
443 
444  int InputCounter;
445  int ClearBBColor;
446  int Prev_100, Prev_10, Next_10, Next_100;
447  int Height;
448  int Width;
449  int FontHeight;
450  int FontWidth;
451  int FontWidth_Normal;
452  unsigned short rd0[TXT_Color_SIZECOLTABLE];
453  unsigned short gn0[TXT_Color_SIZECOLTABLE];
454  unsigned short bl0[TXT_Color_SIZECOLTABLE];
455  unsigned short tr0[TXT_Color_SIZECOLTABLE];
456  TextSubtitleCache_t *SubtitleCache[SUBTITLE_CACHESIZE];
457  unsigned char PageChar[25*40];
458  TextPageAttr_t PageAtrb[25*40];
459  TextPageinfo_t *PageInfo;
460  int PosX;
461  int PosY;
462  int nofirst;
463  unsigned char axdrcs[12+1+10+1];
464  int TTFShiftX, TTFShiftY; /* parameters for adapting to various TTF fonts */
465  bool Boxed;
466  int ScreenMode, PrevScreenMode;
467  bool DelayStarted;
468  unsigned int SubtitleDelay;
470 
472 {
473 public:
474  static void NextDec(int *i);
475  static void PrevDec(int *i);
476  static void Hex2Str(char *s, unsigned int n);
477  static signed int deh24(unsigned char *p);
478 };
Definition: TeletextDefines.h:360
Definition: TeletextDefines.h:330
Definition: TeletextDefines.h:341
Definition: TeletextDefines.h:471
Definition: TeletextDefines.h:393
Definition: TeletextDefines.h:308
Definition: TeletextDefines.h:371
Definition: TeletextDefines.h:433
Definition: TeletextDefines.h:378
Definition: TeletextDefines.h:384