blob: 916448d45e0ef4b58127eb8e23aa51597b3460fa
1 | /* |
2 | * libzvbi -- Closed Caption decoder |
3 | * |
4 | * Copyright (C) 2000, 2001, 2002 Michael H. Schimek |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Library General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Library General Public |
17 | * License along with this library; if not, write to the |
18 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | * Boston, MA 02110-1301 USA. |
20 | */ |
21 | |
22 | /* $Id: cc.h,v 1.9 2008/02/19 00:35:15 mschimek Exp $ */ |
23 | |
24 | #ifndef CC_H |
25 | #define CC_H |
26 | |
27 | #include <pthread.h> |
28 | |
29 | #include "bcd.h" |
30 | #include "format.h" |
31 | |
32 | #ifndef VBI_DECODER |
33 | #define VBI_DECODER |
34 | typedef struct vbi_decoder vbi_decoder; |
35 | #endif |
36 | |
37 | typedef struct { |
38 | int count; |
39 | int chksum; |
40 | uint8_t buffer[32]; |
41 | } xds_sub_packet; |
42 | |
43 | typedef enum { |
44 | MODE_NONE, |
45 | MODE_POP_ON, |
46 | MODE_PAINT_ON, |
47 | MODE_ROLL_UP, |
48 | MODE_TEXT |
49 | } cc_mode; |
50 | |
51 | typedef struct { |
52 | cc_mode mode; |
53 | |
54 | int col, col1; |
55 | int row, row1; |
56 | int roll; |
57 | |
58 | int nul_ct; // XXX should be 'silence count' |
59 | double time; |
60 | unsigned char * language; /* Latin-1 */ |
61 | |
62 | vbi_char attr; |
63 | vbi_char * line; |
64 | |
65 | int hidden; |
66 | vbi_page pg[2]; |
67 | int update; |
68 | } cc_channel; |
69 | |
70 | struct caption { |
71 | pthread_mutex_t mutex; |
72 | |
73 | uint8_t last[2]; /* field 1, cc command repetition */ |
74 | uint8_t last_f1[2]; |
75 | uint8_t last_f2[2]; |
76 | |
77 | int curr_chan; |
78 | int curr_chan_f1; |
79 | int curr_chan_f2; |
80 | |
81 | vbi_char transp_space[2]; /* caption, text mode */ |
82 | cc_channel channel[9]; /* caption 1-4, text 1-4, garbage */ |
83 | |
84 | xds_sub_packet sub_packet[4][0x18]; |
85 | xds_sub_packet * curr_sp; |
86 | int xds; |
87 | |
88 | uint8_t itv_buf[256]; |
89 | int itv_count; |
90 | |
91 | int info_cycle[2]; |
92 | int flash_state; |
93 | }; |
94 | |
95 | /* Public */ |
96 | |
97 | /** |
98 | * @addtogroup Cache |
99 | * @{ |
100 | */ |
101 | extern vbi_bool vbi_fetch_cc_page(vbi_decoder *vbi, vbi_page *pg, |
102 | vbi_pgno pgno, vbi_bool reset); |
103 | /** @} */ |
104 | |
105 | /* Private */ |
106 | |
107 | extern void vbi_caption_init(vbi_decoder *vbi); |
108 | extern void vbi_caption_destroy(vbi_decoder *vbi); |
109 | extern void vbi_decode_caption(vbi_decoder *vbi, int line, uint8_t *buf); |
110 | extern void vbi_caption_desync(vbi_decoder *vbi); |
111 | extern void vbi_caption_channel_switched(vbi_decoder *vbi); |
112 | extern void vbi_caption_color_level(vbi_decoder *vbi); |
113 | |
114 | #endif /* CC_H */ |
115 | |
116 | /* |
117 | Local variables: |
118 | c-set-style: K&R |
119 | c-basic-offset: 8 |
120 | End: |
121 | */ |
122 |