2 * libzvbi -- Raw VBI decoder
4 * Copyright (C) 2000-2004 Michael H. Schimek
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.
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.
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.
22 /* $Id: raw_decoder.h,v 1.12 2008-02-19 00:35:21 mschimek Exp $ */
24 #ifndef __ZVBI_RAW_DECODER_H__
25 #define __ZVBI_RAW_DECODER_H__
30 #include "sampling_par.h"
31 #include "bit_slicer.h"
37 * $brief Raw VBI decoder.
39 * The contents of this structure are private.
40 * Call vbi3_raw_decoder_new() to allocate a raw VBI decoder.
42 typedef struct _vbi3_raw_decoder vbi3_raw_decoder;
45 * $addtogroup RawDecoder
49 vbi3_raw_decoder_sampling_point (vbi3_raw_decoder * rd,
50 vbi3_bit_slicer_point *point,
52 unsigned int nth_bit);
54 vbi3_raw_decoder_decode (vbi3_raw_decoder * rd,
56 unsigned int sliced_lines,
59 vbi3_raw_decoder_reset (vbi3_raw_decoder * rd);
60 extern vbi_service_set
61 vbi3_raw_decoder_services (vbi3_raw_decoder * rd);
62 extern vbi_service_set
63 vbi3_raw_decoder_remove_services
64 (vbi3_raw_decoder * rd,
65 vbi_service_set services);
66 extern vbi_service_set
67 vbi3_raw_decoder_add_services (vbi3_raw_decoder * rd,
68 vbi_service_set services,
71 vbi3_raw_decoder_debug (vbi3_raw_decoder * rd,
73 extern vbi_service_set
74 vbi3_raw_decoder_set_sampling_par
75 (vbi3_raw_decoder * rd,
76 const vbi_sampling_par *sp,
79 vbi3_raw_decoder_get_sampling_par
80 (const vbi3_raw_decoder *rd,
81 vbi_sampling_par * sp);
83 vbi3_raw_decoder_set_log_fn (vbi3_raw_decoder * rd,
88 vbi3_raw_decoder_delete (vbi3_raw_decoder * rd);
89 extern vbi3_raw_decoder *
90 vbi3_raw_decoder_new (const vbi_sampling_par *sp);
97 #define _VBI3_RAW_DECODER_MAX_JOBS 8
99 #define _VBI3_RAW_DECODER_MAX_WAYS 8
104 vbi3_bit_slicer slicer;
105 } _vbi3_raw_decoder_job;
109 vbi3_bit_slicer_point points[512];
110 unsigned int n_points;
111 } _vbi3_raw_decoder_sp_line;
115 * Don't dereference pointers to this structure.
116 * I guarantee it will change.
118 struct _vbi3_raw_decoder {
119 vbi_sampling_par sampling;
121 vbi_service_set services;
127 unsigned int n_sp_lines;
129 int8_t * pattern; /* n scan lines * MAX_WAYS */
130 _vbi3_raw_decoder_job jobs[_VBI3_RAW_DECODER_MAX_JOBS];
131 _vbi3_raw_decoder_sp_line *sp_lines;
136 /** Requires field line numbers. */
137 _VBI_SP_LINE_NUM = (1 << 0),
138 /** Requires field numbers. */
139 _VBI_SP_FIELD_NUM = (1 << 1),
140 } _vbi_service_par_flag;
142 typedef struct _vbi_service_par _vbi_service_par;
145 struct _vbi_service_par {
151 * - 525 lines, FV = 59.94 Hz, FH = 15734 Hz
152 * - 625 lines, FV = 50 Hz, FH = 15625 Hz
154 vbi_videostd_set videostd_set;
157 * Most scan lines used by the data service, first and last
158 * line of first and second field. ITU-R numbering scheme.
159 * Zero if no data from this field, requires field sync.
161 unsigned int first[2];
162 unsigned int last[2];
165 * Leading edge hsync to leading edge first CRI one bit,
166 * half amplitude points, in nanoseconds.
170 unsigned int cri_rate; /**< Hz */
171 unsigned int bit_rate; /**< Hz */
173 /** Clock Run In and FRaming Code, LSB last txed bit of FRC. */
174 unsigned int cri_frc;
176 /** CRI and FRC bits significant for identification. */
177 unsigned int cri_frc_mask;
180 * Number of significat cri_bits (at cri_rate),
181 * frc_bits (at bit_rate).
183 unsigned int cri_bits;
184 unsigned int frc_bits;
186 unsigned int payload; /**< bits */
187 vbi_modulation modulation;
189 _vbi_service_par_flag flags;
192 extern const _vbi_service_par _vbi_service_table [];
195 _vbi3_raw_decoder_dump (const vbi3_raw_decoder *rd,
198 _vbi3_raw_decoder_destroy (vbi3_raw_decoder * rd);
200 _vbi3_raw_decoder_init (vbi3_raw_decoder * rd,
201 const vbi_sampling_par *sp);
205 #endif /* __ZVBI_RAW_DECODER_H__ */