Commit 6b95108d authored by Diego Biurrun's avatar Diego Biurrun

Clean up and simplify raw device support.

Treat access to raw devices just like accessing any other device instead of
providing different semantics. libdvdcss now tries raw devices on all OSes
and bails out instead of continuing if accessing a raw device failed.
parent b4823749
......@@ -6,6 +6,7 @@ Changes since 1.3.0:
* Replace BeOS support by Haiku support.
* dvdcss_error() now returns "const char *" instad of "char *".
* Drop support for MSVC versions before 2010.
* Raw device access now errors out if the device cannot be opened.
* Miscellaneous cleanups to code, documentation, build system.
......
......@@ -336,8 +336,11 @@ void dvdcss_check_device ( dvdcss_t dvdcss )
int dvdcss_open_device ( dvdcss_t dvdcss )
{
const char *psz_device = dvdcss->psz_device;
const char *psz_device = getenv( "DVDCSS_RAW_DEVICE" );
if( !psz_device )
{
psz_device = dvdcss->psz_device;
}
print_debug( dvdcss, "opening target `%s'", psz_device );
#if defined( WIN32 )
......@@ -382,27 +385,6 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
}
}
#ifdef DVDCSS_RAW_OPEN
int dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
{
int i_fd = open( psz_device, 0 );
if( i_fd == -1 )
{
print_debug( dvdcss, "cannot open %s (%s)",
psz_device, strerror(errno) );
print_error( dvdcss, "failed to open raw device, but continuing" );
return -1;
}
else
{
dvdcss->i_fd = i_fd;
}
return 0;
}
#endif /* DVDCSS_RAW_OPEN */
int dvdcss_close_device ( dvdcss_t dvdcss )
{
#if defined( WIN32 )
......
......@@ -44,10 +44,6 @@ struct iovec
#include "dvdcss/dvdcss.h"
#if !defined(WIN32) && !defined(__OS2__)
# define DVDCSS_RAW_OPEN
#endif
/*****************************************************************************
* Device reading prototypes
......@@ -57,9 +53,4 @@ void dvdcss_check_device ( dvdcss_t );
int dvdcss_open_device ( dvdcss_t );
int dvdcss_close_device ( dvdcss_t );
/*****************************************************************************
* Device reading prototypes, raw-device specific
*****************************************************************************/
int dvdcss_raw_open ( dvdcss_t, const char * );
#endif /* DVDCSS_DEVICE_H */
......@@ -458,10 +458,6 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
{
int i_ret;
#ifdef DVDCSS_RAW_OPEN
const char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
#endif
/* Allocate the library structure. */
dvdcss_t dvdcss = malloc( sizeof( *dvdcss ) );
if( dvdcss == NULL )
......@@ -536,13 +532,6 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
init_cache( dvdcss );
#ifdef DVDCSS_RAW_OPEN
if( psz_raw_device != NULL )
{
dvdcss_raw_open( dvdcss, psz_raw_device );
}
#endif /* DVDCSS_RAW_OPEN */
/* Seek to the beginning, just for safety. */
dvdcss->pf_seek( dvdcss, 0 );
......
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