basic win32 port

gbazin at netcourrier.com gbazin at netcourrier.com
Thu Apr 26 11:02:46 CEST 2001


This is my attempt to port the VLC on Win32. Not that I am a very big fan of Windows, but Windows workstations being usually used in networks, a VLC port would be really nice.

First, don't expect to much of this patch. Only the basic functionalities are working. That means no MMX, no DVD plugin, no nice GUI ...
The video and audio plugins used under Windows are (of course) the SDL plugins (but builtin). Almost nothing had to be change in the source code of these plugins :-)
Furthermore, I'm not an expert programmer and I don't know many things about Windows API, so you may find mistakes in the following patch.

I've done the port on my Linux (Debian ;-)) computer with a cross-compiler version of MINGW32. On http://www.libsdl.org/Xmingw32/ you will find all you need to compile the VLC.
I already tried a windows native version of this compiler and also of cygwin, but I found it so much painfull to use that I gave up quickly (The configure script and the Makefile were not working)
This patch is very MINGW32 specific and I really don't know if it will be easy to adapt it to another compiler.

After having installed everything properly and patched the VLC you still have to do a few modifications:
- Because we are cross-compiling, you have to remove the AC_C_BIGENDIAN check in configure.in
- Run autoconf
- Run configure --disable-x11 --disable-gtk --disable-dsp --disable-xvideo
- Modify Makefile.opts to build sdl not as a plugin but builtin (plugins don't work yet on win32)
- Still in Makefile.opts, you will have to add "-lws2_32" to the linker options this is to include winsock. As a quick and ugly hack, just add this on the "LIB_YUV =" line.
- ... I think this is it, now run make.

I know I introduced a lot of #ifdef in the code but I didn't know how the VLC team wanted that. I still hope someone will try to integrate this in the CVS, and if more work is needed for that, I'm ready to help.
By the way, as I already said, this port is for the moment really basic, and there are still a few bugs, mainly with the SDL plugins (The video window is not responsive, you can quit with Q but cannot move the window..., the audio speed is also buggy)
If the someone wants, maybe I can put a working binary on the videolan FTP site.

Have fun,

Gildas Bazin

----- La messagerie itinérante sans abonnement NetCourrier -----
Web : www.netcourrier.com - Minitel : 3615 NETCOURRIER
Téléphone : 08 36 69 00 21


-- Attached file included as plaintext by Listar --

Index: include/common.h
===================================================================
RCS file: /var/cvs/videolan/vlc/include/common.h,v
retrieving revision 1.30
diff -u -r1.30 common.h
--- include/common.h	2001/04/11 02:01:24	1.30
+++ include/common.h	2001/04/26 05:10:08
@@ -142,6 +142,7 @@
 
 #ifdef NTOHL_IN_SYS_PARAM_H
 #   include <sys/param.h>
+#elif defined(SYS_MINGW32MSVC)
 #else
 #   include <netinet/in.h>
 #endif
Index: include/modules.h
===================================================================
RCS file: /var/cvs/videolan/vlc/include/modules.h,v
retrieving revision 1.20
diff -u -r1.20 modules.h
--- include/modules.h	2001/04/15 04:19:57	1.20
+++ include/modules.h	2001/04/26 05:10:09
@@ -21,6 +21,10 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#ifdef SYS_MINGW32MSVC
+#include <sys/types.h>                                              /* off_t */
+#endif
+
 /* Number of tr
ies before we unload an unused module */
 #define MODULE_HIDE_DELAY 100
 
Index: include/threads.h
===================================================================
RCS file: /var/cvs/videolan/vlc/include/threads.h,v
retrieving revision 1.16
diff -u -r1.16 threads.h
--- include/threads.h	2001/03/21 13:42:33	1.16
+++ include/threads.h	2001/04/26 05:10:10
@@ -31,12 +31,17 @@
 #elif defined(HAVE_CTHREADS_H)                                    /* GNUMach */
 #include <cthreads.h>
 
-#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)   /* BeOS */
+#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)  /* BeOS */
 #undef MAX
 #undef MIN
 #include <kernel/OS.h>
 #include <kernel/scheduler.h>
 #include <byteorder.h>
+
+#elif defined(SYS_MINGW32MSVC)                /* Win32 with MinGW32 compiler */
+#include <windows.h>
+#include <process.h>
+
 #else
 #error no threads available on your system !
 #endif
@@ -118,6 +123,12 @@
     thread_id       thread;
 } vlc_cond_t;
 
