1 /* 2 * libzvbi -- Sliced VBI data 3 * 4 * Copyright (C) 2000, 2001 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: sliced.h,v 1.11 2008-02-24 14:17:02 mschimek Exp $ */ 23 24 #ifndef SLICED_H 25 #define SLICED_H 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 /* Public */ 32 33 #include <inttypes.h> 34 35 /** 36 * @addtogroup Sliced Sliced VBI data 37 * @ingroup Raw 38 * @brief Definition of sliced VBI data. 39 * 40 * The output of the libzvbi raw VBI decoder, and input to the data 41 * service decoder, is VBI data in binary format as defined in this 42 * section. It is similar to the output of hardware VBI decoders 43 * and VBI data transmitted in digital TV streams. 44 */ 45 46 /** 47 * @name Data service symbols 48 * @ingroup Sliced 49 * @{ 50 */ 51 52 /** 53 * @anchor VBI_SLICED_ 54 * No data service, blank vbi_sliced structure. 55 */ 56 #define VBI_SLICED_NONE 0 57 58 /** 59 * Unknown data service (vbi_dvb_demux). 60 * @since 0.2.10 61 */ 62 #define VBI_SLICED_UNKNOWN 0 63 64 /** 65 * Antiope a.k.a. Teletext System A 66 * 67 * Reference: <a href="http://www.itu.ch">ITU-R BT.653 68 * "Teletext Systems"</a> 69 * 70 * vbi_sliced payload: Last 37 bytes, without clock run-in and 71 * framing code, lsb first transmitted. 72 * 73 * @since 0.2.10 74 */ 75 #define VBI_SLICED_ANTIOPE 0x00002000 76 /** 77 * Synonym of VBI_SLICED_ANTIOPE. 78 * @since 0.2.10 79 */ 80 #define VBI_SLICED_TELETEXT_A 0x00002000 81 82 #define VBI_SLICED_TELETEXT_B_L10_625 0x00000001 83 #define VBI_SLICED_TELETEXT_B_L25_625 0x00000002 84 /** 85 * Teletext System B for 625 line systems 86 * 87 * Note this is separated into Level 1.0 and Level 2.5+ since the latter 88 * permits occupation of scan line 6 which is frequently out of 89 * range of raw VBI capture drivers. Clients should request decoding of both, 90 * may then verify Level 2.5 is covered. vbi_sliced id can be 91 * VBI_SLICED_TELETEXT_B, _B_L10_625 or _B_L25_625 regardless of line number. 92 * 93 * Reference: <a href="http://www.etsi.org">EN 300 706 94 * "Enhanced Teletext specification"</a>, <a href="http://www.itu.ch"> 95 * ITU-R BT.653 "Teletext Systems"</a> 96 * 97 * vbi_sliced payload: Last 42 of the 45 byte Teletext packet, that is 98 * without clock run-in and framing code, lsb first transmitted. 99 */ 100 #define VBI_SLICED_TELETEXT_B (VBI_SLICED_TELETEXT_B_L10_625 | \ 101 VBI_SLICED_TELETEXT_B_L25_625) 102 /** 103 * Synonym of VBI_SLICED_TELETEXT_B. 104 * @since 0.2.10 105 */ 106 #define VBI_SLICED_TELETEXT_B_625 VBI_SLICED_TELETEXT_B 107 108 /** 109 * Teletext System C for 625 line systems 110 * 111 * Reference: <a href="http://www.itu.ch">ITU-R BT.653 112 * "Teletext Systems"</a> 113 * 114 * vbi_sliced payload: Last 33 bytes, without clock run-in and 115 * framing code, lsb first transmitted. 116 * 117 * @since 0.2.10 118 */ 119 #define VBI_SLICED_TELETEXT_C_625 0x00004000 120 121 /** 122 * Teletext System D for 625 line systems 123 * 124 * Reference: <a href="http://www.itu.ch">ITU-R BT.653 125 * "Teletext Systems"</a> 126 * 127 * vbi_sliced payload: Last 34 bytes, without clock run-in and 128 * framing code, lsb first transmitted. 129 * 130 * @since 0.2.10 131 */ 132 #define VBI_SLICED_TELETEXT_D_625 0x00008000 133 134 /** 135 * Video Program System 136 * 137 * Reference: <a href="http://www.etsi.org">ETS 300 231 138 * "Specification of the domestic video Programme 139 * Delivery Control system (PDC)"</a>, <a href="http://www.irt.de"> 140 * IRT 8R2 "Video-Programm-System (VPS)"</a>. 141 * 142 * vbi_sliced payload: Byte number 3 to 15 according to ETS 300 231 143 * Figure 9, lsb first transmitted. 144 */ 145 #define VBI_SLICED_VPS 0x00000004 146 147 /** 148 * Pseudo-VPS signal transmitted on field 2 149 * 150 * vbi_sliced payload: 13 bytes. 151 * 152 * @since 0.2.10 153 */ 154 #define VBI_SLICED_VPS_F2 0x00001000 155 156 #define VBI_SLICED_CAPTION_625_F1 0x00000008 157 #define VBI_SLICED_CAPTION_625_F2 0x00000010 158 /** 159 * Closed Caption for 625 line systems 160 * 161 * Note this is split into field one and two services since for basic 162 * caption decoding only field one is required. vbi_sliced id can be 163 * VBI_SLICED_CAPTION_625, _625_F1 or _625_F2 regardless of line number. 164 * 165 * Reference: <a href="http://global.ihs.com">EIA 608 166 * "Recommended Practice for Line 21 Data Service"</a>. 167 * 168 * vbi_sliced payload: First and second byte including parity, 169 * lsb first transmitted. 170 */ 171 #define VBI_SLICED_CAPTION_625 (VBI_SLICED_CAPTION_625_F1 | \ 172 VBI_SLICED_CAPTION_625_F2) 173 174 /** 175 * Wide Screen Signalling for 625 line systems 176 * 177 * Reference: <a href="http://www.etsi.org">EN 300 294 178 * "625-line television Wide Screen Signalling (WSS)"</a>. 179 * 180 * vbi_sliced payload: 181 * <pre> 182 * Byte 0 1 183 * msb lsb msb lsb 184 * bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9 8<br></pre> 185 * according to EN 300 294, Table 1, lsb first transmitted. 186 */ 187 #define VBI_SLICED_WSS_625 0x00000400 188 189 #define VBI_SLICED_CAPTION_525_F1 0x00000020 190 #define VBI_SLICED_CAPTION_525_F2 0x00000040 191 /** 192 * Closed Caption for 525 line systems (NTSC). 193 * 194 * Note this is split into field one and two services since for basic 195 * caption decoding only field one is required. vbi_sliced id can be 196 * VBI_SLICED_CAPTION_525, _525_F1 or _525_F2 regardless of line number. 197 * 198 * VBI_SLICED_CAPTION_525 also covers XDS (Extended Data Service), 199 * V-Chip data and ITV / WebTV data. 200 * 201 * Reference: <a href="http://global.ihs.com">EIA 608 202 * "Recommended Practice for Line 21 Data Service"</a>. 203 * 204 * vbi_sliced payload: First and second byte including parity, 205 * lsb first transmitted. 206 */ 207 #define VBI_SLICED_CAPTION_525 (VBI_SLICED_CAPTION_525_F1 | \ 208 VBI_SLICED_CAPTION_525_F2) 209 /** 210 * Closed Caption at double bit rate for 525 line systems. 211 * 212 * Reference: ? 213 * 214 * vbi_sliced payload: First to fourth byte including parity bit, 215 * lsb first transmitted. 216 */ 217 #define VBI_SLICED_2xCAPTION_525 0x00000080 218 219 /** 220 * Teletext System B for 525 line systems 221 * 222 * Reference: <a href="http://www.itu.ch">ITU-R BT.653 223 * "Teletext Systems"</a> 224 * 225 * vbi_sliced payload: Last 34 bytes, without clock run-in and 226 * framing code, lsb first transmitted. 227 * 228 * @since 0.2.10 229 */ 230 #define VBI_SLICED_TELETEXT_B_525 0x00010000 231 232 /** 233 * North American Basic Teletext Specification 234 * a.k.a. Teletext System C for 525 line systems 235 * 236 * Reference: <a href="http://global.ihs.com">EIA-516 237 * "North American Basic Teletext Specification (NABTS)"</a>, 238 * <a href="http://www.itu.ch">ITU-R BT.653 "Teletext Systems"</a> 239 * 240 * vbi_sliced payload: Last 33 bytes, without clock run-in and 241 * framing code, lsb first transmitted. 242 * 243 * @since 0.2.10 244 */ 245 #define VBI_SLICED_NABTS 0x00000100 246 247 /** 248 * Synonym of VBI_SLICED_NABTS. 249 * @since 0.2.10 250 */ 251 #define VBI_SLICED_TELETEXT_C_525 0x00000100 252 253 /** 254 * Misdefined. 255 * 256 * vbi_sliced payload: 34 bytes. 257 * 258 * @deprecated 259 * This service was misdefined. 260 * Use VBI_SLICED_TELETEXT_B_525 or VBI_SLICED_TELETEXT_D_525 in new code. 261 */ 262 #define VBI_SLICED_TELETEXT_BD_525 0x00000200 263 264 /** 265 * Teletext System D for 525 line systems 266 * 267 * Reference: <a href="http://www.itu.ch">ITU-R BT.653 268 * "Teletext Systems"</a> 269 * 270 * vbi_sliced payload: Last 34 bytes, without clock run-in and 271 * framing code, lsb first transmitted. 272 * 273 * @since 0.2.10 274 */ 275 #define VBI_SLICED_TELETEXT_D_525 0x00020000 276 277 /** 278 * Wide Screen Signalling for NTSC Japan 279 * 280 * Reference: <a href="http://www.jeita.or.jp">EIA-J CPR-1204</a> 281 * 282 * vbi_sliced payload: 283 * <pre> 284 * Byte 0 1 2 285 * msb lsb msb lsb msb lsb 286 * bit 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 x x x x 19 18 17 16 287 * </pre> 288 */ 289 290 #define VBI_SLICED_WSS_CPR1204 0x00000800 291 292 /** 293 * No actual data service. This symbol is used to request capturing 294 * of all PAL/SECAM VBI data lines from the libzvbi driver interface, 295 * as opposed to just those lines used to transmit the requested 296 * data services. 297 */ 298 #define VBI_SLICED_VBI_625 0x20000000 299 300 /** 301 * No actual data service. This symbol is used to request capturing 302 * of all NTSC VBI data lines from the libzvbi driver interface, 303 * as opposed to just those lines used to transmit the requested 304 * data services. 305 */ 306 #define VBI_SLICED_VBI_525 0x40000000 307 308 /** @} */ 309 310 typedef unsigned int vbi_service_set; 311 312 /** 313 * @ingroup Sliced 314 * @brief This structure holds one scan line of sliced vbi data. 315 * 316 * For example the contents of NTSC line 21, two bytes of Closed Caption 317 * data. Usually an array of vbi_sliced is used, covering all 318 * VBI lines of the two fields of a video frame. 319 */ 320 typedef struct { 321 /** 322 * A @ref VBI_SLICED_ symbol identifying the data service. Under cirumstances 323 * (see VBI_SLICED_TELETEXT_B) this can be a set of VBI_SLICED_ symbols. 324 */ 325 uint32_t id; 326 /** 327 * Source line number according to the ITU-R line numbering scheme, 328 * a value of @c 0 if the exact line number is unknown. Note that some 329 * data services cannot be reliable decoded without line number. 330 * 331 * @image html zvbi_625.gif "ITU-R PAL/SECAM line numbering scheme" 332 * @image html zvbi_525.gif "ITU-R NTSC line numbering scheme" 333 */ 334 uint32_t line; 335 /** 336 * The actual payload. See the documentation of @ref VBI_SLICED_ symbols 337 * for details. 338 */ 339 uint8_t data[56]; 340 } vbi_sliced; 341 342 /** 343 * @addtogroup Sliced 344 * @{ 345 */ 346 extern const char * 347 vbi_sliced_name (vbi_service_set service) 348 _vbi_const; 349 extern unsigned int 350 vbi_sliced_payload_bits (vbi_service_set service) 351 _vbi_const; 352 /** @} */ 353 354 /* Private */ 355 356 #ifdef __cplusplus 357 } 358 #endif 359 360 #endif /* SLICED_H */ 361 362 /* 363 Local variables: 364 c-set-style: K&R 365 c-basic-offset: 8 366 End: 367 */ 368