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 * ``` 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 185 * ``` 186 * according to EN 300 294, Table 1, lsb first transmitted. 187 */ 188 #define VBI_SLICED_WSS_625 0x00000400 189 190 #define VBI_SLICED_CAPTION_525_F1 0x00000020 191 #define VBI_SLICED_CAPTION_525_F2 0x00000040 192 /** 193 * Closed Caption for 525 line systems (NTSC). 194 * 195 * Note this is split into field one and two services since for basic 196 * caption decoding only field one is required. vbi_sliced id can be 197 * VBI_SLICED_CAPTION_525, _525_F1 or _525_F2 regardless of line number. 198 * 199 * VBI_SLICED_CAPTION_525 also covers XDS (Extended Data Service), 200 * V-Chip data and ITV / WebTV data. 201 * 202 * Reference: <a href="http://global.ihs.com">EIA 608 203 * "Recommended Practice for Line 21 Data Service"</a>. 204 * 205 * vbi_sliced payload: First and second byte including parity, 206 * lsb first transmitted. 207 */ 208 #define VBI_SLICED_CAPTION_525 (VBI_SLICED_CAPTION_525_F1 | \ 209 VBI_SLICED_CAPTION_525_F2) 210 /** 211 * Closed Caption at double bit rate for 525 line systems. 212 * 213 * Reference: ? 214 * 215 * vbi_sliced payload: First to fourth byte including parity bit, 216 * lsb first transmitted. 217 */ 218 #define VBI_SLICED_2xCAPTION_525 0x00000080 219 220 /** 221 * Teletext System B for 525 line systems 222 * 223 * Reference: <a href="http://www.itu.ch">ITU-R BT.653 224 * "Teletext Systems"</a> 225 * 226 * vbi_sliced payload: Last 34 bytes, without clock run-in and 227 * framing code, lsb first transmitted. 228 * 229 * @since 0.2.10 230 */ 231 #define VBI_SLICED_TELETEXT_B_525 0x00010000 232 233 /** 234 * North American Basic Teletext Specification 235 * a.k.a. Teletext System C for 525 line systems 236 * 237 * Reference: <a href="http://global.ihs.com">EIA-516 238 * "North American Basic Teletext Specification (NABTS)"</a>, 239 * <a href="http://www.itu.ch">ITU-R BT.653 "Teletext Systems"</a> 240 * 241 * vbi_sliced payload: Last 33 bytes, without clock run-in and 242 * framing code, lsb first transmitted. 243 * 244 * @since 0.2.10 245 */ 246 #define VBI_SLICED_NABTS 0x00000100 247 248 /** 249 * Synonym of VBI_SLICED_NABTS. 250 * @since 0.2.10 251 */ 252 #define VBI_SLICED_TELETEXT_C_525 0x00000100 253 254 /** 255 * Misdefined. 256 * 257 * vbi_sliced payload: 34 bytes. 258 * 259 * @deprecated 260 * This service was misdefined. 261 * Use VBI_SLICED_TELETEXT_B_525 or VBI_SLICED_TELETEXT_D_525 in new code. 262 */ 263 #define VBI_SLICED_TELETEXT_BD_525 0x00000200 264 265 /** 266 * Teletext System D for 525 line systems 267 * 268 * Reference: <a href="http://www.itu.ch">ITU-R BT.653 269 * "Teletext Systems"</a> 270 * 271 * vbi_sliced payload: Last 34 bytes, without clock run-in and 272 * framing code, lsb first transmitted. 273 * 274 * @since 0.2.10 275 */ 276 #define VBI_SLICED_TELETEXT_D_525 0x00020000 277 278 /** 279 * Wide Screen Signalling for NTSC Japan 280 * 281 * Reference: <a href="http://www.jeita.or.jp">EIA-J CPR-1204</a> 282 * 283 * vbi_sliced payload: 284 * ``` 285 * Byte 0 1 2 286 * msb lsb msb lsb msb lsb 287 * 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 288 * ``` 289 */ 290 291 #define VBI_SLICED_WSS_CPR1204 0x00000800 292 293 /** 294 * No actual data service. This symbol is used to request capturing 295 * of all PAL/SECAM VBI data lines from the libzvbi driver interface, 296 * as opposed to just those lines used to transmit the requested 297 * data services. 298 */ 299 #define VBI_SLICED_VBI_625 0x20000000 300 301 /** 302 * No actual data service. This symbol is used to request capturing 303 * of all NTSC VBI data lines from the libzvbi driver interface, 304 * as opposed to just those lines used to transmit the requested 305 * data services. 306 */ 307 #define VBI_SLICED_VBI_525 0x40000000 308 309 /** @} */ 310 311 typedef unsigned int vbi_service_set; 312 313 /** 314 * @ingroup Sliced 315 * @brief This structure holds one scan line of sliced vbi data. 316 * 317 * For example the contents of NTSC line 21, two bytes of Closed Caption 318 * data. Usually an array of vbi_sliced is used, covering all 319 * VBI lines of the two fields of a video frame. 320 */ 321 typedef struct { 322 /** 323 * A @ref VBI_SLICED_ symbol identifying the data service. Under circumstances 324 * (see VBI_SLICED_TELETEXT_B) this can be a set of VBI_SLICED_ symbols. 325 */ 326 uint32_t id; 327 /** 328 * Source line number according to the ITU-R line numbering scheme, 329 * a value of @c 0 if the exact line number is unknown. Note that some 330 * data services cannot be reliable decoded without line number. 331 * 332 * @image html zvbi_625.gif "ITU-R PAL/SECAM line numbering scheme" 333 * @image html zvbi_525.gif "ITU-R NTSC line numbering scheme" 334 */ 335 uint32_t line; 336 /** 337 * The actual payload. See the documentation of @ref VBI_SLICED_ symbols 338 * for details. 339 */ 340 uint8_t data[56]; 341 } vbi_sliced; 342 343 /** 344 * @addtogroup Sliced 345 * @{ 346 */ 347 extern const char * 348 vbi_sliced_name (vbi_service_set service) 349 _vbi_const; 350 extern unsigned int 351 vbi_sliced_payload_bits (vbi_service_set service) 352 _vbi_const; 353 /** @} */ 354 355 /* Private */ 356 357 #ifdef __cplusplus 358 } 359 #endif 360 361 #endif /* SLICED_H */ 362 363 /* 364 Local variables: 365 c-set-style: K&R 366 c-basic-offset: 8 367 End: 368 */ 369