annotate libmpdvdkit2/ioctl.c @ 13900:99b893f9fb67

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