changeset 230:065a2835ba90 src

Patch to compile with mingw32 from: - Gildas Bazin <gbazin AT altern.org>
author jcdutton
date Sat, 31 Jan 2004 13:27:40 +0000
parents 8b5edf44e384
children 15dc5660d9a8
files dvdnav.c dvdnav_internal.h read_cache.c
diffstat 3 files changed, 28 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav.c	Wed Jan 21 23:11:05 2004 +0000
+++ b/dvdnav.c	Sat Jan 31 13:27:40 2004 +0000
@@ -29,12 +29,9 @@
 #define LOG_DEBUG
 */
 
-#include <pthread.h>
 #include "dvdnav_internal.h"
 #include "read_cache.h"
 
-#include "nav_read.h"
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/time.h>
--- a/dvdnav_internal.h	Wed Jan 21 23:11:05 2004 +0000
+++ b/dvdnav_internal.h	Sat Jan 31 13:27:40 2004 +0000
@@ -33,11 +33,35 @@
 #include <unistd.h>
 #include <limits.h>
 #include <string.h>
+
+#ifdef WIN32
+/* pthread_mutex_* wrapper for win32 */
+#include <windows.h>
+#include <process.h>
+typedef CRITICAL_SECTION pthread_mutex_t;
+#define pthread_mutex_init(a, b) InitializeCriticalSection(a)
+#define pthread_mutex_lock(a)    EnterCriticalSection(a)
+#define pthread_mutex_unlock(a)  LeaveCriticalSection(a)
+#define pthread_mutex_destroy(a)
+#else
 #include <pthread.h>
+#endif
 
-#include "dvd_reader.h"
-#include "ifo_read.h"
-#include "ifo_types.h"
+/* misc win32 helpers */
+#ifdef WIN32
+/* replacement gettimeofday implementation */
+#include <sys/timeb.h>
+static inline int gettimeofday( struct timeval *tv, void *tz )
+{
+  struct timeb t;
+  ftime( &t );
+  tv->tv_sec = t.time;
+  tv->tv_usec = t.millitm * 1000;
+  return 0;
+}
+#include <io.h> /* read() */
+#define lseek64 _lseeki64
+#endif
 
 /* Uncomment for VM command tracing */
 /* #define TRACE */
--- a/read_cache.c	Wed Jan 21 23:11:05 2004 +0000
+++ b/read_cache.c	Sat Jan 31 13:27:40 2004 +0000
@@ -31,8 +31,8 @@
 #endif
 
 #include "dvdnav.h"
+#include "dvdnav_internal.h"
 #include "read_cache.h"
-#include <pthread.h>
 #include <sys/time.h>
 #include <time.h>