blob: 5f3eb5db19fb1925f588f79c5b09ff2938486da7
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 | int update_flag; |
58 | int update_all_flag; |
59 | int edm_flag; |
60 | int pos_flag; |
61 | |
62 | int nul_ct; // XXX should be 'silence count' |
63 | double time; |
64 | unsigned char * language; /* Latin-1 */ |
65 | |
66 | vbi_char attr; |
67 | vbi_char * line; |
68 | |
69 | int hidden; |
70 | vbi_page pg[2]; |
71 | int update; |
72 | } cc_channel; |
73 | |
74 | struct caption { |
75 | pthread_mutex_t mutex; |
76 | |
77 | uint8_t last[2]; /* field 1, cc command repetition */ |
78 | uint8_t last_f1[2]; |
79 | uint8_t last_f2[2]; |
80 | |
81 | int curr_chan; |
82 | int curr_chan_f1; |
83 | int curr_chan_f2; |
84 | |
85 | vbi_char transp_space[2]; /* caption, text mode */ |
86 | cc_channel channel[9]; /* caption 1-4, text 1-4, garbage */ |
87 | |
88 | xds_sub_packet sub_packet[4][0x18]; |
89 | xds_sub_packet * curr_sp; |
90 | int xds; |
91 | |
92 | uint8_t itv_buf[256]; |
93 | int itv_count; |
94 | |
95 | int info_cycle[2]; |
96 | int flash_state; |
97 | }; |
98 | |
99 | /* Public */ |
100 | |
101 | /** |
102 | * @addtogroup Cache |
103 | * @{ |
104 | */ |
105 | extern vbi_bool vbi_fetch_cc_page(vbi_decoder *vbi, vbi_page *pg, |
106 | vbi_pgno pgno, vbi_bool reset); |
107 | /** @} */ |
108 | |
109 | /* Private */ |
110 | |
111 | extern void vbi_caption_init(vbi_decoder *vbi); |
112 | extern void vbi_caption_destroy(vbi_decoder *vbi); |
113 | extern void vbi_decode_caption(vbi_decoder *vbi, int line, uint8_t *buf); |
114 | extern void vbi_caption_desync(vbi_decoder *vbi); |
115 | extern void vbi_caption_channel_switched(vbi_decoder *vbi); |
116 | extern void vbi_caption_color_level(vbi_decoder *vbi); |
117 | |
118 | #endif /* CC_H */ |
119 | |
120 | /* |
121 | Local variables: |
122 | c-set-style: K&R |
123 | c-basic-offset: 8 |
124 | End: |
125 | */ |
126 |