Mercurial > mplayer.hg
comparison libmpdvdkit2/libdvdcss.c @ 16848:279cd50f2ba0
Switch from our own to the upstream DVD key caching strategy and directory.
Should work just as well while reducing our diff towards upstream and
enhancing compatibility with external libdvdcss implementations.
author | diego |
---|---|
date | Mon, 24 Oct 2005 09:50:42 +0000 |
parents | 2ab52c9b72b9 |
children | 68145aae7349 |
comparison
equal
deleted
inserted
replaced
16847:72c1c7054ad5 | 16848:279cd50f2ba0 |
---|---|
88 * | 88 * |
89 * \li \b DVDCSS_CACHE: specify a directory in which to store title key | 89 * \li \b DVDCSS_CACHE: specify a directory in which to store title key |
90 * values. This will speed up descrambling of DVDs which are in the | 90 * values. This will speed up descrambling of DVDs which are in the |
91 * cache. The DVDCSS_CACHE directory is created if it does not exist, | 91 * cache. The DVDCSS_CACHE directory is created if it does not exist, |
92 * and a subdirectory is created named after the DVD's title or | 92 * and a subdirectory is created named after the DVD's title or |
93 * manufacturing date. | 93 * manufacturing date. If DVDCSS_CACHE is not set or is empty, \e libdvdcss |
94 * will use the default value which is "${HOME}/.dvdcss/" under Unix and | |
95 * "C:\Documents and Settings\$USER\Application Data\dvdcss\" under Win32. | |
96 * The special value "off" disables caching. | |
94 */ | 97 */ |
95 | 98 |
96 /* | 99 /* |
97 * Preamble | 100 * Preamble |
98 */ | 101 */ |
130 #include "css.h" | 133 #include "css.h" |
131 #include "libdvdcss.h" | 134 #include "libdvdcss.h" |
132 #include "ioctl.h" | 135 #include "ioctl.h" |
133 #include "device.h" | 136 #include "device.h" |
134 | 137 |
135 #ifndef HAVE_MPLAYER | |
136 #include "get_path.c" | |
137 #else | |
138 extern char * get_path( char * filename ); | |
139 #endif | |
140 | |
141 /** | 138 /** |
142 * \brief Symbol for version checks. | 139 * \brief Symbol for version checks. |
143 * | 140 * |
144 * The name of this symbol contains the library major number, which makes it | 141 * The name of this symbol contains the library major number, which makes it |
145 * easy to check which \e libdvdcss development headers are installed on the | 142 * easy to check which \e libdvdcss development headers are installed on the |
236 free( dvdcss->psz_device ); | 233 free( dvdcss->psz_device ); |
237 free( dvdcss ); | 234 free( dvdcss ); |
238 return NULL; | 235 return NULL; |
239 } | 236 } |
240 } | 237 } |
241 | |
242 #if 0 /* MPlayer caches keys in its own configuration directory */ | |
243 | 238 |
244 /* | 239 /* |
245 * If DVDCSS_CACHE was not set, try to guess a default value | 240 * If DVDCSS_CACHE was not set, try to guess a default value |
246 */ | 241 */ |
247 if( psz_cache == NULL || psz_cache[0] == '\0' ) | 242 if( psz_cache == NULL || psz_cache[0] == '\0' ) |
315 psz_cache = psz_buffer; | 310 psz_cache = psz_buffer; |
316 } | 311 } |
317 #endif | 312 #endif |
318 } | 313 } |
319 | 314 |
320 #endif /* 0 */ | |
321 | |
322 /* | 315 /* |
323 * Find cache dir from the DVDCSS_CACHE environment variable | 316 * Find cache dir from the DVDCSS_CACHE environment variable |
324 */ | 317 */ |
325 if( psz_cache != NULL ) | 318 if( psz_cache != NULL ) |
326 { | 319 { |
334 { | 327 { |
335 print_error( dvdcss, "cache directory name is too long" ); | 328 print_error( dvdcss, "cache directory name is too long" ); |
336 psz_cache = NULL; | 329 psz_cache = NULL; |
337 } | 330 } |
338 } | 331 } |
339 else psz_cache = get_path( "DVDKeys" ); | |
340 | 332 |
341 /* | 333 /* |
342 * Open device | 334 * Open device |
343 */ | 335 */ |
344 i_ret = _dvdcss_open( dvdcss ); | 336 i_ret = _dvdcss_open( dvdcss ); |
513 { | 505 { |
514 print_error( dvdcss, "failed creating cache directory" ); | 506 print_error( dvdcss, "failed creating cache directory" ); |
515 dvdcss->psz_cachefile[0] = '\0'; | 507 dvdcss->psz_cachefile[0] = '\0'; |
516 goto nocache; | 508 goto nocache; |
517 } | 509 } |
518 i += sprintf( dvdcss->psz_cachefile + i, "/"); | 510 |
519 | 511 i += sprintf( dvdcss->psz_cachefile + i, "/%s-%s%s", psz_title, |
520 // i += sprintf( dvdcss->psz_cachefile + i, "/%s", psz_data ); | 512 psz_serial, psz_key ); |
521 i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title, psz_serial ); | |
522 #if !defined( WIN32 ) || defined( SYS_CYGWIN ) | 513 #if !defined( WIN32 ) || defined( SYS_CYGWIN ) |
523 i_ret = mkdir( dvdcss->psz_cachefile, 0755 ); | 514 i_ret = mkdir( dvdcss->psz_cachefile, 0755 ); |
524 #else | 515 #else |
525 i_ret = mkdir( dvdcss->psz_cachefile ); | 516 i_ret = mkdir( dvdcss->psz_cachefile ); |
526 #endif | 517 #endif |