14861
|
1 --- bsdi_ioctl.c 2003-03-10 00:34:10.000000000 +0100
|
|
2 +++ bsdi_ioctl.c 2005-03-01 07:41:41.000000000 +0100
|
|
3 @@ -4,6 +4,10 @@
|
|
4 * Hacked version of the linux cdrom.c kernel module - everything except the
|
|
5 * DVD handling ripped out and the rest rewritten to use raw SCSI commands
|
|
6 * on BSD/OS 4.2 (but should work with earlier versions as well).
|
|
7 + *
|
|
8 + * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
|
|
9 + * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
|
|
10 + * $Id$
|
|
11 */
|
|
12
|
|
13 #include <sys/types.h>
|
|
14 @@ -694,7 +698,7 @@
|
|
15 struct cdrom_tocentry entry;
|
|
16 int ret, i;
|
|
17
|
|
18 - bzero(tracks, sizeof (*tracks));
|
|
19 + memset(tracks, 0, sizeof (*tracks));
|
|
20 ret = cdrom_ioctl(fd, CDROMREADTOCHDR, &header);
|
|
21 /*
|
|
22 * This whole business is a crock anyhow so we don't bother distinguishing
|
|
23 --- common.h 2003-06-13 19:33:35.000000000 +0200
|
|
24 +++ common.h 2005-03-01 07:41:41.000000000 +0100
|
|
25 @@ -3,7 +3,10 @@
|
|
26 * Collection of useful common types and macros definitions
|
|
27 *****************************************************************************
|
|
28 * Copyright (C) 1998, 1999, 2000 VideoLAN
|
|
29 - * $Id$
|
|
30 + *
|
|
31 + * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
|
|
32 + * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
|
|
33 + * $Id$
|
|
34 *
|
|
35 * Authors: Samuel Hocevar <sam@via.ecp.fr>
|
|
36 * Vincent Seguin <seguin@via.ecp.fr>
|
|
37 @@ -27,21 +30,10 @@
|
|
38 /*****************************************************************************
|
|
39 * Basic types definitions
|
|
40 *****************************************************************************/
|
|
41 -#if defined( HAVE_STDINT_H )
|
|
42 -# include <stdint.h>
|
|
43 -#elif defined( HAVE_INTTYPES_H )
|
|
44 -# include <inttypes.h>
|
|
45 -#elif defined( SYS_CYGWIN )
|
|
46 -# include <sys/types.h>
|
|
47 - /* Cygwin only defines half of these... */
|
|
48 - typedef u_int8_t uint8_t;
|
|
49 - typedef u_int32_t uint32_t;
|
|
50 -#else
|
|
51 - /* Fallback types (very x86-centric, sorry) */
|
|
52 - typedef unsigned char uint8_t;
|
|
53 - typedef signed char int8_t;
|
|
54 - typedef unsigned int uint32_t;
|
|
55 - typedef signed int int32_t;
|
|
56 +#include <inttypes.h>
|
|
57 +
|
|
58 +#ifdef __CYGWIN__
|
|
59 +#define SYS_CYGWIN
|
|
60 #endif
|
|
61
|
|
62 #if defined( WIN32 )
|
|
63 --- css.c 2003-07-29 01:37:06.000000000 +0200
|
|
64 +++ css.c 2005-03-01 07:41:41.000000000 +0100
|
|
65 @@ -2,7 +2,10 @@
|
|
66 * css.c: Functions for DVD authentication and descrambling
|
|
67 *****************************************************************************
|
|
68 * Copyright (C) 1999-2001 VideoLAN
|
|
69 - * $Id$
|
|
70 + *
|
|
71 + * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
|
|
72 + * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
|
|
73 + * $Id$
|
|
74 *
|
|
75 * Author: Stéphane Borel <stef@via.ecp.fr>
|
|
76 * Håkan Hjort <d95hjort@dtek.chalmers.se>
|
|
77 @@ -40,19 +43,11 @@
|
|
78 #include <string.h>
|
|
79 #include <sys/types.h>
|
|
80 #include <sys/stat.h>
|
|
81 -#ifdef HAVE_SYS_PARAM_H
|
|
82 -# include <sys/param.h>
|
|
83 -#endif
|
|
84 -#ifdef HAVE_UNISTD_H
|
|
85 -# include <unistd.h>
|
|
86 -#endif
|
|
87 #include <fcntl.h>
|
|
88 +#include <unistd.h>
|
|
89 +#include <limits.h>
|
|
90
|
|
91 -#ifdef HAVE_LIMITS_H
|
|
92 -# include <limits.h>
|
|
93 -#endif
|
|
94 -
|
|
95 -#include "dvdcss/dvdcss.h"
|
|
96 +#include "dvdcss.h"
|
|
97
|
|
98 #include "common.h"
|
|
99 #include "css.h"
|
|
100 --- device.c 2003-07-29 01:37:06.000000000 +0200
|
|
101 +++ device.c 2005-03-01 07:41:41.000000000 +0100
|
|
102 @@ -2,7 +2,10 @@
|
|
103 * device.h: DVD device access
|
|
104 *****************************************************************************
|
|
105 * Copyright (C) 1998-2002 VideoLAN
|
|
106 - * $Id$
|
|
107 + *
|
|
108 + * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
|
|
109 + * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
|
|
110 + * $Id$
|
|
111 *
|
|
112 * Authors: Stéphane Borel <stef@via.ecp.fr>
|
|
113 * Samuel Hocevar <sam@zoy.org>
|
|
114 @@ -33,18 +36,9 @@
|
|
115 #include <string.h>
|
|
116 #include <sys/types.h>
|
|
117 #include <sys/stat.h>
|
|
118 -#ifdef HAVE_SYS_PARAM_H
|
|
119 -# include <sys/param.h>
|
|
120 -#endif
|
|
121 #include <fcntl.h>
|
|
122 -
|
|
123 -#ifdef HAVE_UNISTD_H
|
|
124 -# include <unistd.h>
|
|
125 -#endif
|
|
126 -
|
|
127 -#ifdef HAVE_LIMITS_H
|
|
128 -# include <limits.h>
|
|
129 -#endif
|
|
130 +#include <unistd.h>
|
|
131 +#include <limits.h>
|
|
132
|
|
133 #if defined( WIN32 ) && !defined( SYS_CYGWIN )
|
|
134 # include <io.h> /* read() */
|
|
135 @@ -52,7 +46,7 @@
|
|
136 # include <sys/uio.h> /* struct iovec */
|
|
137 #endif
|
|
138
|
|
139 -#include "dvdcss/dvdcss.h"
|
|
140 +#include "dvdcss.h"
|
|
141
|
|
142 #include "common.h"
|
|
143 #include "css.h"
|
|
144 @@ -143,8 +137,11 @@
|
|
145 _dvdcss_debug( dvdcss, psz_debug );
|
|
146
|
|
147 #if defined( WIN32 )
|
|
148 - /* If device is not "X:", we are actually opening a file. */
|
|
149 - dvdcss->b_file = !psz_device[0] || psz_device[1] != ':' || psz_device[2];
|
|
150 + dvdcss->b_file = 1;
|
|
151 + /* If device is "X:" or "X:\", we are not actually opening a file. */
|
|
152 + if (psz_device[0] && psz_device[1] == ':' &&
|
|
153 + (!psz_device[2] || (psz_device[2] == '\\' && !psz_device[3])))
|
|
154 + dvdcss->b_file = 0;
|
|
155
|
|
156 /* Initialize readv temporary buffer */
|
|
157 dvdcss->p_readv_buffer = NULL;
|
|
158 --- error.c 2003-03-10 01:15:31.000000000 +0100
|
|
159 +++ error.c 2005-03-01 07:41:41.000000000 +0100
|
|
160 @@ -2,7 +2,10 @@
|
|
161 * error.c: error management functions
|
|
162 *****************************************************************************
|
|
163 * Copyright (C) 1998-2002 VideoLAN
|
|
164 - * $Id$
|
|
165 + *
|
|
166 + * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
|
|
167 + * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
|
|
168 + * $Id$
|
|
169 *
|
|
170 * Author: Samuel Hocevar <sam@zoy.org>
|
|
171 *
|
|
172 @@ -25,16 +28,9 @@
|
|
173
|
|
174 #include <stdio.h>
|
|
175 #include <stdlib.h>
|
|
176 +#include <limits.h>
|
|
177
|
|
178 -#ifdef HAVE_SYS_PARAM_H
|
|
179 -# include <sys/param.h>
|
|
180 -#endif
|
|
181 -
|
|
182 -#ifdef HAVE_LIMITS_H
|
|
183 -# include <limits.h>
|
|
184 -#endif
|
|
185 -
|
|
186 -#include "dvdcss/dvdcss.h"
|
|
187 +#include "dvdcss.h"
|
|
188
|
|
189 #include "common.h"
|
|
190 #include "css.h"
|
|
191 --- ioctl.c 2003-03-10 00:34:10.000000000 +0100
|
|
192 +++ ioctl.c 2005-03-01 07:41:41.000000000 +0100
|
|
193 @@ -2,7 +2,10 @@
|
|
194 * ioctl.c: DVD ioctl replacement function
|
|
195 *****************************************************************************
|
|
196 * Copyright (C) 1999-2001 VideoLAN
|
|
197 - * $Id$
|
|
198 + *
|
|
199 + * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
|
|
200 + * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
|
|
201 + * $Id$
|
|
202 *
|
|
203 * Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
|
|
204 * Samuel Hocevar <sam@zoy.org>
|
|
205 @@ -76,6 +79,7 @@
|
|
206 # include <sys/scsi.h>
|
|
207 #endif
|
|
208 #ifdef SOLARIS_USCSI
|
|
209 +# include <dlfcn.h>
|
|
210 # include <unistd.h>
|
|
211 # include <stropts.h>
|
|
212 # include <sys/scsi/scsi_types.h>
|
|
213 @@ -112,6 +116,7 @@
|
|
214 *****************************************************************************/
|
|
215 #if defined( SOLARIS_USCSI )
|
|
216 static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
|
|
217 +static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
|
|
218 #endif
|
|
219
|
|
220 /*****************************************************************************
|
|
221 @@ -192,7 +197,7 @@
|
|
222 rs_cdb.cdb_opaque[ 6 ] = i_layer;
|
|
223 rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_COPYRIGHT;
|
|
224
|
|
225 - i_ret = ioctl(i_fd, USCSICMD, &sc);
|
|
226 + i_ret = SolarisSendUSCSI(i_fd, &sc);
|
|
227
|
|
228 if( i_ret < 0 || sc.uscsi_status ) {
|
|
229 i_ret = -1;
|
|
230 @@ -351,7 +356,7 @@
|
|
231 rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_DISCKEY;
|
|
232 rs_cdb.cdb_opaque[ 10 ] = *pi_agid << 6;
|
|
233
|
|
234 - i_ret = ioctl( i_fd, USCSICMD, &sc );
|
|
235 + i_ret = SolarisSendUSCSI( i_fd, &sc );
|
|
236
|
|
237 if( i_ret < 0 || sc.uscsi_status )
|
|
238 {
|
|
239 @@ -513,7 +518,7 @@
|
|
240 rs_cdb.cdb_opaque[ 5 ] = ( i_pos ) & 0xff;
|
|
241 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
|
|
242
|
|
243 - i_ret = ioctl( i_fd, USCSICMD, &sc );
|
|
244 + i_ret = SolarisSendUSCSI( i_fd, &sc );
|
|
245
|
|
246 if( i_ret < 0 || sc.uscsi_status )
|
|
247 {
|
|
248 @@ -665,7 +670,7 @@
|
|
249
|
|
250 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
|
|
251
|
|
252 - i_ret = ioctl( i_fd, USCSICMD, &sc );
|
|
253 + i_ret = SolarisSendUSCSI( i_fd, &sc );
|
|
254
|
|
255 if( i_ret < 0 || sc.uscsi_status )
|
|
256 {
|
|
257 @@ -787,7 +792,7 @@
|
|
258
|
|
259 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
|
|
260
|
|
261 - i_ret = ioctl( i_fd, USCSICMD, &sc );
|
|
262 + i_ret = SolarisSendUSCSI( i_fd, &sc );
|
|
263
|
|
264 if( i_ret < 0 || sc.uscsi_status )
|
|
265 {
|
|
266 @@ -921,7 +926,7 @@
|
|
267
|
|
268 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_ASF;
|
|
269
|
|
270 - i_ret = ioctl( i_fd, USCSICMD, &sc );
|
|
271 + i_ret = SolarisSendUSCSI( i_fd, &sc );
|
|
272
|
|
273 if( i_ret < 0 || sc.uscsi_status )
|
|
274 {
|
|
275 @@ -1054,7 +1059,7 @@
|
|
276
|
|
277 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
|
|
278
|
|
279 - i_ret = ioctl( i_fd, USCSICMD, &sc );
|
|
280 + i_ret = SolarisSendUSCSI( i_fd, &sc );
|
|
281
|
|
282 if( i_ret < 0 || sc.uscsi_status )
|
|
283 {
|
|
284 @@ -1175,7 +1180,7 @@
|
|
285
|
|
286 rs_cdb.cdb_opaque[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
|
|
287
|
|
288 - i_ret = ioctl( i_fd, USCSICMD, &sc );
|
|
289 + i_ret = SolarisSendUSCSI( i_fd, &sc );
|
|
290
|
|
291 if( i_ret < 0 || sc.uscsi_status )
|
|
292 {
|
|
293 @@ -1299,7 +1304,7 @@
|
|
294 p_buffer[ 1 ] = 0xe;
|
|
295 memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
|
|
296
|
|
297 - if( ioctl( i_fd, USCSICMD, &sc ) < 0 || sc.uscsi_status )
|
|
298 + if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
|
|
299 {
|
|
300 return -1;
|
|
301 }
|
|
302 @@ -1436,7 +1441,7 @@
|
|
303 p_buffer[ 1 ] = 0xa;
|
|
304 memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
|
|
305
|
|
306 - if( ioctl( i_fd, USCSICMD, &sc ) < 0 || sc.uscsi_status )
|
|
307 + if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
|
|
308 {
|
|
309 return -1;
|
|
310 }
|
|
311 @@ -1578,7 +1583,7 @@
|
|
312
|
|
313 rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_RPC;
|
|
314
|
|
315 - i_ret = ioctl( i_fd, USCSICMD, &sc );
|
|
316 + i_ret = SolarisSendUSCSI( i_fd, &sc );
|
|
317
|
|
318 if( i_ret < 0 || sc.uscsi_status )
|
|
319 {
|
|
320 @@ -1728,7 +1733,7 @@
|
|
321 p_buffer[ 1 ] = 6;
|
|
322 p_buffer[ 4 ] = i_pdrc;
|
|
323
|
|
324 - i_ret = ioctl( i_fd, USCSICMD, &sc );
|
|
325 + i_ret = SolarisSendUSCSI( i_fd, &sc );
|
|
326
|
|
327 if( i_ret < 0 || sc.uscsi_status )
|
|
328 {
|
|
329 @@ -1901,6 +1906,54 @@
|
|
330
|
|
331 USCSI_TIMEOUT( p_sc, 15 );
|
|
332 }
|
|
333 +
|
|
334 +/*****************************************************************************
|
|
335 + * SolarisSendUSCSI: send a USCSICMD structure to the Solaris kernel
|
|
336 + * for execution
|
|
337 + *****************************************************************************
|
|
338 + * When available, this function uses the function smedia_uscsi_cmd()
|
|
339 + * from solaris' libsmedia library (solaris 9 or newer) to execute the
|
|
340 + * USCSI command. smedia_uscsi_cmd() allows USCSI commands for
|
|
341 + * non-root users on removable media devices on solaris 9; sending the
|
|
342 + * USCSI command directly to the device using the USCSICMD ioctl fails
|
|
343 + * with an EPERM error on solaris 9.
|
|
344 + *
|
|
345 + * The code will fall back to the USCSICMD ioctl method, when
|
|
346 + * libsmedia.so is not available or does not export the
|
|
347 + * smedia_uscsi_cmd() function (on solaris releases upto and including
|
|
348 + * solaris 8). Fortunatelly, on these old releases non-root users are
|
|
349 + * allowed to perform USCSICMD ioctls on removable media devices.
|
|
350 + *****************************************************************************/
|
|
351 +static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc ) {
|
|
352 + void *sm_hdl;
|
|
353 + static int initialized;
|
|
354 + static void* (*sm_get_handle)(int32_t);
|
|
355 + static int (*sm_release_handle)(void*);
|
|
356 + static int (*sm_uscsi_cmd)(void*, struct uscsi_cmd *);
|
|
357 +
|
|
358 + if (!initialized)
|
|
359 + {
|
|
360 + void *smedia_lib;
|
|
361 +
|
|
362 + smedia_lib = dlopen("libsmedia.so", RTLD_NOW);
|
|
363 + if (smedia_lib) {
|
|
364 + sm_get_handle = dlsym(smedia_lib, "smedia_get_handle");
|
|
365 + sm_release_handle = dlsym(smedia_lib, "smedia_release_handle");
|
|
366 + sm_uscsi_cmd = dlsym(smedia_lib, "smedia_uscsi_cmd");
|
|
367 + }
|
|
368 + initialized = 1;
|
|
369 + }
|
|
370 +
|
|
371 + if (sm_get_handle && sm_uscsi_cmd && sm_release_handle
|
|
372 + && (sm_hdl = sm_get_handle(i_fd)))
|
|
373 + {
|
|
374 + int i_ret = sm_uscsi_cmd(sm_hdl, p_sc);
|
|
375 + sm_release_handle(sm_hdl);
|
|
376 + return i_ret;
|
|
377 + }
|
|
378 +
|
|
379 + return ioctl( i_fd, USCSICMD, p_sc );
|
|
380 +}
|
|
381 #endif
|
|
382
|
|
383 #if defined( WIN32 )
|
|
384 --- libdvdcss.c 2003-06-22 16:08:53.000000000 +0200
|
|
385 +++ libdvdcss.c 2005-03-01 07:41:41.000000000 +0100
|
|
386 @@ -5,7 +5,10 @@
|
|
387 * Håkan Hjort <d95hjort@dtek.chalmers.se>
|
|
388 *
|
|
389 * Copyright (C) 1998-2002 VideoLAN
|
|
390 - * $Id$
|
|
391 + *
|
|
392 + * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
|
|
393 + * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
|
|
394 + * $Id$
|
|
395 *
|
|
396 * This program is free software; you can redistribute it and/or modify
|
|
397 * it under the terms of the GNU General Public License as published by
|
|
398 @@ -22,7 +25,7 @@
|
|
399 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
|
|
400 */
|
|
401
|
|
402 -/**
|
|
403 +/*
|
|
404 * \mainpage libdvdcss developer documentation
|
|
405 *
|
|
406 * \section intro Introduction
|
|
407 @@ -87,10 +90,7 @@
|
|
408 * values. This will speed up descrambling of DVDs which are in the
|
|
409 * cache. The DVDCSS_CACHE directory is created if it does not exist,
|
|
410 * and a subdirectory is created named after the DVD's title or
|
|
411 - * manufacturing date. If DVDCSS_CACHE is not set or is empty, \e libdvdcss
|
|
412 - * will use the default value which is "${HOME}/.dvdcss/" under Unix and
|
|
413 - * "C:\Documents and Settings\$USER\Application Data\dvdcss\" under Win32.
|
|
414 - * The special value "off" disables caching.
|
|
415 + * manufacturing date.
|
|
416 */
|
|
417
|
|
418 /*
|
|
419 @@ -103,28 +103,12 @@
|
|
420 #include <string.h>
|
|
421 #include <sys/types.h>
|
|
422 #include <sys/stat.h>
|
|
423 -#ifdef HAVE_SYS_PARAM_H
|
|
424 -# include <sys/param.h>
|
|
425 -#endif
|
|
426 -#ifdef HAVE_PWD_H
|
|
427 -# include <pwd.h>
|
|
428 -#endif
|
|
429 #include <fcntl.h>
|
|
430 #include <errno.h>
|
|
431 +#include <unistd.h>
|
|
432 +#include <limits.h>
|
|
433
|
|
434 -#ifdef HAVE_UNISTD_H
|
|
435 -# include <unistd.h>
|
|
436 -#endif
|
|
437 -
|
|
438 -#ifdef HAVE_LIMITS_H
|
|
439 -# include <limits.h>
|
|
440 -#endif
|
|
441 -
|
|
442 -#ifdef HAVE_DIRECT_H
|
|
443 -# include <direct.h>
|
|
444 -#endif
|
|
445 -
|
|
446 -#include "dvdcss/dvdcss.h"
|
|
447 +#include "dvdcss.h"
|
|
448
|
|
449 #include "common.h"
|
|
450 #include "css.h"
|
|
451 @@ -132,6 +116,12 @@
|
|
452 #include "ioctl.h"
|
|
453 #include "device.h"
|
|
454
|
|
455 +#ifndef HAVE_MPLAYER
|
|
456 + #include "get_path.c"
|
|
457 +#else
|
|
458 + extern char * get_path( char * filename );
|
|
459 +#endif
|
|
460 +
|
|
461 /**
|
|
462 * \brief Symbol for version checks.
|
|
463 *
|
|
464 @@ -234,87 +224,11 @@
|
|
465 }
|
|
466
|
|
467 /*
|
|
468 - * If DVDCSS_CACHE was not set, try to guess a default value
|
|
469 - */
|
|
470 - if( psz_cache == NULL || psz_cache[0] == '\0' )
|
|
471 - {
|
|
472 -#ifdef HAVE_DIRECT_H
|
|
473 - typedef HRESULT( WINAPI *SHGETFOLDERPATH )
|
|
474 - ( HWND, int, HANDLE, DWORD, LPTSTR );
|
|
475 -
|
|
476 -# define CSIDL_FLAG_CREATE 0x8000
|
|
477 -# define CSIDL_APPDATA 0x1A
|
|
478 -# define SHGFP_TYPE_CURRENT 0
|
|
479 -
|
|
480 - char psz_home[MAX_PATH];
|
|
481 - HINSTANCE p_dll;
|
|
482 - SHGETFOLDERPATH p_getpath;
|
|
483 -
|
|
484 - *psz_home = '\0';
|
|
485 -
|
|
486 - /* Load the shfolder dll to retrieve SHGetFolderPath */
|
|
487 - p_dll = LoadLibrary( "shfolder.dll" );
|
|
488 - if( p_dll )
|
|
489 - {
|
|
490 - p_getpath = (void*)GetProcAddress( p_dll, "SHGetFolderPathA" );
|
|
491 - if( p_getpath )
|
|
492 - {
|
|
493 - /* Get the "Application Data" folder for the current user */
|
|
494 - if( p_getpath( NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
|
|
495 - NULL, SHGFP_TYPE_CURRENT, psz_home ) == S_OK )
|
|
496 - {
|
|
497 - FreeLibrary( p_dll );
|
|
498 - }
|
|
499 - else
|
|
500 - {
|
|
501 - *psz_home = '\0';
|
|
502 - }
|
|
503 - }
|
|
504 - FreeLibrary( p_dll );
|
|
505 - }
|
|
506 -
|
|
507 - /* Cache our keys in
|
|
508 - * C:\Documents and Settings\$USER\Application Data\dvdcss\ */
|
|
509 - if( *psz_home )
|
|
510 - {
|
|
511 - snprintf( psz_buffer, PATH_MAX, "%s/dvdcss", psz_home );
|
|
512 - psz_buffer[PATH_MAX-1] = '\0';
|
|
513 - psz_cache = psz_buffer;
|
|
514 - }
|
|
515 -#else
|
|
516 - char *psz_home = NULL;
|
|
517 -# ifdef HAVE_PWD_H
|
|
518 - struct passwd *p_pwd;
|
|
519 -
|
|
520 - /* Try looking in password file for home dir. */
|
|
521 - p_pwd = getpwuid(getuid());
|
|
522 - if( p_pwd )
|
|
523 - {
|
|
524 - psz_home = p_pwd->pw_dir;
|
|
525 - }
|
|
526 -# endif
|
|
527 -
|
|
528 - if( psz_home == NULL )
|
|
529 - {
|
|
530 - psz_home = getenv( "HOME" );
|
|
531 - }
|
|
532 -
|
|
533 - /* Cache our keys in ${HOME}/.dvdcss/ */
|
|
534 - if( psz_home )
|
|
535 - {
|
|
536 - snprintf( psz_buffer, PATH_MAX, "%s/.dvdcss", psz_home );
|
|
537 - psz_buffer[PATH_MAX-1] = '\0';
|
|
538 - psz_cache = psz_buffer;
|
|
539 - }
|
|
540 -#endif
|
|
541 - }
|
|
542 -
|
|
543 - /*
|
|
544 * Find cache dir from the DVDCSS_CACHE environment variable
|
|
545 */
|
|
546 if( psz_cache != NULL )
|
|
547 {
|
|
548 - if( psz_cache[0] == '\0' || !strcmp( psz_cache, "off" ) )
|
|
549 + if( psz_cache[0] == '\0' )
|
|
550 {
|
|
551 psz_cache = NULL;
|
|
552 }
|
|
553 @@ -325,6 +239,7 @@
|
|
554 psz_cache = NULL;
|
|
555 }
|
|
556 }
|
|
557 + else psz_cache = get_path( "DVDKeys" );
|
|
558
|
|
559 /*
|
|
560 * Open device
|
|
561 @@ -465,9 +380,10 @@
|
|
562 dvdcss->psz_cachefile[0] = '\0';
|
|
563 goto nocache;
|
|
564 }
|
|
565 + i += sprintf( dvdcss->psz_cachefile + i, "/");
|
|
566
|
|
567 - i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title,
|
|
568 - psz_serial );
|
|
569 +// i += sprintf( dvdcss->psz_cachefile + i, "/%s", psz_data );
|
|
570 + i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title, psz_serial );
|
|
571 #if !defined( WIN32 ) || defined( SYS_CYGWIN )
|
|
572 i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
|
|
573 #else
|
|
574 --- dvdcss/dvdcss.h 2003-04-18 20:05:36.000000000 +0200
|
|
575 +++ dvdcss.h 2005-03-01 07:41:41.000000000 +0100
|
|
576 @@ -10,7 +10,10 @@
|
|
577
|
|
578 /*
|
|
579 * Copyright (C) 1998-2002 VideoLAN
|
|
580 - * $Id$
|
|
581 + *
|
|
582 + * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
|
|
583 + * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
|
|
584 + * $Id$
|
|
585 *
|
|
586 * This program is free software; you can redistribute it and/or modify
|
|
587 * it under the terms of the GNU General Public License as published by
|
|
588 @@ -67,6 +70,8 @@
|
|
589 */
|
|
590 extern dvdcss_t dvdcss_open ( char *psz_target );
|
|
591 extern int dvdcss_close ( dvdcss_t );
|
|
592 +extern int dvdcss_title ( dvdcss_t,
|
|
593 + int i_block );
|
|
594 extern int dvdcss_seek ( dvdcss_t,
|
|
595 int i_blocks,
|
|
596 int i_flags );
|