[Diego Biurrun <diego at biurrun.de>] [PATCH] MPlayer changes to libdvdcss

Christophe Massiot massiot at via.ecp.fr
Tue Jul 5 00:59:45 CEST 2005


Hello,

I don't think anyone gave an answer yet. I do not consider myself as 
a libdvdcss maintainer, but I have an account so if no one is willing 
to check it in I can do it instead of letting it die. A few questions 
though :

At 18:03 +0200 24/06/05, System administration wrote:

>--- common.h	2003-06-13 19:33:35.000000000 +0200
>+++ common.h	2005-03-01 07:41:41.000000000 +0100
>@@ -27,21 +30,10 @@
> 
>/*****************************************************************************
>   * Basic types definitions
> 
>*****************************************************************************/
>-#if defined( HAVE_STDINT_H )
>-#   include <stdint.h>
>-#elif defined( HAVE_INTTYPES_H )
>-#   include <inttypes.h>
>-#elif defined( SYS_CYGWIN )
>-#   include <sys/types.h>
>-    /* Cygwin only defines half of these... */
>-    typedef u_int8_t            uint8_t;
>-    typedef u_int32_t           uint32_t;
>-#else
>-    /* Fallback types (very x86-centric, sorry) */
>-    typedef unsigned char       uint8_t;
>-    typedef signed char         int8_t;
>-    typedef unsigned int        uint32_t;
>-    typedef signed int          int32_t;
>+#include <inttypes.h>
>+
>+#ifdef __CYGWIN__
>+#define SYS_CYGWIN
>  #endif
>
>  #if defined( WIN32 )

I don't know much about that, but wouldn't removing this 
compatibility stuff break some of our ports ?

>--- dvdcss/device.c	2005-06-07 19:22:40.181853664 +0200
>+++ device.c	2005-06-07 15:36:21.000000000 +0200
>@@ -143,8 +137,11 @@
>      _dvdcss_debug( dvdcss, psz_debug );
>
>  #if defined( WIN32 )
>-    /* If device is not "X:", we are actually opening a file. */
>-    dvdcss->b_file = !psz_device[0] || psz_device[1] != ':' || psz_device[2];
>+    dvdcss->b_file = 1;
>+    /* If device is "X:" or "X:\", we are not actually opening a file. */
>+    if (psz_device[0] && psz_device[1] == ':' &&
>+       (!psz_device[2] || (psz_device[2] == '\\' && !psz_device[3])))
>+        dvdcss->b_file = 0;
>
>      /* Initialize readv temporary buffer */
>      dvdcss->p_readv_buffer   = NULL;

This breaks reading DVD devices on Win32.