+#elif defined(SY
S_MINGW32MSVC)
+typedef HANDLE      vlc_thread_t;
+typedef HANDLE      vlc_mutex_t;
+typedef HANDLE      vlc_cond_t; 
+typedef unsigned (__stdcall *PTHREAD_START) (void *);
+
 #endif
 
 typedef void *(*vlc_thread_func_t)(void *p_data);
@@ -165,6 +176,23 @@
                               B_NORMAL_PRIORITY, p_data );
     return resume_thread( *p_thread );
 
+#elif defined(SYS_MINGW32MSVC)
+#if 0
+    DWORD threadID;
+    /* This method is not recommended when using the MSVCRT C library,
+     * so we'll have to use _beginthreadex instead */
+    *p_thread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE) func, 
+                             p_data, 0, &threadID);
+#endif
+    unsigned threadID;
+    /* When using the MSVCRT C library you have to use the _beginthreadex
+     * function instead of CreateThread, otherwise you'll end up with memory
+     * leaks and the signal function not working */
+    *p_thread = (HANDLE)_beginthreadex(NULL, 0, (PTHREAD_START) func, 
+                             p_data, 0, &threa
dID);
+    
+    return (*p_thread?0:1);
+
 #endif
 }
 
@@ -183,6 +211,13 @@
 #elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
     exit_thread( 0 );
 
+#elif defined(SYS_MINGW32MSVC)
+#if 0
+    ExitThread( 0 );
+#endif
+    /* For now we don't close the thread handles (because of race conditions).
+     * Need to be looked at. */
+    _endthreadex(0);
 #endif
 }
 
@@ -201,6 +234,8 @@
     int32 exit_value;
     wait_for_thread( thread, &exit_value );
 
+#elif defined(SYS_MINGW32MSVC)
+    WaitForSingleObject( thread, INFINITE);
 #endif
 }
 
@@ -231,6 +266,10 @@
     p_mutex->init = 9999;
     return B_OK;
 
+#elif defined(SYS_MINGW32MSVC)
+    *p_mutex = CreateMutex(0,FALSE,0);
+    return (*p_mutex?0:1);
+
 #endif
 }
 
@@ -255,6 +294,10 @@
     err = acquire_sem( p_mutex->lock );
     return err;
 
+#elif defined(SYS_MINGW32MSVC)
+    WaitForSingleObject( *p_mutex, INFINITE );
+    return 0;
+
 #endif
 }
 
@@ -278,6 +321,10 @@
     release_sem( p_mutex->lock );
     return B_OK;
 
+#elif
 defined(SYS_MINGW32MSVC)
+    ReleaseMutex( *p_mutex );
+    return 0;
+
 #endif
 }
 
@@ -293,6 +340,9 @@
         delete_sem( p_mutex->lock );
     p_mutex->init = 0;
     return B_OK;
+#elif defined(SYS_MINGW32MSVC)
+    CloseHandle(*p_mutex);
+    return 0;
 #endif    
 }
 
@@ -324,6 +374,14 @@
     p_condvar->init = 9999;
     return 0;
 
+#elif defined(SYS_MINGW32MSVC)
+    // Create an auto-reset event.
+    *p_condvar = CreateEvent (NULL,  /* no security */
+                              FALSE, /* auto-reset event */
+                              FALSE, /* non-signaled initially */
+                              NULL); /* unnamed */
+    return (*p_condvar?0:1);
+    
 #endif
 }
 
@@ -372,6 +430,11 @@
     }
     return 0;
 
+#elif defined(SYS_MINGW32MSVC)
+    /* Try to release one waiting thread. */
+    PulseEvent ( *p_condvar );
+    return 0;
+
 #endif
 }
 
@@ -408,6 +471,18 @@
     vlc_mutex_lock( p_mutex );
     return 0;
 
+#elif defined(SYS_MINGW32MSVC)
+    /* Release the <external_mutex> h
ere and wait for the event
+     * to become signaled, due to <pthread_cond_signal> being
+     * called. */
+    vlc_mutex_unlock( p_mutex );
+
+    WaitForSingleObject( *p_condvar, INFINITE );
+
+    /* Reacquire the mutex before returning. */
+    vlc_mutex_lock( p_mutex );
+    return 0;
+
 #endif
 }
 
@@ -421,5 +496,11 @@
 #elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
     p_condvar->init = 0;
     return 0;
+#elif defined(SYS_MINGW32MSVC)
+    CloseHandle( *p_condvar );
+    return 0;
 #endif    
 }
+
+
+
Index: plugins/gtk/gtk_callbacks.c
===================================================================
RCS file: /var/cvs/videolan/vlc/plugins/gtk/gtk_callbacks.c,v
retrieving revision 1.14
diff -u -r1.14 gtk_callbacks.c
--- plugins/gtk/gtk_callbacks.c	2001/04/11 04:31:59	1.14
+++ plugins/gtk/gtk_callbacks.c	2001/04/26 05:10:11
@@ -29,7 +29,7 @@
  * Preamble
  *****************************************************************************/
 #include "defs.h"
-
+#include <sys/types.h
>                                              /* off_t */                           
 #include <stdlib.h>
 
 #include <gtk/gtk.h>
Index: plugins/gtk/gtk_playlist.c
===================================================================
RCS file: /var/cvs/videolan/vlc/plugins/gtk/gtk_playlist.c,v
retrieving revision 1.9
diff -u -r1.9 gtk_playlist.c
--- plugins/gtk/gtk_playlist.c	2001/04/08 13:09:32	1.9
+++ plugins/gtk/gtk_playlist.c	2001/04/26 05:10:12
@@ -170,7 +170,10 @@
    
     for( dummy=0; dummy < playlist_p->i_size; dummy++ )
     {
+        /* WIN32 HACK
         text[0] = g_strdup( rindex( (char *)(playlist_p->p_item[playlist_p->i_size -1 - dummy].psz_name ), '/' ) + 1 );
+        */
+        text[0] = g_strdup("");
         text[1] = g_strdup( "no info");
         
         gtk_clist_insert( clist, 0, text );
Index: plugins/mpeg/input_es.c
===================================================================
RCS file: /var/cvs/videolan/vlc/plugins/mpeg/input_es.c,v
retrieving revision 1.1
diff -u -r1.1 i
nput_es.c
--- plugins/mpeg/input_es.c	2001/04/20 15:02:48	1.1
+++ plugins/mpeg/input_es.c	2001/04/26 05:10:13
@@ -213,7 +213,11 @@
     p_method = (thread_es_data_t *)p_input->p_plugin_data;
 
     /* A little bourrin but should work for a while --Meuuh */
+#ifndef SYS_MINGW32MSVC
     fseeko( p_method->stream, i_position, SEEK_SET );
+#else
+    fseek( p_method->stream, (long)i_position, SEEK_SET );
+#endif
 
     p_input->stream.p_selected_area->i_tell = i_position;
 }
Index: plugins/mpeg/input_ps.c
===================================================================
RCS file: /var/cvs/videolan/vlc/plugins/mpeg/input_ps.c,v
retrieving revision 1.17
diff -u -r1.17 input_ps.c
--- plugins/mpeg/input_ps.c	2001/04/22 00:08:26	1.17
+++ plugins/mpeg/input_ps.c	2001/04/26 05:10:14
@@ -527,7 +527,11 @@
     p_method = (thread_ps_data_t *)p_input->p_plugin_data;
 
     /* A little bourrin but should work for a while --Meuuh */
+#ifndef SYS_MINGW32MSVC
     fseeko( p_method->stream, i_position, SEEK_SET );
+#else
+    
fseek( p_method->stream, (long)i_position, SEEK_SET );
+#endif
 
     p_input->stream.p_selected_area->i_tell = i_position;
 }
Index: plugins/mpeg/input_ts.c
===================================================================
RCS file: /var/cvs/videolan/vlc/plugins/mpeg/input_ts.c,v
retrieving revision 1.14
diff -u -r1.14 input_ts.c
--- plugins/mpeg/input_ts.c	2001/04/13 05:36:12	1.14
+++ plugins/mpeg/input_ts.c	2001/04/26 05:10:14
@@ -35,10 +35,15 @@
 
 #include <sys/types.h>
 #include <sys/time.h>
+
 #ifdef SYS_NTO
 #include <sys/select.h>
 #endif
+
+#ifndef SYS_MINGW32MSVC
 #include <sys/uio.h>
+#endif
+
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -80,7 +85,7 @@
 #define input p_function_list->functions.input
     p_function_list->pf_probe = TSProbe;
     input.pf_init             = TSInit;
-#if !defined( SYS_BEOS ) && !defined( SYS_NTO )
+#if !defined( SYS_BEOS ) && !defined( SYS_NTO ) && !defined( SYS_MINGW32MSVC )
     input.pf_open             = input_NetworkOpen;
     input.pf_c
