]> git.sesse.net Git - vlc/commitdiff
* dvdcss_readv optimisations for Win32. We now send only one read command
authorGildas Bazin <gbazin@videolan.org>
Wed, 25 Jul 2001 08:41:22 +0000 (08:41 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 25 Jul 2001 08:41:22 +0000 (08:41 +0000)
   to the DVD drive for the whole iovec.
 * Fixed _win32_dvdcss_aread to work around the WinASPI32 64kb transfer
   size restriction.
 * New and theoretically better Win32 pthread implementation which fixes a
   problem I was having when changing title on a DVD (netlist related).
   vlc_cond_multicast may or may not work.
 * Fixed the "quit" event handling in directx/vout_events.c.
 * dvd_ifo.c now takes into account error messages from UDFFindFile.
 * Temporarily disabled aout_Probe() in aout_SDL (this function
   is creating an awful lot of problems - libSDL bug ).

ChangeLog
extras/libdvdcss/libdvdcss.c
extras/libdvdcss/libdvdcss.h
include/threads.h
plugins/directx/aout_directx.c
plugins/directx/vout_events.c
plugins/dvd/dvd_ifo.c
plugins/idct/vdec_idct.c
plugins/sdl/aout_sdl.c

index 379b598d8adeccdb8625e008079502b068ec3d28..69a93a3f47be604e3533cb28964c6b9a8179a7f6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,7 +3,13 @@
 #===================#
 
 HEAD
-
+  * dvdcss_readv() optimisations for Win32.
+  * Fixed _win32_dvdcss_aread() to work around the WinASPI32 64kb transfer
+    size restriction.
+  * New and theoretically better Win32 pthread implementation.
+  * dvd_ifo.c now takes into account error messages from UDFFindFile.
+  * Fixed the "quit" event handling in directx/vout_events.c.
+  * Temporarily disabled aout_Probe() in aout_SDL (libSDL bug).
   * libdvdcss segfault fixes.
   * Tuned constants, since it seems to make people happy.
   * Fixed the "paused movie won't restart" bug.
@@ -22,10 +28,11 @@ HEAD
   * Fixed 2 Win32 bugs in libdvdcss (in _win32_dvdcss_readv), one of them
     should have prevented the Win9x dvd input from working.
   * Moved the "if(Win2k)" out of the loop in _win32_dvdcss_readv.
-  * Put a readv() function in input_iovec.h, the input_es now compiles.
-  * Modified input_ts to use this function.
+  * Put a readv() function in input_iovec.h, the input_es plugin now compiles
+    (Win32).
+  * Modified input_ts to use readv() in input_iovec.h (Win32).
   * Fixed an initialisation bug in vout_directx.c.
-  * Right clicking on the mouse now displays the navigation menu.
+  * Right clicking on the mouse displays the navigation menu (DirectX plugin).
   * Fixed audio/video synchro bug with esd, should fix buggy sound due
     to 44100-48000 Hz conversions.
   * The Win32 GetMessage function has been isolated in a thread. This has
index e9b8f19f6f4ad4420fffff64ccd2fc376caffbe2..afb68ec0aca9f59939d4fd81f1c701f03d5a7222 100644 (file)
@@ -2,7 +2,7 @@
  * libdvdcss.c: DVD reading library.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: libdvdcss.c,v 1.8 2001/07/25 00:23:40 sam Exp $
+ * $Id: libdvdcss.c,v 1.9 2001/07/25 08:41:21 gbazin Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -65,7 +65,7 @@ static int _dvdcss_readv ( dvdcss_handle, struct iovec *p_iovec, int i_blocks );
  *****************************************************************************/
 #if defined( WIN32 )
 static int _win32_dvdcss_readv  ( int i_fd, struct iovec *p_iovec,
-                                  int i_num_buffers );
+                                  int i_num_buffers, char *p_tmp_buffer );
 static int _win32_dvdcss_aopen  ( char c_drive, dvdcss_handle dvdcss );
 static int _win32_dvdcss_aclose ( int i_fd );
 static int _win32_dvdcss_aseek  ( int i_fd, int i_blocks, int i_method );
@@ -403,6 +403,10 @@ static int _dvdcss_open ( dvdcss_handle dvdcss, char *psz_target )
         }
     }
 
