summaryrefslogtreecommitdiffstats
path: root/libdvdcss/libdvdcss.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdvdcss/libdvdcss.c')
-rw-r--r--libdvdcss/libdvdcss.c51
1 files changed, 37 insertions, 14 deletions
diff --git a/libdvdcss/libdvdcss.c b/libdvdcss/libdvdcss.c
index 1be814f838..f39d7025d4 100644
--- a/libdvdcss/libdvdcss.c
+++ b/libdvdcss/libdvdcss.c
@@ -7,19 +7,19 @@
* Copyright (C) 1998-2008 VideoLAN
* $Id$
*
- * This program is free software; you can redistribute it and/or modify
+ * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
@@ -166,7 +166,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
char *psz_method = getenv( "DVDCSS_METHOD" );
char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
char *psz_cache = getenv( "DVDCSS_CACHE" );
-#ifndef WIN32
+#if !defined(WIN32) && !defined(SYS_OS2)
char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
#endif
@@ -184,7 +184,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
/*
* Initialize structure with default values
*/
-#ifndef WIN32
+#if !defined(WIN32) && !defined(SYS_OS2)
dvdcss->i_raw_fd = -1;
#endif
dvdcss->p_titles = NULL;
@@ -306,7 +306,25 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
/* Cache our keys in ${HOME}/.dvdcss/ */
if( psz_home )
{
- snprintf( psz_buffer, PATH_MAX, "%s/.dvdcss", psz_home );
+ int home_pos = 0;
+
+#ifdef SYS_OS2
+ if( *psz_home == '/' || *psz_home == '\\')
+ {
+ char *psz_unixroot = getenv("UNIXROOT");
+
+ if( psz_unixroot &&
+ psz_unixroot[0] &&
+ psz_unixroot[1] == ':' &&
+ psz_unixroot[2] == '\0')
+ {
+ strcpy( psz_buffer, psz_unixroot );
+ home_pos = 2;
+ }
+ }
+#endif
+ snprintf( psz_buffer + home_pos, PATH_MAX - home_pos,
+ "%s/.dvdcss", psz_home );
psz_buffer[PATH_MAX-1] = '\0';
psz_cache = psz_buffer;
}
@@ -349,7 +367,14 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
if( dvdcss->b_ioctls )
{
i_ret = _dvdcss_test( dvdcss );
- if( i_ret < 0 )
+ if( i_ret == -2 )
+ {
+ /* Scrambled disk, RPC-II drive, no region set: bail out */
+ free( dvdcss->psz_device );
+ free( dvdcss );
+ return NULL;
+ }
+ else if( i_ret < 0 )
{
/* Disable the CSS ioctls and hope that it works? */
print_debug( dvdcss,
@@ -402,7 +427,6 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
if( psz_cache )
{
uint8_t p_sector[DVDCSS_BLOCK_SIZE];
- char psz_debug[PATH_MAX + 30];
char psz_key[1 + KEY_SIZE * 2 + 1];
char *psz_title;
uint8_t *psz_serial;
@@ -530,13 +554,12 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
/* Pointer to the filename we will use. */
dvdcss->psz_block = dvdcss->psz_cachefile + i;
- sprintf( psz_debug, "using CSS key cache dir: %s",
- dvdcss->psz_cachefile );
- print_debug( dvdcss, psz_debug );
+ print_debug( dvdcss, "using CSS key cache dir: %s",
+ dvdcss->psz_cachefile );
}
nocache:
-#ifndef WIN32
+#if !defined(WIN32) && !defined(SYS_OS2)
if( psz_raw_device != NULL )
{
_dvdcss_raw_open( dvdcss, psz_raw_device );