1 /*- 2 * Copyright (c) 2003 Hidetoshi Shimokawa 3 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the acknowledgement as bellow: 16 * 17 * This product includes software developed by K. Kobayashi and H. Shimokawa 18 * 19 * 4. The name of the author may not be used to endorse or promote products 20 * derived from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 * POSSIBILITY OF SUCH DAMAGE. 33 * 34 * $FreeBSD$ 35 * 36 */ 37 38 #define DV_BROADCAST_ON (1<<30) 39 #define oMPR 0x900 40 #define oPCR 0x904 41 #define iMPR 0x980 42 #define iPCR 0x984 43 44 struct ciphdr { 45 #if BYTE_ORDER == BIG_ENDIAN 46 uint8_t eoh0:1, /* 0 */ 47 form0:1, /* 0 */ 48 src:6; 49 #else 50 uint8_t src:6, 51 form0:1, /* 0 */ 52 eoh0:1; /* 0 */ 53 #endif 54 uint8_t len; 55 #if BYTE_ORDER == BIG_ENDIAN 56 uint8_t fn:2, 57 qpc:3, 58 sph:1, 59 :2; 60 #else 61 uint8_t :2, 62 sph:1, 63 qpc:3, 64 fn:2; 65 #endif 66 uint8_t dbc; 67 #if BYTE_ORDER == BIG_ENDIAN 68 uint8_t eoh1:1, /* 1 */ 69 form1:1, /* 0 */ 70 fmt:6; 71 #else 72 uint8_t fmt:6, 73 form1:1, /* 0 */ 74 eoh1:1; /* 1 */ 75 #endif 76 #define CIP_FMT_DVCR 0 77 #define CIP_FMT_MPEG (1<<5) 78 union { 79 struct { 80 #if BYTE_ORDER == BIG_ENDIAN 81 uint8_t fs:1, /* 50/60 field system 82 NTSC/PAL */ 83 stype:5, 84 :2; 85 #else 86 uint8_t :2, 87 stype:5, 88 fs:1; /* 50/60 field system 89 NTSC/PAL */ 90 #endif 91 #define CIP_STYPE_SD 0 92 #define CIP_STYPE_SDL 1 93 #define CIP_STYPE_HD 2 94 uint16_t cyc:16; /* take care of byte order! */ 95 } __attribute__ ((packed)) dv; 96 uint8_t bytes[3]; 97 } fdf; 98 99 }; 100 struct dvdbc { 101 #if BYTE_ORDER == BIG_ENDIAN 102 uint8_t sct:3, /* Section type */ 103 :1, /* Reserved */ 104 arb:4; /* Arbitrary bit */ 105 #else 106 uint8_t arb:4, /* Arbitrary bit */ 107 :1, /* Reserved */ 108 sct:3; /* Section type */ 109 #endif 110 #define DV_SCT_HEADER 0 111 #define DV_SCT_SUBCODE 1 112 #define DV_SCT_VAUX 2 113 #define DV_SCT_AUDIO 3 114 #define DV_SCT_VIDEO 4 115 #if BYTE_ORDER == BIG_ENDIAN 116 uint8_t dseq:4, /* DIF sequence number */ 117 fsc:1, /* ID of a DIF block in each channel */ 118 :3; 119 #else 120 uint8_t :3, 121 fsc:1, /* ID of a DIF block in each channel */ 122 dseq:4; /* DIF sequence number */ 123 #endif 124 uint8_t dbn; /* DIF block number */ 125 uint8_t payload[77]; 126 #define DV_DSF_12 0x80 /* PAL: payload[0] in Header DIF */ 127 }; 128