Mercurial > mplayer.hg
annotate libmpdvdkit2/bsdi_dvd.h @ 13406:2f69854dfbe4
10l: Make turbo mode compatible with 3-pass encoding
author | gpoirier |
---|---|
date | Mon, 20 Sep 2004 20:07:29 +0000 |
parents | f0f0f176d298 |
children | c92651f83333 |
rev | line source |
---|---|
7027 | 1 #ifndef _DVD_H_ |
2 #define _DVD_H_ | |
3 | |
4 #include <sys/cdefs.h> | |
5 #include <machine/endian.h> | |
6 #include <sys/ioctl.h> | |
7 | |
8 __BEGIN_DECLS | |
9 int dvd_cdrom_ioctl(int, unsigned long, void *); | |
10 int cdrom_blocksize(int, int); | |
11 void dvd_cdrom_debug(int); | |
12 __END_DECLS | |
13 | |
14 #define ioctl(a,b,c) dvd_cdrom_ioctl((a),(b),(c)) | |
15 | |
16 typedef unsigned char __u8; | |
17 typedef unsigned short __u16; | |
18 typedef unsigned int __u32; | |
19 | |
20 #define DVD_READ_STRUCT 0x5390 /* Read structure */ | |
21 #define DVD_WRITE_STRUCT 0x5391 /* Write structure */ | |
22 #define DVD_AUTH 0x5392 /* Authentication */ | |
23 | |
24 #define DVD_STRUCT_PHYSICAL 0x00 | |
25 #define DVD_STRUCT_COPYRIGHT 0x01 | |
26 #define DVD_STRUCT_DISCKEY 0x02 | |
27 #define DVD_STRUCT_BCA 0x03 | |
28 #define DVD_STRUCT_MANUFACT 0x04 | |
29 | |
30 struct dvd_layer { | |
31 __u8 book_version : 4; | |
32 __u8 book_type : 4; | |
33 __u8 min_rate : 4; | |
34 __u8 disc_size : 4; | |
35 __u8 layer_type : 4; | |
36 __u8 track_path : 1; | |
37 __u8 nlayers : 2; | |
38 __u8 track_density : 4; | |
39 __u8 linear_density : 4; | |
40 __u8 bca : 1; | |
41 __u32 start_sector; | |
42 __u32 end_sector; | |
43 __u32 end_sector_l0; | |
44 }; | |
45 | |
46 struct dvd_physical { | |
47 __u8 type; | |
48 __u8 layer_num; | |
49 struct dvd_layer layer[4]; | |
50 }; | |
51 | |
52 struct dvd_copyright { | |
53 __u8 type; | |
54 | |
55 __u8 layer_num; | |
56 __u8 cpst; | |
57 __u8 rmi; | |
58 }; | |
59 | |
60 struct dvd_disckey { | |
61 __u8 type; | |
62 | |
63 unsigned agid : 2; | |
64 __u8 value[2048]; | |
65 }; | |
66 | |
67 struct dvd_bca { | |
68 __u8 type; | |
69 | |
70 int len; | |
71 __u8 value[188]; | |
72 }; | |
73 | |
74 struct dvd_manufact { | |
75 __u8 type; | |
76 | |
77 __u8 layer_num; | |
78 int len; | |
79 __u8 value[2048]; | |
80 }; | |
81 | |
82 typedef union { | |
83 __u8 type; | |
84 | |
85 struct dvd_physical physical; | |
86 struct dvd_copyright copyright; | |
87 struct dvd_disckey disckey; | |
88 struct dvd_bca bca; | |
89 struct dvd_manufact manufact; | |
90 } dvd_struct; | |
91 | |
92 /* | |
93 * DVD authentication ioctl | |
94 */ | |
95 | |
96 /* Authentication states */ | |
97 #define DVD_LU_SEND_AGID 0 | |
98 #define DVD_HOST_SEND_CHALLENGE 1 | |
99 #define DVD_LU_SEND_KEY1 2 | |
100 #define DVD_LU_SEND_CHALLENGE 3 | |
101 #define DVD_HOST_SEND_KEY2 4 | |
102 | |
103 /* Termination states */ | |
104 #define DVD_AUTH_ESTABLISHED 5 | |
105 #define DVD_AUTH_FAILURE 6 | |
106 | |
107 /* Other functions */ | |
108 #define DVD_LU_SEND_TITLE_KEY 7 | |
109 #define DVD_LU_SEND_ASF 8 | |
110 #define DVD_INVALIDATE_AGID 9 | |
111 #define DVD_LU_SEND_RPC_STATE 10 | |
112 #define DVD_HOST_SEND_RPC_STATE 11 | |
113 | |
114 /* State data */ | |
115 typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */ | |
116 typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ | |
117 | |
118 struct dvd_lu_send_agid { | |
119 __u8 type; | |
120 unsigned agid : 2; | |
121 }; | |
122 | |
123 struct dvd_host_send_challenge { | |
124 __u8 type; | |
125 unsigned agid : 2; | |
126 | |
127 dvd_challenge chal; | |
128 }; | |
129 | |
130 struct dvd_send_key { | |
131 __u8 type; | |
132 unsigned agid : 2; | |
133 | |
134 dvd_key key; | |
135 }; | |
136 | |
137 struct dvd_lu_send_challenge { | |
138 __u8 type; | |
139 unsigned agid : 2; | |
140 | |
141 dvd_challenge chal; | |
142 }; | |
143 | |
144 #define DVD_CPM_NO_COPYRIGHT 0 | |
145 #define DVD_CPM_COPYRIGHTED 1 | |
146 | |
147 #define DVD_CP_SEC_NONE 0 | |
148 #define DVD_CP_SEC_EXIST 1 | |
149 | |
150 #define DVD_CGMS_UNRESTRICTED 0 | |
151 #define DVD_CGMS_SINGLE 2 | |
152 #define DVD_CGMS_RESTRICTED 3 | |
153 | |
154 struct dvd_lu_send_title_key { | |
155 __u8 type; | |
156 unsigned agid : 2; | |
157 | |
158 dvd_key title_key; | |
159 int lba; | |
160 unsigned cpm : 1; | |
161 unsigned cp_sec : 1; | |
162 unsigned cgms : 2; | |
163 }; | |
164 | |
165 struct dvd_lu_send_asf { | |
166 __u8 type; | |
167 unsigned agid : 2; | |
168 | |
169 unsigned asf : 1; | |
170 }; | |
171 | |
172 struct dvd_host_send_rpcstate { | |
173 __u8 type; | |
174 __u8 pdrc; | |
175 }; | |
176 | |
177 struct dvd_lu_send_rpcstate { | |
178 __u8 type : 2; | |
179 __u8 vra : 3; | |
180 __u8 ucca : 3; | |
181 __u8 region_mask; | |
182 __u8 rpc_scheme; | |
183 }; | |
184 | |
185 typedef union { | |
186 __u8 type; | |
187 | |
188 struct dvd_lu_send_agid lsa; | |
189 struct dvd_host_send_challenge hsc; | |
190 struct dvd_send_key lsk; | |
191 struct dvd_lu_send_challenge lsc; | |
192 struct dvd_send_key hsk; | |
193 struct dvd_lu_send_title_key lstk; | |
194 struct dvd_lu_send_asf lsasf; | |
195 struct dvd_host_send_rpcstate hrpcs; | |
196 struct dvd_lu_send_rpcstate lrpcs; | |
197 } dvd_authinfo; | |
198 | |
199 | |
200 typedef struct { | |
201 __u16 report_key_length; | |
202 __u8 reserved1; | |
203 __u8 reserved2; | |
204 #if BYTE_ORDER == BIG_ENDIAN | |
205 __u8 type_code : 2; | |
206 __u8 vra : 3; | |
207 __u8 ucca : 3; | |
208 #elif BYTE_ORDER == LITTLE_ENDIAN | |
209 __u8 ucca : 3; | |
210 __u8 vra : 3; | |
211 __u8 type_code : 2; | |
212 #endif | |
213 __u8 region_mask; | |
214 __u8 rpc_scheme; | |
215 __u8 reserved3; | |
216 } rpc_state_t; | |
217 | |
218 /* | |
219 * Stuff for the CDROM ioctls | |
220 */ | |
221 | |
222 #define CDROMREADTOCHDR 0x5305 /* Read TOC header (cdrom_tochdr) */ | |
223 #define CDROMREADTOCENTRY 0x5306 /* Read TOC entry (cdrom_tocentry) */ | |
224 #define CDROMEJECT 0x5309 /* Ejects the cdrom media */ | |
225 #define CDROMCLOSETRAY 0x5319 /* Reverse of CDROMEJECT */ | |
226 #define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ | |
9333
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
227 #define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ |
7027 | 228 #define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) */ |
229 #define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes) */ | |
230 #define CDROMREADRAW 0x5314 /* read data in raw mode (2352 bytes) */ | |
231 | |
232 #define CD_MINS 74 /* max. minutes per CD, not really a limit */ | |
233 #define CD_SECS 60 /* seconds per minute */ | |
234 #define CD_FRAMES 75 /* frames per second */ | |
235 #define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ | |
236 | |
237 #define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ | |
238 #define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */ | |
239 #define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ | |
240 #define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ | |
241 #define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/ | |
242 #define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/ | |
243 | |
244 /* CD-ROM address types (cdrom_tocentry.cdte_format) */ | |
245 #define CDROM_LBA 0x01 /* logical block: first frame is #0 */ | |
246 #define CDROM_MSF 0x02 /* minute-second-frame: binary. not bcd here!*/ | |
247 | |
9333
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
248 /* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */ |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
249 #define CDROM_DATA_TRACK 0x04 |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
250 |
7027 | 251 /* The leadout track is always 0xAA, regardless of # of tracks on disc */ |
252 #define CDROM_LEADOUT 0xAA | |
253 | |
254 /* drive status returned by CDROM_DRIVE_STATUS ioctl */ | |
255 #define CDS_NO_INFO 0 /* if not implemented */ | |
256 #define CDS_NO_DISC 1 | |
257 #define CDS_TRAY_OPEN 2 | |
258 #define CDS_DRIVE_NOT_READY 3 | |
259 #define CDS_DISC_OK 4 | |
260 | |
9333
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
261 /* |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
262 * Return values for CDROM_DISC_STATUS ioctl. |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
263 * Can also return CDS_NO_INFO and CDS_NO_DISC from above |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
264 */ |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
265 #define CDS_AUDIO 100 |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
266 #define CDS_DATA_1 101 |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
267 #define CDS_DATA_2 102 |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
268 #define CDS_XA_2_1 103 |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
269 #define CDS_XA_2_2 104 |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
270 #define CDS_MIXED 105 |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
271 |
7027 | 272 /* For compile compatibility only - we don't support changers */ |
273 #define CDSL_NONE ((int) (~0U>>1)-1) | |
274 #define CDSL_CURRENT ((int) (~0U>>1)) | |
275 | |
9333
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
276 struct cdrom_msf |
7027 | 277 { |
278 __u8 cdmsf_min0; /* start minute */ | |
279 __u8 cdmsf_sec0; /* start second */ | |
280 __u8 cdmsf_frame0; /* start frame */ | |
281 __u8 cdmsf_min1; /* end minute */ | |
282 __u8 cdmsf_sec1; /* end second */ | |
283 __u8 cdmsf_frame1; /* end frame */ | |
284 }; | |
285 | |
9333
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
286 struct cdrom_tochdr |
7027 | 287 { |
288 __u8 cdth_trk0; /* start track */ | |
289 __u8 cdth_trk1; /* end track */ | |
290 }; | |
291 | |
9333
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
292 struct cdrom_msf0 |
7027 | 293 { |
294 __u8 minute; | |
295 __u8 second; | |
296 __u8 frame; | |
297 }; | |
298 | |
9333
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
299 union cdrom_addr |
7027 | 300 { |
301 struct cdrom_msf0 msf; | |
302 int lba; | |
303 }; | |
304 | |
9333
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
305 struct cdrom_tocentry |
7027 | 306 { |
307 __u8 cdte_track; | |
308 __u8 cdte_adr :4; | |
309 __u8 cdte_ctrl :4; | |
310 __u8 cdte_format; | |
311 union cdrom_addr cdte_addr; | |
312 __u8 cdte_datamode; | |
313 }; | |
314 | |
315 struct modesel_head | |
316 { | |
317 __u8 reserved1; | |
318 __u8 medium; | |
319 __u8 reserved2; | |
320 __u8 block_desc_length; | |
321 __u8 density; | |
322 __u8 number_of_blocks_hi; | |
323 __u8 number_of_blocks_med; | |
324 __u8 number_of_blocks_lo; | |
325 __u8 reserved3; | |
326 __u8 block_length_hi; | |
327 __u8 block_length_med; | |
328 __u8 block_length_lo; | |
329 }; | |
9333
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
330 |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
331 typedef struct |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
332 { |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
333 int data; |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
334 int audio; |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
335 int cdi; |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
336 int xa; |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
337 int error; |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
338 } tracktype; |
f0f0f176d298
sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents:
7027
diff
changeset
|
339 |
7027 | 340 #endif /* _DVD_H_ */ |