blob: 2e251bf800486a131aae590309047fbb4ce6ffa9
1 | /* |
2 | * libzvbi -- VBI decoding library |
3 | * |
4 | * Copyright (C) 2000, 2001, 2002 Michael H. Schimek |
5 | * Copyright (C) 2000, 2001 Iñaki García Etxebarria |
6 | * |
7 | * Originally based on AleVT 1.5.1 by Edgar Toernig |
8 | * |
9 | * This library is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU Library General Public |
11 | * License as published by the Free Software Foundation; either |
12 | * version 2 of the License, or (at your option) any later version. |
13 | * |
14 | * This library is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | * Library General Public License for more details. |
18 | * |
19 | * You should have received a copy of the GNU Library General Public |
20 | * License along with this library; if not, write to the |
21 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 | * Boston, MA 02110-1301 USA. |
23 | */ |
24 | |
25 | /* Generated file, do not edit! */ |
26 | |
27 | #ifndef __LIBZVBI_H__ |
28 | #define __LIBZVBI_H__ |
29 | |
30 | #define VBI_VERSION_MAJOR 0 |
31 | #define VBI_VERSION_MINOR 2 |
32 | #define VBI_VERSION_MICRO 33 |
33 | |
34 | #ifdef __cplusplus |
35 | extern "C" { |
36 | #endif |
37 | |
38 | |
39 | typedef struct vbi_decoder vbi_decoder; |
40 | |
41 | /* macros.h */ |
42 | |
43 | #if __GNUC__ >= 4 |
44 | # define _vbi_sentinel __attribute__ ((__sentinel__(0))) |
45 | # define _vbi_deprecated __attribute__ ((__deprecated__)) |
46 | #else |
47 | # define _vbi_sentinel |
48 | # define _vbi_deprecated |
49 | # define __restrict__ |
50 | #endif |
51 | |
52 | #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ >= 4 |
53 | # define _vbi_nonnull(params) __attribute__ ((__nonnull__ params)) |
54 | # define _vbi_format(params) __attribute__ ((__format__ params)) |
55 | #else |
56 | # define _vbi_nonnull(params) |
57 | # define _vbi_format(params) |
58 | #endif |
59 | |
60 | #if __GNUC__ >= 3 |
61 | # define _vbi_pure __attribute__ ((__pure__)) |
62 | # define _vbi_alloc __attribute__ ((__malloc__)) |
63 | #else |
64 | # define _vbi_pure |
65 | # define _vbi_alloc |
66 | #endif |
67 | |
68 | #if __GNUC__ >= 2 |
69 | # define _vbi_unused __attribute__ ((__unused__)) |
70 | # define _vbi_const __attribute__ ((__const__)) |
71 | # define _vbi_inline static __inline__ |
72 | #else |
73 | # define _vbi_unused |
74 | # define _vbi_const |
75 | # define _vbi_inline static |
76 | #endif |
77 | |
78 | #ifndef TRUE |
79 | # define TRUE 1 |
80 | #endif |
81 | #ifndef FALSE |
82 | # define FALSE 0 |
83 | #endif |
84 | |
85 | typedef int vbi_bool; |
86 | |
87 | |
88 | #ifndef NULL |
89 | # ifdef __cplusplus |
90 | # define NULL (0L) |
91 | # else |
92 | # define NULL ((void *) 0) |
93 | # endif |
94 | #endif |
95 | |
96 | /* XXX Document me - for variadic funcs. */ |
97 | #define VBI_END ((void *) 0) |
98 | |
99 | #if 0 |
100 | typedef void |
101 | vbi_lock_fn (void * user_data); |
102 | typedef void |
103 | vbi_unlock_fn (void * user_data); |
104 | #endif |
105 | |
106 | typedef enum { |
107 | |
108 | VBI_LOG_ERROR = 1 << 3, |
109 | |
110 | VBI_LOG_WARNING = 1 << 4, |
111 | |
112 | VBI_LOG_NOTICE = 1 << 5, |
113 | |
114 | |
115 | VBI_LOG_INFO = 1 << 6, |
116 | |
117 | |
118 | VBI_LOG_DEBUG = 1 << 7, |
119 | |
120 | |
121 | VBI_LOG_DRIVER = 1 << 8, |
122 | |
123 | |
124 | VBI_LOG_DEBUG2 = 1 << 9, |
125 | VBI_LOG_DEBUG3 = 1 << 10 |
126 | } vbi_log_mask; |
127 | |
128 | typedef void |
129 | vbi_log_fn (vbi_log_mask level, |
130 | const char * context, |
131 | const char * message, |
132 | void * user_data); |
133 | |
134 | extern vbi_log_fn vbi_log_on_stderr; |
135 | |
136 | |
137 | /* bcd.h */ |
138 | |
139 | /* XXX unsigned? */ |
140 | typedef int vbi_pgno; |
141 | |
142 | typedef int vbi_subno; |
143 | |
144 | #define VBI_ANY_SUBNO 0x3F7F |
145 | #define VBI_NO_SUBNO 0x3F7F |
146 | |
147 | _vbi_inline unsigned int |
148 | vbi_dec2bcd(unsigned int dec) |
149 | { |
150 | return (dec % 10) + ((dec / 10) % 10) * 16 + ((dec / 100) % 10) * 256; |
151 | } |
152 | |
153 | #define vbi_bin2bcd(n) vbi_dec2bcd(n) |
154 | |
155 | _vbi_inline unsigned int |
156 | vbi_bcd2dec(unsigned int bcd) |
157 | { |
158 | return (bcd & 15) + ((bcd >> 4) & 15) * 10 + ((bcd >> 8) & 15) * 100; |
159 | } |
160 | |
161 | #define vbi_bcd2bin(n) vbi_bcd2dec(n) |
162 | |
163 | _vbi_inline unsigned int |
164 | vbi_add_bcd(unsigned int a, unsigned int b) |
165 | { |
166 | unsigned int t; |
167 | |
168 | a += 0x06666666; |
169 | t = a + b; |
170 | b ^= a ^ t; |
171 | b = (~b & 0x11111110) >> 3; |
172 | b |= b * 2; |
173 | |
174 | return t - b; |
175 | } |
176 | |
177 | _vbi_inline vbi_bool |
178 | vbi_is_bcd(unsigned int bcd) |
179 | { |
180 | static const unsigned int x = 0x06666666; |
181 | |
182 | return (((bcd + x) ^ (bcd ^ x)) & 0x11111110) == 0; |
183 | } |
184 | |
185 | _vbi_inline vbi_bool |
186 | vbi_bcd_digits_greater (unsigned int bcd, |
187 | unsigned int maximum) |
188 | { |
189 | maximum ^= ~0; |
190 | |
191 | return 0 != (((bcd + maximum) ^ bcd ^ maximum) & 0x11111110); |
192 | } |
193 | |
194 | /* conv.h */ |
195 | |
196 | #include <stdio.h> |
197 | #include <inttypes.h> /* uint16_t */ |
198 | |
199 | |
200 | #define VBI_NUL_TERMINATED -1 |
201 | |
202 | extern unsigned long |
203 | vbi_strlen_ucs2 (const uint16_t * src); |
204 | extern char * |
205 | vbi_strndup_iconv (const char * dst_codeset, |
206 | const char * src_codeset, |
207 | const char * src, |
208 | unsigned long src_size, |
209 | int repl_char) |
210 | _vbi_alloc; |
211 | extern char * |
212 | vbi_strndup_iconv_ucs2 (const char * dst_codeset, |
213 | const uint16_t * src, |
214 | long src_length, |
215 | int repl_char) |
216 | _vbi_alloc; |
217 | extern char * |
218 | vbi_strndup_iconv_caption (const char * dst_codeset, |
219 | const char * src, |
220 | long src_length, |
221 | int repl_char) |
222 | _vbi_alloc; |
223 | #if 3 == VBI_VERSION_MINOR |
224 | extern char * |
225 | vbi_strndup_iconv_teletext (const char * dst_codeset, |
226 | const vbi_ttx_charset *cs, |
227 | const uint8_t * src, |
228 | long src_length, |
229 | int repl_char) |
230 | _vbi_alloc _vbi_nonnull ((2)); |
231 | #endif |
232 | extern vbi_bool |
233 | vbi_fputs_iconv (FILE * fp, |
234 | const char * dst_codeset, |
235 | const char * src_codeset, |
236 | const char * src, |
237 | unsigned long src_size, |
238 | int repl_char) |
239 | _vbi_nonnull ((1)); |
240 | extern vbi_bool |
241 | vbi_fputs_iconv_ucs2 (FILE * fp, |
242 | const char * dst_codeset, |
243 | const uint16_t * src, |
244 | long src_length, |
245 | int repl_char) |
246 | _vbi_nonnull ((1)); |
247 | extern const char * |
248 | vbi_locale_codeset (void); |
249 | |
250 | |
251 | |
252 | /* event.h */ |
253 | |
254 | #include <inttypes.h> |
255 | |
256 | |
257 | typedef unsigned int vbi_nuid; |
258 | |
259 | typedef struct { |
260 | vbi_nuid nuid; |
261 | |
262 | signed char name[64]; |
263 | |
264 | signed char call[40]; |
265 | |
266 | int tape_delay; |
267 | |
268 | int cni_vps; |
269 | |
270 | int cni_8301; |
271 | |
272 | int cni_8302; |
273 | |
274 | int reserved; |
275 | |
276 | |
277 | int cycle; |
278 | int ts_id; |
279 | } vbi_network; |
280 | |
281 | /* |
282 | * Link |
283 | */ |
284 | |
285 | typedef enum { |
286 | VBI_LINK_NONE = 0, |
287 | VBI_LINK_MESSAGE, |
288 | VBI_LINK_PAGE, |
289 | VBI_LINK_SUBPAGE, |
290 | VBI_LINK_HTTP, |
291 | VBI_LINK_FTP, |
292 | VBI_LINK_EMAIL, |
293 | |
294 | VBI_LINK_LID, |
295 | |
296 | VBI_LINK_TELEWEB |
297 | } vbi_link_type; |
298 | |
299 | typedef enum { |
300 | VBI_WEBLINK_UNKNOWN = 0, |
301 | VBI_WEBLINK_PROGRAM_RELATED, |
302 | VBI_WEBLINK_NETWORK_RELATED, |
303 | VBI_WEBLINK_STATION_RELATED, |
304 | VBI_WEBLINK_SPONSOR_MESSAGE, |
305 | VBI_WEBLINK_OPERATOR |
306 | } vbi_itv_type; |
307 | |
308 | typedef struct vbi_link { |
309 | vbi_link_type type; |
310 | vbi_bool eacem; |
311 | signed char name[80]; |
312 | signed char url[256]; |
313 | signed char script[256]; |
314 | vbi_nuid nuid; |
315 | vbi_pgno pgno; |
316 | vbi_subno subno; |
317 | double expires; |
318 | vbi_itv_type itv_type; |
319 | int priority; |
320 | vbi_bool autoload; |
321 | } vbi_link; |
322 | |
323 | /* |
324 | * Aspect ratio information. |
325 | */ |
326 | |
327 | typedef enum { |
328 | VBI_SUBT_NONE, |
329 | VBI_SUBT_ACTIVE, |
330 | VBI_SUBT_MATTE, |
331 | VBI_SUBT_UNKNOWN |
332 | } vbi_subt; |
333 | |
334 | typedef struct { |
335 | int first_line; |
336 | int last_line; |
337 | double ratio; |
338 | vbi_bool film_mode; |
339 | vbi_subt open_subtitles; |
340 | } vbi_aspect_ratio; |
341 | |
342 | /* |
343 | * Program Info |
344 | * |
345 | * ATTN this is new stuff and subject to change |
346 | */ |
347 | |
348 | typedef enum { |
349 | VBI_RATING_AUTH_NONE = 0, |
350 | VBI_RATING_AUTH_MPAA, |
351 | VBI_RATING_AUTH_TV_US, |
352 | VBI_RATING_AUTH_TV_CA_EN, |
353 | VBI_RATING_AUTH_TV_CA_FR |
354 | } vbi_rating_auth; |
355 | |
356 | #define VBI_RATING_D 0x08 |
357 | #define VBI_RATING_L 0x04 |
358 | #define VBI_RATING_S 0x02 |
359 | #define VBI_RATING_V 0x01 |
360 | |
361 | |
362 | extern const char * vbi_rating_string(vbi_rating_auth auth, int id); |
363 | |
364 | typedef enum { |
365 | VBI_PROG_CLASSF_NONE = 0, |
366 | VBI_PROG_CLASSF_EIA_608, |
367 | VBI_PROG_CLASSF_ETS_300231 |
368 | } vbi_prog_classf; |
369 | |
370 | extern const char * vbi_prog_type_string(vbi_prog_classf classf, int id); |
371 | |
372 | |
373 | /* code depends on order, don't change */ |
374 | typedef enum { |
375 | VBI_AUDIO_MODE_NONE = 0, |
376 | VBI_AUDIO_MODE_MONO, |
377 | VBI_AUDIO_MODE_STEREO, |
378 | VBI_AUDIO_MODE_STEREO_SURROUND, |
379 | VBI_AUDIO_MODE_SIMULATED_STEREO, |
380 | VBI_AUDIO_MODE_VIDEO_DESCRIPTIONS, |
381 | VBI_AUDIO_MODE_NON_PROGRAM_AUDIO, |
382 | |
383 | VBI_AUDIO_MODE_SPECIAL_EFFECTS, |
384 | VBI_AUDIO_MODE_DATA_SERVICE, |
385 | VBI_AUDIO_MODE_UNKNOWN |
386 | } vbi_audio_mode; |
387 | |
388 | typedef struct vbi_rating{ |
389 | /* |
390 | * For details STFW for "v-chip" |
391 | * If unknown rating_auth == VBI_RATING_NONE |
392 | */ |
393 | vbi_rating_auth auth; |
394 | int id; |
395 | /* Only valid when auth == VBI_RATING_TV_US */ |
396 | int dlsv; |
397 | }vbi_rating; |
398 | |
399 | |
400 | typedef struct vbi_program_info { |
401 | /* |
402 | * Refers to the current or next program. |
403 | * (No [2] to allow clients filtering current data more easily.) |
404 | */ |
405 | unsigned int future : 1; |
406 | |
407 | /* 01 Program Identification Number */ |
408 | |
409 | /* If unknown all these fields are -1 */ |
410 | signed char month; /* 0 ... 11 */ |
411 | signed char day; /* 0 ... 30 */ |
412 | signed char hour; /* 0 ... 23 */ |
413 | signed char min; /* 0 ... 59 */ |
414 | |
415 | /* |
416 | * VD: "T indicates if a program is routinely tape delayed for the |
417 | * Mountain and Pacific time zones." |
418 | */ |
419 | signed char tape_delayed; |
420 | |
421 | /* 02 Program Length */ |
422 | |
423 | /* If unknown all these fields are -1 */ |
424 | signed char length_hour; /* 0 ... 63 */ |
425 | signed char length_min; /* 0 ... 59 */ |
426 | |
427 | signed char elapsed_hour; /* 0 ... 63 */ |
428 | signed char elapsed_min; /* 0 ... 59 */ |
429 | signed char elapsed_sec; /* 0 ... 59 */ |
430 | |
431 | /* 03 Program name */ |
432 | |
433 | /* If unknown title[0] == 0 */ |
434 | signed char title[64]; /* ASCII + '\0' */ |
435 | |
436 | /* 04 Program type */ |
437 | |
438 | /* |
439 | * If unknown type_classf == VBI_PROG_CLASSF_NONE. |
440 | * VBI_PROG_CLASSF_EIA_608 can have up to 32 tags |
441 | * identifying 96 keywords. Their numerical value |
442 | * is given here instead of composing a string for |
443 | * easier filtering. Use vbi_prog_type_str_by_id to |
444 | * get the keywords. A zero marks the end. |
445 | */ |
446 | vbi_prog_classf type_classf; |
447 | int type_id[33]; |
448 | |
449 | /* 05 Program rating */ |
450 | |
451 | /* |
452 | * For details STFW for "v-chip" |
453 | * If unknown rating_auth == VBI_RATING_NONE |
454 | */ |
455 | vbi_rating rating; |
456 | |
457 | /* 06 Program Audio Services */ |
458 | |
459 | /* |
460 | * BTSC audio (two independent tracks) is flagged according to XDS, |
461 | * Zweiton/NICAM/EIA-J audio is flagged mono/none, stereo/none or |
462 | * mono/mono for bilingual transmissions. |
463 | */ |
464 | struct { |
465 | /* If unknown mode == VBI_AUDIO_MODE_UNKNOWN */ |
466 | vbi_audio_mode mode; |
467 | /* If unknown language == NULL */ |
468 | unsigned char * language; /* Latin-1 */ |
469 | } audio[2]; /* primary and secondary */ |
470 | |
471 | /* 07 Program Caption Services */ |
472 | |
473 | /* |
474 | * Bits 0...7 corresponding to Caption page 1...8. |
475 | * Note for the current program this information is also |
476 | * available via vbi_classify_page(). |
477 | * |
478 | * If unknown caption_services == -1, _language[] = NULL |
479 | */ |
480 | int caption_services; |
481 | unsigned char * caption_language[8]; /* Latin-1 */ |
482 | |
483 | /* 08 Copy Generation Management System */ |
484 | |
485 | /* If unknown cgms_a == -1 */ |
486 | int cgms_a; /* XXX */ |
487 | |
488 | /* 09 Aspect Ratio */ |
489 | |
490 | /* |
491 | * Note for the current program this information is also |
492 | * available via VBI_EVENT_ASPECT. |
493 | * |
494 | * If unknown first_line == last_line == -1, ratio == 0.0 |
495 | */ |
496 | vbi_aspect_ratio aspect; |
497 | |
498 | /* 10 - 17 Program Description */ |
499 | |
500 | /* |
501 | * 8 rows of 0...32 ASCII chars + '\0', |
502 | * if unknown description[0...7][0] == 0 |
503 | */ |
504 | signed char description[8][33]; |
505 | } vbi_program_info; |
506 | |
507 | extern void vbi_reset_prog_info(vbi_program_info *pi); |
508 | |
509 | |
510 | |
511 | #define VBI_EVENT_NONE 0x0000 |
512 | #define VBI_EVENT_CLOSE 0x0001 |
513 | #define VBI_EVENT_TTX_PAGE 0x0002 |
514 | #define VBI_EVENT_CAPTION 0x0004 |
515 | #define VBI_EVENT_NETWORK 0x0008 |
516 | #define VBI_EVENT_TRIGGER 0x0010 |
517 | #define VBI_EVENT_ASPECT 0x0040 |
518 | #define VBI_EVENT_PROG_INFO 0x0080 |
519 | #define VBI_EVENT_NETWORK_ID 0x0100 |
520 | #define VBI_EVENT_RATING 0x0200 |
521 | |
522 | |
523 | |
524 | #include <inttypes.h> |
525 | |
526 | /* XXX network, aspect, prog_info: should only notify about |
527 | * changes and provide functions to query current value. |
528 | */ |
529 | typedef struct vbi_event { |
530 | int type; |
531 | union { |
532 | struct { |
533 | int pgno; |
534 | int subno; |
535 | uint8_t * raw_header; |
536 | int pn_offset; |
537 | unsigned int roll_header : 1; |
538 | unsigned int header_update : 1; |
539 | unsigned int clock_update : 1; |
540 | } ttx_page; |
541 | struct { |
542 | int pgno; |
543 | } caption; |
544 | vbi_network network; |
545 | vbi_link * trigger; |
546 | vbi_aspect_ratio aspect; |
547 | vbi_program_info * prog_info; |
548 | } ev; |
549 | } vbi_event; |
550 | |
551 | typedef void (* vbi_event_handler)(vbi_event *event, void *user_data); |
552 | |
553 | extern vbi_bool vbi_event_handler_add(vbi_decoder *vbi, int event_mask, |
554 | vbi_event_handler handler, |
555 | void *user_data); |
556 | extern void vbi_event_handler_remove(vbi_decoder *vbi, |
557 | vbi_event_handler handler); |
558 | extern vbi_bool vbi_event_handler_register(vbi_decoder *vbi, int event_mask, |
559 | vbi_event_handler handler, |
560 | void *user_data); |
561 | extern void vbi_event_handler_unregister(vbi_decoder *vbi, |
562 | vbi_event_handler handler, |
563 | void *user_data); |
564 | |
565 | |
566 | /* format.h */ |
567 | |
568 | #include <inttypes.h> |
569 | |
570 | |
571 | /* Code depends on order, don't change. */ |
572 | typedef enum { |
573 | VBI_BLACK, |
574 | VBI_RED, |
575 | VBI_GREEN, |
576 | VBI_YELLOW, |
577 | VBI_BLUE, |
578 | VBI_MAGENTA, |
579 | VBI_CYAN, |
580 | VBI_WHITE |
581 | } vbi_color; |
582 | |
583 | typedef uint32_t vbi_rgba; |
584 | |
585 | #define VBI_RGBA(r, g, b) \ |
586 | ((((r) & 0xFF) << 0) | (((g) & 0xFF) << 8) \ |
587 | | (((b) & 0xFF) << 16) | (0xFF << 24)) |
588 | #define VBI_R(rgba) (((rgba) >> 0) & 0xFF) |
589 | #define VBI_G(rgba) (((rgba) >> 8) & 0xFF) |
590 | #define VBI_B(rgba) (((rgba) >> 16) & 0xFF) |
591 | #define VBI_A(rgba) (((rgba) >> 24) & 0xFF) |
592 | |
593 | |
594 | typedef enum { |
595 | VBI_TRANSPARENT_SPACE, |
596 | VBI_TRANSPARENT_FULL, |
597 | VBI_SEMI_TRANSPARENT, |
598 | VBI_OPAQUE |
599 | } vbi_opacity; |
600 | |
601 | /* Code depends on order, don't change. */ |
602 | typedef enum { |
603 | VBI_NORMAL_SIZE, VBI_DOUBLE_WIDTH, VBI_DOUBLE_HEIGHT, VBI_DOUBLE_SIZE, |
604 | VBI_OVER_TOP, VBI_OVER_BOTTOM, VBI_DOUBLE_HEIGHT2, VBI_DOUBLE_SIZE2 |
605 | } vbi_size; |
606 | |
607 | typedef struct vbi_char { |
608 | unsigned underline : 1; |
609 | unsigned bold : 1; |
610 | unsigned italic : 1; |
611 | unsigned flash : 1; |
612 | unsigned conceal : 1; |
613 | unsigned proportional : 1; |
614 | unsigned link : 1; |
615 | unsigned reserved : 1; |
616 | unsigned size : 8; |
617 | unsigned opacity : 8; |
618 | unsigned foreground : 8; |
619 | unsigned background : 8; |
620 | unsigned drcs_clut_offs : 8; |
621 | unsigned unicode : 16; |
622 | } vbi_char; |
623 | |
624 | struct vbi_font_descr; |
625 | |
626 | typedef struct vbi_page { |
627 | vbi_decoder * vbi; |
628 | |
629 | vbi_nuid nuid; |
630 | /* FIXME this shouldn't be int */ |
631 | int pgno; |
632 | /* FIXME this shouldn't be int */ |
633 | int subno; |
634 | int rows; |
635 | int columns; |
636 | vbi_char text[1056]; |
637 | |
638 | struct { |
639 | /* int x0, x1; */ |
640 | int y0, y1; |
641 | int roll; |
642 | } dirty; |
643 | |
644 | vbi_color screen_color; |
645 | vbi_opacity screen_opacity; |
646 | vbi_rgba color_map[40]; |
647 | |
648 | uint8_t * drcs_clut; /* 64 entries */ |
649 | uint8_t * drcs[32]; |
650 | |
651 | struct { |
652 | int pgno, subno; |
653 | } nav_link[6]; |
654 | char nav_index[64]; |
655 | |
656 | struct vbi_font_descr * font[2]; |
657 | unsigned int double_height_lower; /* legacy */ |
658 | |
659 | vbi_opacity page_opacity[2]; |
660 | vbi_opacity boxed_opacity[2]; |
661 | } vbi_page; |
662 | |
663 | /* lang.h */ |
664 | |
665 | typedef struct vbi_font_descr vbi_font_descr; |
666 | |
667 | _vbi_inline vbi_bool |
668 | vbi_is_print(unsigned int unicode) |
669 | { |
670 | return unicode < 0xE600; |
671 | } |
672 | |
673 | _vbi_inline vbi_bool |
674 | vbi_is_gfx(unsigned int unicode) |
675 | { |
676 | return unicode >= 0xEE00 && unicode <= 0xEFFF; |
677 | } |
678 | |
679 | _vbi_inline vbi_bool |
680 | vbi_is_drcs(unsigned int unicode) |
681 | { |
682 | return unicode >= 0xF000; |
683 | } |
684 | |
685 | extern unsigned int |
686 | vbi_caption_unicode (unsigned int c, |
687 | vbi_bool to_upper); |
688 | |
689 | /* export.h */ |
690 | |
691 | #include <stdio.h> /* FILE */ |
692 | #include <sys/types.h> /* size_t, ssize_t */ |
693 | |
694 | typedef struct vbi_export vbi_export; |
695 | |
696 | typedef struct vbi_export_info { |
697 | char * keyword; |
698 | char * label; |
699 | char * tooltip; |
700 | char * mime_type; |
701 | char * extension; |
702 | } vbi_export_info; |
703 | |
704 | typedef enum { |
705 | VBI_OPTION_BOOL = 1, |
706 | |
707 | VBI_OPTION_INT, |
708 | |
709 | VBI_OPTION_REAL, |
710 | |
711 | VBI_OPTION_STRING, |
712 | |
713 | VBI_OPTION_MENU |
714 | } vbi_option_type; |
715 | |
716 | typedef union { |
717 | int num; |
718 | double dbl; |
719 | char * str; |
720 | } vbi_option_value; |
721 | |
722 | typedef union { |
723 | int * num; |
724 | double * dbl; |
725 | char ** str; |
726 | } vbi_option_value_ptr; |
727 | |
728 | typedef struct { |
729 | vbi_option_type type; |
730 | |
731 | char * keyword; |
732 | |
733 | char * label; |
734 | |
735 | vbi_option_value def; |
736 | vbi_option_value min; |
737 | vbi_option_value max; |
738 | vbi_option_value step; |
739 | vbi_option_value_ptr menu; |
740 | |
741 | char * tooltip; |
742 | } vbi_option_info; |
743 | |
744 | extern vbi_export_info * vbi_export_info_enum(int index); |
745 | extern vbi_export_info * vbi_export_info_keyword(const char *keyword); |
746 | extern vbi_export_info * vbi_export_info_export(vbi_export *); |
747 | |
748 | extern vbi_export * vbi_export_new(const char *keyword, char **errstr); |
749 | extern void vbi_export_delete(vbi_export *); |
750 | |
751 | extern vbi_option_info * vbi_export_option_info_enum(vbi_export *, int index); |
752 | extern vbi_option_info * vbi_export_option_info_keyword(vbi_export *, const char *keyword); |
753 | |
754 | extern vbi_bool vbi_export_option_set(vbi_export *, const char *keyword, ...); |
755 | extern vbi_bool vbi_export_option_get(vbi_export *, const char *keyword, |
756 | vbi_option_value *value); |
757 | extern vbi_bool vbi_export_option_menu_set(vbi_export *, const char *keyword, int entry); |
758 | extern vbi_bool vbi_export_option_menu_get(vbi_export *, const char *keyword, int *entry); |
759 | |
760 | extern ssize_t |
761 | vbi_export_mem (vbi_export * e, |
762 | void * buffer, |
763 | size_t buffer_size, |
764 | const vbi_page * pg) |
765 | _vbi_nonnull ((1)); /* sic */ |
766 | extern void * |
767 | vbi_export_alloc (vbi_export * e, |
768 | void ** buffer, |
769 | size_t * buffer_size, |
770 | const vbi_page * pg) |
771 | _vbi_nonnull ((1)); /* sic */ |
772 | extern vbi_bool vbi_export_stdio(vbi_export *, FILE *fp, vbi_page *pg); |
773 | extern vbi_bool vbi_export_file(vbi_export *, const char *name, vbi_page *pg); |
774 | |
775 | extern char * vbi_export_errstr(vbi_export *); |
776 | |
777 | |
778 | /* cache.h */ |
779 | |
780 | extern void vbi_unref_page(vbi_page *pg); |
781 | extern int vbi_is_cached(vbi_decoder *, int pgno, int subno); |
782 | extern int vbi_cache_hi_subno(vbi_decoder *vbi, int pgno); |
783 | |
784 | |
785 | /* search.h */ |
786 | |
787 | typedef enum { |
788 | VBI_SEARCH_ERROR = -3, |
789 | VBI_SEARCH_CACHE_EMPTY, |
790 | VBI_SEARCH_CANCELED, |
791 | VBI_SEARCH_NOT_FOUND = 0, |
792 | VBI_SEARCH_SUCCESS |
793 | } vbi_search_status; |
794 | |
795 | typedef struct vbi_search vbi_search; |
796 | |
797 | extern vbi_search * vbi_search_new(vbi_decoder *vbi, |
798 | vbi_pgno pgno, vbi_subno subno, |
799 | uint16_t *pattern, |
800 | vbi_bool casefold, vbi_bool regexp, |
801 | int (* progress)(vbi_page *pg)); |
802 | extern void vbi_search_delete(vbi_search *search); |
803 | extern vbi_search_status vbi_search_next(vbi_search *search, vbi_page **pg, int dir); |
804 | |
805 | |
806 | /* sliced.h */ |
807 | |
808 | #include <inttypes.h> |
809 | |
810 | |
811 | |
812 | #define VBI_SLICED_NONE 0 |
813 | |
814 | #define VBI_SLICED_UNKNOWN 0 |
815 | |
816 | #define VBI_SLICED_ANTIOPE 0x00002000 |
817 | #define VBI_SLICED_TELETEXT_A 0x00002000 |
818 | |
819 | #define VBI_SLICED_TELETEXT_B_L10_625 0x00000001 |
820 | #define VBI_SLICED_TELETEXT_B_L25_625 0x00000002 |
821 | #define VBI_SLICED_TELETEXT_B (VBI_SLICED_TELETEXT_B_L10_625 | \ |
822 | VBI_SLICED_TELETEXT_B_L25_625) |
823 | #define VBI_SLICED_TELETEXT_B_625 VBI_SLICED_TELETEXT_B |
824 | |
825 | #define VBI_SLICED_TELETEXT_C_625 0x00004000 |
826 | |
827 | #define VBI_SLICED_TELETEXT_D_625 0x00008000 |
828 | |
829 | #define VBI_SLICED_VPS 0x00000004 |
830 | |
831 | #define VBI_SLICED_VPS_F2 0x00001000 |
832 | |
833 | #define VBI_SLICED_CAPTION_625_F1 0x00000008 |
834 | #define VBI_SLICED_CAPTION_625_F2 0x00000010 |
835 | #define VBI_SLICED_CAPTION_625 (VBI_SLICED_CAPTION_625_F1 | \ |
836 | VBI_SLICED_CAPTION_625_F2) |
837 | |
838 | #define VBI_SLICED_WSS_625 0x00000400 |
839 | |
840 | #define VBI_SLICED_CAPTION_525_F1 0x00000020 |
841 | #define VBI_SLICED_CAPTION_525_F2 0x00000040 |
842 | #define VBI_SLICED_CAPTION_525 (VBI_SLICED_CAPTION_525_F1 | \ |
843 | VBI_SLICED_CAPTION_525_F2) |
844 | #define VBI_SLICED_2xCAPTION_525 0x00000080 |
845 | |
846 | #define VBI_SLICED_TELETEXT_B_525 0x00010000 |
847 | |
848 | #define VBI_SLICED_NABTS 0x00000100 |
849 | |
850 | #define VBI_SLICED_TELETEXT_C_525 0x00000100 |
851 | |
852 | #define VBI_SLICED_TELETEXT_BD_525 0x00000200 |
853 | |
854 | #define VBI_SLICED_TELETEXT_D_525 0x00020000 |
855 | |
856 | |
857 | #define VBI_SLICED_WSS_CPR1204 0x00000800 |
858 | |
859 | #define VBI_SLICED_VBI_625 0x20000000 |
860 | |
861 | #define VBI_SLICED_VBI_525 0x40000000 |
862 | |
863 | |
864 | |
865 | typedef unsigned int vbi_service_set; |
866 | |
867 | typedef struct { |
868 | uint32_t id; |
869 | uint32_t line; |
870 | uint8_t data[56]; |
871 | } vbi_sliced; |
872 | |
873 | extern const char * |
874 | vbi_sliced_name (vbi_service_set service) |
875 | _vbi_const; |
876 | extern unsigned int |
877 | vbi_sliced_payload_bits (vbi_service_set service) |
878 | _vbi_const; |
879 | |
880 | |
881 | /* decoder.h */ |
882 | |
883 | #include <pthread.h> |
884 | |
885 | /* Bit slicer */ |
886 | |
887 | /* Attn: keep this in sync with rte, don't change order */ |
888 | typedef enum { |
889 | VBI_PIXFMT_YUV420 = 1, |
890 | VBI_PIXFMT_YUYV, |
891 | VBI_PIXFMT_YVYU, |
892 | VBI_PIXFMT_UYVY, |
893 | VBI_PIXFMT_VYUY, |
894 | VBI_PIXFMT_PAL8, |
895 | VBI_PIXFMT_RGBA32_LE = 32, |
896 | VBI_PIXFMT_RGBA32_BE, |
897 | VBI_PIXFMT_BGRA32_LE, |
898 | VBI_PIXFMT_BGRA32_BE, |
899 | VBI_PIXFMT_ABGR32_BE = 32, /* synonyms */ |
900 | VBI_PIXFMT_ABGR32_LE, |
901 | VBI_PIXFMT_ARGB32_BE, |
902 | VBI_PIXFMT_ARGB32_LE, |
903 | VBI_PIXFMT_RGB24, |
904 | VBI_PIXFMT_BGR24, |
905 | VBI_PIXFMT_RGB16_LE, |
906 | VBI_PIXFMT_RGB16_BE, |
907 | VBI_PIXFMT_BGR16_LE, |
908 | VBI_PIXFMT_BGR16_BE, |
909 | VBI_PIXFMT_RGBA15_LE, |
910 | VBI_PIXFMT_RGBA15_BE, |
911 | VBI_PIXFMT_BGRA15_LE, |
912 | VBI_PIXFMT_BGRA15_BE, |
913 | VBI_PIXFMT_ARGB15_LE, |
914 | VBI_PIXFMT_ARGB15_BE, |
915 | VBI_PIXFMT_ABGR15_LE, |
916 | VBI_PIXFMT_ABGR15_BE |
917 | } vbi_pixfmt; |
918 | |
919 | |
920 | typedef enum { |
921 | VBI_MODULATION_NRZ_LSB, |
922 | VBI_MODULATION_NRZ_MSB, |
923 | VBI_MODULATION_BIPHASE_LSB, |
924 | VBI_MODULATION_BIPHASE_MSB |
925 | } vbi_modulation; |
926 | |
927 | typedef struct vbi_bit_slicer { |
928 | vbi_bool (* func)(struct vbi_bit_slicer *slicer, |
929 | uint8_t *raw, uint8_t *buf); |
930 | unsigned int cri; |
931 | unsigned int cri_mask; |
932 | int thresh; |
933 | int cri_bytes; |
934 | int cri_rate; |
935 | int oversampling_rate; |
936 | int phase_shift; |
937 | int step; |
938 | unsigned int frc; |
939 | int frc_bits; |
940 | int payload; |
941 | int endian; |
942 | int skip; |
943 | } vbi_bit_slicer; |
944 | |
945 | extern void vbi_bit_slicer_init(vbi_bit_slicer *slicer, |
946 | int raw_samples, int sampling_rate, |
947 | int cri_rate, int bit_rate, |
948 | unsigned int cri_frc, unsigned int cri_mask, |
949 | int cri_bits, int frc_bits, int payload, |
950 | vbi_modulation modulation, vbi_pixfmt fmt); |
951 | _vbi_inline vbi_bool |
952 | vbi_bit_slice(vbi_bit_slicer *slicer, uint8_t *raw, uint8_t *buf) |
953 | { |
954 | return slicer->func(slicer, raw, buf); |
955 | } |
956 | |
957 | |
958 | typedef struct vbi_raw_decoder { |
959 | /* Sampling parameters */ |
960 | |
961 | int scanning; |
962 | vbi_pixfmt sampling_format; |
963 | int sampling_rate; /* Hz */ |
964 | int bytes_per_line; |
965 | int offset; /* 0H, samples */ |
966 | int start[2]; /* ITU-R numbering */ |
967 | int count[2]; /* field lines */ |
968 | vbi_bool interlaced; |
969 | vbi_bool synchronous; |
970 | |
971 | /*< private >*/ |
972 | |
973 | pthread_mutex_t mutex; |
974 | |
975 | unsigned int services; |
976 | int num_jobs; |
977 | |
978 | int8_t * pattern; |
979 | struct _vbi_raw_decoder_job { |
980 | unsigned int id; |
981 | int offset; |
982 | vbi_bit_slicer slicer; |
983 | } jobs[8]; |
984 | } vbi_raw_decoder; |
985 | |
986 | extern void vbi_raw_decoder_init(vbi_raw_decoder *rd); |
987 | extern void vbi_raw_decoder_reset(vbi_raw_decoder *rd); |
988 | extern void vbi_raw_decoder_destroy(vbi_raw_decoder *rd); |
989 | extern unsigned int vbi_raw_decoder_add_services(vbi_raw_decoder *rd, |
990 | unsigned int services, |
991 | int strict); |
992 | extern unsigned int vbi_raw_decoder_check_services(vbi_raw_decoder *rd, |
993 | unsigned int services, int strict); |
994 | extern unsigned int vbi_raw_decoder_remove_services(vbi_raw_decoder *rd, |
995 | unsigned int services); |
996 | extern void vbi_raw_decoder_resize( vbi_raw_decoder *rd, |
997 | int * start, unsigned int * count ); |
998 | extern unsigned int vbi_raw_decoder_parameters(vbi_raw_decoder *rd, unsigned int services, |
999 | int scanning, int *max_rate); |
1000 | extern int vbi_raw_decode(vbi_raw_decoder *rd, uint8_t *raw, vbi_sliced *out); |
1001 | |
1002 | |
1003 | /* sampling_par.h */ |
1004 | |
1005 | typedef vbi_raw_decoder vbi_sampling_par; |
1006 | |
1007 | #define VBI_VIDEOSTD_SET_EMPTY 0 |
1008 | #define VBI_VIDEOSTD_SET_PAL_BG 1 |
1009 | #define VBI_VIDEOSTD_SET_625_50 1 |
1010 | #define VBI_VIDEOSTD_SET_525_60 2 |
1011 | #define VBI_VIDEOSTD_SET_ALL 3 |
1012 | typedef uint64_t vbi_videostd_set; |
1013 | |
1014 | /* dvb_demux.h */ |
1015 | |
1016 | |
1017 | typedef struct _vbi_dvb_demux vbi_dvb_demux; |
1018 | |
1019 | typedef vbi_bool |
1020 | vbi_dvb_demux_cb (vbi_dvb_demux * dx, |
1021 | void * user_data, |
1022 | const vbi_sliced * sliced, |
1023 | unsigned int sliced_lines, |
1024 | int64_t pts); |
1025 | |
1026 | extern void |
1027 | vbi_dvb_demux_reset (vbi_dvb_demux * dx); |
1028 | extern unsigned int |
1029 | vbi_dvb_demux_cor (vbi_dvb_demux * dx, |
1030 | vbi_sliced * sliced, |
1031 | unsigned int sliced_lines, |
1032 | int64_t * pts, |
1033 | const uint8_t ** buffer, |
1034 | unsigned int * buffer_left); |
1035 | extern vbi_bool |
1036 | vbi_dvb_demux_feed (vbi_dvb_demux * dx, |
1037 | const uint8_t * buffer, |
1038 | unsigned int buffer_size); |
1039 | extern void |
1040 | vbi_dvb_demux_set_log_fn (vbi_dvb_demux * dx, |
1041 | vbi_log_mask mask, |
1042 | vbi_log_fn * log_fn, |
1043 | void * user_data); |
1044 | extern void |
1045 | vbi_dvb_demux_delete (vbi_dvb_demux * dx); |
1046 | extern vbi_dvb_demux * |
1047 | vbi_dvb_pes_demux_new (vbi_dvb_demux_cb * callback, |
1048 | void * user_data); |
1049 | |
1050 | |
1051 | |
1052 | /* dvb_mux.h */ |
1053 | |
1054 | |
1055 | extern vbi_bool |
1056 | vbi_dvb_multiplex_sliced (uint8_t ** packet, |
1057 | unsigned int * packet_left, |
1058 | const vbi_sliced ** sliced, |
1059 | unsigned int * sliced_left, |
1060 | vbi_service_set service_mask, |
1061 | unsigned int data_identifier, |
1062 | vbi_bool stuffing) |
1063 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1064 | _vbi_nonnull ((1, 2, 3, 4)) |
1065 | #endif |
1066 | ; |
1067 | extern vbi_bool |
1068 | vbi_dvb_multiplex_raw (uint8_t ** packet, |
1069 | unsigned int * packet_left, |
1070 | const uint8_t ** raw, |
1071 | unsigned int * raw_left, |
1072 | unsigned int data_identifier, |
1073 | vbi_videostd_set videostd_set, |
1074 | unsigned int line, |
1075 | unsigned int first_pixel_position, |
1076 | unsigned int n_pixels_total, |
1077 | vbi_bool stuffing) |
1078 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1079 | _vbi_nonnull ((1, 2, 3, 4)) |
1080 | #endif |
1081 | ; |
1082 | |
1083 | typedef struct _vbi_dvb_mux vbi_dvb_mux; |
1084 | |
1085 | typedef vbi_bool |
1086 | vbi_dvb_mux_cb (vbi_dvb_mux * mx, |
1087 | void * user_data, |
1088 | const uint8_t * packet, |
1089 | unsigned int packet_size); |
1090 | |
1091 | extern void |
1092 | vbi_dvb_mux_reset (vbi_dvb_mux * mx) |
1093 | _vbi_nonnull ((1)); |
1094 | extern vbi_bool |
1095 | vbi_dvb_mux_cor (vbi_dvb_mux * mx, |
1096 | uint8_t ** buffer, |
1097 | unsigned int * buffer_left, |
1098 | const vbi_sliced ** sliced, |
1099 | unsigned int * sliced_lines, |
1100 | vbi_service_set service_mask, |
1101 | const uint8_t * raw, |
1102 | const vbi_sampling_par *sampling_par, |
1103 | int64_t pts) |
1104 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1105 | _vbi_nonnull ((1, 2, 3, 4, 5)) |
1106 | #endif |
1107 | ; |
1108 | extern vbi_bool |
1109 | vbi_dvb_mux_feed (vbi_dvb_mux * mx, |
1110 | const vbi_sliced * sliced, |
1111 | unsigned int sliced_lines, |
1112 | vbi_service_set service_mask, |
1113 | const uint8_t * raw, |
1114 | const vbi_sampling_par *sampling_par, |
1115 | int64_t pts) |
1116 | _vbi_nonnull ((1)); |
1117 | extern unsigned int |
1118 | vbi_dvb_mux_get_data_identifier (const vbi_dvb_mux * mx) |
1119 | _vbi_nonnull ((1)); |
1120 | extern vbi_bool |
1121 | vbi_dvb_mux_set_data_identifier (vbi_dvb_mux * mx, |
1122 | unsigned int data_identifier) |
1123 | _vbi_nonnull ((1)); |
1124 | extern unsigned int |
1125 | vbi_dvb_mux_get_min_pes_packet_size |
1126 | (vbi_dvb_mux * mx) |
1127 | _vbi_nonnull ((1)); |
1128 | extern unsigned int |
1129 | vbi_dvb_mux_get_max_pes_packet_size |
1130 | (vbi_dvb_mux * mx) |
1131 | _vbi_nonnull ((1)); |
1132 | extern vbi_bool |
1133 | vbi_dvb_mux_set_pes_packet_size (vbi_dvb_mux * mx, |
1134 | unsigned int min_size, |
1135 | unsigned int max_size) |
1136 | _vbi_nonnull ((1)); |
1137 | extern void |
1138 | vbi_dvb_mux_delete (vbi_dvb_mux * mx); |
1139 | extern vbi_dvb_mux * |
1140 | vbi_dvb_pes_mux_new (vbi_dvb_mux_cb * callback, |
1141 | void * user_data) |
1142 | _vbi_alloc; |
1143 | extern vbi_dvb_mux * |
1144 | vbi_dvb_ts_mux_new (unsigned int pid, |
1145 | vbi_dvb_mux_cb * callback, |
1146 | void * user_data) |
1147 | _vbi_alloc; |
1148 | |
1149 | |
1150 | |
1151 | /* idl_demux.h */ |
1152 | |
1153 | |
1154 | typedef struct _vbi_idl_demux vbi_idl_demux; |
1155 | |
1156 | |
1157 | |
1158 | #define VBI_IDL_DATA_LOST (1 << 0) |
1159 | |
1160 | #define VBI_IDL_DEPENDENT (1 << 3) |
1161 | |
1162 | |
1163 | |
1164 | |
1165 | typedef vbi_bool |
1166 | vbi_idl_demux_cb (vbi_idl_demux * dx, |
1167 | const uint8_t * buffer, |
1168 | unsigned int n_bytes, |
1169 | unsigned int flags, |
1170 | void * user_data); |
1171 | |
1172 | extern void |
1173 | vbi_idl_demux_reset (vbi_idl_demux * dx) |
1174 | _vbi_nonnull ((1)); |
1175 | extern vbi_bool |
1176 | vbi_idl_demux_feed (vbi_idl_demux * dx, |
1177 | const uint8_t buffer[42]) |
1178 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1179 | _vbi_nonnull ((1, 2)) |
1180 | #endif |
1181 | ; |
1182 | extern vbi_bool |
1183 | vbi_idl_demux_feed_frame (vbi_idl_demux * dx, |
1184 | const vbi_sliced * sliced, |
1185 | unsigned int n_lines) |
1186 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1187 | _vbi_nonnull ((1, 2)) |
1188 | #endif |
1189 | ; |
1190 | extern void |
1191 | vbi_idl_demux_delete (vbi_idl_demux * dx); |
1192 | extern vbi_idl_demux * |
1193 | vbi_idl_a_demux_new (unsigned int channel, |
1194 | unsigned int address, |
1195 | vbi_idl_demux_cb * callback, |
1196 | void * user_data) |
1197 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1198 | _vbi_alloc _vbi_nonnull ((3)) |
1199 | #endif |
1200 | ; |
1201 | |
1202 | |
1203 | |
1204 | /* pfc_demux.h */ |
1205 | |
1206 | |
1207 | typedef struct { |
1208 | |
1209 | vbi_pgno pgno; |
1210 | |
1211 | |
1212 | unsigned int stream; |
1213 | |
1214 | |
1215 | unsigned int application_id; |
1216 | |
1217 | |
1218 | unsigned int block_size; |
1219 | |
1220 | |
1221 | uint8_t block[2048]; |
1222 | } vbi_pfc_block; |
1223 | |
1224 | typedef struct _vbi_pfc_demux vbi_pfc_demux; |
1225 | |
1226 | typedef vbi_bool |
1227 | vbi_pfc_demux_cb (vbi_pfc_demux * dx, |
1228 | void * user_data, |
1229 | const vbi_pfc_block * block); |
1230 | |
1231 | extern void |
1232 | vbi_pfc_demux_reset (vbi_pfc_demux * dx) |
1233 | _vbi_nonnull ((1)); |
1234 | extern vbi_bool |
1235 | vbi_pfc_demux_feed (vbi_pfc_demux * dx, |
1236 | const uint8_t buffer[42]) |
1237 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1238 | _vbi_nonnull ((1, 2)) |
1239 | #endif |
1240 | ; |
1241 | extern vbi_bool |
1242 | vbi_pfc_demux_feed_frame (vbi_pfc_demux * dx, |
1243 | const vbi_sliced * sliced, |
1244 | unsigned int n_lines) |
1245 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1246 | _vbi_nonnull ((1, 2)) |
1247 | #endif |
1248 | ; |
1249 | extern void |
1250 | vbi_pfc_demux_delete (vbi_pfc_demux * dx); |
1251 | extern vbi_pfc_demux * |
1252 | vbi_pfc_demux_new (vbi_pgno pgno, |
1253 | unsigned int stream, |
1254 | vbi_pfc_demux_cb * callback, |
1255 | void * user_data) |
1256 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1257 | _vbi_alloc _vbi_nonnull ((3)) |
1258 | #endif |
1259 | ; |
1260 | |
1261 | |
1262 | |
1263 | /* xds_demux.h */ |
1264 | |
1265 | |
1266 | typedef enum { |
1267 | VBI_XDS_CLASS_CURRENT = 0x00, |
1268 | VBI_XDS_CLASS_FUTURE, |
1269 | VBI_XDS_CLASS_CHANNEL, |
1270 | VBI_XDS_CLASS_MISC, |
1271 | VBI_XDS_CLASS_PUBLIC_SERVICE, |
1272 | VBI_XDS_CLASS_RESERVED, |
1273 | VBI_XDS_CLASS_UNDEFINED |
1274 | } vbi_xds_class; |
1275 | |
1276 | #define VBI_XDS_MAX_CLASSES (VBI_XDS_CLASS_UNDEFINED + 1) |
1277 | |
1278 | typedef enum { |
1279 | VBI_XDS_PROGRAM_ID = 0x01, |
1280 | VBI_XDS_PROGRAM_LENGTH, |
1281 | VBI_XDS_PROGRAM_NAME, |
1282 | VBI_XDS_PROGRAM_TYPE, |
1283 | VBI_XDS_PROGRAM_RATING, |
1284 | VBI_XDS_PROGRAM_AUDIO_SERVICES, |
1285 | VBI_XDS_PROGRAM_CAPTION_SERVICES, |
1286 | VBI_XDS_PROGRAM_CGMS, |
1287 | VBI_XDS_PROGRAM_ASPECT_RATIO, |
1288 | |
1289 | VBI_XDS_PROGRAM_DATA = 0x0C, |
1290 | |
1291 | VBI_XDS_PROGRAM_MISC_DATA, |
1292 | VBI_XDS_PROGRAM_DESCRIPTION_BEGIN = 0x10, |
1293 | VBI_XDS_PROGRAM_DESCRIPTION_END = 0x18 |
1294 | } vbi_xds_subclass_program; |
1295 | |
1296 | |
1297 | typedef enum { |
1298 | VBI_XDS_CHANNEL_NAME = 0x01, |
1299 | VBI_XDS_CHANNEL_CALL_LETTERS, |
1300 | VBI_XDS_CHANNEL_TAPE_DELAY, |
1301 | |
1302 | VBI_XDS_CHANNEL_TSID |
1303 | } vbi_xds_subclass_channel; |
1304 | |
1305 | |
1306 | typedef enum { |
1307 | VBI_XDS_TIME_OF_DAY = 0x01, |
1308 | VBI_XDS_IMPULSE_CAPTURE_ID, |
1309 | VBI_XDS_SUPPLEMENTAL_DATA_LOCATION, |
1310 | VBI_XDS_LOCAL_TIME_ZONE, |
1311 | |
1312 | VBI_XDS_OUT_OF_BAND_CHANNEL = 0x40, |
1313 | |
1314 | VBI_XDS_CHANNEL_MAP_POINTER, |
1315 | |
1316 | VBI_XDS_CHANNEL_MAP_HEADER, |
1317 | |
1318 | VBI_XDS_CHANNEL_MAP |
1319 | } vbi_xds_subclass_misc; |
1320 | |
1321 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1322 | |
1323 | /* Compatibility. */ |
1324 | #define VBI_XDS_MISC_TIME_OF_DAY VBI_XDS_TIME_OF_DAY |
1325 | #define VBI_XDS_MISC_IMPULSE_CAPTURE_ID VBI_XDS_IMPULSE_CAPTURE_ID |
1326 | #define VBI_XDS_MISC_SUPPLEMENTAL_DATA_LOCATION \ |
1327 | VBI_XDS_SUPPLEMENTAL_DATA_LOCATION |
1328 | #define VBI_XDS_MISC_LOCAL_TIME_ZONE VBI_XDS_LOCAL_TIME_ZONE |
1329 | |
1330 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
1331 | |
1332 | typedef enum { |
1333 | VBI_XDS_WEATHER_BULLETIN = 0x01, |
1334 | VBI_XDS_WEATHER_MESSAGE |
1335 | } vbi_xds_subclass_public_service; |
1336 | |
1337 | #define VBI_XDS_MAX_SUBCLASSES (0x18) |
1338 | |
1339 | typedef unsigned int vbi_xds_subclass; |
1340 | |
1341 | typedef struct { |
1342 | vbi_xds_class xds_class; |
1343 | vbi_xds_subclass xds_subclass; |
1344 | |
1345 | |
1346 | unsigned int buffer_size; |
1347 | |
1348 | uint8_t buffer[36]; |
1349 | } vbi_xds_packet; |
1350 | |
1351 | |
1352 | |
1353 | extern void |
1354 | _vbi_xds_packet_dump (const vbi_xds_packet * xp, |
1355 | FILE * fp); |
1356 | |
1357 | |
1358 | typedef struct _vbi_xds_demux vbi_xds_demux; |
1359 | |
1360 | typedef vbi_bool |
1361 | vbi_xds_demux_cb (vbi_xds_demux * xd, |
1362 | const vbi_xds_packet * xp, |
1363 | void * user_data); |
1364 | |
1365 | extern void |
1366 | vbi_xds_demux_reset (vbi_xds_demux * xd); |
1367 | extern vbi_bool |
1368 | vbi_xds_demux_feed (vbi_xds_demux * xd, |
1369 | const uint8_t buffer[2]); |
1370 | extern vbi_bool |
1371 | vbi_xds_demux_feed_frame (vbi_xds_demux * xd, |
1372 | const vbi_sliced * sliced, |
1373 | unsigned int n_lines); |
1374 | extern void |
1375 | vbi_xds_demux_delete (vbi_xds_demux * xd); |
1376 | extern vbi_xds_demux * |
1377 | vbi_xds_demux_new (vbi_xds_demux_cb * callback, |
1378 | void * user_data) |
1379 | _vbi_alloc; |
1380 | |
1381 | |
1382 | |
1383 | /* io.h */ |
1384 | |
1385 | #include <sys/time.h> /* struct timeval */ |
1386 | |
1387 | typedef struct vbi_capture_buffer { |
1388 | void * data; |
1389 | int size; |
1390 | double timestamp; |
1391 | } vbi_capture_buffer; |
1392 | |
1393 | typedef struct vbi_capture vbi_capture; |
1394 | |
1395 | typedef enum { |
1396 | VBI_FD_HAS_SELECT = 1<<0, |
1397 | VBI_FD_HAS_MMAP = 1<<1, |
1398 | VBI_FD_IS_DEVICE = 1<<2 |
1399 | } VBI_CAPTURE_FD_FLAGS; |
1400 | |
1401 | extern vbi_capture * vbi_capture_v4l2_new(const char *dev_name, int buffers, |
1402 | unsigned int *services, int strict, |
1403 | char **errorstr, vbi_bool trace); |
1404 | extern vbi_capture * vbi_capture_v4l2k_new(const char * dev_name, |
1405 | int fd, |
1406 | int buffers, |
1407 | unsigned int * services, |
1408 | int strict, |
1409 | char ** errorstr, |
1410 | vbi_bool trace); |
1411 | extern vbi_capture * vbi_capture_v4l_new(const char *dev_name, int scanning, |
1412 | unsigned int *services, int strict, |
1413 | char **errorstr, vbi_bool trace); |
1414 | extern vbi_capture * vbi_capture_v4l_sidecar_new(const char *dev_name, int given_fd, |
1415 | unsigned int *services, |
1416 | int strict, char **errorstr, |
1417 | vbi_bool trace); |
1418 | extern vbi_capture * vbi_capture_bktr_new (const char * dev_name, |
1419 | int scanning, |
1420 | unsigned int * services, |
1421 | int strict, |
1422 | char ** errstr, |
1423 | vbi_bool trace); |
1424 | extern int vbi_capture_dvb_filter(vbi_capture *cap, int pid); |
1425 | |
1426 | /* This function is deprecated. Use vbi_capture_dvb_new2() instead. |
1427 | See io-dvb.c or the Doxygen documentation for details. */ |
1428 | extern vbi_capture * |
1429 | vbi_capture_dvb_new (char * dev, |
1430 | int scanning, |
1431 | unsigned int * services, |
1432 | int strict, |
1433 | char ** errstr, |
1434 | vbi_bool trace) |
1435 | _vbi_deprecated; |
1436 | |
1437 | extern int64_t |
1438 | vbi_capture_dvb_last_pts (const vbi_capture * cap); |
1439 | extern vbi_capture * |
1440 | vbi_capture_dvb_new2 (const char * device_name, |
1441 | unsigned int pid, |
1442 | char ** errstr, |
1443 | vbi_bool trace); |
1444 | |
1445 | struct vbi_proxy_client; |
1446 | |
1447 | extern vbi_capture * |
1448 | vbi_capture_proxy_new( struct vbi_proxy_client * vpc, |
1449 | int buffers, int scanning, |
1450 | unsigned int *p_services, int strict, |
1451 | char **pp_errorstr ); |
1452 | |
1453 | extern int vbi_capture_read_raw(vbi_capture *capture, void *data, |
1454 | double *timestamp, struct timeval *timeout); |
1455 | extern int vbi_capture_read_sliced(vbi_capture *capture, vbi_sliced *data, int *lines, |
1456 | double *timestamp, struct timeval *timeout); |
1457 | extern int vbi_capture_read(vbi_capture *capture, void *raw_data, |
1458 | vbi_sliced *sliced_data, int *lines, |
1459 | double *timestamp, struct timeval *timeout); |
1460 | extern int vbi_capture_pull_raw(vbi_capture *capture, vbi_capture_buffer **buffer, |
1461 | struct timeval *timeout); |
1462 | extern int vbi_capture_pull_sliced(vbi_capture *capture, vbi_capture_buffer **buffer, |
1463 | struct timeval *timeout); |
1464 | extern int vbi_capture_pull(vbi_capture *capture, vbi_capture_buffer **raw_buffer, |
1465 | vbi_capture_buffer **sliced_buffer, struct timeval *timeout); |
1466 | extern vbi_raw_decoder *vbi_capture_parameters(vbi_capture *capture); |
1467 | extern int vbi_capture_fd(vbi_capture *capture); |
1468 | extern unsigned int vbi_capture_update_services(vbi_capture *capture, |
1469 | vbi_bool reset, vbi_bool commit, |
1470 | unsigned int services, int strict, |
1471 | char ** errorstr); |
1472 | extern int vbi_capture_get_scanning(vbi_capture *capture); |
1473 | extern void vbi_capture_flush(vbi_capture *capture); |
1474 | extern void vbi_capture_delete(vbi_capture *capture); |
1475 | |
1476 | extern vbi_bool vbi_capture_set_video_path(vbi_capture *capture, const char * p_dev_video); |
1477 | extern VBI_CAPTURE_FD_FLAGS vbi_capture_get_fd_flags(vbi_capture *capture); |
1478 | |
1479 | |
1480 | /* io-sim.h */ |
1481 | |
1482 | extern vbi_bool |
1483 | vbi_raw_video_image (uint8_t * raw, |
1484 | unsigned long raw_size, |
1485 | const vbi_sampling_par *sp, |
1486 | int blank_level, |
1487 | int black_level, |
1488 | int white_level, |
1489 | unsigned int pixel_mask, |
1490 | vbi_bool swap_fields, |
1491 | const vbi_sliced * sliced, |
1492 | unsigned int n_sliced_lines); |
1493 | extern vbi_bool |
1494 | vbi_raw_add_noise (uint8_t * raw, |
1495 | const vbi_sampling_par *sp, |
1496 | unsigned int min_freq, |
1497 | unsigned int max_freq, |
1498 | unsigned int amplitude, |
1499 | unsigned int seed); |
1500 | extern vbi_bool |
1501 | vbi_raw_vbi_image (uint8_t * raw, |
1502 | unsigned long raw_size, |
1503 | const vbi_sampling_par *sp, |
1504 | int blank_level, |
1505 | int white_level, |
1506 | vbi_bool swap_fields, |
1507 | const vbi_sliced * sliced, |
1508 | unsigned int n_sliced_lines); |
1509 | |
1510 | extern void |
1511 | vbi_capture_sim_add_noise (vbi_capture * cap, |
1512 | unsigned int min_freq, |
1513 | unsigned int max_freq, |
1514 | unsigned int amplitude); |
1515 | #if 3 == VBI_VERSION_MINOR |
1516 | extern vbi_bool |
1517 | vbi_capture_sim_load_vps (vbi_capture * cap, |
1518 | const vbi_program_id *pid); |
1519 | extern vbi_bool |
1520 | vbi_capture_sim_load_wss_625 (vbi_capture * cap, |
1521 | const vbi_aspect_ratio *ar); |
1522 | extern vbi_bool |
1523 | vbi_capture_sim_load_caption (vbi_capture * cap, |
1524 | const char * stream, |
1525 | vbi_bool append); |
1526 | #endif |
1527 | extern void |
1528 | vbi_capture_sim_decode_raw (vbi_capture * cap, |
1529 | vbi_bool enable); |
1530 | extern vbi_capture * |
1531 | vbi_capture_sim_new (int scanning, |
1532 | unsigned int * services, |
1533 | vbi_bool interlaced, |
1534 | vbi_bool synchronous); |
1535 | |
1536 | |
1537 | /* proxy-msg.h */ |
1538 | |
1539 | typedef enum |
1540 | { |
1541 | VBI_CHN_PRIO_BACKGROUND = 1, |
1542 | VBI_CHN_PRIO_INTERACTIVE = 2, |
1543 | VBI_CHN_PRIO_DEFAULT = VBI_CHN_PRIO_INTERACTIVE, |
1544 | VBI_CHN_PRIO_RECORD = 3 |
1545 | |
1546 | } VBI_CHN_PRIO; |
1547 | |
1548 | typedef enum |
1549 | { |
1550 | VBI_CHN_SUBPRIO_MINIMAL = 0x00, |
1551 | VBI_CHN_SUBPRIO_CHECK = 0x10, |
1552 | VBI_CHN_SUBPRIO_UPDATE = 0x20, |
1553 | VBI_CHN_SUBPRIO_INITIAL = 0x30, |
1554 | VBI_CHN_SUBPRIO_VPS_PDC = 0x40 |
1555 | |
1556 | } VBI_CHN_SUBPRIO; |
1557 | |
1558 | typedef struct |
1559 | { |
1560 | uint8_t is_valid; |
1561 | uint8_t sub_prio; |
1562 | uint8_t allow_suspend; |
1563 | |
1564 | uint8_t reserved0; |
1565 | time_t min_duration; |
1566 | time_t exp_duration; |
1567 | |
1568 | uint8_t reserved1[16]; |
1569 | } vbi_channel_profile; |
1570 | |
1571 | typedef enum |
1572 | { |
1573 | VBI_PROXY_DAEMON_NO_TIMEOUTS = 1<<0 |
1574 | |
1575 | } VBI_PROXY_DAEMON_FLAGS; |
1576 | |
1577 | typedef enum |
1578 | { |
1579 | VBI_PROXY_CLIENT_NO_TIMEOUTS = 1<<0, |
1580 | VBI_PROXY_CLIENT_NO_STATUS_IND = 1<<1 |
1581 | |
1582 | } VBI_PROXY_CLIENT_FLAGS; |
1583 | |
1584 | typedef enum |
1585 | { |
1586 | VBI_PROXY_CHN_RELEASE = 1<<0, |
1587 | VBI_PROXY_CHN_TOKEN = 1<<1, |
1588 | VBI_PROXY_CHN_FLUSH = 1<<2, |
1589 | VBI_PROXY_CHN_NORM = 1<<3, |
1590 | VBI_PROXY_CHN_FAIL = 1<<4, |
1591 | |
1592 | VBI_PROXY_CHN_NONE = 0 |
1593 | |
1594 | } VBI_PROXY_CHN_FLAGS; |
1595 | |
1596 | typedef enum |
1597 | { |
1598 | VBI_API_UNKNOWN, |
1599 | VBI_API_V4L1, |
1600 | VBI_API_V4L2, |
1601 | VBI_API_BKTR |
1602 | } VBI_DRIVER_API_REV; |
1603 | |
1604 | #define VBIPROXY_VERSION 0x00000100 |
1605 | #define VBIPROXY_COMPAT_VERSION 0x00000100 |
1606 | |
1607 | /* proxy-client.h */ |
1608 | |
1609 | #include <sys/time.h> /* struct timeval */ |
1610 | |
1611 | typedef struct vbi_proxy_client vbi_proxy_client; |
1612 | |
1613 | typedef enum |
1614 | { |
1615 | VBI_PROXY_EV_CHN_GRANTED = 1<<0, |
1616 | VBI_PROXY_EV_CHN_CHANGED = 1<<1, |
1617 | VBI_PROXY_EV_NORM_CHANGED = 1<<2, |
1618 | VBI_PROXY_EV_CHN_RECLAIMED = 1<<3, |
1619 | VBI_PROXY_EV_NONE = 0 |
1620 | } VBI_PROXY_EV_TYPE; |
1621 | |
1622 | typedef void VBI_PROXY_CLIENT_CALLBACK ( void * p_client_data, |
1623 | VBI_PROXY_EV_TYPE ev_mask ); |
1624 | |
1625 | /* forward declaration from io.h */ |
1626 | struct vbi_capture_buffer; |
1627 | |
1628 | extern vbi_proxy_client * |
1629 | vbi_proxy_client_create( const char *dev_name, |
1630 | const char *p_client_name, |
1631 | VBI_PROXY_CLIENT_FLAGS client_flags, |
1632 | char **pp_errorstr, |
1633 | int trace_level ); |
1634 | |
1635 | extern void |
1636 | vbi_proxy_client_destroy( vbi_proxy_client * vpc ); |
1637 | |
1638 | extern vbi_capture * |
1639 | vbi_proxy_client_get_capture_if( vbi_proxy_client * vpc ); |
1640 | |
1641 | extern VBI_PROXY_CLIENT_CALLBACK * |
1642 | vbi_proxy_client_set_callback( vbi_proxy_client * vpc, |
1643 | VBI_PROXY_CLIENT_CALLBACK * p_callback, |
1644 | void * p_data ); |
1645 | |
1646 | extern VBI_DRIVER_API_REV |
1647 | vbi_proxy_client_get_driver_api( vbi_proxy_client * vpc ); |
1648 | |
1649 | extern int |
1650 | vbi_proxy_client_channel_request( vbi_proxy_client * vpc, |
1651 | VBI_CHN_PRIO chn_prio, |
1652 | vbi_channel_profile * chn_profile ); |
1653 | |
1654 | extern int |
1655 | vbi_proxy_client_channel_notify( vbi_proxy_client * vpc, |
1656 | VBI_PROXY_CHN_FLAGS notify_flags, |
1657 | unsigned int scanning ); |
1658 | |
1659 | typedef enum |
1660 | { |
1661 | VBI_PROXY_SUSPEND_START, |
1662 | VBI_PROXY_SUSPEND_STOP |
1663 | } VBI_PROXY_SUSPEND; |
1664 | |
1665 | extern int |
1666 | vbi_proxy_client_channel_suspend( vbi_proxy_client * vpc, |
1667 | VBI_PROXY_SUSPEND cmd ); |
1668 | |
1669 | int |
1670 | vbi_proxy_client_device_ioctl( vbi_proxy_client * vpc, |
1671 | int request, |
1672 | void * p_arg ); |
1673 | |
1674 | extern int |
1675 | vbi_proxy_client_get_channel_desc( vbi_proxy_client * vpc, |
1676 | unsigned int * p_scanning, |
1677 | vbi_bool * p_granted ); |
1678 | |
1679 | extern vbi_bool |
1680 | vbi_proxy_client_has_channel_control( vbi_proxy_client * vpc ); |
1681 | |
1682 | |
1683 | |
1684 | /* exp-gfx.h */ |
1685 | |
1686 | extern void vbi_draw_vt_page_region(vbi_page *pg, vbi_pixfmt fmt, |
1687 | void *canvas, int rowstride, |
1688 | int column, int row, |
1689 | int width, int height, |
1690 | int reveal, int flash_on, int subtitle); |
1691 | _vbi_inline void |
1692 | vbi_draw_vt_page(vbi_page *pg, vbi_pixfmt fmt, void *canvas, |
1693 | int reveal, int flash_on, int subtitle) |
1694 | { |
1695 | vbi_draw_vt_page_region(pg, fmt, canvas, -1, 0, 0, |
1696 | pg->columns, pg->rows, reveal, flash_on, subtitle); |
1697 | } |
1698 | |
1699 | extern void vbi_draw_cc_page_region(vbi_page *pg, vbi_pixfmt fmt, |
1700 | void *canvas, int rowstride, |
1701 | int column, int row, |
1702 | int width, int height); |
1703 | |
1704 | _vbi_inline void |
1705 | vbi_draw_cc_page(vbi_page *pg, vbi_pixfmt fmt, void *canvas) |
1706 | { |
1707 | vbi_draw_cc_page_region(pg, fmt, canvas, -1, 0, 0, pg->columns, pg->rows); |
1708 | } |
1709 | |
1710 | extern void vbi_get_max_rendered_size(int *w, int *h); |
1711 | extern void vbi_get_vt_cell_size(int *w, int *h); |
1712 | |
1713 | |
1714 | /* exp-txt.h */ |
1715 | |
1716 | extern int vbi_print_page_region(vbi_page *pg, char *buf, int size, |
1717 | const char *format, vbi_bool table, vbi_bool ltr, |
1718 | int column, int row, int width, int height); |
1719 | |
1720 | _vbi_inline int |
1721 | vbi_print_page(vbi_page *pg, char *buf, int size, |
1722 | const char *format, vbi_bool table, vbi_bool ltr) |
1723 | { |
1724 | return vbi_print_page_region(pg, buf, size, |
1725 | format, table, ltr, |
1726 | 0, 0, pg->columns, pg->rows); |
1727 | } |
1728 | |
1729 | |
1730 | /* hamm.h */ |
1731 | |
1732 | extern const uint8_t _vbi_bit_reverse [256]; |
1733 | extern const uint8_t _vbi_hamm8_fwd [16]; |
1734 | extern const int8_t _vbi_hamm8_inv [256]; |
1735 | extern const int8_t _vbi_hamm24_inv_par [3][256]; |
1736 | |
1737 | |
1738 | _vbi_inline unsigned int |
1739 | vbi_rev8 (unsigned int c) |
1740 | { |
1741 | return _vbi_bit_reverse[(uint8_t) c]; |
1742 | } |
1743 | |
1744 | _vbi_inline unsigned int |
1745 | vbi_rev16 (unsigned int c) |
1746 | { |
1747 | return _vbi_bit_reverse[(uint8_t) c] * 256 |
1748 | + _vbi_bit_reverse[(uint8_t)(c >> 8)]; |
1749 | } |
1750 | |
1751 | _vbi_inline unsigned int |
1752 | vbi_rev16p (const uint8_t * p) |
1753 | { |
1754 | return _vbi_bit_reverse[p[0]] * 256 |
1755 | + _vbi_bit_reverse[p[1]]; |
1756 | } |
1757 | |
1758 | _vbi_inline unsigned int |
1759 | vbi_par8 (unsigned int c) |
1760 | { |
1761 | c &= 255; |
1762 | |
1763 | /* if 0 == (inv_par[] & 32) change bit 7 of c. */ |
1764 | c ^= 128 & ~(_vbi_hamm24_inv_par[0][c] << 2); |
1765 | |
1766 | return c; |
1767 | } |
1768 | |
1769 | _vbi_inline int |
1770 | vbi_unpar8 (unsigned int c) |
1771 | { |
1772 | /* Disabled until someone finds a reliable way |
1773 | to test for cmov support at compile time. */ |
1774 | #if 0 |
1775 | int r = c & 127; |
1776 | |
1777 | /* This saves cache flushes and an explicit branch. */ |
1778 | __asm__ (" testb %1,%1\n" |
1779 | " cmovp %2,%0\n" |
1780 | : "+&a" (r) : "c" (c), "rm" (-1)); |
1781 | return r; |
1782 | #endif |
1783 | if (_vbi_hamm24_inv_par[0][(uint8_t) c] & 32) { |
1784 | return c & 127; |
1785 | } else { |
1786 | /* The idea is to OR results together to find a parity |
1787 | error in a sequence, rather than a test and branch on |
1788 | each byte. */ |
1789 | return -1; |
1790 | } |
1791 | } |
1792 | |
1793 | extern void |
1794 | vbi_par (uint8_t * p, |
1795 | unsigned int n); |
1796 | extern int |
1797 | vbi_unpar (uint8_t * p, |
1798 | unsigned int n); |
1799 | |
1800 | _vbi_inline unsigned int |
1801 | vbi_ham8 (unsigned int c) |
1802 | { |
1803 | return _vbi_hamm8_fwd[c & 15]; |
1804 | } |
1805 | |
1806 | _vbi_inline int |
1807 | vbi_unham8 (unsigned int c) |
1808 | { |
1809 | return _vbi_hamm8_inv[(uint8_t) c]; |
1810 | } |
1811 | |
1812 | _vbi_inline int |
1813 | vbi_unham16p (const uint8_t * p) |
1814 | { |
1815 | return ((int) _vbi_hamm8_inv[p[0]]) |
1816 | | (((int) _vbi_hamm8_inv[p[1]]) << 4); |
1817 | } |
1818 | |
1819 | extern void |
1820 | vbi_ham24p (uint8_t * p, |
1821 | unsigned int c); |
1822 | extern int |
1823 | vbi_unham24p (const uint8_t * p) |
1824 | _vbi_pure; |
1825 | |
1826 | |
1827 | |
1828 | /* cc.h */ |
1829 | |
1830 | extern vbi_bool vbi_fetch_cc_page(vbi_decoder *vbi, vbi_page *pg, |
1831 | vbi_pgno pgno, vbi_bool reset); |
1832 | |
1833 | |
1834 | /* teletext_decoder.h */ |
1835 | |
1836 | typedef enum { |
1837 | VBI_WST_LEVEL_1, |
1838 | VBI_WST_LEVEL_1p5, |
1839 | VBI_WST_LEVEL_2p5, |
1840 | VBI_WST_LEVEL_3p5 |
1841 | } vbi_wst_level; |
1842 | |
1843 | |
1844 | extern void vbi_teletext_set_default_region(vbi_decoder *vbi, int default_region); |
1845 | extern void vbi_teletext_set_level(vbi_decoder *vbi, int level); |
1846 | |
1847 | extern vbi_bool vbi_fetch_vt_page(vbi_decoder *vbi, vbi_page *pg, |
1848 | vbi_pgno pgno, vbi_subno subno, |
1849 | vbi_wst_level max_level, int display_rows, |
1850 | vbi_bool navigation); |
1851 | extern int vbi_page_title(vbi_decoder *vbi, int pgno, int subno, char *buf); |
1852 | |
1853 | extern void vbi_resolve_link(vbi_page *pg, int column, int row, |
1854 | vbi_link *ld); |
1855 | extern void vbi_resolve_home(vbi_page *pg, vbi_link *ld); |
1856 | |
1857 | extern vbi_bool vbi_get_next_pgno(vbi_decoder *vbi, int dir, vbi_pgno *pgno, vbi_pgno *subno); |
1858 | extern vbi_bool vbi_get_next_sub_pgno(vbi_decoder *vbi, int dir, vbi_pgno *pgno, vbi_pgno *subno); |
1859 | extern vbi_bool vbi_get_sub_info(vbi_decoder *vbi, vbi_pgno pgno, int *subs, int *len); |
1860 | |
1861 | |
1862 | /* tables.h */ |
1863 | |
1864 | extern const char * vbi_rating_string(vbi_rating_auth auth, int id); |
1865 | extern const char * vbi_prog_type_string(vbi_prog_classf classf, int id); |
1866 | |
1867 | |
1868 | /* vps.h */ |
1869 | |
1870 | extern vbi_bool |
1871 | vbi_decode_vps_cni (unsigned int * cni, |
1872 | const uint8_t buffer[13]) |
1873 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1874 | _vbi_nonnull ((1, 2)) |
1875 | #endif |
1876 | ; |
1877 | extern vbi_bool |
1878 | vbi_encode_vps_cni (uint8_t buffer[13], |
1879 | unsigned int cni) |
1880 | _vbi_nonnull ((1)); |
1881 | |
1882 | /* vbi.h */ |
1883 | |
1884 | typedef enum { |
1885 | VBI_NO_PAGE = 0x00, |
1886 | VBI_NORMAL_PAGE = 0x01, |
1887 | VBI_SUBTITLE_PAGE = 0x70, |
1888 | VBI_SUBTITLE_INDEX = 0x78, |
1889 | VBI_NONSTD_SUBPAGES = 0x79, |
1890 | VBI_PROGR_WARNING = 0x7A, |
1891 | VBI_CURRENT_PROGR = 0x7C, |
1892 | VBI_NOW_AND_NEXT = 0x7D, |
1893 | VBI_PROGR_INDEX = 0x7F, |
1894 | VBI_PROGR_SCHEDULE = 0x81, |
1895 | VBI_UNKNOWN_PAGE = 0xFF |
1896 | } vbi_page_type; |
1897 | |
1898 | extern void vbi_set_brightness(vbi_decoder *vbi, int brightness); |
1899 | extern void vbi_set_contrast(vbi_decoder *vbi, int contrast); |
1900 | |
1901 | |
1902 | extern vbi_decoder * vbi_decoder_new(void); |
1903 | extern void vbi_decoder_delete(vbi_decoder *vbi); |
1904 | extern void vbi_decode(vbi_decoder *vbi, vbi_sliced *sliced, |
1905 | int lines, double timestamp); |
1906 | extern void vbi_channel_switched(vbi_decoder *vbi, vbi_nuid nuid); |
1907 | extern vbi_page_type vbi_classify_page(vbi_decoder *vbi, vbi_pgno pgno, |
1908 | vbi_subno *subno, char **language); |
1909 | extern void vbi_version(unsigned int *major, unsigned int *minor, unsigned int *micro); |
1910 | extern void |
1911 | vbi_set_log_fn (vbi_log_mask mask, |
1912 | vbi_log_fn * log_fn, |
1913 | void * user_data); |
1914 | |
1915 | |
1916 | |
1917 | #ifdef __cplusplus |
1918 | } |
1919 | #endif |
1920 | |
1921 | #endif /* __LIBZVBI_H__ */ |
1922 |