summaryrefslogtreecommitdiffstats
path: root/libmpdvdkit2/libdvdcss_changes.diff
diff options
context:
space:
mode:
Diffstat (limited to 'libmpdvdkit2/libdvdcss_changes.diff')
-rw-r--r--libmpdvdkit2/libdvdcss_changes.diff453
1 files changed, 54 insertions, 399 deletions
diff --git a/libmpdvdkit2/libdvdcss_changes.diff b/libmpdvdkit2/libdvdcss_changes.diff
index 34be528dca..babed5f415 100644
--- a/libmpdvdkit2/libdvdcss_changes.diff
+++ b/libmpdvdkit2/libdvdcss_changes.diff
@@ -1,17 +1,6 @@
---- bsdi_ioctl.c 2003-03-10 00:34:10.000000000 +0100
-+++ bsdi_ioctl.c 2005-03-01 07:41:41.000000000 +0100
-@@ -694,7 +698,7 @@
- struct cdrom_tocentry entry;
- int ret, i;
-
-- bzero(tracks, sizeof (*tracks));
-+ memset(tracks, 0, sizeof (*tracks));
- ret = cdrom_ioctl(fd, CDROMREADTOCHDR, &header);
- /*
- * This whole business is a crock anyhow so we don't bother distinguishing
--- common.h 2003-06-13 19:33:35.000000000 +0200
+++ common.h 2005-03-01 07:41:41.000000000 +0100
-@@ -27,21 +30,10 @@
+@@ -27,21 +27,10 @@
/*****************************************************************************
* Basic types definitions
*****************************************************************************/
@@ -37,9 +26,9 @@
#endif
#if defined( WIN32 )
---- css.c 2003-07-29 01:37:06.000000000 +0200
-+++ css.c 2005-03-01 07:41:41.000000000 +0100
-@@ -40,19 +43,11 @@
+--- css.c 2005-07-11 14:24:09.000000000 +0200
++++ css.c 2005-10-01 19:02:35.000000000 +0200
+@@ -41,19 +41,11 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -47,25 +36,28 @@
-# include <sys/param.h>
-#endif
-#ifdef HAVE_UNISTD_H
--# include <unistd.h>
+ # include <unistd.h>
-#endif
#include <fcntl.h>
-+#include <unistd.h>
-+#include <limits.h>
-
+-
-#ifdef HAVE_LIMITS_H
--# include <limits.h>
+ # include <limits.h>
-#endif
--
+
-#include "dvdcss/dvdcss.h"
+#include "dvdcss.h"
#include "common.h"
#include "css.h"
---- dvdcss/device.c 2005-06-07 19:22:40.181853664 +0200
-+++ device.c 2005-06-07 15:36:21.000000000 +0200
-@@ -33,18 +36,9 @@
+--- device.c 2005-07-11 13:33:34.000000000 +0200
++++ device.c 2005-10-01 19:08:07.000000000 +0200
+@@ -31,23 +31,12 @@
+ #include <stdio.h>
+ #include <stdlib.h>
#include <string.h>
+-#ifdef HAVE_ERRNO_H
+ # include <errno.h>
+-#endif
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef HAVE_SYS_PARAM_H
@@ -74,18 +66,16 @@
#include <fcntl.h>
-
-#ifdef HAVE_UNISTD_H
--# include <unistd.h>
+ # include <unistd.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
--# include <limits.h>
+ # include <limits.h>
-#endif
-+#include <unistd.h>
-+#include <limits.h>
#if defined( WIN32 ) && !defined( SYS_CYGWIN )
# include <io.h> /* read() */
-@@ -52,7 +46,7 @@
+@@ -55,7 +44,7 @@
# include <sys/uio.h> /* struct iovec */
#endif
@@ -94,8 +84,8 @@
#include "common.h"
#include "css.h"
-@@ -143,8 +137,11 @@
- _dvdcss_debug( dvdcss, psz_debug );
+@@ -143,8 +132,11 @@
+ print_debug( dvdcss, "opening target `%s'", psz_device );
#if defined( WIN32 )
- /* If device is not "X:", we are actually opening a file. */
@@ -108,259 +98,29 @@
/* Initialize readv temporary buffer */
dvdcss->p_readv_buffer = NULL;
-@@ -276,14 +273,14 @@
- * won't send back the right result).
- * (See Microsoft Q241374: Read and Write Access Required for SCSI
- * Pass Through Requests) */
-- (HANDLE) dvdcss->i_fd =
-+ dvdcss->i_fd = (int)
- CreateFile( psz_dvd, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING,
- FILE_FLAG_RANDOM_ACCESS, NULL );
-
- if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
-- (HANDLE) dvdcss->i_fd =
-+ dvdcss->i_fd = (int)
- CreateFile( psz_dvd, GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING,
- FILE_FLAG_RANDOM_ACCESS, NULL );
-@@ -305,8 +302,8 @@
- DWORD dwSupportInfo;
- struct w32_aspidev *fd;
- int i, j, i_hostadapters;
-- long (*lpGetSupport)( void );
-- long (*lpSendCommand)( void* );
-+ GETASPI32SUPPORTINFO lpGetSupport;
-+ SENDASPI32COMMAND lpSendCommand;
- char c_drive = psz_device[0];
-
- /* load aspi and init w32_aspidev structure */
-@@ -317,8 +314,8 @@
- return -1;
- }
-
-- (FARPROC) lpGetSupport = GetProcAddress( hASPI, "GetASPI32SupportInfo" );
-- (FARPROC) lpSendCommand = GetProcAddress( hASPI, "SendASPI32Command" );
-+ lpGetSupport = (GETASPI32SUPPORTINFO) GetProcAddress( hASPI, "GetASPI32SupportInfo" );
-+ lpSendCommand = (SENDASPI32COMMAND) GetProcAddress( hASPI, "SendASPI32Command" );
-
- if(lpGetSupport == NULL || lpSendCommand == NULL )
- {
---- error.c 2003-03-10 01:15:31.000000000 +0100
-+++ error.c 2005-03-01 07:41:41.000000000 +0100
-@@ -25,16 +28,9 @@
+--- error.c 2004-02-24 16:46:49.000000000 +0100
++++ error.c 2005-10-01 19:10:06.000000000 +0200
+@@ -25,16 +25,9 @@
#include <stdio.h>
#include <stdlib.h>
-+#include <limits.h>
-
+-
-#ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
--# include <limits.h>
+ # include <limits.h>
-#endif
--
+
-#include "dvdcss/dvdcss.h"
+#include "dvdcss.h"
#include "common.h"
#include "css.h"
---- ioctl.c 2003-03-10 00:34:10.000000000 +0100
-+++ ioctl.c 2005-03-01 07:41:41.000000000 +0100
-@@ -76,6 +79,7 @@
- # include <sys/scsi.h>
- #endif
- #ifdef SOLARIS_USCSI
-+# include <dlfcn.h>
- # include <unistd.h>
- # include <stropts.h>
- # include <sys/scsi/scsi_types.h>
-@@ -112,6 +116,7 @@
- *****************************************************************************/
- #if defined( SOLARIS_USCSI )
- static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
-+static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
- #endif
-
- /*****************************************************************************
-@@ -192,7 +197,7 @@
- rs_cdb.cdb_opaque[ 6 ] = i_layer;
- rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_COPYRIGHT;
-
-- i_ret = ioctl(i_fd, USCSICMD, &sc);
-+ i_ret = SolarisSendUSCSI(i_fd, &sc);
-
- if( i_ret < 0 || sc.uscsi_status ) {
- i_ret = -1;
-@@ -351,7 +356,7 @@
- rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_DISCKEY;
- rs_cdb.cdb_opaque[ 10 ] = *pi_agid << 6;
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -513,7 +518,7 @@
- rs_cdb.cdb_opaque[ 5 ] = ( i_pos ) & 0xff;
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -665,7 +670,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -787,7 +792,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -921,7 +926,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_ASF;
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -1054,7 +1059,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -1175,7 +1180,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -1299,7 +1304,7 @@
- p_buffer[ 1 ] = 0xe;
- memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
-
-- if( ioctl( i_fd, USCSICMD, &sc ) < 0 || sc.uscsi_status )
-+ if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
- {
- return -1;
- }
-@@ -1436,7 +1441,7 @@
- p_buffer[ 1 ] = 0xa;
- memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
-
-- if( ioctl( i_fd, USCSICMD, &sc ) < 0 || sc.uscsi_status )
-+ if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
- {
- return -1;
- }
-@@ -1578,7 +1583,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_RPC;
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -1728,7 +1733,7 @@
- p_buffer[ 1 ] = 6;
- p_buffer[ 4 ] = i_pdrc;
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -1901,6 +1906,54 @@
-
- USCSI_TIMEOUT( p_sc, 15 );
- }
-+
-+/*****************************************************************************
-+ * SolarisSendUSCSI: send a USCSICMD structure to the Solaris kernel
-+ * for execution
-+ *****************************************************************************
-+ * When available, this function uses the function smedia_uscsi_cmd()
-+ * from solaris' libsmedia library (solaris 9 or newer) to execute the
-+ * USCSI command. smedia_uscsi_cmd() allows USCSI commands for
-+ * non-root users on removable media devices on solaris 9; sending the
-+ * USCSI command directly to the device using the USCSICMD ioctl fails
-+ * with an EPERM error on solaris 9.
-+ *
-+ * The code will fall back to the USCSICMD ioctl method, when
-+ * libsmedia.so is not available or does not export the
-+ * smedia_uscsi_cmd() function (on solaris releases upto and including
-+ * solaris 8). Fortunatelly, on these old releases non-root users are
-+ * allowed to perform USCSICMD ioctls on removable media devices.
-+ *****************************************************************************/
-+static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc ) {
-+ void *sm_hdl;
-+ static int initialized;
-+ static void* (*sm_get_handle)(int32_t);
-+ static int (*sm_release_handle)(void*);
-+ static int (*sm_uscsi_cmd)(void*, struct uscsi_cmd *);
-+
-+ if (!initialized)
-+ {
-+ void *smedia_lib;
-+
-+ smedia_lib = dlopen("libsmedia.so", RTLD_NOW);
-+ if (smedia_lib) {
-+ sm_get_handle = dlsym(smedia_lib, "smedia_get_handle");
-+ sm_release_handle = dlsym(smedia_lib, "smedia_release_handle");
-+ sm_uscsi_cmd = dlsym(smedia_lib, "smedia_uscsi_cmd");
-+ }
-+ initialized = 1;
-+ }
-+
-+ if (sm_get_handle && sm_uscsi_cmd && sm_release_handle
-+ && (sm_hdl = sm_get_handle(i_fd)))
-+ {
-+ int i_ret = sm_uscsi_cmd(sm_hdl, p_sc);
-+ sm_release_handle(sm_hdl);
-+ return i_ret;
-+ }
-+
-+ return ioctl( i_fd, USCSICMD, p_sc );
-+}
- #endif
-
- #if defined( 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 @@
+--- libdvdcss.c 2004-08-13 15:40:18.000000000 +0200
++++ libdvdcss.c 2005-10-01 19:11:27.000000000 +0200
+@@ -87,10 +87,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
@@ -372,7 +132,7 @@
*/
/*
-@@ -103,28 +103,12 @@
+@@ -103,28 +100,12 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -384,17 +144,15 @@
-#endif
#include <fcntl.h>
#include <errno.h>
-+#include <unistd.h>
-+#include <limits.h>
-
+-
-#ifdef HAVE_UNISTD_H
--# include <unistd.h>
+ # include <unistd.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
--# include <limits.h>
+ # include <limits.h>
-#endif
--
+
-#ifdef HAVE_DIRECT_H
-# include <direct.h>
-#endif
@@ -404,7 +162,7 @@
#include "common.h"
#include "css.h"
-@@ -132,6 +116,12 @@
+@@ -132,6 +113,12 @@
#include "ioctl.h"
#include "device.h"
@@ -417,96 +175,25 @@
/**
* \brief Symbol for version checks.
*
-@@ -234,87 +224,11 @@
+@@ -233,6 +220,8 @@
+ }
+ }
+
++#if 0 /* MPlayer caches keys in its own configuration directory */
++
+ /*
+ * If DVDCSS_CACHE was not set, try to guess a default value
+ */
+@@ -309,6 +298,8 @@
+ #endif
}
++#endif /* 0 */
++
/*
-- * 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 @@
+@@ -326,6 +317,7 @@
psz_cache = NULL;
}
}
@@ -514,48 +201,16 @@
/*
* Open device
-@@ -465,9 +380,10 @@
+@@ -504,9 +496,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-%s%s", psz_title,
+- psz_serial, psz_key );
+// 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", psz_title, psz_serial );
#if !defined( WIN32 ) || defined( SYS_CYGWIN )
i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
#else
---- dvdcss/dvdcss.h 2003-04-18 20:05:36.000000000 +0200
-+++ dvdcss.h 2005-03-01 07:41:41.000000000 +0100
-@@ -67,6 +70,8 @@
- */
- extern dvdcss_t dvdcss_open ( char *psz_target );
- extern int dvdcss_close ( dvdcss_t );
-+extern int dvdcss_title ( dvdcss_t,
-+ int i_block );
- extern int dvdcss_seek ( dvdcss_t,
- int i_blocks,
- int i_flags );
---- dvdcss/ioctl.h 2005-06-07 19:22:40.187852752 +0200
-+++ ioctl.h 2005-06-07 15:31:43.000000000 +0200
-@@ -318,6 +318,9 @@
- * win32 aspi specific
- *****************************************************************************/
-
-+typedef WINAPI DWORD (*GETASPI32SUPPORTINFO)(VOID);
-+typedef WINAPI DWORD (*SENDASPI32COMMAND)(LPVOID);
-+
- #define WIN2K ( GetVersion() < 0x80000000 )
- #define ASPI_HAID 0
- #define ASPI_TARGET 0
-@@ -339,7 +342,7 @@
- long hASPI;
- short i_sid;
- int i_blocks;
-- long (*lpSendCommand)( void* );
-+ SENDASPI32COMMAND lpSendCommand;
- };
-
- #pragma pack(1)