+    /* initialise readv temporary buffer */
+    dvdcss->p_readv_buffer   = NULL;
+    dvdcss->i_readv_buf_size = 0;
+
 #else
     dvdcss->i_fd = open( psz_target, 0 );
 
@@ -428,8 +432,18 @@ static int _dvdcss_close ( dvdcss_handle dvdcss )
     {
         _win32_dvdcss_aclose( dvdcss->i_fd );
     }
+
+    /* Free readv temporary buffer */
+    if( dvdcss->p_readv_buffer )
+    {
+        free( dvdcss->p_readv_buffer );
+        dvdcss->p_readv_buffer   = NULL;
+        dvdcss->i_readv_buf_size = 0;
+    }
+
 #else
     close( dvdcss->i_fd );
+
 #endif
 
     return 0;
@@ -513,14 +527,36 @@ static int _dvdcss_readv ( dvdcss_handle dvdcss, struct iovec *p_iovec,
     int i_read;
 
 #if defined( WIN32 )
-    i_read = _win32_dvdcss_readv( dvdcss->i_fd, p_iovec, i_blocks );
+    /* Check the size of the readv temp buffer, just in case we need to
+     * realloc something bigger */
+    if( dvdcss->i_readv_buf_size < i_blocks * DVDCSS_BLOCK_SIZE )
+    {
+        dvdcss->i_readv_buf_size = i_blocks * DVDCSS_BLOCK_SIZE;
+
+        if( dvdcss->p_readv_buffer ) free( dvdcss->p_readv_buffer );
+
+        /* Allocate a buffer which will be used as a temporary storage
+         * for readv */
+        dvdcss->p_readv_buffer = malloc( dvdcss->i_readv_buf_size );
+        if( !dvdcss->p_readv_buffer )
+        {
+            _dvdcss_error( dvdcss, " failed (readv)" );
+            return -1;
+        }
+    }
+
+    i_read = _win32_dvdcss_readv( dvdcss->i_fd, p_iovec, i_blocks,
+                                  dvdcss->p_readv_buffer );
     return i_read;
+
 #else
     i_read = readv( dvdcss->i_fd, p_iovec, i_blocks );
     return i_read / DVDCSS_BLOCK_SIZE;
+
 #endif
 }
 
