Mercurial > mplayer.hg
annotate libdvdcss/ioctl.h @ 36965:5fb43d5efdca
configure: add CONFIG_CABAC
fix ffmpeg linking
author | michael |
---|---|
date | Tue, 25 Mar 2014 00:15:02 +0000 |
parents | 691431d2289e |
children |
rev | line source |
---|---|
20613 | 1 /***************************************************************************** |
2 * ioctl.h: DVD ioctl replacement function | |
3 ***************************************************************************** | |
4 * Copyright (C) 1999-2001 VideoLAN | |
5 * | |
27462 | 6 * Authors: Sam Hocevar <sam@zoy.org> |
20613 | 7 * |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
31098
9e9595c779cf
libdvdcss: cosmetics: Fix FSF address and program name in license headers.
diego
parents:
27462
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
9e9595c779cf
libdvdcss: cosmetics: Fix FSF address and program name in license headers.
diego
parents:
27462
diff
changeset
|
19 * with libdvdcss; if not, write to the Free Software Foundation, Inc., |
9e9595c779cf
libdvdcss: cosmetics: Fix FSF address and program name in license headers.
diego
parents:
27462
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20613 | 21 *****************************************************************************/ |
22 | |
32265
cda66f57f7a5
Sync some minor changes from upstream libdvdcss, up to r237.
diego
parents:
31098
diff
changeset
|
23 #ifndef DVDCSS_IOCTL_H |
cda66f57f7a5
Sync some minor changes from upstream libdvdcss, up to r237.
diego
parents:
31098
diff
changeset
|
24 #define DVDCSS_IOCTL_H |
cda66f57f7a5
Sync some minor changes from upstream libdvdcss, up to r237.
diego
parents:
31098
diff
changeset
|
25 |
20613 | 26 int ioctl_ReadCopyright ( int, int, int * ); |
27 int ioctl_ReadDiscKey ( int, int *, uint8_t * ); | |
28 int ioctl_ReadTitleKey ( int, int *, int, uint8_t * ); | |
29 int ioctl_ReportAgid ( int, int * ); | |
30 int ioctl_ReportChallenge ( int, int *, uint8_t * ); | |
31 int ioctl_ReportKey1 ( int, int *, uint8_t * ); | |
32 int ioctl_ReportASF ( int, int *, int * ); | |
33 int ioctl_InvalidateAgid ( int, int * ); | |
34 int ioctl_SendChallenge ( int, int *, uint8_t * ); | |
35 int ioctl_SendKey2 ( int, int *, uint8_t * ); | |
36 int ioctl_ReportRPC ( int, int *, int *, int * ); | |
37 | |
38 #define DVD_KEY_SIZE 5 | |
39 #define DVD_CHALLENGE_SIZE 10 | |
40 #define DVD_DISCKEY_SIZE 2048 | |
41 | |
42 /***************************************************************************** | |
43 * Common macro, BeOS specific | |
44 *****************************************************************************/ | |
35952 | 45 #if defined( __BEOS__ ) |
20613 | 46 #define INIT_RDC( TYPE, SIZE ) \ |
35952 | 47 raw_device_command rdc = { 0 }; \ |
20613 | 48 uint8_t p_buffer[ (SIZE)+1 ]; \ |
49 rdc.data = (char *)p_buffer; \ | |
50 rdc.data_length = (SIZE); \ | |
51 BeInitRDC( &rdc, (TYPE) ); | |
52 #endif | |
53 | |
54 /***************************************************************************** | |
55 * Common macro, HP-UX specific | |
56 *****************************************************************************/ | |
57 #if defined( HPUX_SCTL_IO ) | |
58 #define INIT_SCTL_IO( TYPE, SIZE ) \ | |
35952 | 59 struct sctl_io sctl_io = { 0 }; \ |
20613 | 60 uint8_t p_buffer[ (SIZE)+1 ]; \ |
61 sctl_io.data = (void *)p_buffer; \ | |
62 sctl_io.data_length = (SIZE); \ | |
63 HPUXInitSCTL( &sctl_io, (TYPE) ); | |
64 #endif | |
65 | |
66 /***************************************************************************** | |
67 * Common macro, Solaris specific | |
68 *****************************************************************************/ | |
69 #if defined( SOLARIS_USCSI ) | |
70 #define USCSI_TIMEOUT( SC, TO ) ( (SC)->uscsi_timeout = (TO) ) | |
71 #define USCSI_RESID( SC ) ( (SC)->uscsi_resid ) | |
72 #define INIT_USCSI( TYPE, SIZE ) \ | |
35952 | 73 struct uscsi_cmd sc = { 0 }; \ |
20613 | 74 union scsi_cdb rs_cdb; \ |
75 uint8_t p_buffer[ (SIZE)+1 ]; \ | |
76 sc.uscsi_cdb = (caddr_t)&rs_cdb; \ | |
77 sc.uscsi_bufaddr = (caddr_t)p_buffer; \ | |
78 sc.uscsi_buflen = (SIZE); \ | |
79 SolarisInitUSCSI( &sc, (TYPE) ); | |
80 #endif | |
81 | |
82 /***************************************************************************** | |
83 * Common macro, Darwin specific | |
84 *****************************************************************************/ | |
85 #if defined( DARWIN_DVD_IOCTL ) | |
86 #define INIT_DVDIOCTL( DKDVD_TYPE, BUFFER_TYPE, FORMAT ) \ | |
35952 | 87 DKDVD_TYPE dvd = { 0 }; \ |
88 BUFFER_TYPE dvdbs = { 0 }; \ | |
20613 | 89 dvd.format = FORMAT; \ |
90 dvd.buffer = &dvdbs; \ | |
91 dvd.bufferLength = sizeof(dvdbs); | |
92 #endif | |
93 | |
94 /***************************************************************************** | |
95 * Common macro, win32 specific | |
96 *****************************************************************************/ | |
97 #if defined( WIN32 ) | |
98 #define INIT_SPTD( TYPE, SIZE ) \ | |
99 DWORD tmp; \ | |
35952 | 100 SCSI_PASS_THROUGH_DIRECT sptd = { 0 }; \ |
20613 | 101 uint8_t p_buffer[ (SIZE) ]; \ |
102 sptd.Length = sizeof( SCSI_PASS_THROUGH_DIRECT ); \ | |
103 sptd.DataBuffer = p_buffer; \ | |
104 sptd.DataTransferLength = (SIZE); \ | |
105 WinInitSPTD( &sptd, (TYPE) ); | |
106 #define SEND_SPTD( DEV, SPTD, TMP ) \ | |
107 (DeviceIoControl( (HANDLE)(DEV), IOCTL_SCSI_PASS_THROUGH_DIRECT, \ | |
108 (SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \ | |
109 (SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \ | |
110 (TMP), NULL ) ? 0 : -1) | |
111 #define INIT_SSC( TYPE, SIZE ) \ | |
35952 | 112 struct SRB_ExecSCSICmd ssc = { 0 }; \ |
20613 | 113 uint8_t p_buffer[ (SIZE)+1 ]; \ |
35952 | 114 ssc.SRB_BufPointer = (unsigned char *)p_buffer; \ |
20613 | 115 ssc.SRB_BufLen = (SIZE); \ |
116 WinInitSSC( &ssc, (TYPE) ); | |
117 #endif | |
118 | |
119 /***************************************************************************** | |
120 * Common macro, QNX specific | |
121 *****************************************************************************/ | |
122 #if defined( __QNXNTO__ ) | |
123 #define INIT_CPT( TYPE, SIZE ) \ | |
35952 | 124 CAM_PASS_THRU * p_cpt = { 0 }; \ |
20613 | 125 uint8_t * p_buffer; \ |
126 int structSize = sizeof( CAM_PASS_THRU ) + (SIZE); \ | |
127 p_cpt = (CAM_PASS_THRU *) malloc ( structSize ); \ | |
128 p_buffer = (uint8_t *) p_cpt + sizeof( CAM_PASS_THRU ); \ | |
129 p_cpt->cam_data_ptr = sizeof( CAM_PASS_THRU ); \ | |
130 p_cpt->cam_dxfer_len = (SIZE); \ | |
131 QNXInitCPT( p_cpt, (TYPE) ); | |
132 #endif | |
133 | |
134 /***************************************************************************** | |
135 * Common macro, OS2 specific | |
136 *****************************************************************************/ | |
35952 | 137 #if defined( __OS2__ ) |
20613 | 138 #define INIT_SSC( TYPE, SIZE ) \ |
35952 | 139 struct OS2_ExecSCSICmd sdc = { 0 }; \ |
140 uint8_t p_buffer[ (SIZE) + 1 ] = { 0 }; \ | |
20613 | 141 unsigned long ulParamLen; \ |
142 unsigned long ulDataLen; \ | |
143 sdc.data_length = (SIZE); \ | |
144 ulParamLen = sizeof(sdc); \ | |
145 OS2InitSDC( &sdc, (TYPE) ) | |
146 #endif | |
147 | |
148 /***************************************************************************** | |
149 * Additional types, OpenBSD specific | |
150 *****************************************************************************/ | |
151 #if defined( HAVE_OPENBSD_DVD_STRUCT ) | |
152 typedef union dvd_struct dvd_struct; | |
153 typedef union dvd_authinfo dvd_authinfo; | |
154 #endif | |
155 | |
156 /***************************************************************************** | |
157 * Various DVD I/O tables | |
158 *****************************************************************************/ | |
35952 | 159 /* The generic packet command opcodes for CD/DVD Logical Units, |
160 * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ | |
161 #define GPCMD_READ_DVD_STRUCTURE 0xad | |
162 #define GPCMD_REPORT_KEY 0xa4 | |
163 #define GPCMD_SEND_KEY 0xa3 | |
164 /* DVD struct types */ | |
165 #define DVD_STRUCT_PHYSICAL 0x00 | |
166 #define DVD_STRUCT_COPYRIGHT 0x01 | |
167 #define DVD_STRUCT_DISCKEY 0x02 | |
168 #define DVD_STRUCT_BCA 0x03 | |
169 #define DVD_STRUCT_MANUFACT 0x04 | |
170 /* Key formats */ | |
171 #define DVD_REPORT_AGID 0x00 | |
172 #define DVD_REPORT_CHALLENGE 0x01 | |
173 #define DVD_SEND_CHALLENGE 0x01 | |
174 #define DVD_REPORT_KEY1 0x02 | |
175 #define DVD_SEND_KEY2 0x03 | |
176 #define DVD_REPORT_TITLE_KEY 0x04 | |
177 #define DVD_REPORT_ASF 0x05 | |
178 #define DVD_SEND_RPC 0x06 | |
179 #define DVD_REPORT_RPC 0x08 | |
180 #define DVDCSS_INVALIDATE_AGID 0x3f | |
20613 | 181 |
182 /***************************************************************************** | |
183 * win32 ioctl specific | |
184 *****************************************************************************/ | |
185 #if defined( WIN32 ) | |
186 | |
187 #define WIN32_LEAN_AND_MEAN | |
188 #include <windows.h> | |
189 | |
190 #define IOCTL_DVD_START_SESSION CTL_CODE(FILE_DEVICE_DVD, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS) | |
191 #define IOCTL_DVD_READ_KEY CTL_CODE(FILE_DEVICE_DVD, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS) | |
192 #define IOCTL_DVD_SEND_KEY CTL_CODE(FILE_DEVICE_DVD, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS) | |
193 #define IOCTL_DVD_END_SESSION CTL_CODE(FILE_DEVICE_DVD, 0x0403, METHOD_BUFFERED, FILE_READ_ACCESS) | |
194 #define IOCTL_DVD_GET_REGION CTL_CODE(FILE_DEVICE_DVD, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS) | |
195 #define IOCTL_DVD_SEND_KEY2 CTL_CODE(FILE_DEVICE_DVD, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) | |
196 #define IOCTL_DVD_READ_STRUCTURE CTL_CODE(FILE_DEVICE_DVD, 0x0450, METHOD_BUFFERED, FILE_READ_ACCESS) | |
197 #define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(FILE_DEVICE_CONTROLLER, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) | |
198 | |
199 #define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY)) | |
200 #define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY)) | |
201 #define DVD_TITLE_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY)) | |
202 #define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY)) | |
203 #define DVD_RPC_KEY_LENGTH (sizeof(DVD_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY)) | |
204 #define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY)) | |
205 | |
206 #define DVD_COPYRIGHT_MASK 0x00000040 | |
207 #define DVD_NOT_COPYRIGHTED 0x00000000 | |
208 #define DVD_COPYRIGHTED 0x00000040 | |
209 | |
210 #define DVD_SECTOR_PROTECT_MASK 0x00000020 | |
211 #define DVD_SECTOR_NOT_PROTECTED 0x00000000 | |
212 #define DVD_SECTOR_PROTECTED 0x00000020 | |
213 | |
214 #define SCSI_IOCTL_DATA_OUT 0 | |
215 #define SCSI_IOCTL_DATA_IN 1 | |
216 | |
217 typedef ULONG DVD_SESSION_ID, *PDVD_SESSION_ID; | |
218 | |
219 typedef enum DVD_STRUCTURE_FORMAT { | |
220 DvdPhysicalDescriptor, | |
221 DvdCopyrightDescriptor, | |
222 DvdDiskKeyDescriptor, | |
223 DvdBCADescriptor, | |
224 DvdManufacturerDescriptor, | |
225 DvdMaxDescriptor | |
226 } DVD_STRUCTURE_FORMAT, *PDVD_STRUCTURE_FORMAT; | |
227 | |
228 typedef struct DVD_READ_STRUCTURE { | |
229 LARGE_INTEGER BlockByteOffset; | |
230 DVD_STRUCTURE_FORMAT Format; | |
231 DVD_SESSION_ID SessionId; | |
232 UCHAR LayerNumber; | |
233 } DVD_READ_STRUCTURE, *PDVD_READ_STRUCTURE; | |
234 | |
24535
b015cbd37591
Leading underscores in identifiers are reserved in C.
diego
parents:
20613
diff
changeset
|
235 typedef struct DVD_COPYRIGHT_DESCRIPTOR { |
20613 | 236 UCHAR CopyrightProtectionType; |
237 UCHAR RegionManagementInformation; | |
238 USHORT Reserved; | |
239 } DVD_COPYRIGHT_DESCRIPTOR, *PDVD_COPYRIGHT_DESCRIPTOR; | |
240 | |
241 typedef enum | |
242 { | |
243 DvdChallengeKey = 0x01, | |
244 DvdBusKey1, | |
245 DvdBusKey2, | |
246 DvdTitleKey, | |
247 DvdAsf, | |
248 DvdSetRpcKey = 0x6, | |
249 DvdGetRpcKey = 0x8, | |
250 DvdDiskKey = 0x80, | |
251 DvdInvalidateAGID = 0x3f | |
252 } DVD_KEY_TYPE; | |
253 | |
24535
b015cbd37591
Leading underscores in identifiers are reserved in C.
diego
parents:
20613
diff
changeset
|
254 typedef struct DVD_COPY_PROTECT_KEY |
20613 | 255 { |
256 ULONG KeyLength; | |
257 DVD_SESSION_ID SessionId; | |
258 DVD_KEY_TYPE KeyType; | |
259 ULONG KeyFlags; | |
260 union | |
261 { | |
262 struct | |
263 { | |
264 ULONG FileHandle; | |
265 ULONG Reserved; // used for NT alignment | |
266 }; | |
267 LARGE_INTEGER TitleOffset; | |
268 } Parameters; | |
269 UCHAR KeyData[0]; | |
270 } DVD_COPY_PROTECT_KEY, *PDVD_COPY_PROTECT_KEY; | |
271 | |
24535
b015cbd37591
Leading underscores in identifiers are reserved in C.
diego
parents:
20613
diff
changeset
|
272 typedef struct DVD_ASF |
20613 | 273 { |
274 UCHAR Reserved0[3]; | |
275 UCHAR SuccessFlag:1; | |
276 UCHAR Reserved1:7; | |
277 } DVD_ASF, * PDVD_ASF; | |
278 | |
24535
b015cbd37591
Leading underscores in identifiers are reserved in C.
diego
parents:
20613
diff
changeset
|
279 typedef struct DVD_RPC_KEY |
20613 | 280 { |
281 UCHAR UserResetsAvailable:3; | |
282 UCHAR ManufacturerResetsAvailable:3; | |
283 UCHAR TypeCode:2; | |
284 UCHAR RegionMask; | |
285 UCHAR RpcScheme; | |
286 UCHAR Reserved2[1]; | |
287 } DVD_RPC_KEY, * PDVD_RPC_KEY; | |
288 | |
24535
b015cbd37591
Leading underscores in identifiers are reserved in C.
diego
parents:
20613
diff
changeset
|
289 typedef struct SCSI_PASS_THROUGH_DIRECT |
20613 | 290 { |
291 USHORT Length; | |
292 UCHAR ScsiStatus; | |
293 UCHAR PathId; | |
294 UCHAR TargetId; | |
295 UCHAR Lun; | |
296 UCHAR CdbLength; | |
297 UCHAR SenseInfoLength; | |
298 UCHAR DataIn; | |
299 ULONG DataTransferLength; | |
300 ULONG TimeOutValue; | |
301 PVOID DataBuffer; | |
302 ULONG SenseInfoOffset; | |
303 UCHAR Cdb[16]; | |
304 } SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT; | |
305 | |
306 /***************************************************************************** | |
307 * win32 aspi specific | |
308 *****************************************************************************/ | |
309 | |
310 typedef DWORD (CALLBACK *GETASPI32SUPPORTINFO)(VOID); | |
311 typedef DWORD (CALLBACK *SENDASPI32COMMAND)(LPVOID); | |
312 | |
313 #define WIN2K ( GetVersion() < 0x80000000 ) | |
314 #define ASPI_HAID 0 | |
315 #define ASPI_TARGET 0 | |
316 #define DTYPE_CDROM 0x05 | |
317 | |
318 #define SENSE_LEN 0x0E | |
319 #define SC_GET_DEV_TYPE 0x01 | |
320 #define SC_EXEC_SCSI_CMD 0x02 | |
321 #define SC_GET_DISK_INFO 0x06 | |
322 #define SS_COMP 0x01 | |
323 #define SS_PENDING 0x00 | |
324 #define SS_NO_ADAPTERS 0xE8 | |
325 #define SRB_DIR_IN 0x08 | |
326 #define SRB_DIR_OUT 0x10 | |
327 #define SRB_EVENT_NOTIFY 0x40 | |
328 | |
329 struct w32_aspidev | |
330 { | |
331 long hASPI; | |
332 short i_sid; | |
333 int i_blocks; | |
334 SENDASPI32COMMAND lpSendCommand; | |
335 }; | |
336 | |
337 #pragma pack(1) | |
338 | |
339 struct SRB_GetDiskInfo | |
340 { | |
341 unsigned char SRB_Cmd; | |
342 unsigned char SRB_Status; | |
343 unsigned char SRB_HaId; | |
344 unsigned char SRB_Flags; | |
345 unsigned long SRB_Hdr_Rsvd; | |
346 unsigned char SRB_Target; | |
347 unsigned char SRB_Lun; | |
348 unsigned char SRB_DriveFlags; | |
349 unsigned char SRB_Int13HDriveInfo; | |
350 unsigned char SRB_Heads; | |
351 unsigned char SRB_Sectors; | |
352 unsigned char SRB_Rsvd1[22]; | |
353 }; | |
354 | |
355 struct SRB_GDEVBlock | |
356 { | |
357 unsigned char SRB_Cmd; | |
358 unsigned char SRB_Status; | |
359 unsigned char SRB_HaId; | |
360 unsigned char SRB_Flags; | |
361 unsigned long SRB_Hdr_Rsvd; | |
362 unsigned char SRB_Target; | |
363 unsigned char SRB_Lun; | |
364 unsigned char SRB_DeviceType; | |
365 unsigned char SRB_Rsvd1; | |
366 }; | |
367 | |
368 struct SRB_ExecSCSICmd | |
369 { | |
370 unsigned char SRB_Cmd; | |
371 unsigned char SRB_Status; | |
372 unsigned char SRB_HaId; | |
373 unsigned char SRB_Flags; | |
374 unsigned long SRB_Hdr_Rsvd; | |
375 unsigned char SRB_Target; | |
376 unsigned char SRB_Lun; | |
377 unsigned short SRB_Rsvd1; | |
378 unsigned long SRB_BufLen; | |
379 unsigned char *SRB_BufPointer; | |
380 unsigned char SRB_SenseLen; | |
381 unsigned char SRB_CDBLen; | |
382 unsigned char SRB_HaStat; | |
383 unsigned char SRB_TargStat; | |
384 unsigned long *SRB_PostProc; | |
385 unsigned char SRB_Rsvd2[20]; | |
386 unsigned char CDBByte[16]; | |
387 unsigned char SenseArea[SENSE_LEN+2]; | |
388 }; | |
389 | |
390 #pragma pack() | |
391 | |
392 #endif | |
393 | |
394 /***************************************************************************** | |
395 * OS2 ioctl specific | |
396 *****************************************************************************/ | |
35952 | 397 #if defined( __OS2__ ) |
20613 | 398 |
399 #define CDROMDISK_EXECMD 0x7A | |
400 | |
401 #define EX_DIRECTION_IN 0x01 | |
402 #define EX_PLAYING_CHK 0x02 | |
403 | |
404 #pragma pack(1) | |
405 | |
406 struct OS2_ExecSCSICmd | |
407 { | |
408 unsigned long id_code; // 'CD01' | |
409 unsigned short data_length; // length of the Data Packet | |
410 unsigned short cmd_length; // length of the Command Buffer | |
411 unsigned short flags; // flags | |
412 unsigned char command[16]; // Command Buffer for SCSI command | |
413 | |
414 } OS2_ExecSCSICmd; | |
415 | |
416 #pragma pack() | |
417 | |
418 #endif | |
32265
cda66f57f7a5
Sync some minor changes from upstream libdvdcss, up to r237.
diego
parents:
31098
diff
changeset
|
419 |
cda66f57f7a5
Sync some minor changes from upstream libdvdcss, up to r237.
diego
parents:
31098
diff
changeset
|
420 #endif /* DVDCSS_IOCTL_H */ |