lose            = input_NetworkClose;
 #else
@@ -253,7 +258,11 @@
     
     if( i_data )
     {
+#ifndef SYS_MINGW32MSVC
         i_read = readv( p_input->i_handle, p_iovec, INPUT_READ_ONCE );
+#else
+        i_read = -1;
+#endif
         
         if( i_read == -1 )
         {
@@ -273,3 +282,4 @@
     }
     return 0;
 }
+
Index: plugins/sdl/aout_sdl.c
===================================================================
RCS file: /var/cvs/videolan/vlc/plugins/sdl/aout_sdl.c,v
retrieving revision 1.10
diff -u -r1.10 aout_sdl.c
--- plugins/sdl/aout_sdl.c	2001/03/21 13:42:34	1.10
+++ plugins/sdl/aout_sdl.c	2001/04/26 05:10:15
@@ -33,7 +33,9 @@
 
 #include <errno.h>                                                 /* ENOMEM */
 #include <fcntl.h>                                       /* open(), O_WRONLY */
+#ifndef SYS_MINGW32MSVC
 #include <sys/ioctl.h>                                            /* ioctl() */
+#endif
 #include <string.h>                                            /* strerror() */
 #include <unis
td.h>                                      /* write(), close() */
 #include <stdio.h>                                           /* "intf_msg.h" */
@@ -110,7 +112,6 @@
 {
     SDL_AudioSpec desired, obtained;
 
-    return 0;
     /* Start AudioSDL */
     if( SDL_Init(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE) != 0 )
     {
@@ -121,7 +122,7 @@
     desired.freq       = 11025;                                 /* frequency */
     desired.format     = AUDIO_U8;                        /* unsigned 8 bits */
     desired.channels   = 2;                                          /* mono */
-    desired.callback   = NULL;                   /* no callback function yet */
+    desired.callback   = aout_SDLCallback;    /* callback function mandatory */
     desired.userdata   = NULL;                     /* null parm for callback */
     desired.samples    = 4096;
 
@@ -134,6 +135,9 @@
     }
 
     /* Otherwise, there are good chances we can use this plugin, return 100. */
+
+    intf_DbgMsg( "aout: SDL_OpenAudio Worked." );

+
     SDL_CloseAudio();
 
     if( TestMethod( AOUT_METHOD_VAR, "sdl" ) )
Index: plugins/sdl/vout_sdl.c
===================================================================
RCS file: /var/cvs/videolan/vlc/plugins/sdl/vout_sdl.c,v
retrieving revision 1.47
diff -u -r1.47 vout_sdl.c
--- plugins/sdl/vout_sdl.c	2001/04/11 02:01:24	1.47
+++ plugins/sdl/vout_sdl.c	2001/04/26 05:10:17
@@ -158,8 +158,12 @@
     }
 
     /* Initialize library */