+
 #if defined( WIN32 )
 
 /*****************************************************************************
@@ -528,75 +564,58 @@ static int _dvdcss_readv ( dvdcss_handle dvdcss, struct iovec *p_iovec,
  *                      _win32_dvdcss_aread for win9x
  *****************************************************************************/
 static int _win32_dvdcss_readv( int i_fd, struct iovec *p_iovec,
-                                int i_num_buffers )
+                                int i_num_buffers, char *p_tmp_buffer )
 {
-    int i_index, i_len, i_total = 0;
-    unsigned char *p_base;
-    int i_blocks;
+    int i_index;
+    int i_blocks, i_blocks_total = 0;
 
-    if( WIN2K )
+    for( i_index = i_num_buffers; i_index; i_index-- )
     {
-        for( i_index = i_num_buffers; i_index; i_index-- )
-        {
-            i_len  = p_iovec->iov_len;
-            p_base = p_iovec->iov_base;
+        i_blocks_total += p_iovec[i_index-1].iov_len; 
+    }
 
-            if( i_len > 0 )
-            {
-                unsigned long int i_bytes;
-                if( !ReadFile( (HANDLE) i_fd, p_base, i_len, &i_bytes, NULL ) )
-                {
-                    return -1;
-                    /* One of the reads failed, too bad.
-                       We won't even bother returning the reads that went well,
-                       and like in the posix spec the file postition is left
-                       unspecified after a failure */
-                }
-                i_blocks = i_bytes / DVDCSS_BLOCK_SIZE;
-
-                i_total += i_blocks;
-
-                if( i_blocks != (i_len / DVDCSS_BLOCK_SIZE) )
-                {
-                    /* we reached the end of the file */
-                    return i_total;
-                }
+    if( i_blocks_total <= 0 ) return 0;
 
-            }
+    i_blocks_total /= DVDCSS_BLOCK_SIZE;
 
-            p_iovec++;
+    if( WIN2K )
+    {
+        unsigned long int i_bytes;
+        if( !ReadFile( (HANDLE)i_fd, p_tmp_buffer,
+                       i_blocks_total * DVDCSS_BLOCK_SIZE, &i_bytes, NULL ) )
+        {
+            return -1;
+            /* The read failed... too bad.
+               As in the posix spec the file postition is left
+               unspecified after a failure */
         }
+        i_blocks = i_bytes / DVDCSS_BLOCK_SIZE;
     }
     else /* Win9x */
     {
-        for( i_index = i_num_buffers; i_index; i_index-- )
+        i_blocks = _win32_dvdcss_aread( i_fd, p_tmp_buffer, i_blocks_total );
+        if( i_blocks < 0 )
         {
-            i_len  = p_iovec->iov_len / DVDCSS_BLOCK_SIZE;
-            p_base = p_iovec->iov_base;
-
-            if( i_len > 0 )
-            {
-                i_blocks = _win32_dvdcss_aread( i_fd, p_base, i_len );
-                if( i_blocks < 0 )
-                {
-                    return -1;  /* idem */
-                }
-
-                i_total += i_blocks;
-
-                if( i_blocks != i_len )
-                {
-                    /* we reached the end of the file or a signal interrupted
-                       the read */
-                    return i_total;
-                }
-            }
-
-            p_iovec++;
+            return -1;  /* idem */
         }
     }
 
-    return i_total;
+    /* We just have to copy the content of the temp buffer into the iovecs */
+    i_index = 0;
+    i_blocks_total = i_blocks;
+    while( i_blocks_total > 0 )
+    {
+        memcpy( p_iovec[i_index].iov_base,
+                &p_tmp_buffer[(i_blocks - i_blocks_total) * DVDCSS_BLOCK_SIZE],
+                p_iovec[i_index].iov_len );
+        /* if we read less blocks than asked, we'll just end up copying
+           garbage, this isn't an issue as we return the number of
+           blocks actually read */
+        i_blocks_total -= ( p_iovec[i_index].iov_len / DVDCSS_BLOCK_SIZE );
+        i_index++;
+    } 
+
+    return i_blocks;
 }
 
 /*****************************************************************************
@@ -611,7 +630,7 @@ static int _win32_dvdcss_aopen( char c_drive, dvdcss_handle dvdcss )
     int i, j, i_hostadapters;
     long (*lpGetSupport)( void );
     long (*lpSendCommand)( void* );
-    
+     
     hASPI = LoadLibrary( "wnaspi32.dll" );
     if( hASPI == NULL )
     {
@@ -621,7 +640,7 @@ static int _win32_dvdcss_aopen( char c_drive, dvdcss_handle dvdcss )
 
     (FARPROC) lpGetSupport = GetProcAddress( hASPI, "GetASPI32SupportInfo" );
     (FARPROC) lpSendCommand = GetProcAddress( hASPI, "SendASPI32Command" );
-    
     if(lpGetSupport == NULL || lpSendCommand == NULL )
     {
         _dvdcss_debug( dvdcss, "unable to get aspi function pointers" );
@@ -680,8 +699,8 @@ static int _win32_dvdcss_aopen( char c_drive, dvdcss_handle dvdcss )
 
             lpSendCommand( (void*) &srbDiskInfo );
 
-            if( srbDiskInfo.SRB_Status == SS_COMP &&
-                srbDiskInfo.SRB_Int13HDriveInfo == c_drive )
+            if( (srbDiskInfo.SRB_Status == SS_COMP) &&
+                (srbDiskInfo.SRB_Int13HDriveInfo == c_drive) )
             {
                 fd->i_sid = MAKEWORD( i, j );
                 return (int) fd;
@@ -692,8 +711,7 @@ static int _win32_dvdcss_aopen( char c_drive, dvdcss_handle dvdcss )
     free( (void*) fd );
     FreeLibrary( hASPI );
     _dvdcss_debug( dvdcss, "unable to get haid and target (aspi)" );
-
-    return( -1 );
+    return( -1 );        
 }
 
 /*****************************************************************************
@@ -743,56 +761,78 @@ static int _win32_dvdcss_aseek( int i_fd, int i_blocks, int i_method )
 static int _win32_dvdcss_aread( int i_fd, void *p_data, int i_blocks )
 {
     HANDLE hEvent;
-    DWORD dwStart, dwLen;
     struct SRB_ExecSCSICmd ssc;
     struct w32_aspidev *fd = (struct w32_aspidev *) i_fd;
 
-    memset( &ssc, 0, sizeof( ssc ) );
-
-    dwStart = fd->i_blocks;
-    dwLen = i_blocks;
-
+    /* Create the transfer completion event */
     hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
     if( hEvent == NULL )
     {
         return -1;
     }
 
+    memset( &ssc, 0, sizeof( ssc ) );
+
     ssc.SRB_Cmd         = SC_EXEC_SCSI_CMD;
     ssc.SRB_Flags       = SRB_DIR_IN | SRB_EVENT_NOTIFY;
     ssc.SRB_HaId        = LOBYTE( fd->i_sid );
     ssc.SRB_Target      = HIBYTE( fd->i_sid );
     ssc.SRB_SenseLen    = SENSE_LEN;
-    ssc.SRB_PostProc    = (LPVOID) hEvent;
-
-    ssc.SRB_BufLen      = dwLen * DVDCSS_BLOCK_SIZE;
+    
+    ssc.SRB_PostProc = (LPVOID) hEvent;
     ssc.SRB_BufPointer  = p_data;
     ssc.SRB_CDBLen      = 12;
-
+    
     ssc.CDBByte[0]      = 0xA8; /* RAW */
-    ssc.CDBByte[2]      = (UCHAR) dwStart >> 24;
-    ssc.CDBByte[3]      = (UCHAR) (dwStart >> 16) & 0xff;
-    ssc.CDBByte[4]      = (UCHAR) (dwStart >> 8) & 0xff;
-    ssc.CDBByte[5]      = (UCHAR) (dwStart) & 0xff;
-    ssc.CDBByte[6]      = (UCHAR) dwLen >> 24;
-    ssc.CDBByte[7]      = (UCHAR) (dwLen >> 16) & 0xff;
-    ssc.CDBByte[8]      = (UCHAR) (dwLen >> 8) & 0xff;
-    ssc.CDBByte[9]      = (UCHAR) (dwLen) & 0xff;
-
-    ResetEvent( hEvent );
-    if( fd->lpSendCommand( (void*) &ssc ) == SS_PENDING )
+    ssc.CDBByte[2]      = (UCHAR) (fd->i_blocks >> 24);
+    ssc.CDBByte[3]      = (UCHAR) (fd->i_blocks >> 16) & 0xff;
+    ssc.CDBByte[4]      = (UCHAR) (fd->i_blocks >> 8) & 0xff;
+    ssc.CDBByte[5]      = (UCHAR) (fd->i_blocks) & 0xff;
+    
+    /* We have to break down the reads into 64kb pieces (ASPI restriction) */
+    if( i_blocks > 32 )
     {
-        WaitForSingleObject( hEvent, INFINITE );
+        ssc.SRB_BufLen = 32 * DVDCSS_BLOCK_SIZE;
+        ssc.CDBByte[9] = 32;
+        fd->i_blocks  += 32;
+
+        /* Initiate transfer */  
+        ResetEvent( hEvent );
+        fd->lpSendCommand( (void*) &ssc );
+
+        /* transfer the next 64kb (_win32_dvdcss_aread is called recursively)
+         * We need to check the status of the read on return */
+        if( _win32_dvdcss_aread( i_fd, p_data + 32 * DVDCSS_BLOCK_SIZE,
+                                 i_blocks - 32) < 0 )
+        {
+            return -1;
+        }
     }
+    else
+    {
+        /* This is the last transfer */
+        ssc.SRB_BufLen   = i_blocks * DVDCSS_BLOCK_SIZE;
+        ssc.CDBByte[9]   = (UCHAR) i_blocks;
+        fd->i_blocks += i_blocks;
 
+        /* Initiate transfer */  
+        ResetEvent( hEvent );
+        fd->lpSendCommand( (void*) &ssc );
+
+    }
+
+    /* If the command has still not been processed, wait until it's finished */
+    if( ssc.SRB_Status == SS_PENDING )
+    {
+        WaitForSingleObject( hEvent, INFINITE );
+    }
     CloseHandle( hEvent );
 
+    /* check that the transfer went as planned */
     if( ssc.SRB_Status != SS_COMP )
     {
-        return -1;
+      return -1;
     }
-        
-    fd->i_blocks += i_blocks;
 
     return i_blocks;
 }