>--- libdvdcss.c	2003-06-22 16:08:53.000000000 +0200
>+++ libdvdcss.c	2005-03-01 07:41:41.000000000 +0100
>@@ -22,7 +25,7 @@
>   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
>   */
>
>-/**
>+/*
>   * \mainpage libdvdcss developer documentation
>   *
>   * \section intro Introduction
>@@ -87,10 +90,7 @@
>   *     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. 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.
>+ *     manufacturing date.
>   */
>
>  /*
>@@ -103,28 +103,12 @@
>  #include <string.h>
>  #include <sys/types.h>
>  #include <sys/stat.h>
>-#ifdef HAVE_SYS_PARAM_H
>-#   include <sys/param.h>
>-#endif
>-#ifdef HAVE_PWD_H
>-#   include <pwd.h>
>-#endif
>  #include <fcntl.h>
>  #include <errno.h>
>+#include <unistd.h>
>+#include <limits.h>
>
>-#ifdef HAVE_UNISTD_H
>-#   include <unistd.h>
>-#endif
>-
>-#ifdef HAVE_LIMITS_H
>-#   include <limits.h>
>-#endif
>-
>-#ifdef HAVE_DIRECT_H
>-#   include <direct.h>
>-#endif
>-
>-#include "dvdcss/dvdcss.h"
>+#include "dvdcss.h"
>
>  #include "common.h"
>  #include "css.h"
>@@ -132,6 +116,12 @@
>  #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.
>   *
>@@ -234,87 +224,11 @@
>      }
>
>      /*
>-     *  If DVDCSS_CACHE was not set, try to guess a default value
>-     */
>-    if( psz_cache == NULL || psz_cache[0] == '\0' )
>-    {
>-#ifdef HAVE_DIRECT_H
>-        typedef HRESULT( WINAPI *SHGETFOLDERPATH )
>-                       ( HWND, int, HANDLE, DWORD, LPTSTR );
>-
>-#   define CSIDL_FLAG_CREATE 0x8000
>-#   define CSIDL_APPDATA 0x1A
>-#   define SHGFP_TYPE_CURRENT 0
>-
>-        char psz_home[MAX_PATH];
>-        HINSTANCE p_dll;
>-        SHGETFOLDERPATH p_getpath;
>-
>-        *psz_home = '\0';
>-
>-        /* Load the shfolder dll to retrieve SHGetFolderPath */
>-        p_dll = LoadLibrary( "shfolder.dll" );
>-        if( p_dll )
>-        {
>-            p_getpath = (void*)GetProcAddress( p_dll, "SHGetFolderPathA" );
>-            if( p_getpath )
>-            {
>-                /* Get the "Application Data" folder for the current user */
>-                if( p_getpath( NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
>-                               NULL, SHGFP_TYPE_CURRENT, psz_home ) == S_OK )
>-                {
>-                    FreeLibrary( p_dll );
>-                }
>-                else
>-                {
>-                    *psz_home = '\0';
>-                }
>-            }
>-            FreeLibrary( p_dll );
>-        }
>-
>-        /* Cache our keys in
>-         * C:\Documents and Settings\$USER\Application Data\dvdcss\ */
>-        if( *psz_home )
>-        {
>-            snprintf( psz_buffer, PATH_MAX, "%s/dvdcss", psz_home );
>-            psz_buffer[PATH_MAX-1] = '\0';
>-            psz_cache = psz_buffer;
>-        }
>-#else
>-        char *psz_home = NULL;
>-#   ifdef HAVE_PWD_H
>-        struct passwd *p_pwd;
>-
>-        /* Try looking in password file for home dir. */
>-        p_pwd = getpwuid(getuid());
>-        if( p_pwd )
>-        {
>-            psz_home = p_pwd->pw_dir;
>-        }
>-#   endif
>-
>-        if( psz_home == NULL )
>-        {
>-            psz_home = getenv( "HOME" );
>-        }
>-
>-        /* Cache our keys in ${HOME}/.dvdcss/ */
>-        if( psz_home )
>-        {
>-            snprintf( psz_buffer, PATH_MAX, "%s/.dvdcss", psz_home );
>-            psz_buffer[PATH_MAX-1] = '\0';
>-            psz_cache = psz_buffer;
>-        }
>-#endif
>-    }
>-
>-    /*
>       *  Find cache dir from the DVDCSS_CACHE environment variable
>       */
>      if( psz_cache != NULL )
>      {
>-        if( psz_cache[0] == '\0' || !strcmp( psz_cache, "off" ) )
>+        if( psz_cache[0] == '\0' )
>          {
>              psz_cache = NULL;
>          }
>@@ -325,6 +239,7 @@
>              psz_cache = NULL;
>          }
>      }
>+    else psz_cache = get_path( "DVDKeys" );
>
>      /*
>       *  Open device
>@@ -465,9 +380,10 @@
>              dvdcss->psz_cachefile[0] = '\0';
>              goto nocache;
>          }
>+        i += sprintf( dvdcss->psz_cachefile + i, "/");
>
>-        i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title,
>-                      psz_serial );
>+//        i += sprintf( dvdcss->psz_cachefile + i, "/%s", psz_data );
>+	i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title, 
>psz_serial );
>  #if !defined( WIN32 ) || defined( SYS_CYGWIN )
>          i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
>  #else

I'm not sure why you removed this ?

-- 
Christophe Massiot.

-- 
This is the libdvdcss-devel mailing-list, see http://developers.videolan.org/
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the libdvdcss-devel mailing list