annotate libmpdvdkit2/ioctl.c @ 15841:d78b20a4e113

Synced with 1.66
author jheryan
date Tue, 28 Jun 2005 13:29:27 +0000
parents c2ddedd0619e
children 954cdf2171f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2 * ioctl.c: DVD ioctl replacement function
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
3 *****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
4 * Copyright (C) 1999-2001 VideoLAN
14860
c2ddedd0619e Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents: 10272
diff changeset
5 *
c2ddedd0619e Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents: 10272
diff changeset
6 * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
c2ddedd0619e Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents: 10272
diff changeset
7 * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
8 * $Id$
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
9 *
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
10 * Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
11 * Samuel Hocevar <sam@zoy.org>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
12 * Jon Lech Johansen <jon-vl@nanocrew.net>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
13 * Håkan Hjort <d95hjort@dtek.chalmers.se>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
14 * Eugenio Jarosiewicz <ej0@cise.ufl.edu>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
15 * David Siebörger <drs-videolan@rucus.ru.ac.za>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
16 * Alex Strelnikov <lelik@os2.ru>
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
17 * Gildas Bazin <gbazin@netcourrier.com>
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
18 *
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
19 * This program is free software; you can redistribute it and/or modify
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
20 * it under the terms of the GNU General Public License as published by
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
21 * the Free Software Foundation; either version 2 of the License, or
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
22 * (at your option) any later version.
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
23 *
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
27 * GNU General Public License for more details.
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
28 *
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
30 * along with this program; if not, write to the Free Software
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
31 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
32 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
33
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
34 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
35 * Preamble
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
36 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
37 #include "config.h"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
38
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
39 #include <stdio.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
40
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
41 #include <string.h> /* memcpy(), memset() */
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
42 #include <sys/types.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
43
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
44 #if defined( WIN32 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
45 # include <windows.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
46 # include <winioctl.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
47 #elif defined ( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
48 # define INCL_DOSFILEMGR
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
49 # define INCL_DOSDEVICES
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
50 # define INCL_DOSDEVIOCTL
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
51 # define INCL_DOSERRORS
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
52 # include <os2.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
53 # include <sys/ioctl.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
54 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
55 # include <netinet/in.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
56 # include <sys/ioctl.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
57 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
58
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
59 #ifdef DVD_STRUCT_IN_SYS_CDIO_H
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
60 # include <sys/cdio.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
61 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
62 #ifdef DVD_STRUCT_IN_SYS_DVDIO_H
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
63 # include <sys/dvdio.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
64 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
65 #ifdef DVD_STRUCT_IN_LINUX_CDROM_H
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
66 # include <linux/cdrom.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
67 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
68 #ifdef DVD_STRUCT_IN_DVD_H
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
69 # include <dvd.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
70 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
71 #ifdef DVD_STRUCT_IN_BSDI_DVDIOCTL_DVD_H
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
72 # include "bsdi_dvd.h"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
73 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
74 #ifdef SYS_BEOS
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
75 # include <malloc.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
76 # include <scsi.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
77 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
78 #ifdef HPUX_SCTL_IO
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
79 # include <sys/scsi.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
80 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
81 #ifdef SOLARIS_USCSI
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
82 # include <dlfcn.h>
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
83 # include <unistd.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
84 # include <stropts.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
85 # include <sys/scsi/scsi_types.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
86 # include <sys/scsi/impl/uscsi.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
87 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
88 #ifdef DARWIN_DVD_IOCTL
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
89 # include <IOKit/storage/IODVDMediaBSDClient.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
90 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
91 #ifdef __QNXNTO__
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
92 # include <sys/mman.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
93 # include <sys/dcmd_cam.h>
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
94 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
95
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
96 #include "common.h"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
97
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
98 #include "ioctl.h"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
99
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
100 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
101 * Local prototypes, BeOS specific
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
102 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
103 #if defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
104 static void BeInitRDC ( raw_device_command *, int );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
105 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
106
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
107 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
108 * Local prototypes, HP-UX specific
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
109 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
110 #if defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
111 static void HPUXInitSCTL ( struct sctl_io *sctl_io, int i_type );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
112 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
113
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
114 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
115 * Local prototypes, Solaris specific
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
116 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
117 #if defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
118 static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
119 static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
120 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
121
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
122 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
123 * Local prototypes, win32 (aspi) specific
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
124 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
125 #if defined( WIN32 )
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
126 static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
127 static void WinInitSSC ( struct SRB_ExecSCSICmd *, int );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
128 static int WinSendSSC ( int, struct SRB_ExecSCSICmd * );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
129 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
130
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
131 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
132 * Local prototypes, QNX specific
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
133 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
134 #if defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
135 static void QNXInitCPT ( CAM_PASS_THRU *, int );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
136 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
137
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
138 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
139 * Local prototypes, OS2 specific
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
140 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
141 #if defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
142 static void OS2InitSDC( struct OS2_ExecSCSICmd *, int );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
143 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
144
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
145 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
146 * ioctl_ReadCopyright: check whether the disc is encrypted or not
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
147 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
148 int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
149 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
150 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
151
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
152 #if defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
153 dvd_struct dvd;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
154
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
155 memset( &dvd, 0, sizeof( dvd ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
156 dvd.type = DVD_STRUCT_COPYRIGHT;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
157 dvd.copyright.layer_num = i_layer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
158
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
159 i_ret = ioctl( i_fd, DVD_READ_STRUCT, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
160
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
161 *pi_copyright = dvd.copyright.cpst;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
162
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
163 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
164 struct dvd_struct dvd;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
165
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
166 memset( &dvd, 0, sizeof( dvd ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
167 dvd.format = DVD_STRUCT_COPYRIGHT;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
168 dvd.layer_num = i_layer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
169
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
170 i_ret = ioctl( i_fd, DVDIOCREADSTRUCTURE, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
171
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
172 *pi_copyright = dvd.cpst;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
173
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
174 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
175 INIT_RDC( GPCMD_READ_DVD_STRUCTURE, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
176
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
177 rdc.command[ 6 ] = i_layer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
178 rdc.command[ 7 ] = DVD_STRUCT_COPYRIGHT;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
179
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
180 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
181
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
182 *pi_copyright = p_buffer[ 4 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
183
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
184 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
185 INIT_SCTL_IO( GPCMD_READ_DVD_STRUCTURE, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
186
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
187 sctl_io.cdb[ 6 ] = i_layer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
188 sctl_io.cdb[ 7 ] = DVD_STRUCT_COPYRIGHT;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
189
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
190 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
191
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
192 *pi_copyright = p_buffer[ 4 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
193
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
194 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
195 INIT_USCSI( GPCMD_READ_DVD_STRUCTURE, 8 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
196
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
197 rs_cdb.cdb_opaque[ 6 ] = i_layer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
198 rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_COPYRIGHT;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
199
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
200 i_ret = SolarisSendUSCSI(i_fd, &sc);
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
201
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
202 if( i_ret < 0 || sc.uscsi_status ) {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
203 i_ret = -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
204 }
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
205
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
206 *pi_copyright = p_buffer[ 4 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
207 /* s->copyright.rmi = p_buffer[ 5 ]; */
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
208
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
209 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
210 INIT_DVDIOCTL( dk_dvd_read_structure_t, DVDCopyrightInfo,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
211 kDVDStructureFormatCopyrightInfo );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
212
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
213 dvd.layer = i_layer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
214
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
215 i_ret = ioctl( i_fd, DKIOCDVDREADSTRUCTURE, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
216
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
217 *pi_copyright = dvdbs.copyrightProtectionSystemType;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
218
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
219 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
220 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
221 {
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
222 INIT_SPTD( GPCMD_READ_DVD_STRUCTURE, 8 );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
223
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
224 /* When using IOCTL_DVD_READ_STRUCTURE and
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
225 DVD_COPYRIGHT_DESCRIPTOR, CopyrightProtectionType
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
226 seems to be always 6 ???
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
227 To work around this MS bug we try to send a raw scsi command
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
228 instead (if we've got enough privileges to do so). */
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
229
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
230 sptd.Cdb[ 6 ] = i_layer;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
231 sptd.Cdb[ 7 ] = DVD_STRUCT_COPYRIGHT;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
232
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
233 i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
234
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
235 if( i_ret == 0 )
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
236 {
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
237 *pi_copyright = p_buffer[ 4 ];
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
238 }
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
239 }
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
240 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
241 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
242 INIT_SSC( GPCMD_READ_DVD_STRUCTURE, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
243
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
244 ssc.CDBByte[ 6 ] = i_layer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
245 ssc.CDBByte[ 7 ] = DVD_STRUCT_COPYRIGHT;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
246
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
247 i_ret = WinSendSSC( i_fd, &ssc );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
248
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
249 *pi_copyright = p_buffer[ 4 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
250 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
251
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
252 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
253
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
254 INIT_CPT( GPCMD_READ_DVD_STRUCTURE, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
255
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
256 p_cpt->cam_cdb[ 6 ] = i_layer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
257 p_cpt->cam_cdb[ 7 ] = DVD_STRUCT_COPYRIGHT;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
258
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
259 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
260
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
261 *pi_copyright = p_buffer[4];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
262
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
263 #elif defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
264 INIT_SSC( GPCMD_READ_DVD_STRUCTURE, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
265
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
266 sdc.command[ 6 ] = i_layer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
267 sdc.command[ 7 ] = DVD_STRUCT_COPYRIGHT;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
268
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
269 i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
270 &sdc, sizeof(sdc), &ulParamLen,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
271 p_buffer, sizeof(p_buffer), &ulDataLen);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
272
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
273 *pi_copyright = p_buffer[ 4 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
274
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
275 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
276 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
277
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
278 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
279 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
280 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
281
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
282 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
283 * ioctl_ReadDiscKey: get the disc key
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
284 *****************************************************************************/
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
285 int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
286 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
287 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
288
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
289 #if defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
290 dvd_struct dvd;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
291
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
292 memset( &dvd, 0, sizeof( dvd ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
293 dvd.type = DVD_STRUCT_DISCKEY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
294 dvd.disckey.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
295 memset( dvd.disckey.value, 0, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
296
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
297 i_ret = ioctl( i_fd, DVD_READ_STRUCT, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
298
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
299 if( i_ret < 0 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
300 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
301 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
302 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
303
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
304 memcpy( p_key, dvd.disckey.value, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
305
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
306 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
307 struct dvd_struct dvd;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
308
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
309 memset( &dvd, 0, sizeof( dvd ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
310 dvd.format = DVD_STRUCT_DISCKEY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
311 dvd.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
312 memset( dvd.data, 0, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
313
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
314 i_ret = ioctl( i_fd, DVDIOCREADSTRUCTURE, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
315
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
316 if( i_ret < 0 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
317 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
318 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
319 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
320
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
321 memcpy( p_key, dvd.data, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
322
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
323 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
324 INIT_RDC( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
325
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
326 rdc.command[ 7 ] = DVD_STRUCT_DISCKEY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
327 rdc.command[ 10 ] = *pi_agid << 6;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
328
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
329 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
330
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
331 if( i_ret < 0 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
332 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
333 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
334 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
335
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
336 memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
337
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
338 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
339 INIT_SCTL_IO( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
340
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
341 sctl_io.cdb[ 7 ] = DVD_STRUCT_DISCKEY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
342 sctl_io.cdb[ 10 ] = *pi_agid << 6;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
343
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
344 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
345
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
346 if( i_ret < 0 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
347 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
348 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
349 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
350
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
351 memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
352
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
353 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
354 INIT_USCSI( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
355
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
356 rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_DISCKEY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
357 rs_cdb.cdb_opaque[ 10 ] = *pi_agid << 6;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
358
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
359 i_ret = SolarisSendUSCSI( i_fd, &sc );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
360
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
361 if( i_ret < 0 || sc.uscsi_status )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
362 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
363 i_ret = -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
364 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
365 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
366
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
367 memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
368
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
369 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
370 INIT_DVDIOCTL( dk_dvd_read_structure_t, DVDDiscKeyInfo,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
371 kDVDStructureFormatDiscKeyInfo );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
372
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
373 dvd.grantID = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
374
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
375 i_ret = ioctl( i_fd, DKIOCDVDREADSTRUCTURE, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
376
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
377 memcpy( p_key, dvdbs.discKeyStructures, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
378
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
379 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
380 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
381 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
382 DWORD tmp;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
383 uint8_t buffer[DVD_DISK_KEY_LENGTH];
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
384 PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
385
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
386 memset( &buffer, 0, sizeof( buffer ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
387
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
388 key->KeyLength = DVD_DISK_KEY_LENGTH;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
389 key->SessionId = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
390 key->KeyType = DvdDiskKey;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
391 key->KeyFlags = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
392
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
393 i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
394 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
395
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
396 if( i_ret < 0 )
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
397 {
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
398 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
399 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
400
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
401 memcpy( p_key, key->KeyData, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
402 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
403 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
404 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
405 INIT_SSC( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
406
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
407 ssc.CDBByte[ 7 ] = DVD_STRUCT_DISCKEY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
408 ssc.CDBByte[ 10 ] = *pi_agid << 6;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
409
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
410 i_ret = WinSendSSC( i_fd, &ssc );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
411
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
412 if( i_ret < 0 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
413 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
414 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
415 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
416
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
417 memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
418 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
419
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
420 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
421
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
422 INIT_CPT( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
423
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
424 p_cpt->cam_cdb[ 7 ] = DVD_STRUCT_DISCKEY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
425 p_cpt->cam_cdb[ 10 ] = *pi_agid << 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
426
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
427 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
428
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
429 memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
430
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
431 #elif defined ( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
432 INIT_SSC( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
433
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
434 sdc.command[ 7 ] = DVD_STRUCT_DISCKEY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
435 sdc.command[ 10 ] = *pi_agid << 6;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
436
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
437 i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
438 &sdc, sizeof(sdc), &ulParamLen,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
439 p_buffer, sizeof(p_buffer), &ulDataLen);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
440
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
441 if( i_ret < 0 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
442 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
443 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
444 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
445
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
446 memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
447
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
448 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
449 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
450
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
451 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
452 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
453 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
454
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
455 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
456 * ioctl_ReadTitleKey: get the title key
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
457 *****************************************************************************/
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
458 int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
459 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
460 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
461
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
462 #if defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
463 dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
464
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
465 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
466 auth_info.type = DVD_LU_SEND_TITLE_KEY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
467 auth_info.lstk.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
468 auth_info.lstk.lba = i_pos;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
469
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
470 i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
471
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
472 memcpy( p_key, auth_info.lstk.title_key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
473
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
474 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
475 struct dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
476
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
477 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
478 auth_info.format = DVD_REPORT_TITLE_KEY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
479 auth_info.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
480 auth_info.lba = i_pos;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
481
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
482 i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
483
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
484 memcpy( p_key, auth_info.keychal, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
485
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
486 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
487 INIT_RDC( GPCMD_REPORT_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
488
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
489 rdc.command[ 2 ] = ( i_pos >> 24 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
490 rdc.command[ 3 ] = ( i_pos >> 16 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
491 rdc.command[ 4 ] = ( i_pos >> 8 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
492 rdc.command[ 5 ] = ( i_pos ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
493 rdc.command[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
494
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
495 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
496
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
497 memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
498
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
499 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
500 INIT_SCTL_IO( GPCMD_REPORT_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
501
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
502 sctl_io.cdb[ 2 ] = ( i_pos >> 24 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
503 sctl_io.cdb[ 3 ] = ( i_pos >> 16 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
504 sctl_io.cdb[ 4 ] = ( i_pos >> 8 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
505 sctl_io.cdb[ 5 ] = ( i_pos ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
506 sctl_io.cdb[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
507
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
508 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
509
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
510 memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
511
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
512 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
513 INIT_USCSI( GPCMD_REPORT_KEY, 12 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
514
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
515 rs_cdb.cdb_opaque[ 2 ] = ( i_pos >> 24 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
516 rs_cdb.cdb_opaque[ 3 ] = ( i_pos >> 16 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
517 rs_cdb.cdb_opaque[ 4 ] = ( i_pos >> 8 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
518 rs_cdb.cdb_opaque[ 5 ] = ( i_pos ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
519 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
520
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
521 i_ret = SolarisSendUSCSI( i_fd, &sc );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
522
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
523 if( i_ret < 0 || sc.uscsi_status )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
524 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
525 i_ret = -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
526 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
527
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
528 /* Do we want to return the cp_sec flag perhaps? */
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
529 /* a->lstk.cpm = (buf[ 4 ] >> 7) & 1; */
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
530 /* a->lstk.cp_sec = (buf[ 4 ] >> 6) & 1; */
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
531 /* a->lstk.cgms = (buf[ 4 ] >> 4) & 3; */
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
532
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
533 memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
534
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
535 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
536 INIT_DVDIOCTL( dk_dvd_report_key_t, DVDTitleKeyInfo,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
537 kDVDKeyFormatTitleKey );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
538
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
539 dvd.address = i_pos;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
540 dvd.grantID = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
541 dvd.keyClass = kDVDKeyClassCSS_CPPM_CPRM;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
542
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
543 i_ret = ioctl( i_fd, DKIOCDVDREPORTKEY, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
544
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
545 memcpy( p_key, dvdbs.titleKeyValue, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
546
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
547 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
548 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
549 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
550 DWORD tmp;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
551 uint8_t buffer[DVD_TITLE_KEY_LENGTH];
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
552 PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
553
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
554 memset( &buffer, 0, sizeof( buffer ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
555
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
556 key->KeyLength = DVD_TITLE_KEY_LENGTH;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
557 key->SessionId = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
558 key->KeyType = DvdTitleKey;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
559 key->KeyFlags = 0;
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
560 key->Parameters.TitleOffset.QuadPart = (LONGLONG) i_pos *
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
561 2048 /*DVDCSS_BLOCK_SIZE*/;
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
562
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
563 i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
564 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
565
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
566 memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
567 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
568 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
569 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
570 INIT_SSC( GPCMD_REPORT_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
571
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
572 ssc.CDBByte[ 2 ] = ( i_pos >> 24 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
573 ssc.CDBByte[ 3 ] = ( i_pos >> 16 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
574 ssc.CDBByte[ 4 ] = ( i_pos >> 8 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
575 ssc.CDBByte[ 5 ] = ( i_pos ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
576 ssc.CDBByte[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
577
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
578 i_ret = WinSendSSC( i_fd, &ssc );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
579
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
580 memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
581 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
582
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
583 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
584
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
585 INIT_CPT( GPCMD_REPORT_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
586
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
587 p_cpt->cam_cdb[ 2 ] = ( i_pos >> 24 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
588 p_cpt->cam_cdb[ 3 ] = ( i_pos >> 16 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
589 p_cpt->cam_cdb[ 4 ] = ( i_pos >> 8 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
590 p_cpt->cam_cdb[ 5 ] = ( i_pos ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
591 p_cpt->cam_cdb[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
592
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
593 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
594
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
595 memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
596
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
597 #elif defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
598 INIT_SSC( GPCMD_REPORT_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
599
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
600 sdc.command[ 2 ] = ( i_pos >> 24 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
601 sdc.command[ 3 ] = ( i_pos >> 16 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
602 sdc.command[ 4 ] = ( i_pos >> 8 ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
603 sdc.command[ 5 ] = ( i_pos ) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
604 sdc.command[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
605
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
606 i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
607 &sdc, sizeof(sdc), &ulParamLen,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
608 p_buffer, sizeof(p_buffer), &ulDataLen);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
609
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
610 memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
611
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
612 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
613 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
614
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
615 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
616
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
617 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
618 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
619
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
620
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
621 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
622 * ioctl_ReportAgid: get AGID from the drive
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
623 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
624 int ioctl_ReportAgid( int i_fd, int *pi_agid )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
625 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
626 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
627
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
628 #if defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
629 dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
630
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
631 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
632 auth_info.type = DVD_LU_SEND_AGID;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
633 auth_info.lsa.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
634
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
635 i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
636
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
637 *pi_agid = auth_info.lsa.agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
638
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
639 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
640 struct dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
641
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
642 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
643 auth_info.format = DVD_REPORT_AGID;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
644 auth_info.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
645
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
646 i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
647
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
648 *pi_agid = auth_info.agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
649
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
650 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
651 INIT_RDC( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
652
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
653 rdc.command[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
654
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
655 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
656
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
657 *pi_agid = p_buffer[ 7 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
658
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
659 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
660 INIT_SCTL_IO( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
661
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
662 sctl_io.cdb[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
663
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
664 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
665
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
666 *pi_agid = p_buffer[ 7 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
667
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
668 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
669 INIT_USCSI( GPCMD_REPORT_KEY, 8 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
670
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
671 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
672
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
673 i_ret = SolarisSendUSCSI( i_fd, &sc );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
674
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
675 if( i_ret < 0 || sc.uscsi_status )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
676 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
677 i_ret = -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
678 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
679
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
680 *pi_agid = p_buffer[ 7 ] >> 6;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
681
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
682 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
683 INIT_DVDIOCTL( dk_dvd_report_key_t, DVDAuthenticationGrantIDInfo,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
684 kDVDKeyFormatAGID_CSS );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
685
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
686 dvd.grantID = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
687 dvd.keyClass = kDVDKeyClassCSS_CPPM_CPRM;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
688
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
689 i_ret = ioctl( i_fd, DKIOCDVDREPORTKEY, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
690
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
691 *pi_agid = dvdbs.grantID;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
692
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
693 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
694 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
695 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
696 ULONG id;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
697 DWORD tmp;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
698
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
699 i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_START_SESSION,
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
700 &tmp, 4, &id, sizeof( id ), &tmp, NULL ) ? 0 : -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
701
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
702 *pi_agid = id;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
703 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
704 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
705 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
706 INIT_SSC( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
707
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
708 ssc.CDBByte[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
709
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
710 i_ret = WinSendSSC( i_fd, &ssc );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
711
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
712 *pi_agid = p_buffer[ 7 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
713 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
714
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
715 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
716
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
717 INIT_CPT( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
718
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
719 p_cpt->cam_cdb[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
720
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
721 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
722
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
723 *pi_agid = p_buffer[ 7 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
724
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
725 #elif defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
726 INIT_SSC( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
727
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
728 sdc.command[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
729
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
730 i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
731 &sdc, sizeof(sdc), &ulParamLen,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
732 p_buffer, sizeof(p_buffer), &ulDataLen);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
733
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
734 *pi_agid = p_buffer[ 7 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
735
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
736 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
737 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
738
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
739 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
740 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
741 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
742
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
743 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
744 * ioctl_ReportChallenge: get challenge from the drive
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
745 *****************************************************************************/
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
746 int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
747 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
748 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
749
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
750 #if defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
751 dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
752
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
753 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
754 auth_info.type = DVD_LU_SEND_CHALLENGE;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
755 auth_info.lsc.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
756
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
757 i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
758
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
759 memcpy( p_challenge, auth_info.lsc.chal, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
760
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
761 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
762 struct dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
763
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
764 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
765 auth_info.format = DVD_REPORT_CHALLENGE;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
766 auth_info.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
767
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
768 i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
769
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
770 memcpy( p_challenge, auth_info.keychal, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
771
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
772 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
773 INIT_RDC( GPCMD_REPORT_KEY, 16 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
774
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
775 rdc.command[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
776
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
777 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
778
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
779 memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
780
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
781 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
782 INIT_SCTL_IO( GPCMD_REPORT_KEY, 16 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
783
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
784 sctl_io.cdb[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
785
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
786 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
787
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
788 memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
789
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
790 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
791 INIT_USCSI( GPCMD_REPORT_KEY, 16 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
792
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
793 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
794
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
795 i_ret = SolarisSendUSCSI( i_fd, &sc );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
796
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
797 if( i_ret < 0 || sc.uscsi_status )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
798 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
799 i_ret = -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
800 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
801
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
802 memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
803
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
804 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
805 INIT_DVDIOCTL( dk_dvd_report_key_t, DVDChallengeKeyInfo,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
806 kDVDKeyFormatChallengeKey );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
807
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
808 dvd.grantID = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
809
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
810 i_ret = ioctl( i_fd, DKIOCDVDREPORTKEY, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
811
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
812 memcpy( p_challenge, dvdbs.challengeKeyValue, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
813
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
814 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
815 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
816 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
817 DWORD tmp;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
818 uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH];
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
819 PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
820
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
821 memset( &buffer, 0, sizeof( buffer ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
822
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
823 key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
824 key->SessionId = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
825 key->KeyType = DvdChallengeKey;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
826 key->KeyFlags = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
827
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
828 i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
829 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
830
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
831 if( i_ret < 0 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
832 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
833 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
834 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
835
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
836 memcpy( p_challenge, key->KeyData, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
837 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
838 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
839 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
840 INIT_SSC( GPCMD_REPORT_KEY, 16 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
841
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
842 ssc.CDBByte[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
843
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
844 i_ret = WinSendSSC( i_fd, &ssc );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
845
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
846 memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
847 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
848
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
849 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
850
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
851 INIT_CPT( GPCMD_REPORT_KEY, 16 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
852
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
853 p_cpt->cam_cdb[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
854
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
855 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
856
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
857 memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
858
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
859 #elif defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
860 INIT_SSC( GPCMD_REPORT_KEY, 16 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
861
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
862 sdc.command[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
863
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
864 i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
865 &sdc, sizeof(sdc), &ulParamLen,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
866 p_buffer, sizeof(p_buffer), &ulDataLen);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
867
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
868 memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
869
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
870 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
871 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
872
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
873 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
874 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
875 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
876
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
877 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
878 * ioctl_ReportASF: get ASF from the drive
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
879 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
880 int ioctl_ReportASF( int i_fd, int *pi_remove_me, int *pi_asf )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
881 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
882 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
883
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
884 #if defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
885 dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
886
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
887 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
888 auth_info.type = DVD_LU_SEND_ASF;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
889 auth_info.lsasf.asf = *pi_asf;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
890
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
891 i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
892
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
893 *pi_asf = auth_info.lsasf.asf;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
894
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
895 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
896 struct dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
897
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
898 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
899 auth_info.format = DVD_REPORT_ASF;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
900 auth_info.asf = *pi_asf;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
901
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
902 i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
903
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
904 *pi_asf = auth_info.asf;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
905
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
906 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
907 INIT_RDC( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
908
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
909 rdc.command[ 10 ] = DVD_REPORT_ASF;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
910
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
911 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
912
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
913 *pi_asf = p_buffer[ 7 ] & 1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
914
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
915 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
916 INIT_SCTL_IO( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
917
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
918 sctl_io.cdb[ 10 ] = DVD_REPORT_ASF;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
919
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
920 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
921
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
922 *pi_asf = p_buffer[ 7 ] & 1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
923
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
924 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
925 INIT_USCSI( GPCMD_REPORT_KEY, 8 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
926
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
927 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_ASF;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
928
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
929 i_ret = SolarisSendUSCSI( i_fd, &sc );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
930
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
931 if( i_ret < 0 || sc.uscsi_status )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
932 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
933 i_ret = -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
934 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
935
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
936 *pi_asf = p_buffer[ 7 ] & 1;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
937
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
938 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
939 INIT_DVDIOCTL( dk_dvd_report_key_t, DVDAuthenticationSuccessFlagInfo,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
940 kDVDKeyFormatASF );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
941
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
942 i_ret = ioctl( i_fd, DKIOCDVDREPORTKEY, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
943
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
944 *pi_asf = dvdbs.successFlag;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
945
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
946 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
947 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
948 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
949 DWORD tmp;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
950 uint8_t buffer[DVD_ASF_LENGTH];
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
951 PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
952
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
953 memset( &buffer, 0, sizeof( buffer ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
954
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
955 key->KeyLength = DVD_ASF_LENGTH;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
956 key->KeyType = DvdAsf;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
957 key->KeyFlags = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
958
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
959 ((PDVD_ASF)key->KeyData)->SuccessFlag = *pi_asf;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
960
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
961 i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
962 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
963
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
964 if( i_ret < 0 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
965 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
966 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
967 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
968
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
969 *pi_asf = ((PDVD_ASF)key->KeyData)->SuccessFlag;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
970 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
971 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
972 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
973 INIT_SSC( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
974
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
975 ssc.CDBByte[ 10 ] = DVD_REPORT_ASF;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
976
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
977 i_ret = WinSendSSC( i_fd, &ssc );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
978
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
979 *pi_asf = p_buffer[ 7 ] & 1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
980 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
981
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
982 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
983
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
984 INIT_CPT( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
985
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
986 p_cpt->cam_cdb[ 10 ] = DVD_REPORT_ASF;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
987
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
988 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
989
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
990 *pi_asf = p_buffer[ 7 ] & 1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
991
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
992 #elif defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
993 INIT_SSC( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
994
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
995 sdc.command[ 10 ] = DVD_REPORT_ASF;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
996
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
997 i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
998 &sdc, sizeof(sdc), &ulParamLen,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
999 p_buffer, sizeof(p_buffer), &ulDataLen);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1000
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1001 *pi_asf = p_buffer[ 7 ] & 1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1002
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1003 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1004 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1005
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1006 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1007 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1008 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1009
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1010 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1011 * ioctl_ReportKey1: get the first key from the drive
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1012 *****************************************************************************/
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1013 int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1014 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1015 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1016
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1017 #if defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1018 dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1019
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1020 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1021 auth_info.type = DVD_LU_SEND_KEY1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1022 auth_info.lsk.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1023
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1024 i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1025
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1026 memcpy( p_key, auth_info.lsk.key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1028 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1029 struct dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1030
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1031 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1032 auth_info.format = DVD_REPORT_KEY1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1033 auth_info.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1034
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1035 i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1036
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1037 memcpy( p_key, auth_info.keychal, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1038
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1039 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1040 INIT_RDC( GPCMD_REPORT_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1041
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1042 rdc.command[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1043
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1044 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1045
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1046 memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1047
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1048 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1049 INIT_SCTL_IO( GPCMD_REPORT_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1050
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1051 sctl_io.cdb[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1052
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1053 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1054
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1055 memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1056
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1057 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1058 INIT_USCSI( GPCMD_REPORT_KEY, 12 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1059
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1060 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1061
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1062 i_ret = SolarisSendUSCSI( i_fd, &sc );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1063
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1064 if( i_ret < 0 || sc.uscsi_status )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1065 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1066 i_ret = -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1067 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1068
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1069 memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1070
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1071 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1072 INIT_DVDIOCTL( dk_dvd_report_key_t, DVDKey1Info,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1073 kDVDKeyFormatKey1 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1074
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1075 dvd.grantID = *pi_agid;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1076
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1077 i_ret = ioctl( i_fd, DKIOCDVDREPORTKEY, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1078
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1079 memcpy( p_key, dvdbs.key1Value, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1080
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1081 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
1082 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1083 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1084 DWORD tmp;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1085 uint8_t buffer[DVD_BUS_KEY_LENGTH];
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1086 PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1087
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1088 memset( &buffer, 0, sizeof( buffer ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1089
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1090 key->KeyLength = DVD_BUS_KEY_LENGTH;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1091 key->SessionId = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1092 key->KeyType = DvdBusKey1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1093 key->KeyFlags = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1094
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1095 i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1096 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1097
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1098 memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1099 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1100 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1101 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1102 INIT_SSC( GPCMD_REPORT_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1103
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1104 ssc.CDBByte[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1105
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1106 i_ret = WinSendSSC( i_fd, &ssc );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1107
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1108 memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1109 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1110
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1111 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1112
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1113 INIT_CPT( GPCMD_REPORT_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1114
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1115 p_cpt->cam_cdb[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1116
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1117 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1118
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1119 memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1120
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1121 #elif defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1122 INIT_SSC( GPCMD_REPORT_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1123
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1124 sdc.command[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1125
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1126 i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1127 &sdc, sizeof(sdc), &ulParamLen,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1128 p_buffer, sizeof(p_buffer), &ulDataLen);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1129
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1130 memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1131
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1132 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1133 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1134
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1135 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1136 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1137 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1138
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1139 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1140 * ioctl_InvalidateAgid: invalidate the current AGID
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1141 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1142 int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1143 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1144 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1145
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1146 #if defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1147 dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1148
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1149 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1150 auth_info.type = DVD_INVALIDATE_AGID;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1151 auth_info.lsa.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1152
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1153 i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1154
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1155 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1156 struct dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1157
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1158 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1159 auth_info.format = DVD_INVALIDATE_AGID;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1160 auth_info.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1161
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1162 i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1163
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1164 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1165 INIT_RDC( GPCMD_REPORT_KEY, 0 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1166
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1167 rdc.command[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1168
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1169 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1170
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1171 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1172 INIT_SCTL_IO( GPCMD_REPORT_KEY, 0 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1173
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1174 sctl_io.cdb[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1175
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1176 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1177
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1178 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1179 INIT_USCSI( GPCMD_REPORT_KEY, 0 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1180
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1181 rs_cdb.cdb_opaque[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1182
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1183 i_ret = SolarisSendUSCSI( i_fd, &sc );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1184
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1185 if( i_ret < 0 || sc.uscsi_status )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1186 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1187 i_ret = -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1188 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1189
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1190 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1191 INIT_DVDIOCTL( dk_dvd_send_key_t, DVDAuthenticationGrantIDInfo,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1192 kDVDKeyFormatAGID_Invalidate );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1193
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1194 dvd.grantID = *pi_agid;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1195
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1196 i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1197
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1198 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
1199 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1200 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1201 DWORD tmp;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1202
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1203 i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_END_SESSION,
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1204 pi_agid, sizeof( *pi_agid ), NULL, 0, &tmp, NULL ) ? 0 : -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1205 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1206 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1207 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1208 #if defined( __MINGW32__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1209 INIT_SSC( GPCMD_REPORT_KEY, 0 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1210 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1211 INIT_SSC( GPCMD_REPORT_KEY, 1 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1212
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1213 ssc.SRB_BufLen = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1214 ssc.CDBByte[ 8 ] = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1215 ssc.CDBByte[ 9 ] = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1216 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1217
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1218 ssc.CDBByte[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1219
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1220 i_ret = WinSendSSC( i_fd, &ssc );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1221 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1222
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1223 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1224
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1225 INIT_CPT( GPCMD_REPORT_KEY, 0 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1226
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1227 p_cpt->cam_cdb[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1228
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1229 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1230
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1231 #elif defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1232 INIT_SSC( GPCMD_REPORT_KEY, 1 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1233
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1234 sdc.data_length = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1235 sdc.command[ 8 ] = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1236 sdc.command[ 9 ] = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1237
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1238 sdc.command[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1239
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1240 i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1241 &sdc, sizeof(sdc), &ulParamLen,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1242 NULL, 0, &ulDataLen);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1243 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1244 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1245
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1246 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1247 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1248 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1249
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1250 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1251 * ioctl_SendChallenge: send challenge to the drive
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1252 *****************************************************************************/
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1253 int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1254 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1255 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1256
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1257 #if defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1258 dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1259
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1260 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1261 auth_info.type = DVD_HOST_SEND_CHALLENGE;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1262 auth_info.hsc.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1263
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1264 memcpy( auth_info.hsc.chal, p_challenge, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1265
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1266 i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1267
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1268 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1269 struct dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1270
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1271 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1272 auth_info.format = DVD_SEND_CHALLENGE;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1273 auth_info.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1274
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1275 memcpy( auth_info.keychal, p_challenge, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1276
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1277 i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1278
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1279 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1280 INIT_RDC( GPCMD_SEND_KEY, 16 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1281
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1282 rdc.command[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1283
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1284 p_buffer[ 1 ] = 0xe;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1285 memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1286
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1287 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1288
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1289 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1290 INIT_SCTL_IO( GPCMD_SEND_KEY, 16 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1291
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1292 sctl_io.cdb[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1293
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1294 p_buffer[ 1 ] = 0xe;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1295 memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1296
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1297 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1298
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1299 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1300 INIT_USCSI( GPCMD_SEND_KEY, 16 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1301
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1302 rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1303
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1304 p_buffer[ 1 ] = 0xe;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1305 memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1306
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1307 if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1308 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1309 return -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1310 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1311
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1312 i_ret = 0;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1313
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1314 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1315 INIT_DVDIOCTL( dk_dvd_send_key_t, DVDChallengeKeyInfo,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1316 kDVDKeyFormatChallengeKey );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1317
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1318 dvd.grantID = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1319 dvd.keyClass = kDVDKeyClassCSS_CPPM_CPRM;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1320
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1321 dvdbs.dataLength[ 1 ] = 0xe;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1322 memcpy( dvdbs.challengeKeyValue, p_challenge, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1323
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1324 i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1325
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1326 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
1327 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1328 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1329 DWORD tmp;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1330 uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH];
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1331 PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1332
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1333 memset( &buffer, 0, sizeof( buffer ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1334
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1335 key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1336 key->SessionId = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1337 key->KeyType = DvdChallengeKey;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1338 key->KeyFlags = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1339
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1340 memcpy( key->KeyData, p_challenge, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1341
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1342 i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1343 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1344 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1345 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1346 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1347 INIT_SSC( GPCMD_SEND_KEY, 16 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1348
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1349 ssc.CDBByte[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1350
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1351 p_buffer[ 1 ] = 0xe;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1352 memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1353
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1354 i_ret = WinSendSSC( i_fd, &ssc );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1355 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1356
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1357 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1358
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1359 INIT_CPT( GPCMD_SEND_KEY, 16 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1360
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1361 p_cpt->cam_cdb[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1362
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1363 p_buffer[ 1 ] = 0xe;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1364 memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1365
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1366 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1367
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1368 #elif defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1369 INIT_SSC( GPCMD_SEND_KEY, 16 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1370
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1371 sdc.command[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1372
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1373 p_buffer[ 1 ] = 0xe;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1374 memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1375
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1376 i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1377 &sdc, sizeof(sdc), &ulParamLen,
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1378 p_buffer, sizeof(p_buffer), &ulDataLen );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1379
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1380 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1381 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1382
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1383 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1384 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1385 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1386
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1387 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1388 * ioctl_SendKey2: send the second key to the drive
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1389 *****************************************************************************/
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1390 int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1391 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1392 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1393
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1394 #if defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1395 dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1396
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1397 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1398 auth_info.type = DVD_HOST_SEND_KEY2;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1399 auth_info.hsk.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1400
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1401 memcpy( auth_info.hsk.key, p_key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1402
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1403 i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1404
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1405 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1406 struct dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1407
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1408 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1409 auth_info.format = DVD_SEND_KEY2;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1410 auth_info.agid = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1411
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1412 memcpy( auth_info.keychal, p_key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1413
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1414 i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1415
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1416 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1417 INIT_RDC( GPCMD_SEND_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1418
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1419 rdc.command[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1420
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1421 p_buffer[ 1 ] = 0xa;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1422 memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1423
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1424 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1425
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1426 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1427 INIT_SCTL_IO( GPCMD_SEND_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1428
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1429 sctl_io.cdb[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1430
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1431 p_buffer[ 1 ] = 0xa;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1432 memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1433
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1434 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1435
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1436 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1437 INIT_USCSI( GPCMD_SEND_KEY, 12 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1438
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1439 rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1440
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1441 p_buffer[ 1 ] = 0xa;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1442 memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1443
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1444 if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1445 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1446 return -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1447 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1448
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1449 i_ret = 0;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1450
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1451 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1452 INIT_DVDIOCTL( dk_dvd_send_key_t, DVDKey2Info,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1453 kDVDKeyFormatKey2 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1454
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1455 dvd.grantID = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1456 dvd.keyClass = kDVDKeyClassCSS_CPPM_CPRM;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1457
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1458 dvdbs.dataLength[ 1 ] = 0xa;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1459 memcpy( dvdbs.key2Value, p_key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1460
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1461 i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1462
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1463 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
1464 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1465 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1466 DWORD tmp;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1467 uint8_t buffer[DVD_BUS_KEY_LENGTH];
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1468 PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1469
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1470 memset( &buffer, 0, sizeof( buffer ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1471
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1472 key->KeyLength = DVD_BUS_KEY_LENGTH;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1473 key->SessionId = *pi_agid;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1474 key->KeyType = DvdBusKey2;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1475 key->KeyFlags = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1476
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1477 memcpy( key->KeyData, p_key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1478
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1479 i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1480 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1481 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1482 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1483 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1484 INIT_SSC( GPCMD_SEND_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1485
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1486 ssc.CDBByte[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1487
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1488 p_buffer[ 1 ] = 0xa;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1489 memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1490
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1491 i_ret = WinSendSSC( i_fd, &ssc );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1492 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1493
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1494 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1495
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1496 INIT_CPT( GPCMD_SEND_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1497
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1498 p_cpt->cam_cdb[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1499
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1500 p_buffer[ 1 ] = 0xa;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1501 memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1502
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1503 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1504
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1505 #elif defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1506 INIT_SSC( GPCMD_SEND_KEY, 12 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1507
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1508 sdc.command[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1509
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1510 p_buffer[ 1 ] = 0xa;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1511 memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1512
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1513 i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1514 &sdc, sizeof(sdc), &ulParamLen,
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1515 p_buffer, sizeof(p_buffer), &ulDataLen );
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1516
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1517 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1518 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1519
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1520 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1521 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1522 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1523
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1524 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1525 * ioctl_ReportRPC: get RPC status for the drive
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1526 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1527 int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1528 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1529 int i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1530
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1531 #if defined( HAVE_LINUX_DVD_STRUCT ) && defined( DVD_LU_SEND_RPC_STATE )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1532 dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1533
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1534 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1535 auth_info.type = DVD_LU_SEND_RPC_STATE;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1536
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1537 i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1538
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1539 *p_type = auth_info.lrpcs.type;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1540 *p_mask = auth_info.lrpcs.region_mask;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1541 *p_scheme = auth_info.lrpcs.rpc_scheme;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1542
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1543 #elif defined( HAVE_LINUX_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1544 /* FIXME: OpenBSD doesn't know this */
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1545 i_ret = -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1546
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1547 #elif defined( HAVE_BSD_DVD_STRUCT )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1548 struct dvd_authinfo auth_info;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1549
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1550 memset( &auth_info, 0, sizeof( auth_info ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1551 auth_info.format = DVD_REPORT_RPC;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1552
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1553 i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1554
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1555 *p_type = auth_info.reg_type;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1556 *p_mask = auth_info.region; // ??
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1557 *p_scheme = auth_info.rpc_scheme;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1558
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1559 #elif defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1560 INIT_RDC( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1561
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1562 rdc.command[ 10 ] = DVD_REPORT_RPC;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1563
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1564 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1565
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1566 *p_type = p_buffer[ 4 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1567 *p_mask = p_buffer[ 5 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1568 *p_scheme = p_buffer[ 6 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1569
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1570 #elif defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1571 INIT_SCTL_IO( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1572
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1573 sctl_io.cdb[ 10 ] = DVD_REPORT_RPC;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1574
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1575 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1576
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1577 *p_type = p_buffer[ 4 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1578 *p_mask = p_buffer[ 5 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1579 *p_scheme = p_buffer[ 6 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1580
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1581 #elif defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1582 INIT_USCSI( GPCMD_REPORT_KEY, 8 );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1583
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1584 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_RPC;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1585
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1586 i_ret = SolarisSendUSCSI( i_fd, &sc );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1587
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1588 if( i_ret < 0 || sc.uscsi_status )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1589 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1590 i_ret = -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1591 }
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1592
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1593 *p_type = p_buffer[ 4 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1594 *p_mask = p_buffer[ 5 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1595 *p_scheme = p_buffer[ 6 ];
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1596
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1597 #elif defined( DARWIN_DVD_IOCTL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1598 INIT_DVDIOCTL( dk_dvd_report_key_t, DVDRegionPlaybackControlInfo,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1599 kDVDKeyFormatRegionState );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1600
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1601 dvd.keyClass = kDVDKeyClassCSS_CPPM_CPRM;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1602
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1603 i_ret = ioctl( i_fd, DKIOCDVDREPORTKEY, &dvd );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1604
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1605 *p_type = dvdbs.typeCode;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1606 *p_mask = dvdbs.driveRegion;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1607 *p_scheme = dvdbs.rpcScheme;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1608
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1609 #elif defined( WIN32 )
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
1610 if( WIN2K ) /* NT/2k/XP */
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1611 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1612 DWORD tmp;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1613 uint8_t buffer[DVD_RPC_KEY_LENGTH];
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1614 PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1615
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1616 memset( &buffer, 0, sizeof( buffer ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1617
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1618 key->KeyLength = DVD_RPC_KEY_LENGTH;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1619 key->KeyType = DvdGetRpcKey;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1620 key->KeyFlags = 0;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1621
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1622 i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1623 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1624
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1625 if( i_ret < 0 )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1626 {
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1627 return i_ret;
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
1628 }
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1629
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1630 *p_type = ((PDVD_RPC_KEY)key->KeyData)->TypeCode;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1631 *p_mask = ((PDVD_RPC_KEY)key->KeyData)->RegionMask;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1632 *p_scheme = ((PDVD_RPC_KEY)key->KeyData)->RpcScheme;
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1633 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1634 else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1635 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1636 INIT_SSC( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1637
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1638 ssc.CDBByte[ 10 ] = DVD_REPORT_RPC;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1639
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1640 i_ret = WinSendSSC( i_fd, &ssc );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1641
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1642 *p_type = p_buffer[ 4 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1643 *p_mask = p_buffer[ 5 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1644 *p_scheme = p_buffer[ 6 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1645 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1646
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1647 #elif defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1648
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1649 INIT_CPT( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1650
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1651 p_cpt->cam_cdb[ 10 ] = DVD_REPORT_RPC;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1652
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1653 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1654
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1655 *p_type = p_buffer[ 4 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1656 *p_mask = p_buffer[ 5 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1657 *p_scheme = p_buffer[ 6 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1658
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1659 #elif defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1660 INIT_SSC( GPCMD_REPORT_KEY, 8 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1661
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1662 sdc.command[ 10 ] = DVD_REPORT_RPC;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1663
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1664 i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1665 &sdc, sizeof(sdc), &ulParamLen,
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1666 p_buffer, sizeof(p_buffer), &ulDataLen);
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1667
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1668 *p_type = p_buffer[ 4 ] >> 6;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1669 *p_mask = p_buffer[ 5 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1670 *p_scheme = p_buffer[ 6 ];
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1671
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1672 #else
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1673 # error "DVD ioctls are unavailable on this system"
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1674
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1675 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1676 return i_ret;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1677 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1678
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1679 /*****************************************************************************
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1680 * ioctl_SendRPC: set RPC status for the drive
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1681 *****************************************************************************/
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1682 int ioctl_SendRPC( int i_fd, int i_pdrc )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1683 {
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1684 int i_ret;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1685
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1686 #if defined( HAVE_LINUX_DVD_STRUCT ) && defined( DVD_HOST_SEND_RPC_STATE )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1687 dvd_authinfo auth_info;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1688
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1689 memset( &auth_info, 0, sizeof( auth_info ) );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1690 auth_info.type = DVD_HOST_SEND_RPC_STATE;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1691 auth_info.hrpcs.pdrc = i_pdrc;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1692
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1693 i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1694
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1695 #elif defined( HAVE_LINUX_DVD_STRUCT )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1696 /* FIXME: OpenBSD doesn't know this */
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1697 i_ret = -1;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1698
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1699 #elif defined( HAVE_BSD_DVD_STRUCT )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1700 struct dvd_authinfo auth_info;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1701
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1702 memset( &auth_info, 0, sizeof( auth_info ) );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1703 auth_info.format = DVD_SEND_RPC;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1704 auth_info.region = i_pdrc;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1705
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1706 i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1707
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1708 #elif defined( SYS_BEOS )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1709 INIT_RDC( GPCMD_SEND_KEY, 8 );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1710
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1711 rdc.command[ 10 ] = DVD_SEND_RPC;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1712
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1713 p_buffer[ 1 ] = 6;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1714 p_buffer[ 4 ] = i_pdrc;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1715
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1716 i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1717
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1718 #elif defined( HPUX_SCTL_IO )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1719 INIT_SCTL_IO( GPCMD_SEND_KEY, 8 );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1720
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1721 sctl_io.cdb[ 10 ] = DVD_SEND_RPC;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1722
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1723 p_buffer[ 1 ] = 6;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1724 p_buffer[ 4 ] = i_pdrc;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1725
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1726 i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1727
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1728 #elif defined( SOLARIS_USCSI )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1729 INIT_USCSI( GPCMD_SEND_KEY, 8 );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1730
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1731 rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_RPC;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1732
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1733 p_buffer[ 1 ] = 6;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1734 p_buffer[ 4 ] = i_pdrc;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1735
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1736 i_ret = SolarisSendUSCSI( i_fd, &sc );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1737
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1738 if( i_ret < 0 || sc.uscsi_status )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1739 {
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1740 i_ret = -1;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1741 }
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1742
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1743 #elif defined( DARWIN_DVD_IOCTL )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1744 INIT_DVDIOCTL( dk_dvd_send_key_t, DVDRegionPlaybackControlInfo,
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1745 kDVDKeyFormatSetRegion );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1746
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1747 dvd.keyClass = kDVDKeyClassCSS_CPPM_CPRM;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1748 dvdbs.driveRegion = i_pdrc;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1749
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1750 i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1751
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1752 #elif defined( WIN32 )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1753 if( WIN2K ) /* NT/2k/XP */
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1754 {
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1755 INIT_SPTD( GPCMD_SEND_KEY, 8 );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1756
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1757 sptd.Cdb[ 10 ] = DVD_SEND_RPC;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1758
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1759 p_buffer[ 1 ] = 6;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1760 p_buffer[ 4 ] = i_pdrc;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1761
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1762 i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1763 }
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1764 else
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1765 {
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1766 INIT_SSC( GPCMD_SEND_KEY, 8 );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1767
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1768 ssc.CDBByte[ 10 ] = DVD_SEND_RPC;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1769
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1770 p_buffer[ 1 ] = 6;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1771 p_buffer[ 4 ] = i_pdrc;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1772
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1773 i_ret = WinSendSSC( i_fd, &ssc );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1774 }
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1775
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1776 #elif defined( __QNXNTO__ )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1777
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1778 INIT_CPT( GPCMD_SEND_KEY, 8 );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1779
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1780 p_cpt->cam_cdb[ 10 ] = DVD_SEND_RPC;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1781
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1782 p_buffer[ 1 ] = 6;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1783 p_buffer[ 4 ] = i_pdrc;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1784
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1785 i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1786
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1787 #elif defined( SYS_OS2 )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1788 INIT_SSC( GPCMD_SEND_KEY, 8 );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1789
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1790 sdc.command[ 10 ] = DVD_SEND_RPC;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1791
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1792 p_buffer[ 1 ] = 6;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1793 p_buffer[ 4 ] = i_pdrc;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1794
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1795 i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1796 &sdc, sizeof(sdc), &ulParamLen,
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1797 p_buffer, sizeof(p_buffer), &ulDataLen );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1798
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1799 #else
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1800 # error "DVD ioctls are unavailable on this system"
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1801
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1802 #endif
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1803 return i_ret;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1804 }
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1805
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1806 /* Local prototypes */
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1807
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1808 #if defined( SYS_BEOS )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1809 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1810 * BeInitRDC: initialize a RDC structure for the BeOS kernel
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1811 *****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1812 * This function initializes a BeOS raw device command structure for future
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1813 * use, either a read command or a write command.
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1814 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1815 static void BeInitRDC( raw_device_command *p_rdc, int i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1816 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1817 memset( p_rdc->data, 0, p_rdc->data_length );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1818
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1819 switch( i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1820 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1821 case GPCMD_SEND_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1822 /* leave the flags to 0 */
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1823 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1824
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1825 case GPCMD_READ_DVD_STRUCTURE: case GPCMD_REPORT_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1826 p_rdc->flags = B_RAW_DEVICE_DATA_IN; break; }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1827
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1828 p_rdc->command[ 0 ] = i_type;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1829
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1830 p_rdc->command[ 8 ] = (p_rdc->data_length >> 8) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1831 p_rdc->command[ 9 ] = p_rdc->data_length & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1832 p_rdc->command_length = 12;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1833
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1834 p_rdc->sense_data = NULL;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1835 p_rdc->sense_data_length = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1836
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1837 p_rdc->timeout = 1000000;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1838 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1839 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1840
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1841 #if defined( HPUX_SCTL_IO )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1842 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1843 * HPUXInitSCTL: initialize a sctl_io structure for the HP-UX kernel
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1844 *****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1845 * This function initializes a HP-UX command structure for future
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1846 * use, either a read command or a write command.
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1847 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1848 static void HPUXInitSCTL( struct sctl_io *sctl_io, int i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1849 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1850 memset( sctl_io->data, 0, sctl_io->data_length );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1851
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1852 switch( i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1853 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1854 case GPCMD_SEND_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1855 /* leave the flags to 0 */
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1856 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1857
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1858 case GPCMD_READ_DVD_STRUCTURE:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1859 case GPCMD_REPORT_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1860 sctl_io->flags = SCTL_READ;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1861 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1862 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1863
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1864 sctl_io->cdb[ 0 ] = i_type;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1865
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1866 sctl_io->cdb[ 8 ] = (sctl_io->data_length >> 8) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1867 sctl_io->cdb[ 9 ] = sctl_io->data_length & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1868 sctl_io->cdb_length = 12;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1869
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1870 sctl_io->max_msecs = 1000000;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1871 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1872 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1873
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1874 #if defined( SOLARIS_USCSI )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1875 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1876 * SolarisInitUSCSI: initialize a USCSICMD structure for the Solaris kernel
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1877 *****************************************************************************
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1878 * This function initializes a Solaris userspace scsi command structure for
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1879 * future use, either a read command or a write command.
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1880 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1881 static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type )
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1882 {
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1883 union scsi_cdb *rs_cdb;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1884 memset( p_sc->uscsi_cdb, 0, sizeof( union scsi_cdb ) );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1885 memset( p_sc->uscsi_bufaddr, 0, p_sc->uscsi_buflen );
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1886
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1887 switch( i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1888 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1889 case GPCMD_SEND_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1890 p_sc->uscsi_flags = USCSI_ISOLATE | USCSI_WRITE;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1891 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1892
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1893 case GPCMD_READ_DVD_STRUCTURE:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1894 case GPCMD_REPORT_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1895 p_sc->uscsi_flags = USCSI_ISOLATE | USCSI_READ;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1896 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1897 }
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1898
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1899 rs_cdb = (union scsi_cdb *)p_sc->uscsi_cdb;
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1900
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1901 rs_cdb->scc_cmd = i_type;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1902
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1903 rs_cdb->cdb_opaque[ 8 ] = (p_sc->uscsi_buflen >> 8) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1904 rs_cdb->cdb_opaque[ 9 ] = p_sc->uscsi_buflen & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1905 p_sc->uscsi_cdblen = 12;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1906
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1907 USCSI_TIMEOUT( p_sc, 15 );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1908 }
8575
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1909
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1910 /*****************************************************************************
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1911 * SolarisSendUSCSI: send a USCSICMD structure to the Solaris kernel
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1912 * for execution
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1913 *****************************************************************************
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1914 * When available, this function uses the function smedia_uscsi_cmd()
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1915 * from solaris' libsmedia library (solaris 9 or newer) to execute the
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1916 * USCSI command. smedia_uscsi_cmd() allows USCSI commands for
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1917 * non-root users on removable media devices on solaris 9; sending the
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1918 * USCSI command directly to the device using the USCSICMD ioctl fails
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1919 * with an EPERM error on solaris 9.
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1920 *
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1921 * The code will fall back to the USCSICMD ioctl method, when
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1922 * libsmedia.so is not available or does not export the
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1923 * smedia_uscsi_cmd() function (on solaris releases upto and including
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1924 * solaris 8). Fortunatelly, on these old releases non-root users are
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1925 * allowed to perform USCSICMD ioctls on removable media devices.
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1926 *****************************************************************************/
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1927 static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc ) {
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1928 void *sm_hdl;
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1929 static int initialized;
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1930 static void* (*sm_get_handle)(int32_t);
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1931 static int (*sm_release_handle)(void*);
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1932 static int (*sm_uscsi_cmd)(void*, struct uscsi_cmd *);
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1933
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1934 if (!initialized)
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1935 {
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1936 void *smedia_lib;
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1937
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1938 smedia_lib = dlopen("libsmedia.so", RTLD_NOW);
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1939 if (smedia_lib) {
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1940 sm_get_handle = dlsym(smedia_lib, "smedia_get_handle");
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1941 sm_release_handle = dlsym(smedia_lib, "smedia_release_handle");
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1942 sm_uscsi_cmd = dlsym(smedia_lib, "smedia_uscsi_cmd");
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1943 }
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1944 initialized = 1;
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1945 }
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1946
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1947 if (sm_get_handle && sm_uscsi_cmd && sm_release_handle
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1948 && (sm_hdl = sm_get_handle(i_fd)))
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1949 {
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1950 int i_ret = sm_uscsi_cmd(sm_hdl, p_sc);
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1951 sm_release_handle(sm_hdl);
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1952 return i_ret;
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1953 }
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1954
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1955 return ioctl( i_fd, USCSICMD, p_sc );
1d15ca298dda Fix DVD authentication on Solaris 9.
jkeil
parents: 8142
diff changeset
1956 }
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1957 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1958
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1959 #if defined( WIN32 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1960 /*****************************************************************************
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1961 * WinInitSPTD: initialize a sptd structure
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1962 *****************************************************************************
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1963 * This function initializes a SCSI pass through command structure for future
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1964 * use, either a read command or a write command.
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1965 *****************************************************************************/
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1966 static void WinInitSPTD( SCSI_PASS_THROUGH_DIRECT *p_sptd, int i_type )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1967 {
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1968 memset( p_sptd->DataBuffer, 0, p_sptd->DataTransferLength );
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1969
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1970 switch( i_type )
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1971 {
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1972 case GPCMD_SEND_KEY:
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1973 p_sptd->DataIn = SCSI_IOCTL_DATA_OUT;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1974 break;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1975
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1976 case GPCMD_READ_DVD_STRUCTURE:
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1977 case GPCMD_REPORT_KEY:
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1978 p_sptd->DataIn = SCSI_IOCTL_DATA_IN;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1979 break;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1980 }
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1981
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1982 p_sptd->Cdb[ 0 ] = i_type;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1983 p_sptd->Cdb[ 8 ] = (uint8_t)(p_sptd->DataTransferLength >> 8) & 0xff;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1984 p_sptd->Cdb[ 9 ] = (uint8_t) p_sptd->DataTransferLength & 0xff;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1985 p_sptd->CdbLength = 12;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1986
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1987 p_sptd->TimeOutValue = 2;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1988 }
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1989
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
1990 /*****************************************************************************
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1991 * WinInitSSC: initialize a ssc structure for the win32 aspi layer
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1992 *****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1993 * This function initializes a ssc raw device command structure for future
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1994 * use, either a read command or a write command.
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1995 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1996 static void WinInitSSC( struct SRB_ExecSCSICmd *p_ssc, int i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1997 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1998 memset( p_ssc->SRB_BufPointer, 0, p_ssc->SRB_BufLen );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
1999
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2000 switch( i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2001 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2002 case GPCMD_SEND_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2003 p_ssc->SRB_Flags = SRB_DIR_OUT;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2004 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2005
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2006 case GPCMD_READ_DVD_STRUCTURE:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2007 case GPCMD_REPORT_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2008 p_ssc->SRB_Flags = SRB_DIR_IN;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2009 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2010 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2011
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2012 p_ssc->SRB_Cmd = SC_EXEC_SCSI_CMD;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2013 p_ssc->SRB_Flags |= SRB_EVENT_NOTIFY;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2014
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2015 p_ssc->CDBByte[ 0 ] = i_type;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2016
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
2017 p_ssc->CDBByte[ 8 ] = (uint8_t)(p_ssc->SRB_BufLen >> 8) & 0xff;
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
2018 p_ssc->CDBByte[ 9 ] = (uint8_t) p_ssc->SRB_BufLen & 0xff;
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2019 p_ssc->SRB_CDBLen = 12;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2020
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2021 p_ssc->SRB_SenseLen = SENSE_LEN;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2022 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2023
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2024 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2025 * WinSendSSC: send a ssc structure to the aspi layer
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2026 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2027 static int WinSendSSC( int i_fd, struct SRB_ExecSCSICmd *p_ssc )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2028 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2029 HANDLE hEvent = NULL;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2030 struct w32_aspidev *fd = (struct w32_aspidev *) i_fd;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2031
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2032 hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2033 if( hEvent == NULL )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2034 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2035 return -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2036 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2037
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2038 p_ssc->SRB_PostProc = hEvent;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2039 p_ssc->SRB_HaId = LOBYTE( fd->i_sid );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2040 p_ssc->SRB_Target = HIBYTE( fd->i_sid );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2041
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2042 ResetEvent( hEvent );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2043 if( fd->lpSendCommand( (void*) p_ssc ) == SS_PENDING )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2044 WaitForSingleObject( hEvent, INFINITE );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2045
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2046 CloseHandle( hEvent );
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2047
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2048 return p_ssc->SRB_Status == SS_COMP ? 0 : -1;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2049 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2050 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2051
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2052 #if defined( __QNXNTO__ )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2053 /*****************************************************************************
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
2054 * QNXInitCPT: initialize a CPT structure for QNX Neutrino
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2055 *****************************************************************************
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
2056 * This function initializes a cpt command structure for future use,
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
2057 * either a read command or a write command.
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2058 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2059 static void QNXInitCPT( CAM_PASS_THRU * p_cpt, int i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2060 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2061 switch( i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2062 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2063 case GPCMD_SEND_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2064 p_cpt->cam_flags = CAM_DIR_OUT;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2065 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2066
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2067 case GPCMD_READ_DVD_STRUCTURE:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2068 case GPCMD_REPORT_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2069 p_cpt->cam_flags = CAM_DIR_IN;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2070 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2071 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2072
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2073 p_cpt->cam_cdb[0] = i_type;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2074
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2075 p_cpt->cam_cdb[ 8 ] = (p_cpt->cam_dxfer_len >> 8) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2076 p_cpt->cam_cdb[ 9 ] = p_cpt->cam_dxfer_len & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2077 p_cpt->cam_cdb_len = 12;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2078
8637
0211de3039eb update libdvdcss in libmpdvdkit to latest version (1.2.4)
arpi
parents: 8575
diff changeset
2079 p_cpt->cam_timeout = CAM_TIME_DEFAULT;
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2080 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2081 #endif
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2082
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2083 #if defined( SYS_OS2 )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2084 /*****************************************************************************
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2085 * OS2InitSDC: initialize a SDC structure for the Execute SCSI-command
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2086 *****************************************************************************
9333
f0f0f176d298 sync with libdvdcss 1.2.5 (including u8->uint8_t and whitespace cosmetics...)
arpi
parents: 8839
diff changeset
2087 * This function initializes a OS2 'execute SCSI command' structure for
7027
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2088 * future use, either a read command or a write command.
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2089 *****************************************************************************/
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2090 static void OS2InitSDC( struct OS2_ExecSCSICmd *p_sdc, int i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2091 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2092 switch( i_type )
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2093 {
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2094 case GPCMD_SEND_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2095 p_sdc->flags = 0;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2096 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2097
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2098 case GPCMD_READ_DVD_STRUCTURE:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2099 case GPCMD_REPORT_KEY:
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2100 p_sdc->flags = EX_DIRECTION_IN;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2101 break;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2102 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2103
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2104 p_sdc->command[ 0 ] = i_type;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2105 p_sdc->command[ 8 ] = (p_sdc->data_length >> 8) & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2106 p_sdc->command[ 9 ] = p_sdc->data_length & 0xff;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2107 p_sdc->id_code = 0x31304443; // 'CD01'
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2108 p_sdc->cmd_length = 12;
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2109 }
c9a4dfaa9868 importing libdvdcss 1.2.2 files
arpi
parents:
diff changeset
2110 #endif