index 36bd7482442307847928e5637e315ebfc895db44..19df12bd30801efb953530be0e06559ad1051d1a 100644 (file)
@@ -2,7 +2,7 @@
  * private.h: private DVD reading library data
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: libdvdcss.h,v 1.5 2001/07/25 00:23:40 sam Exp $
+ * $Id: libdvdcss.h,v 1.6 2001/07/25 08:41:21 gbazin Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -46,6 +46,10 @@ struct dvdcss_s
     boolean_t b_errors;
     boolean_t b_debug;
 
+#if defined( WIN32 )
+    char *p_readv_buffer;
+    int  i_readv_buf_size;
+#endif
 };
 
 /*****************************************************************************
index a43129630d11f00cec17758f339c355d0f331430..0b1b090be04ee1be4c2021e3e03c6c829c8f879d 100644 (file)
@@ -3,7 +3,7 @@
  * This header provides a portable threads implementation.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: threads.h,v 1.20 2001/07/18 14:21:00 massiot Exp $
+ * $Id: threads.h,v 1.21 2001/07/25 08:41:21 gbazin Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
@@ -45,7 +45,7 @@
 #   include <kernel/scheduler.h>
 #   include <byteorder.h>
 
-#elif defined( WIN32 )                        /* Win32 with MinGW32 compiler */
+#elif defined( WIN32 )
 #   include <windows.h>
 #   include <process.h>
 
