Commit 5bcfa0fa authored by Gildas Bazin's avatar Gildas Bazin

 * dvdcss_readv optimisations for Win32. We now send only one read command
   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 ).
parent 1977c0ab
...@@ -3,7 +3,13 @@ ...@@ -3,7 +3,13 @@
#===================# #===================#
HEAD 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. * libdvdcss segfault fixes.
* Tuned constants, since it seems to make people happy. * Tuned constants, since it seems to make people happy.
* Fixed the "paused movie won't restart" bug. * Fixed the "paused movie won't restart" bug.
...@@ -22,10 +28,11 @@ HEAD ...@@ -22,10 +28,11 @@ HEAD
* Fixed 2 Win32 bugs in libdvdcss (in _win32_dvdcss_readv), one of them * Fixed 2 Win32 bugs in libdvdcss (in _win32_dvdcss_readv), one of them
should have prevented the Win9x dvd input from working. should have prevented the Win9x dvd input from working.
* Moved the "if(Win2k)" out of the loop in _win32_dvdcss_readv. * 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. * Put a readv() function in input_iovec.h, the input_es plugin now compiles
* Modified input_ts to use this function. (Win32).
* Modified input_ts to use readv() in input_iovec.h (Win32).
* Fixed an initialisation bug in vout_directx.c. * 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 * Fixed audio/video synchro bug with esd, should fix buggy sound due
to 44100-48000 Hz conversions. to 44100-48000 Hz conversions.
* The Win32 GetMessage function has been isolated in a thread. This has * The Win32 GetMessage function has been isolated in a thread. This has
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* private.h: private DVD reading library data * private.h: private DVD reading library data
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * 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: Stphane Borel <stef@via.ecp.fr> * Authors: Stphane Borel <stef@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -46,6 +46,10 @@ struct dvdcss_s ...@@ -46,6 +46,10 @@ struct dvdcss_s
boolean_t b_errors; boolean_t b_errors;
boolean_t b_debug; boolean_t b_debug;
#if defined( WIN32 )
char *p_readv_buffer;
int i_readv_buf_size;
#endif
}; };
/***************************************************************************** /*****************************************************************************
......
...@@ -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.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> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
# include <kernel/scheduler.h> # include <kernel/scheduler.h>
# include <byteorder.h> # include <byteorder.h>
#elif defined( WIN32 ) /* Win32 with MinGW32 compiler */ #elif defined( WIN32 )
# include <windows.h> # include <windows.h>
# include <process.h> # include <process.h>
...@@ -134,9 +134,15 @@ typedef struct ...@@ -134,9 +134,15 @@ typedef struct
} vlc_cond_t; } vlc_cond_t;
#elif defined( WIN32 ) #elif defined( WIN32 )
typedef HANDLE vlc_thread_t; typedef HANDLE vlc_thread_t;
typedef HANDLE vlc_mutex_t; typedef CRITICAL_SECTION vlc_mutex_t;
typedef HANDLE vlc_cond_t;
typedef struct
{
int i_waiting_threads;
HANDLE signal;
} vlc_cond_t;
typedef unsigned (__stdcall *PTHREAD_START) (void *); typedef unsigned (__stdcall *PTHREAD_START) (void *);
#endif #endif
...@@ -188,7 +194,23 @@ typedef struct wrapper_s ...@@ -188,7 +194,23 @@ typedef struct wrapper_s
struct itimerval itimer; struct itimerval itimer;
} wrapper_t; } 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 * vlc_threads_init: initialize threads system
...@@ -274,8 +296,8 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) ...@@ -274,8 +296,8 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
return B_OK; return B_OK;
#elif defined( WIN32 ) #elif defined( WIN32 )
*p_mutex = CreateMutex(0,FALSE,0); InitializeCriticalSection( p_mutex );
return (*p_mutex?0:1); return 0;
#endif #endif
} }
...@@ -312,7 +334,7 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex ) ...@@ -312,7 +334,7 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
return err; return err;
#elif defined( WIN32 ) #elif defined( WIN32 )
WaitForSingleObject( *p_mutex, INFINITE ); EnterCriticalSection( p_mutex );
return 0; return 0;
#endif #endif
...@@ -348,7 +370,7 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) ...@@ -348,7 +370,7 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
return B_OK; return B_OK;
#elif defined( WIN32 ) #elif defined( WIN32 )
ReleaseMutex( *p_mutex ); LeaveCriticalSection( p_mutex );
return 0; return 0;
#endif #endif
...@@ -375,7 +397,7 @@ static __inline__ int vlc_mutex_destroy( vlc_mutex_t *p_mutex ) ...@@ -375,7 +397,7 @@ static __inline__ int vlc_mutex_destroy( vlc_mutex_t *p_mutex )
return B_OK; return B_OK;
#elif defined( WIN32 ) #elif defined( WIN32 )
CloseHandle(*p_mutex); DeleteCriticalSection( p_mutex );
return 0; return 0;
#endif #endif
...@@ -417,13 +439,16 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) ...@@ -417,13 +439,16 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
return 0; return 0;
#elif defined( WIN32 ) #elif defined( WIN32 )
/* initialise counter */
p_condvar->i_waiting_threads = 0;
/* Create an auto-reset event. */ /* Create an auto-reset event. */
*p_condvar = CreateEvent( NULL, /* no security */ p_condvar->signal = CreateEvent( NULL, /* no security */
FALSE, /* auto-reset event */ FALSE, /* auto-reset event */
FALSE, /* non-signaled initially */ FALSE, /* non-signaled initially */
NULL ); /* unnamed */ NULL ); /* unnamed */
return( *p_condvar ? 0 : 1 ); return( !p_condvar->signal );
#endif #endif
} }
...@@ -484,8 +509,14 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) ...@@ -484,8 +509,14 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
return 0; return 0;
#elif defined( WIN32 ) #elif defined( WIN32 )
/* Try to release one waiting thread. */ /* Release one waiting thread if one is available. */
PulseEvent ( *p_condvar ); /* 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; return 0;
#endif #endif
...@@ -552,8 +583,14 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar ) ...@@ -552,8 +583,14 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar )
return 0; return 0;
#elif defined( WIN32 ) #elif defined( WIN32 )
/* Try to release one waiting thread. */ /* Release all waiting threads. */
PulseEvent ( *p_condvar ); /* 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; return 0;
#endif #endif
...@@ -602,16 +639,31 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex ...@@ -602,16 +639,31 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex
return 0; return 0;
#elif defined( WIN32 ) #elif defined( WIN32 )
/* Release the <external_mutex> here and wait for the event /* The ideal would be to use a function which atomically releases the
* to become signaled, due to <pthread_cond_signal> being * mutex and initiate the waiting.
* called. */ * 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 ); 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. */ /* Reacquire the mutex before returning. */
vlc_mutex_lock( p_mutex ); vlc_mutex_lock( p_mutex );
return 0;
return( i_result == WAIT_FAILED );
#endif #endif
} }
...@@ -632,8 +684,7 @@ static __inline__ int vlc_cond_destroy( vlc_cond_t *p_condvar ) ...@@ -632,8 +684,7 @@ static __inline__ int vlc_cond_destroy( vlc_cond_t *p_condvar )
return 0; return 0;
#elif defined( WIN32 ) #elif defined( WIN32 )
CloseHandle( *p_condvar ); return( !CloseHandle( p_condvar->signal ) );
return 0;
#endif #endif
} }
...@@ -642,7 +693,8 @@ static __inline__ int vlc_cond_destroy( vlc_cond_t *p_condvar ) ...@@ -642,7 +693,8 @@ static __inline__ int vlc_cond_destroy( vlc_cond_t *p_condvar )
* vlc_thread_create: create a thread * vlc_thread_create: create a thread
*****************************************************************************/ *****************************************************************************/
static __inline__ int vlc_thread_create( vlc_thread_t *p_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 ) void *p_data )
{ {
int i_ret; int i_ret;
...@@ -785,4 +837,3 @@ static void *vlc_thread_wrapper( void *p_wrapper ) ...@@ -785,4 +837,3 @@ static void *vlc_thread_wrapper( void *p_wrapper )
return func( p_data ); return func( p_data );
} }
#endif #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_directx.c: Windows DirectX audio output method * aout_directx.c: Windows DirectX audio output method
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -306,7 +306,9 @@ static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) ...@@ -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_buffer_size - l_play_position
+ p_aout->p_sys->l_write_position) /2 ; + p_aout->p_sys->l_write_position) /2 ;
#if 0
intf_WarnMsg( 5, "aout: DirectX aout_GetBufInfo: %li", l_result); intf_WarnMsg( 5, "aout: DirectX aout_GetBufInfo: %li", l_result);
#endif
return l_result; return l_result;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_events.c: Windows DirectX video output events handler * vout_events.c: Windows DirectX video output events handler
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -179,7 +179,6 @@ void DirectXEventThread( vout_thread_t *p_vout ) ...@@ -179,7 +179,6 @@ void DirectXEventThread( vout_thread_t *p_vout )
case WM_RBUTTONUP: case WM_RBUTTONUP:
intf_WarnMsg( 4, "vout: vout_Manage WM_RBUTTONUP" ); intf_WarnMsg( 4, "vout: vout_Manage WM_RBUTTONUP" );
/* FIXME: need locking ! */
p_main->p_intf->b_menu_change = 1; p_main->p_intf->b_menu_change = 1;
break; break;
...@@ -192,7 +191,7 @@ void DirectXEventThread( vout_thread_t *p_vout ) ...@@ -192,7 +191,7 @@ void DirectXEventThread( vout_thread_t *p_vout )
{ {
case VK_ESCAPE: case VK_ESCAPE:
case VK_F12: case VK_F12:
p_main->p_intf->b_die = 1; PostQuitMessage( 0 );
break; break;
} }
TranslateMessage(&msg); TranslateMessage(&msg);
...@@ -205,7 +204,7 @@ void DirectXEventThread( vout_thread_t *p_vout ) ...@@ -205,7 +204,7 @@ void DirectXEventThread( vout_thread_t *p_vout )
{ {
case 'q': case 'q':
case 'Q': case 'Q':
p_main->p_intf->b_die = 1; PostQuitMessage( 0 );
break; break;
case 'f': /* switch to fullscreen */ case 'f': /* switch to fullscreen */
...@@ -295,7 +294,6 @@ void DirectXEventThread( vout_thread_t *p_vout ) ...@@ -295,7 +294,6 @@ void DirectXEventThread( vout_thread_t *p_vout )
/* Set thread Status */ /* Set thread Status */
p_vout->p_sys->i_event_thread_status = THREAD_OVER; p_vout->p_sys->i_event_thread_status = THREAD_OVER;
return;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing * dvd_ifo.c: Functions for ifo parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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: Stphane Borel <stef@via.ecp.fr> * Authors: Stphane Borel <stef@via.ecp.fr>
* German Tischler <tanis@gaspode.franken.de> * German Tischler <tanis@gaspode.franken.de>
...@@ -121,6 +121,7 @@ int IfoInit( ifo_t * p_ifo ) ...@@ -121,6 +121,7 @@ int IfoInit( ifo_t * p_ifo )
/* find the start sector of video information on the dvd */ /* find the start sector of video information on the dvd */
p_ifo->i_start = UDFFindFile( p_ifo->dvdhandle, "/VIDEO_TS/VIDEO_TS.IFO" ); 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 ); p_tmp = FillBuffer( p_ifo, p_buf, p_ifo->i_start );
//i_start = p_ifo->i_pos; //i_start = p_ifo->i_pos;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vdec_idct.c : common IDCT functions * vdec_idct.c : common IDCT functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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: Gal Hendryckx <jimmy@via.ecp.fr> * Authors: Gal Hendryckx <jimmy@via.ecp.fr>
* *
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
*****************************************************************************/ *****************************************************************************/
#include "defs.h" #include "defs.h"
#include <stdlib.h> /* malloc() */
#include <string.h> /* memcpy(), memset() */ #include <string.h> /* memcpy(), memset() */
#include "config.h" #include "config.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_sdl.c : audio sdl functions library * aout_sdl.c : audio sdl functions library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -108,6 +108,7 @@ void _M( aout_getfunctions )( function_list_t * p_function_list ) ...@@ -108,6 +108,7 @@ void _M( aout_getfunctions )( function_list_t * p_function_list )
*****************************************************************************/ *****************************************************************************/
static int aout_Probe( probedata_t *p_data ) static int aout_Probe( probedata_t *p_data )
{ {
#if 0
SDL_AudioSpec desired, obtained; SDL_AudioSpec desired, obtained;
/* Start AudioSDL */ /* Start AudioSDL */
...@@ -135,6 +136,7 @@ static int aout_Probe( probedata_t *p_data ) ...@@ -135,6 +136,7 @@ static int aout_Probe( probedata_t *p_data )
/* Otherwise, there are good chances we can use this plugin, return 100. */ /* Otherwise, there are good chances we can use this plugin, return 100. */
intf_DbgMsg( "aout: SDL_OpenAudio successfully run" ); intf_DbgMsg( "aout: SDL_OpenAudio successfully run" );
SDL_CloseAudio(); SDL_CloseAudio();
#endif
if( TestMethod( AOUT_METHOD_VAR, "sdl" ) ) if( TestMethod( AOUT_METHOD_VAR, "sdl" ) )
{ {
......
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