-    if( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTTHREAD | SDL_INIT_NOPARACHUTE)
-            < 0 )
+    if( SDL_Init( SDL_INIT_VIDEO
+#ifndef SYS_MINGW32MSVC
+    /* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/
+                | SDL_INIT_EVENTTHREAD
+#endif
+	        | SDL_INIT_NOPARACHUTE ) < 0 )
     {
         intf_ErrMsg( "vout error: can't initialize SDL (%s)", SDL_GetError() );
         free( p_vout->p_sys );
Index: src/ac3_decoder/ac3_bit_allocate.c
===================================================================
RCS file: /var/cvs/videolan/vl
c/src/ac3_decoder/ac3_bit_allocate.c,v
retrieving revision 1.18
diff -u -r1.18 ac3_bit_allocate.c
--- src/ac3_decoder/ac3_bit_allocate.c	2001/04/20 12:14:34	1.18
+++ src/ac3_decoder/ac3_bit_allocate.c	2001/04/26 05:10:18
@@ -152,11 +152,13 @@
                      10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14,
                      14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15 };
 
+#undef max
 static __inline__ u16 max (s16 a, s16 b)
 {
     return (a > b ? a : b);
 }
 
+#undef min
 static __inline__ u16 min (s16 a, s16 b)
 {
     return (a < b ? a : b);
Index: src/ac3_decoder/ac3_imdct.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/ac3_decoder/ac3_imdct.c,v
retrieving revision 1.15
diff -u -r1.15 ac3_imdct.c
--- src/ac3_decoder/ac3_imdct.c	2001/04/20 12:14:34	1.15
+++ src/ac3_decoder/ac3_imdct.c	2001/04/26 05:10:19
@@ -41,6 +41,10 @@
 
 #include "ac3_downmix.h"
 
+#ifdef SYS_MINGW32MSVC
+# define M_PI           3.14
159265358979323846  /* pi */
+#endif
+
 void imdct_do_256(imdct_t * p_imdct, float x[],float y[], int id);
 void imdct_do_512(imdct_t * p_imdct, float x[],float y[], int id);
 
Index: src/ac3_decoder/ac3_rematrix.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/ac3_decoder/ac3_rematrix.c,v
retrieving revision 1.13
diff -u -r1.13 ac3_rematrix.c
--- src/ac3_decoder/ac3_rematrix.c	2001/04/20 12:14:34	1.13
+++ src/ac3_decoder/ac3_rematrix.c	2001/04/26 05:10:19
@@ -41,6 +41,7 @@
 
 static const struct rematrix_band_s rematrix_band[] = { {13,24}, {25,36}, {37 ,60}, {61,252}};
 
+#undef min
 static __inline__ u32 min (u32 a, u32 b)
 {
     return (a < b ? a : b);
Index: src/audio_output/audio_output.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/audio_output/audio_output.c,v
retrieving revision 1.56
diff -u -r1.56 audio_output.c
--- src/audio_output/audio_output.c	2001/03/21 13:42:34	1.56
+++ src/audio
_output/audio_output.c	2001/04/26 05:10:20
@@ -39,6 +39,9 @@
 #include "defs.h"
 
 #include <unistd.h>                                              /* getpid() */
+#ifdef SYS_MINGW32MSVC         /* getpid() for win32 is located in process.h */
+#include <process.h>
+#endif
 
 #include <stdio.h>                                           /* "intf_msg.h" */
 #include <stdlib.h>                            /* calloc(), malloc(), free() */
Index: src/input/input.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/input/input.c,v
retrieving revision 1.99
diff -u -r1.99 input.c
--- src/input/input.c	2001/04/22 00:08:26	1.99
+++ src/input/input.c	2001/04/26 05:10:21
@@ -38,7 +38,7 @@
 
 /* Network functions */
 
-#if !defined( SYS_BEOS ) && !defined( SYS_NTO )
+#if !defined( SYS_BEOS ) && !defined( SYS_NTO ) && !defined( SYS_MINGW32MSVC )
 #include <netdb.h>                                             /* hostent ... */
 #include <sys/socket.h>
 #include <netinet/in
.h>
@@ -488,7 +488,7 @@
         p_input->stream.p_selected_area->i_size = stat_info.st_size;
     }
     else if( S_ISFIFO(stat_info.st_mode)
-#ifndef SYS_BEOS
+#if !defined( SYS_BEOS ) && !defined( SYS_MINGW32MSVC )
              || S_ISSOCK(stat_info.st_mode)
 #endif
              )
@@ -509,8 +509,13 @@
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 
     intf_Msg( "input: opening %s", p_input->p_source );
+#ifndef SYS_MINGW32MSVC
     if( (p_input->i_handle = open( psz_name,
                                    /*O_NONBLOCK | O_LARGEFILE*/0 )) == (-1) )
+#else
+    if( (p_input->i_handle = open( psz_name, O_BINARY
+                                   /*O_NONBLOCK | O_LARGEFILE*/ )) == (-1) )
+#endif
     {
         intf_ErrMsg( "input error: cannot open file (%s)", strerror(errno) );
         p_input->b_error = 1;
@@ -531,7 +531,7 @@
 }
 
 
-#if !defined( SYS_BEOS ) && !defined( SYS_NTO )
+#if !defined( SYS_BEOS ) && !defined( SYS_NTO ) && !defined( SYS_MINGW32MSVC )
 /*****************************
************************************************
  * input_NetworkOpen : open a network socket 
  *****************************************************************************/
Index: src/input/input_clock.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/input/input_clock.c,v
retrieving revision 1.10
diff -u -r1.10 input_clock.c
--- src/input/input_clock.c	2001/04/26 03:55:44	1.10
+++ src/input/input_clock.c	2001/04/26 05:10:22
@@ -27,6 +27,7 @@
 #include "defs.h"
 
 #include <string.h>                                    /* memcpy(), memset() */
+#include <sys/types.h>                                              /* off_t */
 
 #include "config.h"
 #include "common.h"
Index: src/input/input_dec.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/input/input_dec.c,v
retrieving revision 1.10
diff -u -r1.10 input_dec.c
--- src/input/input_dec.c	2001/04/06 09:15:47	1.10
+++ src/input/input_dec.c	2001/04/
26 05:10:22
@@ -28,6 +28,7 @@
 
 #include <stdlib.h>
 #include <string.h>                                    /* memcpy(), memset() */
+#include <sys/types.h>                                              /* off_t */
 
 #include "config.h"
 #include "common.h"
Index: src/input/input_ext-dec.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/input/input_ext-dec.c,v
retrieving revision 1.13
diff -u -r1.13 input_ext-dec.c
--- src/input/input_ext-dec.c	2001/04/25 10:22:33	1.13
+++ src/input/input_ext-dec.c	2001/04/26 05:10:23
@@ -27,6 +27,7 @@
 #include "defs.h"
 
 #include <string.h>                                    /* memcpy(), memset() */
+#include <sys/types.h>                                              /* off_t */
 
 #include "config.h"
 #include "common.h"
Index: src/input/input_ext-intf.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/input/input_ext-intf.c,v
retrieving revision 1.20
diff -u -r
1.20 input_ext-intf.c
--- src/input/input_ext-intf.c	2001/04/08 07:24:47	1.20
+++ src/input/input_ext-intf.c	2001/04/26 05:10:23
@@ -27,6 +27,11 @@
 #include "defs.h"
 
 #include <string.h>                                    /* memcpy(), memset() */
+#include <sys/types.h>                                              /* off_t */
+
+#ifdef SYS_MINGW32MSVC
+#define snprintf _snprintf
+#endif
 
 #include "config.h"
 #include "common.h"
Index: src/input/input_netlist.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/input/input_netlist.c,v
retrieving revision 1.33
diff -u -r1.33 input_netlist.c
--- src/input/input_netlist.c	2001/04/06 09:15:47	1.33
+++ src/input/input_netlist.c	2001/04/26 05:10:24
@@ -29,7 +29,9 @@
 #include <stdlib.h>
 #include <string.h>                                    /* memcpy(), memset() */
 #include <sys/types.h>
+#ifndef SYS_MINGW32MSVC
 #include <sys/uio.h>                                         /* struct iovec */
+#endif
 #inclu
de <unistd.h>
 
 #include "config.h"
@@ -45,6 +45,13 @@
 #include "input.h"
 #include "input_netlist.h"

+#ifdef SYS_MINGW32MSVC 
+struct iovec
+  {
+    void *iov_base;     /* Pointer to data.  */
+    size_t iov_len;     /* Length of data.  */
+  };
+#endif
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
Index: src/input/input_programs.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/input/input_programs.c,v
retrieving revision 1.50
diff -u -r1.50 input_programs.c
--- src/input/input_programs.c	2001/04/22 00:08:26	1.50
+++ src/input/input_programs.c	2001/04/26 05:10:26
@@ -28,6 +28,7 @@
 
 #include <stdlib.h>
 #include <string.h>                                    /* memcpy(), memset() */
+#include <sys/types.h>                                              /* off_t */
 
 #include "config.h"
 #include "common.h"
Index: s
rc/input/mpeg_system.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/input/mpeg_system.c,v
retrieving revision 1.51
diff -u -r1.51 mpeg_system.c
--- src/input/mpeg_system.c	2001/04/17 14:54:54	1.51
+++ src/input/mpeg_system.c	2001/04/26 05:10:29
@@ -32,6 +32,7 @@
 
 #include <stdlib.h>
 #include <string.h>                                    /* memcpy(), memset() */
+#include <sys/types.h>                                              /* off_t */
 
 #include "config.h"
 #include "common.h"
Index: src/interface/interface.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/interface/interface.c,v
retrieving revision 1.72
diff -u -r1.72 interface.c
--- src/interface/interface.c	2001/04/11 02:01:24	1.72
+++ src/interface/interface.c	2001/04/26 05:10:30
@@ -32,6 +32,7 @@
 #include <stdlib.h>                                      /* free(), strtol() */
 #include <stdio.h>                                     
              /* FILE */
 #include <string.h>                                            /* strerror() */
+#include <sys/types.h>                                              /* off_t */
 
 #include "config.h"
 #include "common.h"
Index: src/interface/intf_msg.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/interface/intf_msg.c,v
retrieving revision 1.30
diff -u -r1.30 intf_msg.c
--- src/interface/intf_msg.c	2001/04/25 09:31:14	1.30
+++ src/interface/intf_msg.c	2001/04/26 05:10:32
@@ -47,6 +47,10 @@
 
 #include "main.h"
 
+#ifdef SYS_MINGW32MSVC
+#define snprintf _snprintf         /* snprintf not defined in mingw32 (bug?) */
+#endif
+
 /*****************************************************************************
  * intf_msg_item_t
  *****************************************************************************
Index: src/interface/main.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/interface/m
ain.c,v
retrieving revision 1.87
diff -u -r1.87 main.c
--- src/interface/main.c	2001/04/20 05:40:03	1.87
+++ src/interface/main.c	2001/04/26 05:10:34
@@ -864,13 +864,15 @@
 static void InitSignalHandler( void )
 {
     /* Termination signals */
-    signal( SIGHUP,  FatalSignalHandler );
+#ifndef SYS_MINGW32MSVC
     signal( SIGINT,  FatalSignalHandler );
+    signal( SIGHUP,  FatalSignalHandler );
     signal( SIGQUIT, FatalSignalHandler );
 
     /* Other signals */
     signal( SIGALRM, SimpleSignalHandler );
     signal( SIGPIPE, SimpleSignalHandler );
+#endif
 }
 
 
@@ -897,9 +899,11 @@
     /* Once a signal has been trapped, the termination sequence will be
      * armed and following signals will be ignored to avoid sending messages
      * to an interface having been destroyed */
-    signal( SIGHUP,  SIG_IGN );
+#ifndef SYS_MINGW32MSVC
     signal( SIGINT,  SIG_IGN );
+    signal( SIGHUP,  SIG_IGN );
     signal( SIGQUIT, SIG_IGN );
+#endif
 
     /* Acknowledge the signal received */
     intf_ErrMs
gImm( "intf error: signal %d received, exiting", i_signal );
Index: src/misc/modules.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/misc/modules.c,v
retrieving revision 1.26
diff -u -r1.26 modules.c
--- src/misc/modules.c	2001/04/20 11:06:48	1.26
+++ src/misc/modules.c	2001/04/26 05:10:36
@@ -64,6 +64,12 @@
 #endif
 #include "modules_builtin.h"
 
+#ifdef SYS_MINGW32MSVC
+#ifdef FreeModule
+#undef FreeModule       /* This name is already used as a macro in winbase.h */
+#endif
+#endif
+
 /* Local prototypes */
 #ifdef HAVE_DYNAMIC_PLUGINS
 static int AllocatePluginModule ( module_bank_t *, char * );
Index: src/misc/mtime.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/misc/mtime.c,v
retrieving revision 1.16
diff -u -r1.16 mtime.c
--- src/misc/mtime.c	2001/03/21 13:42:34	1.16
+++ src/misc/mtime.c	2001/04/26 05:10:36
@@ -40,6 +40,10 @@
 #include <kernel/OS.h>
 #endif
 
+#ifdef SYS_MINGW32MSVC
+#in
clude <windows.h>
+#endif
+
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
@@ -72,7 +76,29 @@
 {
 #ifdef HAVE_KERNEL_OS_H
     return( real_time_clock_usecs() );
-    
+#else    
+
+#ifdef SYS_MINGW32MSVC
+    /* We don't get the real date, just the value of a high precision timer.
+     * this is because the usual time functions have at best only a milisecond
+     * resolution */
+    mtime_t freq,usec_time;
+
+    if( !QueryPerformanceFrequency((LARGE_INTEGER *)&freq) )
+    {
+        /* Milisecond resolution */
+        FILETIME file_time;
+        GetSystemTimeAsFileTime((FILETIME *)&file_time);
+        usec_time *= 1000;
+    }
+    else
+    {
+        /* Microsecond resolution */
+        QueryPerformanceCounter((LARGE_INTEGER *)&usec_time);
+   	usec_time /= (freq/1000000);
+    }
+    return( usec_time );
+
 #else
     struct timeval tv_date;
 
@@ -81,8 +107,10 @@
      * here, since tv is a local variable. */
     gettimeofday( &tv_date, NULL );
     return( (mtime_t) tv_date.tv_se
c * 1000000 + (mtime_t) tv_date.tv_usec );
+
+#endif /* SYS_MINGW32MSVC */
     
-#endif
+#endif /* HAVE_KERNEL_OS_H */
 }
 
 /*****************************************************************************
@@ -106,6 +134,20 @@
     snooze( delay );
 #else
 
+#ifdef SYS_MINGW32MSVC
+    mtime_t usec_time, delay;
+
+    usec_time = mdate();
+    delay = date - usec_time;
+    if( delay <= 0 )
+    {
+        return;
+    }
+    /* Sleep only has milisecond resolution */
+    Sleep( (DWORD)(delay/1000) );
+
+#else
+
 #ifdef HAVE_USLEEP
     struct timeval tv_date;
 
@@ -137,6 +179,8 @@
     select( 0, NULL, NULL, NULL, &tv_delay );
 #endif
 
+#endif /* SYS_MINGW32MSVC */
+
 #endif /* HAVE_KERNEL_OS_H */
 }
 
