summaryrefslogtreecommitdiff
path: root/src/cc.h (plain)
blob: 03dd8a3ff3b34f8c56ef63fde02078ec3143abc5
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
34typedef struct vbi_decoder vbi_decoder;
35#endif
36
37typedef struct {
38 int count;
39 int chksum;
40 uint8_t buffer[32];
41} xds_sub_packet;
42
43typedef enum {
44 MODE_NONE,
45 MODE_POP_ON,
46 MODE_PAINT_ON,
47 MODE_ROLL_UP,
48 MODE_TEXT
49} cc_mode;
50
51typedef struct {
52 cc_mode mode;
53
54 int col, col1;
55 int row, row1;
56 int roll;
57 int update_flag;
58 int pos_flag;
59
60 int nul_ct; // XXX should be 'silence count'
61 double time;
62 unsigned char * language; /* Latin-1 */
63
64 vbi_char attr;
65 vbi_char * line;
66
67 int hidden;
68 vbi_page pg[3];
69 int update;
70} cc_channel;
71
72struct caption {
73 pthread_mutex_t mutex;
74
75 uint8_t last[2]; /* field 1, cc command repetition */
76 uint8_t last_f1[2];
77 uint8_t last_f2[2];
78
79 int curr_chan;
80 int curr_chan_f1;
81 int curr_chan_f2;
82 int curr_chan_f1_d1;
83 int curr_chan_f1_d2;
84 int curr_chan_f2_d1;
85 int curr_chan_f2_d2;
86
87 vbi_char transp_space[2]; /* caption, text mode */
88 cc_channel channel[9]; /* caption 1-4, text 1-4, garbage */
89
90 xds_sub_packet sub_packet[4][0x18];
91 xds_sub_packet * curr_sp;
92 int xds;
93
94 uint8_t itv_buf[256];
95 int itv_count;
96
97 int info_cycle[2];
98 int flash_state;
99};
100
101/* Public */
102
103/**
104 * @addtogroup Cache
105 * @{
106 */
107extern vbi_bool vbi_fetch_cc_page(vbi_decoder *vbi, vbi_page *pg,
108 vbi_pgno pgno, vbi_bool reset);
109/** @} */
110
111/* Private */
112
113extern void vbi_caption_init(vbi_decoder *vbi);
114extern void vbi_caption_destroy(vbi_decoder *vbi);
115extern void vbi_decode_caption(vbi_decoder *vbi, int line, uint8_t *buf);
116extern void vbi_caption_desync(vbi_decoder *vbi);
117extern void vbi_caption_channel_switched(vbi_decoder *vbi);
118extern void vbi_caption_color_level(vbi_decoder *vbi);
119
120#endif /* CC_H */
121
122/*
123Local variables:
124c-set-style: K&R
125c-basic-offset: 8
126End:
127*/
128