ref: 6b95108d3de1755beab102b3a02ca7ef02494bd1
parent: b48237494e0367a324722e106ea2c1ad5121f4b5
author: Diego Biurrun <[email protected]>
date: Fri Nov 14 06:15:12 EST 2014
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.
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@
* 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.
--- a/src/device.c
+++ b/src/device.c
@@ -336,8 +336,11 @@
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 )
@@ -381,27 +384,6 @@
return libc_open( dvdcss, psz_device );
}
}
-
-#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 )
{
--- a/src/device.h
+++ b/src/device.h
@@ -44,11 +44,7 @@
#include "dvdcss/dvdcss.h"
-#if !defined(WIN32) && !defined(__OS2__)
-# define DVDCSS_RAW_OPEN
-#endif
-
/*****************************************************************************
* Device reading prototypes
*****************************************************************************/
@@ -56,10 +52,5 @@
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 */
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -458,10 +458,6 @@
{
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 )
@@ -535,13 +531,6 @@
}
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 );