Commit e98aae28 authored by Sam Hocevar's avatar Sam Hocevar

  * ./plugins/win32/intfwin.bpr: we now build intfwin.so at the right place.
  * ./plugins/win32/Makefile: intfwin.so can be built using commandline.
  * ./configure.in, ./include/threads.h, ./include/common.h: a custom defs.h
    file isn't needed for the intfwin plugin anymore.
  * ./INSTALL.win32: updated compilation instructions for the intfwin plugin.
parent cf5b3832
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
HEAD HEAD
* ./plugins/win32/intfwin.bpr: we now build intfwin.so at the right place.
* ./plugins/win32/Makefile: intfwin.so can be built using commandline.
* ./configure.in, ./include/threads.h, ./include/common.h: a custom defs.h
file isn't needed for the intfwin plugin anymore.
* ./INSTALL.win32: updated compilation instructions for the intfwin plugin.
* ./AUTHORS: added ipkiss. * ./AUTHORS: added ipkiss.
* ./plugins/win32/mainframe.cpp: disabled the "hide interface" menu * ./plugins/win32/mainframe.cpp: disabled the "hide interface" menu
item, not yet implemented. item, not yet implemented.
......
...@@ -128,24 +128,16 @@ Building Win32 interface with bcc32 (Borland's compiler) ...@@ -128,24 +128,16 @@ Building Win32 interface with bcc32 (Borland's compiler)
1) Compile vlc as usual. 1) Compile vlc as usual.
include\defs.h should be generated. include\defs.h should be generated.
2) Edit include\defs.h, and add the following lines if necessary: 2) From the plugin\win32 directory, use Borland C++ command-line tools
#define WIN32
#define MODULE_NAME win32
#define MODULE_NAME_IS win32
#define PLUGIN
#define HAVE_DYNAMIC_PLUGINS
3) Still in defs.h, comment the following line to avoid compilation warnings:
#define PACKAGE "vlc"
4) From the plugin\win32 directory, use Borland C++ command-line tools
as follows: as follows:
bpr2mak intfwin.bpr // Create a makefile from intfwin.bpr bpr2mak intfwin.bpr -s \
| sed 's#^LIBPATH = .*#&;$$(RELEASELIBPATH)# ; s#^USERDEFINES = .*#& -DWIN32 -DPLUGIN -DMODULE_NAME_IS_intfwin -DMODULE_NAME=intfwin#' \
> intfwin.mak // Create a makefile from intfwin.bpr
make -fintfwin // It's Borland's make utility ! make -fintfwin // It's Borland's make utility !
5) This should create a intfwin.so 3) This should create a intfwin.so
You can remove any other generated file. You can remove any other generated file.
Well done, now you're ready to use vlc! Well done, now you're ready to use vlc!
======================================= =======================================
\ No newline at end of file
...@@ -142,7 +142,7 @@ PLUGINS_TARGETS := a52/a52 \ ...@@ -142,7 +142,7 @@ PLUGINS_TARGETS := a52/a52 \
text/rc \ text/rc \
vcd/vcd \ vcd/vcd \
win32/waveout \ win32/waveout \
win32/win32 \ win32/intfwin \
x11/x11 \ x11/x11 \
x11/xvideo x11/xvideo
......
...@@ -73,9 +73,15 @@ $(SRC_CPP:%.cpp=%.$(suff).$(module_name)): %.$(suff).$(module_name): .dep/%.dpp ...@@ -73,9 +73,15 @@ $(SRC_CPP:%.cpp=%.$(suff).$(module_name)): %.$(suff).$(module_name): .dep/%.dpp
$(SRC_CPP:%.cpp=%.$(suff).$(module_name)): %.$(suff).$(module_name): %.cpp $(SRC_CPP:%.cpp=%.$(suff).$(module_name)): %.$(suff).$(module_name): %.cpp
$(CC) $(CFLAGS) $(CFLAGS_EXTRA) -c $< -o $@ $(CC) $(CFLAGS) $(CFLAGS_EXTRA) -c $< -o $@
# foo_CUSTOM lets us override all target rules for foo.so and foo.a
ifeq (,$($(module_name)_CUSTOM))
../$(module_name).so: $(EXTRA_DEP) $(OBJ_ALL) ../$(module_name).so: $(EXTRA_DEP) $(OBJ_ALL)
$(CC) $(OBJ_ALL) $(PLDFLAGS) $(LIB_$(MODULE_NAME)) $(LIB_COMMON) -o $@ && chmod a-x $@ $(CC) $(OBJ_ALL) $(PLDFLAGS) $(LIB_$(MODULE_NAME)) $(LIB_COMMON) -o $@
chmod a-x $@
../$(module_name).a: $(EXTRA_DEP) $(OBJ_ALL) ../$(module_name).a: $(EXTRA_DEP) $(OBJ_ALL)
rm -f $@ && ar rc $@ $(OBJ_ALL) && $(RANLIB) $@ rm -f $@
ar rc $@ $(OBJ_ALL)
$(RANLIB) $@
endif
...@@ -1227,11 +1227,11 @@ fi ...@@ -1227,11 +1227,11 @@ fi
ALL_LINGUAS="de fr ja no ru nl" ALL_LINGUAS="de fr ja no ru nl"
cat >> confdefs.h <<EOF cat >> confdefs.h <<EOF
#define PACKAGE "vlc" #define VLC_PACKAGE "vlc"
EOF EOF
cat >> confdefs.h <<EOF cat >> confdefs.h <<EOF
#define VERSION "$VERSION" #define VLC_VERSION "$VERSION"
EOF EOF
# Extract the first word of "ranlib", so it can be a program name with args. # Extract the first word of "ranlib", so it can be a program name with args.
...@@ -8222,8 +8222,8 @@ s%@TUNING@%$TUNING%g ...@@ -8222,8 +8222,8 @@ s%@TUNING@%$TUNING%g
s%@RELEASE@%$RELEASE%g s%@RELEASE@%$RELEASE%g
s%@MOC@%$MOC%g s%@MOC@%$MOC%g
s%@DLL_PATH@%$DLL_PATH%g s%@DLL_PATH@%$DLL_PATH%g
s%@PACKAGE@%$PACKAGE%g s%@VLC_PACKAGE@%$VLC_PACKAGE%g
s%@VERSION@%$VERSION%g s%@VLC_VERSION@%$VLC_VERSION%g
s%@PLDFLAGS@%$PLDFLAGS%g s%@PLDFLAGS@%$PLDFLAGS%g
s%@LIB_COMMON@%$LIB_COMMON%g s%@LIB_COMMON@%$LIB_COMMON%g
s%@LIB_VLC@%$LIB_VLC%g s%@LIB_VLC@%$LIB_VLC%g
......
...@@ -39,8 +39,8 @@ fi ...@@ -39,8 +39,8 @@ fi
dnl Gettext stuff dnl Gettext stuff
ALL_LINGUAS="de fr ja no ru nl" ALL_LINGUAS="de fr ja no ru nl"
AC_DEFINE_UNQUOTED(PACKAGE, "vlc", [Package name]) AC_DEFINE_UNQUOTED(VLC_PACKAGE, "vlc", [Package name])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version]) AC_DEFINE_UNQUOTED(VLC_VERSION, "$VERSION", [Package version])
AM_GNU_GETTEXT AM_GNU_GETTEXT
dnl AM_PROG_LIBTOOL dnl AM_PROG_LIBTOOL
...@@ -1420,8 +1420,8 @@ AC_SUBST(RELEASE) ...@@ -1420,8 +1420,8 @@ AC_SUBST(RELEASE)
AC_SUBST(MOC) AC_SUBST(MOC)
AC_SUBST(WINDRES) AC_SUBST(WINDRES)
AC_SUBST(DLL_PATH) AC_SUBST(DLL_PATH)
AC_SUBST(PACKAGE) AC_SUBST(VLC_PACKAGE)
AC_SUBST(VERSION) AC_SUBST(VLC_VERSION)
AC_SUBST(LDFLAGS) AC_SUBST(LDFLAGS)
AC_SUBST(PLDFLAGS) AC_SUBST(PLDFLAGS)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.92 2002/04/05 01:05:22 gbazin Exp $ * $Id: common.h,v 1.93 2002/04/05 03:27:27 sam Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -476,7 +476,12 @@ typedef __int64 off_t; ...@@ -476,7 +476,12 @@ typedef __int64 off_t;
/***************************************************************************** /*****************************************************************************
* I18n stuff * I18n stuff
*****************************************************************************/ *****************************************************************************/
#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT ) #ifndef PACKAGE
#define PACKAGE VLC_PACKAGE
#endif
#define VERSION VLC_VERSION
#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT ) && !defined( __BORLANDC__ )
# include <libintl.h> # include <libintl.h>
#else #else
# define _(String) (String) # define _(String) (String)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* This header provides a portable threads implementation. * This header provides a portable threads implementation.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: threads.h,v 1.39 2002/04/02 23:43:57 gbazin Exp $ * $Id: threads.h,v 1.40 2002/04/05 03:27:27 sam Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
#elif defined( ST_INIT_IN_ST_H ) /* State threads */ #elif defined( ST_INIT_IN_ST_H ) /* State threads */
# include <st.h> # include <st.h>
#elif defined( WIN32 )
# include <process.h>
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) /* pthreads (like Linux & BSD) */ #elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) /* pthreads (like Linux & BSD) */
# include <pthread.h> # include <pthread.h>
# ifdef DEBUG # ifdef DEBUG
...@@ -52,9 +55,6 @@ int pthread_mutexattr_setkind_np( pthread_mutexattr_t *attr, int kind ); ...@@ -52,9 +55,6 @@ int pthread_mutexattr_setkind_np( pthread_mutexattr_t *attr, int kind );
# include <kernel/scheduler.h> # include <kernel/scheduler.h>
# include <byteorder.h> # include <byteorder.h>
#elif defined( WIN32 )
# include <process.h>
#else #else
# error no threads available on your system ! # error no threads available on your system !
...@@ -100,6 +100,23 @@ typedef st_thread_t * vlc_thread_t; ...@@ -100,6 +100,23 @@ typedef st_thread_t * vlc_thread_t;
typedef st_mutex_t * vlc_mutex_t; typedef st_mutex_t * vlc_mutex_t;
typedef st_cond_t * vlc_cond_t; typedef st_cond_t * vlc_cond_t;
#elif defined( WIN32 )
typedef HANDLE vlc_thread_t;
typedef struct
{
CRITICAL_SECTION csection;
HANDLE mutex;
} vlc_mutex_t;
typedef struct
{
int i_waiting_threads;
HANDLE signal;
} vlc_cond_t;
typedef unsigned (__stdcall *PTHREAD_START) (void *);
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
typedef pthread_t vlc_thread_t; typedef pthread_t vlc_thread_t;
typedef pthread_mutex_t vlc_mutex_t; typedef pthread_mutex_t vlc_mutex_t;
...@@ -144,23 +161,6 @@ typedef struct ...@@ -144,23 +161,6 @@ typedef struct
thread_id thread; thread_id thread;
} vlc_cond_t; } vlc_cond_t;
#elif defined( WIN32 )
typedef HANDLE vlc_thread_t;
typedef struct
{
CRITICAL_SECTION csection;
HANDLE mutex;
} vlc_mutex_t;
typedef struct
{
int i_waiting_threads;
HANDLE signal;
} vlc_cond_t;
typedef unsigned (__stdcall *PTHREAD_START) (void *);
#endif #endif
typedef void *(*vlc_thread_func_t)(void *p_data); typedef void *(*vlc_thread_func_t)(void *p_data);
...@@ -216,6 +216,9 @@ static __inline__ int vlc_threads_init( void ) ...@@ -216,6 +216,9 @@ static __inline__ int vlc_threads_init( void )
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
return st_init(); return st_init();
#elif defined( WIN32 )
return 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
return 0; return 0;
...@@ -225,9 +228,6 @@ static __inline__ int vlc_threads_init( void ) ...@@ -225,9 +228,6 @@ static __inline__ int vlc_threads_init( void )
#elif defined( HAVE_KERNEL_SCHEDULER_H ) #elif defined( HAVE_KERNEL_SCHEDULER_H )
return 0; return 0;
#elif defined( WIN32 )
return 0;
#endif #endif
} }
...@@ -242,6 +242,9 @@ static __inline__ int vlc_threads_end( void ) ...@@ -242,6 +242,9 @@ static __inline__ int vlc_threads_end( void )
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
return 0; return 0;
#elif defined( WIN32 )
return 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
return 0; return 0;
...@@ -251,9 +254,6 @@ static __inline__ int vlc_threads_end( void ) ...@@ -251,9 +254,6 @@ static __inline__ int vlc_threads_end( void )
#elif defined( HAVE_KERNEL_SCHEDULER_H ) #elif defined( HAVE_KERNEL_SCHEDULER_H )
return 0; return 0;
#elif defined( WIN32 )
return 0;
#endif #endif
} }
...@@ -269,6 +269,24 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) ...@@ -269,6 +269,24 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
*p_mutex = st_mutex_new(); *p_mutex = st_mutex_new();
return ( *p_mutex == NULL ) ? errno : 0; return ( *p_mutex == NULL ) ? errno : 0;
#elif defined( WIN32 )
/* We use mutexes on WinNT/2K/XP because we can use the SignalObjectAndWait
* function and have a 100% correct vlc_cond_wait() implementation.
* As this function is not available on Win9x, we can use the faster
* CriticalSections */
if( (GetVersion() < 0x80000000) && !p_main_sys->b_fast_pthread )
{
/* We are running on NT/2K/XP, we can use SignalObjectAndWait */
p_mutex->mutex = CreateMutex( 0, FALSE, 0 );
return ( p_mutex->mutex ? 0 : 1 );
}
else
{
InitializeCriticalSection( &p_mutex->csection );
p_mutex->mutex = NULL;
return 0;
}
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
# if defined(DEBUG) && defined(SYS_LINUX) # if defined(DEBUG) && defined(SYS_LINUX)
/* Create error-checking mutex to detect threads problems more easily. */ /* Create error-checking mutex to detect threads problems more easily. */
...@@ -310,24 +328,6 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) ...@@ -310,24 +328,6 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
p_mutex->init = 9999; p_mutex->init = 9999;
return B_OK; return B_OK;
#elif defined( WIN32 )
/* We use mutexes on WinNT/2K/XP because we can use the SignalObjectAndWait
* function and have a 100% correct vlc_cond_wait() implementation.
* As this function is not available on Win9x, we can use the faster
* CriticalSections */
if( (GetVersion() < 0x80000000) && !p_main_sys->b_fast_pthread )
{
/* We are running on NT/2K/XP, we can use SignalObjectAndWait */
p_mutex->mutex = CreateMutex( 0, FALSE, 0 );
return ( p_mutex->mutex ? 0 : 1 );
}
else
{
InitializeCriticalSection( &p_mutex->csection );
p_mutex->mutex = NULL;
return 0;
}
#endif #endif
} }
...@@ -351,6 +351,17 @@ static __inline__ int _vlc_mutex_lock( char * psz_file, int i_line, ...@@ -351,6 +351,17 @@ static __inline__ int _vlc_mutex_lock( char * psz_file, int i_line,
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
return st_mutex_lock( *p_mutex ); return st_mutex_lock( *p_mutex );
#elif defined( WIN32 )
if( p_mutex->mutex )
{
WaitForSingleObject( p_mutex->mutex, INFINITE );
}
else
{
EnterCriticalSection( &p_mutex->csection );
}
return 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
int i_return = pthread_mutex_lock( p_mutex ); int i_return = pthread_mutex_lock( p_mutex );
if( i_return ) if( i_return )
...@@ -380,17 +391,6 @@ static __inline__ int _vlc_mutex_lock( char * psz_file, int i_line, ...@@ -380,17 +391,6 @@ static __inline__ int _vlc_mutex_lock( char * psz_file, int i_line,
err = acquire_sem( p_mutex->lock ); err = acquire_sem( p_mutex->lock );
return err; return err;
#elif defined( WIN32 )
if( p_mutex->mutex )
{
WaitForSingleObject( p_mutex->mutex, INFINITE );
}
else
{
EnterCriticalSection( &p_mutex->csection );
}
return 0;
#endif #endif
} }
...@@ -414,6 +414,17 @@ static __inline__ int _vlc_mutex_unlock( char * psz_file, int i_line, ...@@ -414,6 +414,17 @@ static __inline__ int _vlc_mutex_unlock( char * psz_file, int i_line,
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
return st_mutex_unlock( *p_mutex ); return st_mutex_unlock( *p_mutex );
#elif defined( WIN32 )
if( p_mutex->mutex )
{
ReleaseMutex( p_mutex->mutex );
}
else
{
LeaveCriticalSection( &p_mutex->csection );
}
return 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
int i_return = pthread_mutex_unlock( p_mutex ); int i_return = pthread_mutex_unlock( p_mutex );
if( i_return ) if( i_return )
...@@ -441,17 +452,6 @@ static __inline__ int _vlc_mutex_unlock( char * psz_file, int i_line, ...@@ -441,17 +452,6 @@ static __inline__ int _vlc_mutex_unlock( char * psz_file, int i_line,
release_sem( p_mutex->lock ); release_sem( p_mutex->lock );
return B_OK; return B_OK;
#elif defined( WIN32 )
if( p_mutex->mutex )
{
ReleaseMutex( p_mutex->mutex );
}
else
{
LeaveCriticalSection( &p_mutex->csection );
}
return 0;
#endif #endif
} }
...@@ -475,6 +475,17 @@ static __inline__ int _vlc_mutex_destroy( char * psz_file, int i_line, ...@@ -475,6 +475,17 @@ static __inline__ int _vlc_mutex_destroy( char * psz_file, int i_line,
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
return st_mutex_destroy( *p_mutex ); return st_mutex_destroy( *p_mutex );
#elif defined( WIN32 )
if( p_mutex->mutex )
{
CloseHandle( p_mutex->mutex );
}
else
{
DeleteCriticalSection( &p_mutex->csection );
}
return 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
int i_return = pthread_mutex_destroy( p_mutex ); int i_return = pthread_mutex_destroy( p_mutex );
if( i_return ) if( i_return )
...@@ -496,17 +507,6 @@ static __inline__ int _vlc_mutex_destroy( char * psz_file, int i_line, ...@@ -496,17 +507,6 @@ static __inline__ int _vlc_mutex_destroy( char * psz_file, int i_line,
p_mutex->init = 0; p_mutex->init = 0;
return B_OK; return B_OK;
#elif defined( WIN32 )
if( p_mutex->mutex )
{
CloseHandle( p_mutex->mutex );
}
else
{
DeleteCriticalSection( &p_mutex->csection );
}
return 0;
#endif #endif
} }
...@@ -522,6 +522,18 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) ...@@ -522,6 +522,18 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
*p_condvar = st_cond_new(); *p_condvar = st_cond_new();
return ( *p_condvar == NULL ) ? errno : 0; return ( *p_condvar == NULL ) ? errno : 0;
#elif defined( WIN32 )
/* initialise counter */
p_condvar->i_waiting_threads = 0;
/* Create an auto-reset event. */
p_condvar->signal = CreateEvent( NULL, /* no security */
FALSE, /* auto-reset event */
FALSE, /* non-signaled initially */
NULL ); /* unnamed */
return( !p_condvar->signal );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
return pthread_cond_init( p_condvar, NULL ); return pthread_cond_init( p_condvar, NULL );
...@@ -549,18 +561,6 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) ...@@ -549,18 +561,6 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
p_condvar->init = 9999; p_condvar->init = 9999;
return 0; return 0;
#elif defined( WIN32 )
/* initialise counter */
p_condvar->i_waiting_threads = 0;
/* Create an auto-reset event. */
p_condvar->signal = CreateEvent( NULL, /* no security */
FALSE, /* auto-reset event */
FALSE, /* non-signaled initially */
NULL ); /* unnamed */
return( !p_condvar->signal );
#endif #endif
} }
...@@ -575,6 +575,13 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) ...@@ -575,6 +575,13 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
return st_cond_signal( *p_condvar ); return st_cond_signal( *p_condvar );
#elif defined( WIN32 )
/* Release one waiting thread if one is available. */
/* For this trick to work properly, the vlc_cond_signal must be surrounded
* by a mutex. This will prevent another thread from stealing the signal */
PulseEvent( p_condvar->signal );
return 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
return pthread_cond_signal( p_condvar ); return pthread_cond_signal( p_condvar );
...@@ -622,13 +629,6 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) ...@@ -622,13 +629,6 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
} }
return 0; return 0;
#elif defined( WIN32 )
/* Release one waiting thread if one is available. */
/* For this trick to work properly, the vlc_cond_signal must be surrounded
* by a mutex. This will prevent another thread from stealing the signal */
PulseEvent( p_condvar->signal );
return 0;
#endif #endif
} }
...@@ -648,6 +648,17 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar ) ...@@ -648,6 +648,17 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar )
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
return st_cond_broadcast( p_condvar ); return st_cond_broadcast( p_condvar );
#elif defined( WIN32 )
/* Release all waiting threads. */
/* For this trick to work properly, the vlc_cond_signal must be surrounded
* by a mutex. This will prevent another thread from stealing the signal */
while( p_condvar->i_waiting_threads )
{
PulseEvent( p_condvar->signal );
Sleep( 1 ); /* deschedule the current thread */
}
return 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
return pthread_cond_broadcast( p_condvar ); return pthread_cond_broadcast( p_condvar );
...@@ -695,17 +706,6 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar ) ...@@ -695,17 +706,6 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar )
} }
return 0; return 0;
#elif defined( WIN32 )
/* Release all waiting threads. */
/* For this trick to work properly, the vlc_cond_signal must be surrounded
* by a mutex. This will prevent another thread from stealing the signal */
while( p_condvar->i_waiting_threads )
{
PulseEvent( p_condvar->signal );
Sleep( 1 ); /* deschedule the current thread */
}
return 0;
#endif #endif
} }
...@@ -736,6 +736,38 @@ static __inline__ int _vlc_cond_wait( char * psz_file, int i_line, ...@@ -736,6 +736,38 @@ static __inline__ int _vlc_cond_wait( char * psz_file, int i_line,
return i_ret; return i_ret;
#elif defined( WIN32 )
/* The ideal would be to use a function which atomically releases the
* mutex and initiate the waiting.
* Unfortunately only the SignalObjectAndWait function does this and it's
* only supported on WinNT/2K, furthermore it cannot take multiple
* events as parameters.
*
* The solution we use should however fulfill all our needs (even though
* it is not a correct pthreads implementation)
*/
int i_result;
p_condvar->i_waiting_threads ++;
if( p_mutex->mutex )
{
p_main_sys->SignalObjectAndWait( p_mutex->mutex, p_condvar->signal,
INFINITE, FALSE );
}
else
{
/* Release the mutex */
vlc_mutex_unlock( p_mutex );
i_result = WaitForSingleObject( p_condvar->signal, INFINITE);
p_condvar->i_waiting_threads --;
}
/* Reacquire the mutex before returning. */
vlc_mutex_lock( p_mutex );
return( i_result == WAIT_FAILED );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
#ifndef DEBUG #ifndef DEBUG
...@@ -801,38 +833,6 @@ static __inline__ int _vlc_cond_wait( char * psz_file, int i_line, ...@@ -801,38 +833,6 @@ static __inline__ int _vlc_cond_wait( char * psz_file, int i_line,
vlc_mutex_lock( p_mutex ); vlc_mutex_lock( p_mutex );
return 0; return 0;
#elif defined( WIN32 )
/* The ideal would be to use a function which atomically releases the
* mutex and initiate the waiting.
* Unfortunately only the SignalObjectAndWait function does this and it's
* only supported on WinNT/2K, furthermore it cannot take multiple
* events as parameters.
*
* The solution we use should however fulfill all our needs (even though
* it is not a correct pthreads implementation)
*/
int i_result;
p_condvar->i_waiting_threads ++;
if( p_mutex->mutex )
{
p_main_sys->SignalObjectAndWait( p_mutex->mutex, p_condvar->signal,
INFINITE, FALSE );
}
else
{
/* Release the mutex */
vlc_mutex_unlock( p_mutex );
i_result = WaitForSingleObject( p_condvar->signal, INFINITE);
p_condvar->i_waiting_threads --;
}
/* Reacquire the mutex before returning. */
vlc_mutex_lock( p_mutex );
return( i_result == WAIT_FAILED );
#endif #endif
} }
...@@ -856,6 +856,9 @@ static __inline__ int _vlc_cond_destroy( char * psz_file, int i_line, ...@@ -856,6 +856,9 @@ static __inline__ int _vlc_cond_destroy( char * psz_file, int i_line,
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
return st_cond_destroy( *p_condvar ); return st_cond_destroy( *p_condvar );
#elif defined( WIN32 )
return( !CloseHandle( p_condvar->signal ) );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
int i_result = pthread_cond_destroy( p_condvar ); int i_result = pthread_cond_destroy( p_condvar );
if( i_result ) if( i_result )
...@@ -872,9 +875,6 @@ static __inline__ int _vlc_cond_destroy( char * psz_file, int i_line, ...@@ -872,9 +875,6 @@ static __inline__ int _vlc_cond_destroy( char * psz_file, int i_line,
p_condvar->init = 0; p_condvar->init = 0;
return 0; return 0;
#elif defined( WIN32 )
return( !CloseHandle( p_condvar->signal ) );
#endif #endif
} }
...@@ -922,6 +922,16 @@ static __inline__ int _vlc_thread_create( char * psz_file, int i_line, ...@@ -922,6 +922,16 @@ static __inline__ int _vlc_thread_create( char * psz_file, int i_line,
*p_thread = st_thread_create( func, p_data, 1, 0 ); *p_thread = st_thread_create( func, p_data, 1, 0 );
i_ret = ( p_thread == NULL ); i_ret = ( p_thread == NULL );
#elif defined( WIN32 )
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 functions not working */
*p_thread = (HANDLE)_beginthreadex( NULL, 0, (PTHREAD_START) func,
p_data, 0, &threadID );
i_ret = ( *p_thread ? 0 : 1 );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_create( p_thread, NULL, func, p_data ); i_ret = pthread_create( p_thread, NULL, func, p_data );
...@@ -934,16 +944,6 @@ static __inline__ int _vlc_thread_create( char * psz_file, int i_line, ...@@ -934,16 +944,6 @@ static __inline__ int _vlc_thread_create( char * psz_file, int i_line,
B_NORMAL_PRIORITY, p_data ); B_NORMAL_PRIORITY, p_data );
i_ret = resume_thread( *p_thread ); i_ret = resume_thread( *p_thread );
#elif defined( WIN32 )
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 functions not working */
*p_thread = (HANDLE)_beginthreadex( NULL, 0, (PTHREAD_START) func,
p_data, 0, &threadID );
i_ret = ( *p_thread ? 0 : 1 );
#endif #endif
#ifdef GPROF #ifdef GPROF
...@@ -983,6 +983,11 @@ static __inline__ void vlc_thread_exit( void ) ...@@ -983,6 +983,11 @@ static __inline__ void vlc_thread_exit( void )
int result; int result;
st_thread_exit( &result ); st_thread_exit( &result );
#elif defined( WIN32 )
/* For now we don't close the thread handles (because of race conditions).
* Need to be looked at. */
_endthreadex(0);
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
pthread_exit( 0 ); pthread_exit( 0 );
...@@ -993,11 +998,6 @@ static __inline__ void vlc_thread_exit( void ) ...@@ -993,11 +998,6 @@ static __inline__ void vlc_thread_exit( void )
#elif defined( HAVE_KERNEL_SCHEDULER_H ) #elif defined( HAVE_KERNEL_SCHEDULER_H )
exit_thread( 0 ); exit_thread( 0 );
#elif defined( WIN32 )
/* For now we don't close the thread handles (because of race conditions).
* Need to be looked at. */
_endthreadex(0);
#endif #endif
} }
...@@ -1023,6 +1023,9 @@ static __inline__ void _vlc_thread_join( char * psz_file, int i_line, ...@@ -1023,6 +1023,9 @@ static __inline__ void _vlc_thread_join( char * psz_file, int i_line,
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
i_ret = st_thread_join( thread, NULL ); i_ret = st_thread_join( thread, NULL );
#elif defined( WIN32 )
WaitForSingleObject( thread, INFINITE );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_join( thread, NULL ); i_ret = pthread_join( thread, NULL );
...@@ -1034,9 +1037,6 @@ static __inline__ void _vlc_thread_join( char * psz_file, int i_line, ...@@ -1034,9 +1037,6 @@ static __inline__ void _vlc_thread_join( char * psz_file, int i_line,
int32 exit_value; int32 exit_value;
wait_for_thread( thread, &exit_value ); wait_for_thread( thread, &exit_value );
#elif defined( WIN32 )
WaitForSingleObject( thread, INFINITE );
#endif #endif
if( i_ret ) if( i_ret )
......
win32_SRC = win32.cpp #
# Waveout module - the classic way to do things
#
waveout_SOURCES = waveout.c waveout_SOURCES = waveout.c
#
# Borland C++ project
# we override everything by setting intfwin_CUSTOM
#
intfwin_CUSTOM = yes
BCBUILDER = "D:/Program Files/CBuilder5"
../intfwin.so: Makefile
rm -f intfwin.mak
$(BCBUILDER)/Bin/bpr2mak intfwin.bpr -s | sed 's#^LIBPATH = .*#&;$$(RELEASELIBPATH)# ; s#^USERDEFINES = .*#& -DWIN32 -DPLUGIN -DMODULE_NAME_IS_intfwin -DMODULE_NAME=intfwin#' > intfwin.mak
$(BCBUILDER)/Bin/make -f intfwin.mak -b
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<PROJECT> <PROJECT>
<MACROS> <MACROS>
<VERSION value="BCB.05.03"/> <VERSION value="BCB.05.03"/>
<PROJECT value="intfwin.so"/> <PROJECT value="..\intfwin.so"/>
<OBJFILES value="win32.obj intf_win32.obj mainframe.obj network.obj playlist.obj <OBJFILES value="win32.obj intf_win32.obj mainframe.obj network.obj playlist.obj
preferences.obj about.obj disc.obj control.obj menu.obj messages.obj"/> preferences.obj about.obj disc.obj control.obj menu.obj messages.obj"/>
<RESFILES value=""/> <RESFILES value=""/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment