[libdvdcss-devel] build: Refactor system-specific ifdeffery around raw device access
Diego Biurrun
git at videolan.org
Thu Feb 14 00:50:25 CET 2013
libdvdcss | branch: master | Diego Biurrun <diego at biurrun.de> | Thu Feb 14 00:45:18 2013 +0100| [b468e1f1ac9c4ec594aedcd68911bd1d2acff929] | committer: Jean-Baptiste Kempf
build: Refactor system-specific ifdeffery around raw device access
Signed-off-by: Diego Biurrun <diego at biurrun.de>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=b468e1f1ac9c4ec594aedcd68911bd1d2acff929
---
src/device.c | 4 ++--
src/device.h | 5 +++++
src/libdvdcss.c | 6 +++---
src/libdvdcss.h | 5 ++---
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/device.c b/src/device.c
index d8ea194..09cdca3 100644
--- a/src/device.c
+++ b/src/device.c
@@ -410,7 +410,7 @@ int _dvdcss_open ( dvdcss_t dvdcss )
}
}
-#if !defined(WIN32) && !defined(__OS2__)
+#ifdef DVDCSS_RAW_OPEN
int _dvdcss_raw_open ( dvdcss_t dvdcss, char const *psz_device )
{
dvdcss->i_raw_fd = open( psz_device, 0 );
@@ -463,7 +463,7 @@ int _dvdcss_close ( dvdcss_t dvdcss )
#else
close( dvdcss->i_fd );
-#ifndef __OS2__
+#ifdef DVDCSS_RAW_OPEN
if( dvdcss->i_raw_fd >= 0 )
{
close( dvdcss->i_raw_fd );
diff --git a/src/device.h b/src/device.h
index fd58066..6bc0f12 100644
--- a/src/device.h
+++ b/src/device.h
@@ -45,6 +45,11 @@ struct iovec
#include "dvdcss/dvdcss.h"
+#if !defined(WIN32) && !defined(__OS2__)
+# define DVDCSS_RAW_OPEN
+#endif
+
+
/*****************************************************************************
* Device reading prototypes
*****************************************************************************/
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 2bbb2dc..cd92326 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -167,7 +167,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" );
-#if !defined(WIN32) && !defined(__OS2__)
+#ifdef DVDCSS_RAW_OPEN
char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
#endif
@@ -185,7 +185,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
/*
* Initialize structure with default values
*/
-#if !defined(WIN32) && !defined(__OS2__)
+#ifdef DVDCSS_RAW_OPEN
dvdcss->i_raw_fd = -1;
#endif
dvdcss->p_titles = NULL;
@@ -549,7 +549,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
}
nocache:
-#if !defined(WIN32) && !defined(__OS2__)
+#ifdef DVDCSS_RAW_OPEN
if( psz_raw_device != NULL )
{
_dvdcss_raw_open( dvdcss, psz_raw_device );
diff --git a/src/libdvdcss.h b/src/libdvdcss.h
index 6be963c..f80e862 100644
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -27,8 +27,7 @@
#include "dvdcss/dvdcss.h"
#include "css.h"
-
-struct iovec;
+#include "device.h"
/*****************************************************************************
* The libdvdcss structure
@@ -68,7 +67,7 @@ struct dvdcss_s
int i_readv_buf_size;
#endif
-#if !defined(WIN32) && !defined(__OS2__)
+#ifdef DVDCSS_RAW_OPEN
int i_raw_fd;
#endif
};
More information about the libdvdcss-devel
mailing list