summaryrefslogtreecommitdiff
path: root/src/cc.h (plain)
blob: 2267b16f0420863c7058f327d9f8d14e827e624b
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} cc_channel;
68
69struct caption {
70 pthread_mutex_t mutex;
71
72 uint8_t last[2]; /* field 1, cc command repetition */
73
74 int curr_chan;
75 vbi_char transp_space[2]; /* caption, text mode */
76 cc_channel channel[9]; /* caption 1-4, text 1-4, garbage */
77
78 xds_sub_packet sub_packet[4][0x18];
79 xds_sub_packet * curr_sp;
80 int xds;
81
82 uint8_t itv_buf[256];
83 int itv_count;
84
85 int info_cycle[2];
86};
87
88/* Public */
89
90/**
91 * @addtogroup Cache
92 * @{
93 */
94extern vbi_bool vbi_fetch_cc_page(vbi_decoder *vbi, vbi_page *pg,
95 vbi_pgno pgno, vbi_bool reset);
96/** @} */
97
98/* Private */
99
100extern void vbi_caption_init(vbi_decoder *vbi);
101extern void vbi_caption_destroy(vbi_decoder *vbi);
102extern void vbi_decode_caption(vbi_decoder *vbi, int line, uint8_t *buf);
103extern void vbi_caption_desync(vbi_decoder *vbi);
104extern void vbi_caption_channel_switched(vbi_decoder *vbi);
105extern void vbi_caption_color_level(vbi_decoder *vbi);
106
107#endif /* CC_H */
108
109/*
110Local variables:
111c-set-style: K&R
112c-basic-offset: 8
113End:
114*/
115