Commit beda2783 authored by Stéphane Borel's avatar Stéphane Borel

Use of an environment variable to choose libdvdcss method.

parent 88a15495
......@@ -2,7 +2,7 @@
* css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: css.c,v 1.10 2001/10/13 15:34:21 stef Exp $
* $Id: css.c,v 1.11 2001/10/14 03:26:20 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
* Hkan Hjort <d95hjort@dtek.chalmers.se>
......@@ -494,7 +494,7 @@ int CSSGetTitleKey( dvdcss_handle dvdcss, int i_pos )
memcpy( dvdcss->css.p_title_key, p_key, sizeof(dvd_key_t) );
return 0;
} // ( dvdcss->i_method == DVDCSS_TITLECRACK ) || ( dvdcss->b_ioctls == 0 )
} // ( dvdcss->i_method == DVDCSS_TITLE ) || ( dvdcss->b_ioctls == 0 )
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* libdvdcss.c: DVD reading library.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: libdvdcss.c,v 1.16 2001/10/13 15:34:21 stef Exp $
* $Id: libdvdcss.c,v 1.17 2001/10/14 03:26:20 stef Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -80,10 +80,12 @@ static int _win32_dvdcss_aread ( int i_fd, void *p_data, int i_blocks );
/*****************************************************************************
* dvdcss_open: initialize library, open a DVD device, crack CSS key
*****************************************************************************/
extern dvdcss_handle dvdcss_open ( char *psz_target, int i_method, int i_flags )
extern dvdcss_handle dvdcss_open ( char *psz_target, int i_flags )
{
int i_ret;
char psz_method[16] = "dvdcss_method";
dvdcss_handle dvdcss;
/* Allocate the library structure */
......@@ -102,9 +104,25 @@ extern dvdcss_handle dvdcss_open ( char *psz_target, int i_method, int i_flags )
dvdcss->p_titles = NULL;
dvdcss->b_debug = i_flags & DVDCSS_INIT_DEBUG;
dvdcss->b_errors = !(i_flags & DVDCSS_INIT_QUIET);
dvdcss->i_method = i_method;
dvdcss->psz_error = "no error";
/* find method from DVDCSS_METHOD environment variable */
dvdcss->i_method = DVDCSS_TITLE;
if( getenv( psz_method ) )
{
if( !strncmp( getenv( psz_method ), "key", 3 ) )
{
dvdcss->i_method = DVDCSS_KEY;
}
else if( !strncmp( getenv( psz_method ), "disc", 4 ) )
{
dvdcss->i_method = DVDCSS_DISC;
}
}
i_ret = _dvdcss_open( dvdcss, psz_target );
if( i_ret < 0 )
{
......
......@@ -2,7 +2,7 @@
* libdvdcss.h: DVD reading library, exported functions.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvdcss.h,v 1.6 2001/10/13 15:34:21 stef Exp $
* $Id: dvdcss.h,v 1.7 2001/10/14 03:26:20 stef Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -53,7 +53,6 @@ typedef struct dvdcss_s* dvdcss_handle;
* Exported prototypes
*****************************************************************************/
extern dvdcss_handle dvdcss_open ( char *psz_target,
int i_method,
int i_flags );
extern int dvdcss_close ( dvdcss_handle );
extern int dvdcss_title ( dvdcss_handle,
......
......@@ -220,7 +220,7 @@
#define INPUT_AUDIO_VAR "vlc_input_audio"
#define INPUT_CHANNEL_VAR "vlc_input_channel"
#define INPUT_SUBTITLE_VAR "vlc_input_subtitle"
#define INPUT_DVDCSS_VAR "vlc_input_dvdcss"
#define INPUT_DVDCSS_VAR "dvdcss_method"
#define INPUT_DVDCSS_DEFAULT "title"
/* VCD defaults */
......
......@@ -10,7 +10,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.88 2001/10/13 15:34:21 stef Exp $
* $Id: input_dvd.c,v 1.89 2001/10/14 03:26:20 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -306,8 +306,6 @@ static void DVDInit( input_thread_t * p_input )
static void DVDOpen( struct input_thread_s *p_input )
{
dvdcss_handle dvdhandle;
char * psz_method;
int i_method;
vlc_mutex_lock( &p_input->stream.stream_lock );
......@@ -322,32 +320,15 @@ static void DVDOpen( struct input_thread_s *p_input )
vlc_mutex_unlock( &p_input->stream.stream_lock );
/* XXX: put this shit in an access plugin */
psz_method = main_GetPszVariable( INPUT_DVDCSS_VAR,
INPUT_DVDCSS_DEFAULT );
if( !strncmp( psz_method, "key", 3 ) )
{
i_method = DVDCSS_KEY;
}
else if( !strncmp( psz_method, "disc", 4 ) )
{
i_method = DVDCSS_DISC;
}
else
{
i_method = DVDCSS_TITLE;
}
if( strlen( p_input->p_source ) > 4
&& !strncasecmp( p_input->p_source, "dvd:", 4 ) )
{
dvdhandle = dvdcss_open( p_input->p_source + 4,
i_method,
DVDCSS_INIT_QUIET );
}
else
{
dvdhandle = dvdcss_open( p_input->p_source,
i_method,
DVDCSS_INIT_QUIET );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment