Commit 0a4aeaa6 authored by Sam Hocevar's avatar Sam Hocevar

  * Coding style fixes here and there.
  * Miscellaneous QNX compile fixes.
  * Beginning of the mingw32 port by Gildas Bazin <gbazin@netcourrier.com>.
  * Added Marcari and Gildas to the AUTHORS file.

  (I commited the mingw32 port because it doesn't add any new code outside
   the #ifdefs, but we won't tell a word about it for the moment. We don't
   really need windows users whining about bugs, do we ?)
parent eb7f7ca0
......@@ -5,6 +5,11 @@
# The fields are: name (N), email (E), web-address (W), CVS account login (C),
# PGP key ID and fingerprint (P), description (D), and snail-mail address (S).
N: Marc Ariberti
C: marcari
E: marcari@via.ecp.fr
D: communication with channel server
N: Pierre Baillet
E: oct@zoy.org
C: octplane
......@@ -14,6 +19,10 @@ N: Ethan C. Baldridge
E: BaldridgeE@cadmus.com
D: directory browsing code in modules.c
N: Gildas Bazin
E: gbazin@netcourrier.com
D: mingw32 port
N: Stphane Borel
E: stef@via.ecp.fr
C: stef
......@@ -40,6 +49,7 @@ E: ndeb@ece.cmu.edu
D: Minor configure.in and Makefile.in fixes
N: Cyril Deguet
C: asmax
E: asmax@via.ecp.fr
D: PS input packet allocator
......
......@@ -4,7 +4,10 @@
HEAD
* Changed broadcast handling
* Coding style fixes here and there.
* Miscellaneous QNX compile fixes.
* Beginning of the mingw32 port by Gildas Bazin <gbazin@netcourrier.com>.
* Changed broadcast handling.
* Added a vlc-howto in sgml format in the doc directory.
* Fixed the continuous 'seeking position' bug in network mode.
* Support for `ts://foo:42' style input source.
......
......@@ -176,7 +176,7 @@ distclean: clean
rm -f **/*.o **/*~ *.log
rm -f Makefile.opts
rm -f include/defs.h include/config.h include/modules_builtin.h
rm -f config.status config.cache config.log
rm -f config*status config*cache config*log
rm -f gmon.out core build-stamp
rm -Rf .dep
rm -f .gdb_history
......@@ -353,5 +353,5 @@ $(PLUGIN_OBJ): FORCE
builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
$(BUILTIN_OBJ): FORCE
cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
ranlib $@
$(RANLIB) $@
......@@ -13,13 +13,13 @@
# the plugins in this line and put them as built-ins, otherwise your
# application won't be able to load them.
#
PLUGINS := @PLUGINS@
PLUGINS :=@PLUGINS@
#
# Built-in modules to build
# WARNING: do NOT put gtk and gnome together in this rule.
#
BUILTINS := @BUILTINS@
BUILTINS :=@BUILTINS@
#
# Additional build options
......@@ -42,7 +42,9 @@ GETOPT = @GETOPT@
# Build environment
#
CC = @CC@
CFLAGS = @CFLAGS@
SHELL = @SHELL@
RANLIB = @RANLIB@
#
# Installation environment
......@@ -137,6 +139,10 @@ INCLUDE += -Iinclude -Iextras -I/usr/local/include
#
LIB += @LIB@ -L/usr/local/lib
ifneq (,$(findstring mingw32,$(SYS)))
LIB += -lws2_32
endif
#
# Libraries needed by built-in modules
#
......
This diff is collapsed.
......@@ -13,22 +13,37 @@ dnl Check for tools
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CPP
AC_PROG_RANLIB
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL
dnl Check for compiler environment
AC_C_CONST
AC_C_BIGENDIAN
dnl Check for endianness if not cross-compiling
if test x${cross_compiling} != xyes; then
AC_C_BIGENDIAN
fi
dnl Check for system libs needed
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol)
AC_CHECK_FUNCS(setenv putenv)
AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect,LIB="${LIB} -lsocket")])
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname,LIB="${LIB} -lnsl")])
AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,LIB="${LIB} -lrt",[AC_CHECK_LIB(posix4,nanosleep,LIB="${LIB} -lposix4")])])
AC_CHECK_FUNC(connect,,[
AC_CHECK_LIB(socket,connect,LIB="${LIB} -lsocket")
])
AC_CHECK_FUNC(gethostbyname,,[
AC_CHECK_LIB(nsl,gethostbyname,LIB="${LIB} -lnsl")
])
AC_CHECK_FUNC(nanosleep,,[
AC_CHECK_LIB(rt,nanosleep,LIB="${LIB} -lrt",[
AC_CHECK_LIB(posix4,nanosleep,LIB="${LIB} -lposix4")
])
])
AC_CHECK_FUNCS(usleep)
AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton,LIB="${LIB} -lresolv")])
AC_CHECK_FUNC(inet_aton,,[
AC_CHECK_LIB(resolv,inet_aton,LIB="${LIB} -lresolv")
])
AC_CHECK_FUNCS(vasprintf)
AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
......@@ -54,10 +69,10 @@ AC_EGREP_CPP(yes,
AC_CHECK_LIB(threads,thread_create,LIB="${LIB} -lthreads")
CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
AC_CHECK_HEADERS(stddef.h)
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(sys/sockio.h)
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h)
dnl Check for headers
AC_CHECK_HEADERS(stddef.h getopt.h strings.h)
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h unistd.h)
AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
AC_CHECK_HEADERS(dlfcn.h image.h)
AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
......@@ -66,6 +81,16 @@ AC_CHECK_HEADERS(machine/param.h)
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
dnl Check for misc headers
AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
Define if <pthread.h> defines pthread_cond_t.)
])
AC_EGREP_HEADER(strncasecmp,strings.h,[
AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
Define if <strings.h> defines strncasecmp.)
])
dnl Do a series of bizarre compilation tests
save_CFLAGS=$CFLAGS
......@@ -74,7 +99,7 @@ CFLAGS="${CFLAGS} -Wall -Werror"
AC_MSG_CHECKING([for ntohl in sys/param.h])
AC_TRY_COMPILE([#include <sys/param.h>
void foo() { int meuh; ntohl(meuh); }],,
AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if ntohl is in <sys/param.h>.)
AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
dnl Check for -rdynamic flag
......@@ -110,11 +135,17 @@ dnl
dnl default modules
dnl
BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion"
if test x$host_os = xbeos; then
case x$host_os in
xbeos|xnto-qnx)
ACCEL_PLUGINS="yuvmmx idctmmx motionmmx"
else
;;
xmingw32msvc)
ACCEL_PLUGINS="idctmmx idctmmxext motionmmx motionmmxext"
;;
*)
ACCEL_PLUGINS="yuvmmx idctmmx idctmmxext motionmmx motionmmxext"
fi
;;
esac
dnl
dnl DVD module: check for DVD ioctls
......@@ -166,7 +197,7 @@ AC_ARG_ENABLE(mmx,
[ --disable-mmx Disable MMX optimizations (default enabled for x86)],
[ if test x$enableval = xyes; then ARCH="${ARCH} mmx";
BUILTINS="${BUILTINS} ${ACCEL_PLUGINS}"; fi ],
[ if test x${host_cpu} = xi686 -o x${host_cpu} = xi586 -o x${host_cpu} = xx86; then ARCH="${ARCH} mmx";
[ if test x${host_cpu} = xi686 -o x${host_cpu} = xi586 -o x${host_cpu} = xx86 -o x${host_cpu} = xi386; then ARCH="${ARCH} mmx";
BUILTINS="${BUILTINS} ${ACCEL_PLUGINS}"; fi ])
dnl
......@@ -507,9 +538,9 @@ trace mode : ${TRACE}
optimizations : ${OPTIMS}
CSS decryption : ${CSS}
need builtin getopt : ${GETOPT}
plugin modules : ${PLUGINS}
built-in modules : ${BUILTINS}
vlc aliases : ${ALIASES}
plugin modules :${PLUGINS}
built-in modules :${BUILTINS}
vlc aliases :${ALIASES}
You may now tune Makefile.opts at your convenience."
......@@ -75,6 +75,9 @@
#include <unixlib.h>
#if HAVE_STRING_H - 0
#include <string.h>
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
#endif
#endif
#endif
......@@ -650,6 +653,7 @@ int
else
{
if (opterr)
{
if (argv[optind - 1][1] == '-')
/* --option */
fprintf(stderr,
......@@ -660,6 +664,7 @@ int
fprintf(stderr,
_("%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
}
nextchar += strlen(nextchar);
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.30 2001/04/11 02:01:24 henri Exp $
* $Id: common.h,v 1.31 2001/04/28 03:36:25 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -142,6 +142,7 @@ struct data_packet_s;
#ifdef NTOHL_IN_SYS_PARAM_H
# include <sys/param.h>
#elif defined(WIN32)
#else
# include <netinet/in.h>
#endif
......
......@@ -451,7 +451,7 @@
* message function was called */
#define INTF_MSG_DBG_FORMAT "## %s:%s(),%i: "
/* Maximal number of arguments on a command line, including the function name */
/* Max number of arguments on a command line, including the function name */
#define INTF_MAX_ARGS 20
/* Maximal size of a command line in a script */
......
......@@ -109,6 +109,9 @@
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
......@@ -133,7 +136,13 @@
/* getopt support */
#undef HAVE_GETOPT_LONG
/* Define if ntohl is in <sys/param.h>. */
/* Define if <pthread.h> defines pthread_cond_t. */
#undef PTHREAD_COND_T_IN_PTHREAD_H
/* Define if <strings.h> defines strncasecmp. */
#undef STRNCASECMP_IN_STRINGS_H
/* Define if <sys/param.h> defines ntohl. */
#undef NTOHL_IN_SYS_PARAM_H
/* Define if <sys/types.h> defines boolean_t. */
......
......@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-dec.h,v 1.29 2001/04/25 10:22:32 massiot Exp $
* $Id: input_ext-dec.h,v 1.30 2001/04/28 03:36:25 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -169,7 +169,7 @@ typedef struct bit_stream_s
byte_t * p_byte;
/* Pointer to the last byte that is to be read (in the current packet */
byte_t * p_end;
/* Temporary buffer in case we're not aligned when changing data packets. */
/* Temporary buffer in case we're not aligned when changing data packets */
WORD_TYPE i_showbits_buffer;
data_packet_t showbits_data;
} bit_stream_t;
......
......@@ -2,7 +2,7 @@
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.20 2001/04/15 04:19:57 sam Exp $
* $Id: modules.h,v 1.21 2001/04/28 03:36:25 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -21,6 +21,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifdef WIN32
#include <sys/types.h> /* off_t */
#endif
/* Number of tries before we unload an unused module */
#define MODULE_HIDE_DELAY 100
......
......@@ -3,7 +3,7 @@
* This header provides a portable threads implementation.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: threads.h,v 1.16 2001/03/21 13:42:33 sam Exp $
* $Id: threads.h,v 1.17 2001/04/28 03:36:25 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -25,18 +25,23 @@
#include <stdio.h>
#if defined(HAVE_PTHREAD_H) /* pthreads (Linux & BSD for example) */
#if defined(PTHREAD_COND_T_IN_PTHREAD_H) /* pthreads (like Linux & BSD) */
#include <pthread.h>
#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(WIN32) /* Win32 with MinGW32 compiler */
#include <windows.h>
#include <process.h>
#else
#error no threads available on your system !
#endif
......@@ -71,17 +76,15 @@
* Types definition
*****************************************************************************/
#if defined(HAVE_PTHREAD_H)
#if defined(PTHREAD_COND_T_IN_PTHREAD_H)
typedef pthread_t vlc_thread_t;
typedef pthread_mutex_t vlc_mutex_t;
typedef pthread_cond_t vlc_cond_t;
#elif defined(HAVE_CTHREADS_H)
typedef cthread_t vlc_thread_t;
/* those structs are the ones defined in /include/cthreads.h but we need
/* Those structs are the ones defined in /include/cthreads.h but we need
* to handle (*foo) where foo is a (mutex_t) while they handle (foo) where
* foo is a (mutex_t*) */
typedef struct s_mutex {
......@@ -99,8 +102,7 @@ typedef struct s_condition {
} vlc_cond_t;
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
/* This is the BeOS implementation of the vlc thread, note that the mutex is
/* This is the BeOS implementation of the vlc threads, note that the mutex is
* not a real mutex and the cond_var is not like a pthread cond_var but it is
* enough for what wee need */
......@@ -118,6 +120,12 @@ typedef struct
thread_id thread;
} vlc_cond_t;
#elif defined(WIN32)
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);
......@@ -126,24 +134,24 @@ typedef void *(*vlc_thread_func_t)(void *p_data);
* Prototypes
*****************************************************************************/
static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, char *psz_name,
vlc_thread_func_t func, void *p_data );
static __inline__ void vlc_thread_exit ( void );
static __inline__ void vlc_thread_join ( vlc_thread_t thread );
static __inline__ int vlc_thread_create ( vlc_thread_t *, char *,
vlc_thread_func_t, void * );
static __inline__ void vlc_thread_exit ( void );
static __inline__ void vlc_thread_join ( vlc_thread_t );
static __inline__ int vlc_mutex_init ( vlc_mutex_t *p_mutex );
static __inline__ int vlc_mutex_lock ( vlc_mutex_t *p_mutex );
static __inline__ int vlc_mutex_unlock ( vlc_mutex_t *p_mutex );
static __inline__ int vlc_mutex_destroy ( vlc_mutex_t *p_mutex );
static __inline__ int vlc_mutex_init ( vlc_mutex_t * );
static __inline__ int vlc_mutex_lock ( vlc_mutex_t * );
static __inline__ int vlc_mutex_unlock ( vlc_mutex_t * );
static __inline__ int vlc_mutex_destroy ( vlc_mutex_t * );
static __inline__ int vlc_cond_init ( vlc_cond_t *p_condvar );
static __inline__ int vlc_cond_signal ( vlc_cond_t *p_condvar );
static __inline__ int vlc_cond_wait ( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex );
static __inline__ int vlc_cond_destroy ( vlc_cond_t *p_condvar );
static __inline__ int vlc_cond_init ( vlc_cond_t * );
static __inline__ int vlc_cond_signal ( vlc_cond_t * );
static __inline__ int vlc_cond_wait ( vlc_cond_t *, vlc_mutex_t * );
static __inline__ int vlc_cond_destroy ( vlc_cond_t * );
#if 0
static _inline__ int vlc_cond_timedwait ( vlc_cond_t * condvar, vlc_mutex_t * mutex,
mtime_t absoute_timeout_time );
static __inline__ int vlc_cond_timedwait( vlc_cond_t *, vlc_mutex_t *,
mtime_t );
#endif
/*****************************************************************************
......@@ -153,7 +161,7 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
char *psz_name, vlc_thread_func_t func,
void *p_data)
{
#if defined(HAVE_PTHREAD_H)
#if defined(PTHREAD_COND_T_IN_PTHREAD_H)
return pthread_create( p_thread, NULL, func, p_data );
#elif defined(HAVE_CTHREADS_H)
......@@ -165,6 +173,23 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
B_NORMAL_PRIORITY, p_data );
return resume_thread( *p_thread );
#elif defined(WIN32)
#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, &threadID);
return( *p_thread ? 0 : 1 );
#endif
}
......@@ -173,7 +198,7 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
*****************************************************************************/
static __inline__ void vlc_thread_exit( void )
{
#if defined(HAVE_PTHREAD_H)
#if defined(PTHREAD_COND_T_IN_PTHREAD_H)
pthread_exit( 0 );
#elif defined(HAVE_CTHREADS_H)
......@@ -183,6 +208,14 @@ static __inline__ void vlc_thread_exit( void )
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
exit_thread( 0 );
#elif defined(WIN32)
#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
}
......@@ -191,7 +224,7 @@ static __inline__ void vlc_thread_exit( void )
*****************************************************************************/
static __inline__ void vlc_thread_join( vlc_thread_t thread )
{
#if defined(HAVE_PTHREAD_H)
#if defined(PTHREAD_COND_T_IN_PTHREAD_H)
pthread_join( thread, NULL );
#elif defined(HAVE_CTHREADS_H)
......@@ -201,6 +234,9 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread )
int32 exit_value;
wait_for_thread( thread, &exit_value );
#elif defined(WIN32)
WaitForSingleObject( thread, INFINITE);
#endif
}
......@@ -209,7 +245,7 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread )
*****************************************************************************/
static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
{
#if defined(HAVE_PTHREAD_H)
#if defined(PTHREAD_COND_T_IN_PTHREAD_H)
return pthread_mutex_init( p_mutex, NULL );
#elif defined(HAVE_CTHREADS_H)
......@@ -219,7 +255,11 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
/* check the arguments and whether it's already been initialized */
if( p_mutex == NULL ) return B_BAD_VALUE;
if( p_mutex == NULL )
{
return B_BAD_VALUE;
}
if( p_mutex->init == 9999 )
{
return EALREADY;
......@@ -227,10 +267,17 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
p_mutex->lock = create_sem( 1, "BeMutex" );
if( p_mutex->lock < B_NO_ERROR )
{
return( -1 );
}
p_mutex->init = 9999;
return B_OK;
#elif defined(WIN32)
*p_mutex = CreateMutex(0,FALSE,0);
return (*p_mutex?0:1);
#endif
}
......@@ -239,7 +286,7 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
*****************************************************************************/
static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
{
#if defined(HAVE_PTHREAD_H)
#if defined(PTHREAD_COND_T_IN_PTHREAD_H)
return pthread_mutex_lock( p_mutex );
#elif defined(HAVE_CTHREADS_H)
......@@ -249,12 +296,23 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
status_t err;
if( !p_mutex ) return B_BAD_VALUE;
if( p_mutex->init < 2000 ) return B_NO_INIT;
if( !p_mutex )
{
return B_BAD_VALUE;
}
if( p_mutex->init < 2000 )
{
return B_NO_INIT;
}
err = acquire_sem( p_mutex->lock );
return err;
#elif defined(WIN32)
WaitForSingleObject( *p_mutex, INFINITE );
return 0;
#endif
}
......@@ -263,7 +321,7 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
*****************************************************************************/
static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
{
#if defined(HAVE_PTHREAD_H)
#if defined(PTHREAD_COND_T_IN_PTHREAD_H)
return pthread_mutex_unlock( p_mutex );
#elif defined(HAVE_CTHREADS_H)
......@@ -271,13 +329,23 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
return 0;
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
if( !p_mutex)
{
return B_BAD_VALUE;
}
if(! p_mutex) return B_BAD_VALUE;
if( p_mutex->init < 2000 ) return B_NO_INIT;
if( p_mutex->init < 2000 )
{
return B_NO_INIT;
}
release_sem( p_mutex->lock );
return B_OK;
#elif defined(WIN32)
ReleaseMutex( *p_mutex );
return 0;
#endif
}
......@@ -286,13 +354,22 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
*****************************************************************************/
static __inline__ int vlc_mutex_destroy( vlc_mutex_t *p_mutex )
{
#if defined(HAVE_PTHREAD_H)
#if defined(PTHREAD_COND_T_IN_PTHREAD_H)
return pthread_mutex_destroy( p_mutex );
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
if( p_mutex->init == 9999 )
{
delete_sem( p_mutex->lock );
}
p_mutex->init = 0;
return B_OK;
#elif defined(WIN32)
CloseHandle(*p_mutex);
return 0;
#endif
}
......@@ -301,7 +378,7 @@ static __inline__ int vlc_mutex_destroy( vlc_mutex_t *p_mutex )
*****************************************************************************/
static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
{
#if defined(HAVE_PTHREAD_H)
#if defined(PTHREAD_COND_T_IN_PTHREAD_H)
return pthread_cond_init( p_condvar, NULL );
#elif defined(HAVE_CTHREADS_H)
......@@ -315,15 +392,28 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)