@@ -134,9 +134,15 @@ typedef struct
 } vlc_cond_t;
 
 #elif defined( WIN32 )
-typedef HANDLE      vlc_thread_t;
-typedef HANDLE      vlc_mutex_t;
-typedef HANDLE      vlc_cond_t; 
+typedef HANDLE           vlc_thread_t;
+typedef CRITICAL_SECTION vlc_mutex_t;
+
+typedef struct
+{
+    int             i_waiting_threads;
+    HANDLE          signal;
+} vlc_cond_t;
+
 typedef unsigned (__stdcall *PTHREAD_START) (void *);
 
 #endif
@@ -188,7 +194,23 @@ typedef struct wrapper_s
     struct itimerval itimer;
 
 } wrapper_t;
-#endif
+
+#ifdef WIN32
+struct itimerval
+{
+    struct timeval it_value;
+    struct timeval it_interval;
+};
+
+int setitimer(int kind, const struct itimerval* itnew,
+             struct itimerval* itold);
+
+#define ITIMER_REAL 1
+#define ITIMER_PROF 2
+
+#endif /* WIN32 */
+
+#endif /* PROFILING */
 
 /*****************************************************************************
  * vlc_threads_init: initialize threads system
@@ -274,8 +296,8 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
     return B_OK;
 
 #elif defined( WIN32 )
-    *p_mutex = CreateMutex(0,FALSE,0);
-    return (*p_mutex?0:1);
+    InitializeCriticalSection( p_mutex );
+    return 0;
 
 #endif
 }
@@ -312,7 +334,7 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
     return err;
 
 #elif defined( WIN32 )
-    WaitForSingleObject( *p_mutex, INFINITE );
+    EnterCriticalSection( p_mutex );
     return 0;
 
 #endif
@@ -348,7 +370,7 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
     return B_OK;
 
 #elif defined( WIN32 )
-    ReleaseMutex( *p_mutex );
+    LeaveCriticalSection( p_mutex );
     return 0;
 
 #endif
@@ -375,7 +397,7 @@ static __inline__ int vlc_mutex_destroy( vlc_mutex_t *p_mutex )
     return B_OK;
 
 #elif defined( WIN32 )
-    CloseHandle(*p_mutex);
+    DeleteCriticalSection( p_mutex );
     return 0;
 
 #endif    
@@ -417,13 +439,16 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
     return 0;
 
 #elif defined( WIN32 )
+    /* initialise counter */
+    p_condvar->i_waiting_threads = 0;
+
     /* Create an auto-reset event. */
