options: fix -ar default back to enabled if available
[mplayer.git] / libdvdcss / bsdi_dvd.h
blobf4c8b89f6dbf726cf73f0115bf85de3c5642ad62
1 /*
2 * $Id$
3 */
5 #ifndef DVDCSS_DVD_H
6 #define DVDCSS_DVD_H
8 #include <sys/cdefs.h>
9 #include <machine/endian.h>
10 #include <sys/ioctl.h>
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
18 #define ioctl(a,b,c) dvd_cdrom_ioctl((a),(b),(c))
20 typedef unsigned char __u8;
21 typedef unsigned short __u16;
22 typedef unsigned int __u32;
24 #define DVD_READ_STRUCT 0x5390 /* Read structure */
25 #define DVD_WRITE_STRUCT 0x5391 /* Write structure */
26 #define DVD_AUTH 0x5392 /* Authentication */
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
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;
50 struct dvd_physical {
51 __u8 type;
52 __u8 layer_num;
53 struct dvd_layer layer[4];
56 struct dvd_copyright {
57 __u8 type;
59 __u8 layer_num;
60 __u8 cpst;
61 __u8 rmi;
64 struct dvd_disckey {
65 __u8 type;
67 unsigned agid : 2;
68 __u8 value[2048];
71 struct dvd_bca {
72 __u8 type;
74 int len;
75 __u8 value[188];
78 struct dvd_manufact {
79 __u8 type;
81 __u8 layer_num;
82 int len;
83 __u8 value[2048];
86 typedef union {
87 __u8 type;
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;
97 * DVD authentication ioctl
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
107 /* Termination states */
108 #define DVD_AUTH_ESTABLISHED 5
109 #define DVD_AUTH_FAILURE 6
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
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. */
122 struct dvd_lu_send_agid {
123 __u8 type;
124 unsigned agid : 2;
127 struct dvd_host_send_challenge {
128 __u8 type;
129 unsigned agid : 2;
131 dvd_challenge chal;
134 struct dvd_send_key {
135 __u8 type;
136 unsigned agid : 2;
138 dvd_key key;
141 struct dvd_lu_send_challenge {
142 __u8 type;
143 unsigned agid : 2;
145 dvd_challenge chal;
148 #define DVD_CPM_NO_COPYRIGHT 0
149 #define DVD_CPM_COPYRIGHTED 1
151 #define DVD_CP_SEC_NONE 0
152 #define DVD_CP_SEC_EXIST 1
154 #define DVD_CGMS_UNRESTRICTED 0
155 #define DVD_CGMS_SINGLE 2
156 #define DVD_CGMS_RESTRICTED 3
158 struct dvd_lu_send_title_key {
159 __u8 type;
160 unsigned agid : 2;
162 dvd_key title_key;
163 int lba;
164 unsigned cpm : 1;
165 unsigned cp_sec : 1;
166 unsigned cgms : 2;
169 struct dvd_lu_send_asf {
170 __u8 type;
171 unsigned agid : 2;
173 unsigned asf : 1;
176 struct dvd_host_send_rpcstate {
177 __u8 type;
178 __u8 pdrc;
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;
189 typedef union {
190 __u8 type;
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;
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;
223 * Stuff for the CDROM ioctls
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) */
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 */
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*/
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!*/
252 /* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */
253 #define CDROM_DATA_TRACK 0x04
255 /* The leadout track is always 0xAA, regardless of # of tracks on disc */
256 #define CDROM_LEADOUT 0xAA
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
266 * Return values for CDROM_DISC_STATUS ioctl.
267 * Can also return CDS_NO_INFO and CDS_NO_DISC from above
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
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))
280 struct cdrom_msf
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 */
290 struct cdrom_tochdr
292 __u8 cdth_trk0; /* start track */
293 __u8 cdth_trk1; /* end track */
296 struct cdrom_msf0
298 __u8 minute;
299 __u8 second;
300 __u8 frame;
303 union cdrom_addr
305 struct cdrom_msf0 msf;
306 int lba;
309 struct cdrom_tocentry
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;
319 struct modesel_head
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;
335 typedef struct
337 int data;
338 int audio;
339 int cdi;
340 int xa;
341 int error;
342 } tracktype;
344 #endif /* DVDCSS_DVD_H */