changeset 176:4e099155c968 src

Helping with the WIN32 port.
author jcdutton
date Mon, 28 Apr 2003 16:29:22 +0000
parents ef3c17633f62
children 20d91d6028ac
files dvd_reader.c dvd_udf.c dvdread_internal.h read_cache.c remap.c vm.c
diffstat 6 files changed, 53 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dvd_reader.c	Mon Apr 28 15:32:19 2003 +0000
+++ b/dvd_reader.c	Mon Apr 28 16:29:22 2003 +0000
@@ -51,6 +51,10 @@
 
 #define DEFAULT_UDF_CACHE_LEVEL 1
 
+/**/
+#define WIN32_CSS 0
+/**/
+
 struct dvd_reader_s {
     /* Basic information. */
     int isImageFile;
@@ -296,13 +300,32 @@
 
 dvd_reader_t *DVDOpen( const char *path )
 {
+#ifndef _MSC_VER
     struct stat fileinfo;
-    int ret, have_css;
+    int ret;
+#endif /* _MSC_VER */
+
+    int have_css;
+
     char *dev_name = 0;
 
     if( path == NULL )
       return 0;
 
+#ifdef _MSC_VER
+
+#ifdef WIN32_CSS
+    /* Try to open libdvdcss or fall back to standard functions */
+    have_css = dvdinput_setup();
+
+    return DVDOpenImageFile( path, have_css );
+#else
+    /* Under Win32, we only try to open image files */
+    return DVDOpenImageFile( path, DVDInputSetup() );
+#endif
+
+#else
+
     ret = stat( path, &fileinfo );
     if( ret < 0 ) {
 	/* If we can't stat the file, give up */
@@ -446,6 +469,7 @@
          */
         return DVDOpenPath( path );
     }
+#endif /* _MSC_VER */
 
     /* If it's none of the above, screw it. */
     fprintf( stderr, "libdvdread: Could not open %s\n", path );
--- a/dvd_udf.c	Mon Apr 28 15:32:19 2003 +0000
+++ b/dvd_udf.c	Mon Apr 28 16:29:22 2003 +0000
@@ -33,7 +33,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
+#ifndef _MSC_VER
 #include <sys/ioctl.h>
+#endif /* _MSC_VER */
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
--- a/dvdread_internal.h	Mon Apr 28 15:32:19 2003 +0000
+++ b/dvdread_internal.h	Mon Apr 28 16:29:22 2003 +0000
@@ -1,6 +1,9 @@
 #ifndef DVDREAD_INTERNAL_H
 #define DVDREAD_INTERNAL_H
 
+#ifdef _MSC_VER
+#include <unistd.h>
+#endif /* _MSC_VER */
 
 #define CHECK_VALUE(arg) \
  if(!(arg)) { \
--- a/read_cache.c	Mon Apr 28 15:32:19 2003 +0000
+++ b/read_cache.c	Mon Apr 28 16:29:22 2003 +0000
@@ -114,7 +114,11 @@
 # if READ_CACHE_TRACE
 #  define dprintf(fmt, ...) fprintf(MSG_OUT, "libdvdnav: %s: "fmt,  __func__ , __VA_ARGS__)
 # else
+#ifdef _MSC_VER
+#  define dprintf(fmt, str) /* Nowt */
+#else
 #  define dprintf(fmt, ...) /* Nowt */
+#endif /* _MSC_VER */
 # endif
 #endif
 
--- a/remap.c	Mon Apr 28 15:32:19 2003 +0000
+++ b/remap.c	Mon Apr 28 16:29:22 2003 +0000
@@ -21,8 +21,16 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+
+#ifndef _MSC_VER 
 #include <sys/param.h>
 #include <sys/fcntl.h>
+#else
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 255
+#endif
+#endif /* _MSC_VER */
+
 #include <assert.h>
 #include "remap.h"
 #include "dvdnav_internal.h"
--- a/vm.c	Mon Apr 28 15:32:19 2003 +0000
+++ b/vm.c	Mon Apr 28 16:29:22 2003 +0000
@@ -42,6 +42,11 @@
 
 #include "dvdnav_internal.h"
 
+#ifdef _MSC_VER
+#include <io.h>   /* read() */
+#define lseek64 lseek
+#endif /* _MSC_VER */
+
 /*
 #define STRICT
 */
@@ -123,7 +128,7 @@
 
 static void dvd_read_name(char *name, const char *device) {
     int fd, i;
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(WIN32)
     off64_t off;
 #else
     off_t off;
@@ -1841,6 +1846,9 @@
 
 /*
  * $Log$
+ * Revision 1.59  2003/04/28 16:29:22  jcdutton
+ * Helping with the WIN32 port.
+ *
  * Revision 1.58  2003/04/27 01:26:18  jcdutton
  * Modified libdvdnav to do without libdvdread.
  * Use internal ifo tools.