[MPlayer-dev-eng] [PATCH] switch to general libdvdcss cache directory

Diego Biurrun diego at biurrun.de
Thu Oct 20 10:51:44 CEST 2005


Hi,

the attached patch reverts some of our changes to libdvdcss.  We store
cached DVD keys in ~/.mplayer/DVDkeys/ while libdvdcss normally uses
~/.dvdcss/.  This used to be necessary because in the past libdvdcss did
not support key caching.  This is not the case any longer and so I don't
see a good reason to continue patching the lib and do things our own
way.

The effect on users will be minimal, keys will have to be regenerated,
but this happens only once on startup and you can always move the old
directory to the new place.  Besides, keys can then be shared with other
players like vlc and xine.

Diego
-------------- next part --------------
Index: libmpdvdkit2/libdvdcss.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/libdvdcss.c,v
retrieving revision 1.17
diff -u -r1.17 libdvdcss.c
--- libmpdvdkit2/libdvdcss.c	9 Oct 2005 10:18:24 -0000	1.17
+++ libmpdvdkit2/libdvdcss.c	20 Oct 2005 08:41:17 -0000
@@ -90,7 +90,10 @@
  *     values. This will speed up descrambling of DVDs which are in the
  *     cache. The DVDCSS_CACHE directory is created if it does not exist,
  *     and a subdirectory is created named after the DVD's title or
- *     manufacturing date.
+ *     manufacturing date. If DVDCSS_CACHE is not set or is empty, \e libdvdcss
+ *     will use the default value which is "${HOME}/.dvdcss/" under Unix and
+ *     "C:\Documents and Settings\$USER\Application Data\dvdcss\" under Win32.
+ *     The special value "off" disables caching.
  */
 
 /*
@@ -132,12 +135,6 @@
 #include "ioctl.h"
 #include "device.h"
 
-#ifndef HAVE_MPLAYER
- #include "get_path.c"
-#else
- extern char * get_path( char * filename );
-#endif
-
 /**
  * \brief Symbol for version checks.
  *
@@ -239,8 +236,6 @@
         }
     }
 
-#if 0 /* MPlayer caches keys in its own configuration directory */
-
     /*
      *  If DVDCSS_CACHE was not set, try to guess a default value
      */
@@ -317,8 +312,6 @@
 #endif
     }
 
-#endif /* 0 */
-
     /*
      *  Find cache dir from the DVDCSS_CACHE environment variable
      */
@@ -336,7 +329,6 @@
             psz_cache = NULL;
         }
     }
-    else psz_cache = get_path( "DVDKeys" );
 
     /*
      *  Open device
@@ -515,10 +507,9 @@
             dvdcss->psz_cachefile[0] = '\0';
             goto nocache;
         }
-        i += sprintf( dvdcss->psz_cachefile + i, "/");
 
-//        i += sprintf( dvdcss->psz_cachefile + i, "/%s", psz_data );
-        i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title, psz_serial );
+        i += sprintf( dvdcss->psz_cachefile + i, "/%s-%s%s", psz_title,
+                      psz_serial, psz_key );
 #if !defined( WIN32 ) || defined( SYS_CYGWIN )
         i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
 #else


More information about the MPlayer-dev-eng mailing list