-    *p_condvar = CreateEvent( NULL,   /* no security */
-                              FALSE,  /* auto-reset event */
-                              FALSE,  /* non-signaled initially */
-                              NULL ); /* unnamed */
+    p_condvar->signal = CreateEvent( NULL, /* no security */
+                                    FALSE,  /* auto-reset event */
+                                    FALSE,  /* non-signaled initially */
+                                    NULL ); /* unnamed */
 
-    return( *p_condvar ? 0 : 1 );
+    return( !p_condvar->signal );
     
 #endif
 }
@@ -484,8 +509,14 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
     return 0;
 
 #elif defined( WIN32 )
-    /* Try to release one waiting thread. */
-    PulseEvent ( *p_condvar );
+    /* 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 */
+    while( p_condvar->i_waiting_threads )
+    {
+        PulseEvent( p_condvar->signal );
+        Sleep( 0 ); /* deschedule the current thread */
+    }
     return 0;
 
 #endif
@@ -552,8 +583,14 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar )
     return 0;
 
 #elif defined( WIN32 )
-    /* Try to release one waiting thread. */
-    PulseEvent ( *p_condvar );
+    /* 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( 0 ); /* deschedule the current thread */
+    }
     return 0;
 
 #endif
@@ -602,16 +639,31 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex
     return 0;
 
 #elif defined( WIN32 )
-    /* Release the <external_mutex> here and wait for the event
-     * to become signaled, due to <pthread_cond_signal> being
-     * called. */
+    /* 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 ++;
+
+    /* Release the mutex */
     vlc_mutex_unlock( p_mutex );
 
-    WaitForSingleObject( *p_condvar, INFINITE );
+    i_result = WaitForSingleObject( p_condvar->signal, INFINITE); 
+
+    /* maybe we should protect this with a mutex ? */
+    p_condvar->i_waiting_threads --;
 
     /* Reacquire the mutex before returning. */
     vlc_mutex_lock( p_mutex );
-    return 0;
+
+    return( i_result == WAIT_FAILED );
 
 #endif
 }
@@ -632,8 +684,7 @@ static __inline__ int vlc_cond_destroy( vlc_cond_t *p_condvar )
     return 0;
 
 #elif defined( WIN32 )
-    CloseHandle( *p_condvar );
-    return 0;
+    return( !CloseHandle( p_condvar->signal ) );
 
 #endif    
 }
@@ -642,7 +693,8 @@ static __inline__ int vlc_cond_destroy( vlc_cond_t *p_condvar )
  * vlc_thread_create: create a thread
  *****************************************************************************/
 static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
-                                         char *psz_name, vlc_thread_func_t func,
+                                         char *psz_name,
+                                         vlc_thread_func_t func,
                                          void *p_data )
 {
     int i_ret;
@@ -785,4 +837,3 @@ static void *vlc_thread_wrapper( void *p_wrapper )
     return func( p_data );
 }
 #endif
-
index 61bbb858db436006bd32ed88d89f26eb18fc3a29..29f2ee3bb06865b8d9710d94881a0ae861a22c4b 100644 (file)
@@ -2,7 +2,7 @@
  * aout_directx.c: Windows DirectX audio output method
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: aout_directx.c,v 1.5 2001/07/12 20:44:52 reno Exp $
+ * $Id: aout_directx.c,v 1.6 2001/07/25 08:41:21 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -306,7 +306,9 @@ static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
                : (p_aout->p_sys->l_buffer_size - l_play_position
                   + p_aout->p_sys->l_write_position) /2 ;
 
+#if 0
     intf_WarnMsg( 5, "aout: DirectX aout_GetBufInfo: %li", l_result);
+#endif
     return l_result;
 }
 