@@ -151,6 +195,12 @@
     snooze( delay );
 #else
 
+#ifdef SYS_MINGW32MSVC
+    Sleep( delay/1000 );             /* Sleep only has milisecond resolution */
+  /* Maybe we could use the multimedia timer to reach the right resolution,  */
+  /* or the old Winsock select() function ?*/
+#else
+
 #ifdef HAVE_USL
EEP
     usleep( delay );
 #else
@@ -165,5 +215,13 @@
     select( 0, NULL, NULL, NULL, &tv_delay );
 #endif
 
+#endif /* SYS_MINGW32MSVC */
+
 #endif /* HAVE_KERNEL_OS_H */
 }
+
+
+
+
+
+
Index: src/misc/netutils.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/misc/netutils.c,v
retrieving revision 1.25
diff -u -r1.25 netutils.c
--- src/misc/netutils.c	2001/04/17 20:43:41	1.25
+++ src/misc/netutils.c	2001/04/26 05:10:38
@@ -28,15 +28,18 @@
  *****************************************************************************/
 #include "defs.h"
 
-#include <netdb.h>                                        /* gethostbyname() */
 #include <stdlib.h>                             /* free(), realloc(), atoi() */
 #include <errno.h>                                                /* errno() */
 #include <string.h>                                      /* bzero(), bcopy() */
 #include <unistd.h>                                         /* gethostname() */
 #include <sys/
