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