kodi
cc_decoder708.h
1 #pragma once
2 
3 #include <sys/stat.h>
4 
5 extern "C"{
6 #include "cc_decoder.h"
7 }
8 
9 #define MAX_708_PACKET_LENGTH 128
10 #define CCX_DECODERS_708_MAX_SERVICES 8
11 #define I708_MAX_ROWS 15
12 #define I708_MAX_COLUMNS 42
13 #define I708_SCREENGRID_ROWS 75
14 #define I708_SCREENGRID_COLUMNS 210
15 #define I708_MAX_WINDOWS 8
16 
17 enum COMMANDS_C0_CODES
18 {
19  NUL=0,
20  ETX=3,
21  BS=8,
22  FF=0xC,
23  CR=0xD,
24  HCR=0xE,
25  EXT1=0x10,
26  P16=0x18
27 };
28 
29 enum COMMANDS_C1_CODES
30 {
31  CW0=0x80,
32  CW1=0x81,
33  CW2=0x82,
34  CW3=0x83,
35  CW4=0x84,
36  CW5=0x85,
37  CW6=0x86,
38  CW7=0x87,
39  CLW=0x88,
40  DSW=0x89,
41  HDW=0x8A,
42  TGW=0x8B,
43  DLW=0x8C,
44  DLY=0x8D,
45  DLC=0x8E,
46  RST=0x8F,
47  SPA=0x90,
48  SPC=0x91,
49  SPL=0x92,
50  RSV93=0x93,
51  RSV94=0x94,
52  RSV95=0x95,
53  RSV96=0x96,
54  SWA=0x97,
55  DF0=0x98,
56  DF1=0x99,
57  DF2=0x9A,
58  DF3=0x9B,
59  DF4=0x9C,
60  DF5=0x9D,
61  DF6=0x9E,
62  DF7=0x9F
63 };
64 
66 {
67  int code;
68  const char *name;
69  const char *description;
70  int length;
71 };
72 
73 
74 enum eWindowsAttribJustify
75 {
76  left=0,
77  right=1,
78  center=2,
79  full=3
80 };
81 
82 enum eWindowsAttribPrintDirection
83 {
84  pd_left_to_right=0,
85  pd_right_to_left=1,
86  pd_top_to_bottom=2,
87  pd_bottom_to_top=3
88 };
89 
90 enum eWindowsAttribScrollDirection
91 {
92  sd_left_to_right=0,
93  sd_right_to_left=1,
94  sd_top_to_bottom=2,
95  sd_bottom_to_top=3
96 };
97 
98 enum eWindowsAttribScrollDisplayEffect
99 {
100  snap=0,
101  fade=1,
102  wipe=2
103 };
104 
105 enum eWindowsAttribEffectDirection
106 {
107  left_to_right=0,
108  right_to_left=1,
109  top_to_bottom=2,
110  bottom_to_top=3
111 };
112 
113 enum eWindowsAttribFillOpacity
114 {
115  solid=0,
116  flash=1,
117  translucent=2,
118  transparent=3
119 };
120 
121 enum eWindowsAttribBorderType
122 {
123  none=0,
124  raised=1,
125  depressed=2,
126  uniform=3,
127  shadow_left=4,
128  shadow_right=5
129 };
130 
131 enum ePenAttribSize
132 {
133  pensize_small=0,
134  pensize_standard=1,
135  pensize_large=2
136 };
137 
138 enum ePenAttribFontStyle
139 {
140  fontstyle_default_or_undefined=0,
141  monospaced_with_serifs=1,
142  proportionally_spaced_with_serifs=2,
143  monospaced_without_serifs=3,
144  proportionally_spaced_without_serifs=4,
145  casual_font_type=5,
146  cursive_font_type=6,
147  small_capitals=7
148 };
149 
150 enum ePanAttribTextTag
151 {
152  texttag_dialog=0,
153  texttag_source_or_speaker_id=1,
154  texttag_electronic_voice=2,
155  texttag_foreign_language=3,
156  texttag_voiceover=4,
157  texttag_audible_translation=5,
158  texttag_subtitle_translation=6,
159  texttag_voice_quality_description=7,
160  texttag_song_lyrics=8,
161  texttag_sound_effect_description=9,
162  texttag_musical_score_description=10,
163  texttag_expletive=11,
164  texttag_undefined_12=12,
165  texttag_undefined_13=13,
166  texttag_undefined_14=14,
167  texttag_not_to_be_displayed=15
168 };
169 
170 enum ePanAttribOffset
171 {
172  offset_subscript=0,
173  offset_normal=1,
174  offset_superscript=2
175 };
176 
177 enum ePanAttribEdgeType
178 {
179  edgetype_none=0,
180  edgetype_raised=1,
181  edgetype_depressed=2,
182  edgetype_uniform=3,
183  edgetype_left_drop_shadow=4,
184  edgetype_right_drop_shadow=5
185 };
186 
187 enum eAnchorPoints
188 {
189  anchorpoint_top_left = 0,
190  anchorpoint_top_center = 1,
191  anchorpoint_top_right =2,
192  anchorpoint_middle_left = 3,
193  anchorpoint_middle_center = 4,
194  anchorpoint_middle_right = 5,
195  anchorpoint_bottom_left = 6,
196  anchorpoint_bottom_center = 7,
197  anchorpoint_bottom_right = 8
198 };
199 
200 typedef struct e708Pen_color
201 {
202  int fg_color;
203  int fg_opacity;
204  int bg_color;
205  int bg_opacity;
206  int edge_color;
207 } e708Pen_color;
208 
209 typedef struct e708Pen_attribs
210 {
211  int pen_size;
212  int offset;
213  int text_tag;
214  int font_tag;
215  int edge_type;
216  int underline;
217  int italic;
219 
220 typedef struct e708Window_attribs
221 {
222  int fill_color;
223  int fill_opacity;
224  int border_color;
225  int border_type01;
226  int justify;
227  int scroll_dir;
228  int print_dir;
229  int word_wrap;
230  int border_type;
231  int display_eff;
232  int effect_dir;
233  int effect_speed;
235 
236 typedef struct e708Window
237 {
238  int is_defined;
239  int number; // Handy, in case we only have a pointer to the window
240  int priority;
241  int col_lock;
242  int row_lock;
243  int visible;
244  int anchor_vertical;
245  int relative_pos;
246  int anchor_horizontal;
247  int row_count;
248  int anchor_point;
249  int col_count;
250  int pen_style;
251  int win_style;
252  unsigned char commands[6]; // Commands used to create this window
253  e708Window_attribs attribs;
254  e708Pen_attribs pen;
255  e708Pen_color pen_color;
256  int pen_row;
257  int pen_column;
258  unsigned char *rows[I708_MAX_ROWS+1]; // Max is 15, but we define an extra one for convenience
259  int memory_reserved;
260  int is_empty;
261 } e708Window;
262 
263 typedef struct tvscreen
264 {
265  unsigned char chars[I708_SCREENGRID_ROWS][I708_SCREENGRID_COLUMNS+1];
266 }
267 tvscreen;
268 
269 class CDecoderCC708;
270 typedef struct cc708_service_decoder
271 {
272  e708Window windows[I708_MAX_WINDOWS];
273  int current_window;
274  int inited;
275  int service;
276  tvscreen tv;
277  int is_empty_tv;
278  int srt_counter;
279  void *userdata;
280  void (*callback)(int service, void *userdata);
281  char text[I708_SCREENGRID_ROWS*I708_SCREENGRID_COLUMNS+1];
282  int textlen;
283  CDecoderCC708 *parent;
284 }
286 
287 void process_character (cc708_service_decoder *decoder, unsigned char internal_char);
288 
290 {
291 public:
292  CDecoderCC708();
293  virtual ~CDecoderCC708();
294  void Init(void (*handler)(int service, void *userdata), void *userdata);
295  void Decode(const unsigned char *data, int datalength);
296  bool m_inited;
297  cc708_service_decoder* m_cc708decoders;
298  cc_decoder_t *m_cc608decoder;
299  unsigned char m_current_packet[MAX_708_PACKET_LENGTH]; // Length according to EIA-708B, part 5
300  int m_current_packet_length;
301  int m_last_seq;
302  bool m_seen708;
303  bool m_seen608;
304 };
Definition: cc_decoder708.h:209
Definition: cc_decoder708.h:65
Definition: cc_decoder708.h:220
Definition: cc_decoder708.h:263
Definition: cc_decoder708.h:236
Definition: inftrees.h:24
Definition: cc_decoder708.h:200
Definition: cc_decoder708.h:289
Definition: cc_decoder.h:91
Definition: cc_decoder708.h:270