index b711141eeeb69ebf21f0741b91c61641d6796141..bb44cc1f306b7e95f4a8dfb4460b97732bed115b 100644 (file)
@@ -2,7 +2,7 @@
  * vout_events.c: Windows DirectX video output events handler
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vout_events.c,v 1.2 2001/07/12 23:06:54 gbazin Exp $
+ * $Id: vout_events.c,v 1.3 2001/07/25 08:41:21 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -179,7 +179,6 @@ void DirectXEventThread( vout_thread_t *p_vout )
                 
             case WM_RBUTTONUP:
                 intf_WarnMsg( 4, "vout: vout_Manage WM_RBUTTONUP" );
-                /* FIXME: need locking ! */
                 p_main->p_intf->b_menu_change = 1;
                 break;
 
@@ -192,7 +191,7 @@ void DirectXEventThread( vout_thread_t *p_vout )
                 {
                 case VK_ESCAPE:
                 case VK_F12:
-                    p_main->p_intf->b_die = 1;
+                    PostQuitMessage( 0 );
                     break;
                 }
                 TranslateMessage(&msg);
@@ -205,7 +204,7 @@ void DirectXEventThread( vout_thread_t *p_vout )
                 {
                 case 'q':
                 case 'Q':
-                    p_main->p_intf->b_die = 1;
+                    PostQuitMessage( 0 );
                     break;
                   
                 case 'f':                            /* switch to fullscreen */
@@ -295,7 +294,6 @@ void DirectXEventThread( vout_thread_t *p_vout )
     /* Set thread Status */
     p_vout->p_sys->i_event_thread_status = THREAD_OVER;
 
-    return;
 }
 
 
index 8e47449d1e4de66e73ea6dc3f09efb75fec7c371..9d4686cb6a70f015e3eb4f346a01295462fd5f95 100644 (file)
@@ -2,7 +2,7 @@
  * dvd_ifo.c: Functions for ifo parsing
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: dvd_ifo.c,v 1.34 2001/06/20 07:43:48 sam Exp $
+ * $Id: dvd_ifo.c,v 1.35 2001/07/25 08:41:21 gbazin Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          German Tischler <tanis@gaspode.franken.de>
@@ -121,6 +121,7 @@ int IfoInit( ifo_t * p_ifo )
 
     /* find the start sector of video information on the dvd */
     p_ifo->i_start = UDFFindFile( p_ifo->dvdhandle, "/VIDEO_TS/VIDEO_TS.IFO" );
+    if( !p_ifo->i_start ) return -1;
 
     p_tmp = FillBuffer( p_ifo, p_buf, p_ifo->i_start );
     //i_start = p_ifo->i_pos;
index 808ad851726f8e7add71935b810f2ac376ae57dc..278e7f2ea5a5116659fe75e245770cd439afc748 100644 (file)
@@ -2,7 +2,7 @@
  * vdec_idct.c : common IDCT functions
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: vdec_idct.c,v 1.2 2001/07/17 09:48:07 massiot Exp $
+ * $Id: vdec_idct.c,v 1.3 2001/07/25 08:41:21 gbazin Exp $
  *
  * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -33,6 +33,7 @@
  *****************************************************************************/
 #include "defs.h"
 
+#include <stdlib.h>                                              /* malloc() */
 #include <string.h>                                    /* memcpy(), memset() */
 
 #include "config.h"
index 0df6f0aac22447e0e6117fc0388aaa35bf342722..6c73027237f89b0be13ca61aaddfbb2c4dd5e82c 100644 (file)
@@ -2,7 +2,7 @@
  * aout_sdl.c : audio sdl functions library
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: aout_sdl.c,v 1.14 2001/07/12 20:44:52 reno Exp $
+ * $Id: aout_sdl.c,v 1.15 2001/07/25 08:41:21 gbazin Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -108,6 +108,7 @@ void _M( aout_getfunctions )( function_list_t * p_function_list )
  *****************************************************************************/
 static int aout_Probe( probedata_t *p_data )
 {
+#if 0
     SDL_AudioSpec desired, obtained;
 
     /* Start AudioSDL */
@@ -135,6 +136,7 @@ static int aout_Probe( probedata_t *p_data )
     /* Otherwise, there are good chances we can use this plugin, return 100. */
     intf_DbgMsg( "aout: SDL_OpenAudio successfully run" );
     SDL_CloseAudio();
+#endif
 
     if( TestMethod( AOUT_METHOD_VAR, "sdl" ) )
     {