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