annotate libmpdvdkit2/ioctl.c @ 9695:68c44d3530c8

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