summaryrefslogtreecommitdiff
path: root/src/cc.h (plain)
blob: 7800ff7a269f0accba2951af7c11802e2e4afc98
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
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
70struct 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};
93
94/* Public */
95
96/**
97 * @addtogroup Cache
98 * @{
99 */
100extern vbi_bool vbi_fetch_cc_page(vbi_decoder *vbi, vbi_page *pg,
101 vbi_pgno pgno, vbi_bool reset);
102/** @} */
103
104/* Private */
105
106extern void vbi_caption_init(vbi_decoder *vbi);
107extern void vbi_caption_destroy(vbi_decoder *vbi);
108extern void vbi_decode_caption(vbi_decoder *vbi, int line, uint8_t *buf);
109extern void vbi_caption_desync(vbi_decoder *vbi);
110extern void vbi_caption_channel_switched(vbi_decoder *vbi);
111extern void vbi_caption_color_level(vbi_decoder *vbi);
112
113#endif /* CC_H */
114
115/*
116Local variables:
117c-set-style: K&R
118c-basic-offset: 8
119End:
120*/
121