time.h>                                        /* gettimeofday */
 
+#ifndef SYS_MINGW32MSVC
+#include <netdb.h>                                        /* gethostbyname() */
 #include <netinet/in.h>                               /* BSD: struct in_addr */
 #include <sys/socket.h>                              /* BSD: struct sockaddr */
+#endif
+
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>                           /* inet_ntoa(), inet_aton() */
 #endif
Index: src/spu_decoder/spu_decoder.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/spu_decoder/spu_decoder.c,v
retrieving revision 1.37
diff -u -r1.37 spu_decoder.c
--- src/spu_decoder/spu_decoder.c	2001/04/25 10:22:33	1.37
+++ src/spu_decoder/spu_decoder.c	2001/04/26 05:10:39
@@ -27,6 +27,9 @@
 #include "defs.h"
 
 #include <unistd.h>                                              /* getpid() */
+#ifdef SYS_MINGW32MSVC         /* getpid() for win32 is located in process.h */
+#include <process.h>
+#end
if
 
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                    /* memcpy(), memset() */
Index: src/video_output/video_text.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/video_output/video_text.c,v
retrieving revision 1.24
diff -u -r1.24 video_text.c
--- src/video_output/video_text.c	2001/04/25 09:31:14	1.24
+++ src/video_output/video_text.c	2001/04/26 05:10:40
@@ -254,7 +254,11 @@
         }
 
         /* Open file */
+#ifndef SYS_MINGW32MSVC
         i_file = open( psz_file, O_RDONLY );
+#else
+        i_file = open( psz_file, O_RDONLY | O_BINARY );
+#endif
         free( psz_file );
 
         if( i_file != -1 )
Index: src/video_parser/video_parser.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/video_parser/video_parser.c,v
retrieving revision 1.79
diff -u -r1.79 video_parser.c
--- src/video_parser/video_parser.c
	2001/04/25 10:22:33	1.79
+++ src/video_parser/video_parser.c	2001/04/26 05:10:41
@@ -279,7 +279,7 @@
     p_vpar->pp_vdec[0]->b_error = 0;
     p_vpar->pp_vdec[0]->p_vpar = p_vpar;
 
-#   ifndef SYS_BEOS
+#   if !defined(SYS_BEOS) && !defined(SYS_MINGW32MSVC)
 #       if VDEC_NICE
     /* Re-nice ourself */
     if( nice(VDEC_NICE) == -1 )







More information about the vlc-devel mailing list