Commit 1dedf688 authored by Sam Hocevar's avatar Sam Hocevar

* ./plugins/dummy/intf_dummy.c, ./plugins/chroma/i420_yuy2.c,

    src/interface/intf_eject.c, src/misc/threads.c: win32 compilation fix.
  * ./plugins/directx/aout_directx.c, plugins/directx/vout_directx.c,
    ./plugins/directx/vout_events.c: the DirectX notification and event threads
    now use the vlc_thread_create / vlc_thread_ready scheme. Untested.
  * ./configure.in: added a check for inttypes.h and sys/int_types.h.
  * ./configure.in: fixed the HTTP plugin compilation under BeOS.
  * ./plugins/network/ipv6.c: reactivated IPv6 module.
parent 2dad070c
......@@ -4,6 +4,17 @@
HEAD
* ./plugins/dummy/intf_dummy.c, ./plugins/chroma/i420_yuy2.c,
src/interface/intf_eject.c, src/misc/threads.c: win32 compilation fix.
* ./plugins/directx/aout_directx.c, plugins/directx/vout_directx.c,
./plugins/directx/vout_events.c: the DirectX notification and event threads
now use the vlc_thread_create / vlc_thread_ready scheme. Untested.
* ./configure.in: added a check for inttypes.h and sys/int_types.h.
* ./configure.in: fixed the HTTP plugin compilation under BeOS.
* ./plugins/network/ipv6.c: reactivated IPv6 module.
* ./src/misc/beos_specific.cpp: BeOS fixes, removed a static variable.
* ./include/main.h: replaced p_sys with explicit variables because it's
really much simpler this way.
* ./src/misc/beos_specific.cpp: the BeOS BApplication thread now uses the
vlc_thread_create / vlc_thread_ready scheme to signal readiness.
* ./src/misc/objects.c: prevent the creation of a too small vlc_object_t.
......
This diff is collapsed.
......@@ -133,6 +133,10 @@ AC_CHECK_FUNC(connect,,[
ipv4_LDFLAGS="${ipv4_LDFLAGS} -lsocket"
vlc_LDFLAGS="${vlc_LDFLAGS} -lsocket"
)])
AC_CHECK_FUNC(send,,[
AC_CHECK_LIB(socket,send,
http_LDFLAGS="${http_LDFLAGS} -lsocket"
)])
AC_CHECK_FUNC(gethostbyname,,[
AC_CHECK_LIB(nsl,gethostbyname,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lnsl")
])
......@@ -205,7 +209,7 @@ AC_EGREP_HEADER(strncasecmp,strings.h,[
Define if <strings.h> defines strncasecmp.)])
dnl Check for headers
AC_CHECK_HEADERS(stdint.h getopt.h strings.h)
AC_CHECK_HEADERS(stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h)
AC_CHECK_HEADERS(dlfcn.h image.h)
AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
......
......@@ -217,6 +217,9 @@
/* Define if you have the <image.h> header file. */
#undef HAVE_IMAGE_H
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the <kernel/OS.h> header file. */
#undef HAVE_KERNEL_OS_H
......@@ -280,6 +283,9 @@
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <sys/int_types.h> header file. */
#undef HAVE_SYS_INT_TYPES_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
......
......@@ -4,7 +4,7 @@
* (http://liba52.sf.net/).
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: a52.c,v 1.16 2002/06/01 12:31:58 sam Exp $
* $Id: a52.c,v 1.17 2002/06/01 16:45:34 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -26,18 +26,20 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
#include <inttypes.h> /* int16_t .. */
#include <vlc/vlc.h>
#include <vlc/aout.h>
#include <vlc/decoder.h>
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
#ifdef HAVE_INTTYPES_H
# include <inttypes.h> /* int16_t .. */
#endif
#ifdef USE_A52DEC_TREE /* liba52 header file */
#include "include/a52.h"
# include "include/a52.h"
#else
#include "a52dec/a52.h"
# include "a52dec/a52.h"
#endif
#include "a52.h"
......
......@@ -2,7 +2,7 @@
* i420_yuy2.c : YUV to YUV conversion module for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: i420_yuy2.c,v 1.8 2002/06/01 12:31:58 sam Exp $
* $Id: i420_yuy2.c,v 1.9 2002/06/01 16:45:34 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -58,6 +58,11 @@ static void I420_cyuv ( vout_thread_t *, picture_t *, picture_t * );
static void I420_Y211 ( vout_thread_t *, picture_t *, picture_t * );
#endif
#ifdef MODULE_NAME_IS_chroma_i420_yuy2_mmx
static unsigned long long i_00ffw;
static unsigned long long i_80w;
#endif
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
......@@ -72,6 +77,9 @@ MODULE_INIT_START
SET_DESCRIPTION( _("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) )
ADD_CAPABILITY( CHROMA, 100 )
ADD_REQUIREMENT( MMX )
/* Initialize MMX-specific constants */
i_00ffw = 0x00ff00ff00ff00ff;
i_80w = 0x0000000080808080;
#endif
MODULE_INIT_STOP
......
......@@ -2,7 +2,7 @@
* i420_yuy2.h : YUV to YUV conversion module for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: i420_yuy2.h,v 1.9 2002/06/01 13:52:24 sam Exp $
* $Id: i420_yuy2.h,v 1.10 2002/06/01 16:45:34 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -23,11 +23,6 @@
#ifdef MODULE_NAME_IS_chroma_i420_yuy2_mmx
#define UNUSED_LONGLONG(foo) \
unsigned long long foo __asm__ (#foo) __attribute__((unused))
UNUSED_LONGLONG(woo_00ffw) = 0x00ff00ff00ff00ff;
UNUSED_LONGLONG(woo_80w) = 0x0000000080808080;
#define MMX_CALL(MMX_INSTRUCTIONS) \
do { \
__asm__ __volatile__( \
......@@ -100,17 +95,17 @@ movq (%2), %%mm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
movq (%3), %%mm1 # Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 \n\
movd (%4), %%mm2 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
movd (%5), %%mm3 # Load 4 Cr 00 00 00 00 v3 v2 v1 v0 \n\
pand woo_00ffw, %%mm0 # get Y even 00 Y6 00 Y4 00 Y2 00 Y0 \n\
pand i_00ffw, %%mm0 # get Y even 00 Y6 00 Y4 00 Y2 00 Y0 \n\
packuswb %%mm0, %%mm0 # pack Y y6 y4 y2 y0 y6 y4 y2 y0 \n\
pand woo_00ffw, %%mm2 # get U even 00 u6 00 u4 00 u2 00 u0 \n\
pand i_00ffw, %%mm2 # get U even 00 u6 00 u4 00 u2 00 u0 \n\
packuswb %%mm2, %%mm2 # pack U 00 00 u2 u0 00 00 u2 u0 \n\
pand woo_00ffw, %%mm3 # get V even 00 v6 00 v4 00 v2 00 v0 \n\
pand i_00ffw, %%mm3 # get V even 00 v6 00 v4 00 v2 00 v0 \n\
packuswb %%mm3, %%mm3 # pack V 00 00 v2 v0 00 00 v2 v0 \n\
punpcklbw %%mm3, %%mm2 # 00 00 00 00 v2 u2 v0 u0 \n\
psubsw woo_80w, %%mm2 # U,V -= 128 \n\
psubsw i_80w, %%mm2 # U,V -= 128 \n\
punpcklbw %%mm2, %%mm0 # v2 y6 u2 y4 v0 y2 u0 y0 \n\
movq %%mm0, (%0) # Store YUYV \n\
pand woo_00ffw, %%mm1 # get Y even 00 Y6 00 Y4 00 Y2 00 Y0 \n\
pand i_00ffw, %%mm1 # get Y even 00 Y6 00 Y4 00 Y2 00 Y0 \n\
packuswb %%mm1, %%mm1 # pack Y Y6 Y4 Y2 Y0 Y6 Y4 Y2 Y0 \n\
punpcklbw %%mm2, %%mm1 # v2 Y6 u2 Y4 v0 Y2 u0 Y0 \n\
movq %%mm1, (%1) # Store YUYV \n\
......
......@@ -2,7 +2,7 @@
* aout_directx.c: Windows DirectX audio output method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aout_directx.c,v 1.22 2002/06/01 12:31:58 sam Exp $
* $Id: aout_directx.c,v 1.23 2002/06/01 16:45:34 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -44,6 +44,18 @@
#include <initguid.h>
DEFINE_GUID(IID_IDirectSoundNotify, 0xb0210783, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16);
/*****************************************************************************
* notification_thread_t: DirectX event thread
*****************************************************************************/
typedef struct notification_thread_s
{
VLC_COMMON_MEMBERS
aout_thread_t * p_aout;
DSBPOSITIONNOTIFY p_events[2]; /* play notification events */
} notification_thread_t;
/*****************************************************************************
* aout_sys_t: directx audio output method descriptor
*****************************************************************************
......@@ -75,28 +87,23 @@ struct aout_sys_s
vlc_mutex_t buffer_lock; /* audio buffer lock */
vlc_thread_t notification_thread_id; /* DirectSoundThread id */
DSBPOSITIONNOTIFY notification_events[2]; /* play notification events */
vlc_bool_t b_notification_thread_die; /* flag to kill the thread */
notification_thread_t * p_notif; /* DirectSoundThread id */
};
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int aout_Open ( aout_thread_t *p_aout );
static int aout_SetFormat ( aout_thread_t *p_aout );
static int aout_GetBufInfo ( aout_thread_t *p_aout, int i_buffer_info );
static void aout_Play ( aout_thread_t *p_aout,
byte_t *buffer, int i_size );
static void aout_Close ( aout_thread_t *p_aout );
static int aout_Open ( aout_thread_t * );
static int aout_SetFormat ( aout_thread_t * );
static int aout_GetBufInfo ( aout_thread_t *, int );
static void aout_Play ( aout_thread_t *, byte_t *, int );
static void aout_Close ( aout_thread_t * );
/* local functions */
static int DirectxCreateSecondaryBuffer ( aout_thread_t *p_aout );
static void DirectxDestroySecondaryBuffer( aout_thread_t *p_aout );
static int DirectxInitDSound ( aout_thread_t *p_aout );
static void DirectSoundThread ( aout_thread_t *p_aout );
static int DirectxCreateSecondaryBuffer ( aout_thread_t * );
static void DirectxDestroySecondaryBuffer( aout_thread_t * );
static int DirectxInitDSound ( aout_thread_t * );
static void DirectSoundThread ( notification_thread_t * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
......@@ -137,10 +144,9 @@ static int aout_Open( aout_thread_t *p_aout )
p_aout->p_sys->p_dsbuffer_primary = NULL;
p_aout->p_sys->p_dsbuffer = NULL;
p_aout->p_sys->p_dsnotify = NULL;
p_aout->p_sys->b_notification_thread_die = 0;
p_aout->p_sys->l_data_written_from_beginning = 0;
p_aout->p_sys->l_data_played_from_beginning = 0;
vlc_mutex_init( &p_aout->p_sys->buffer_lock );
vlc_mutex_init( p_aout, &p_aout->p_sys->buffer_lock );
/* Initialise DirectSound */
......@@ -172,21 +178,25 @@ static int aout_Open( aout_thread_t *p_aout )
/* Now we need to setup DirectSound play notification */
/* first we need to create the notification events */
p_aout->p_sys->notification_events[0].hEventNotify =
p_aout->p_sys->p_notif->p_events[0].hEventNotify =
CreateEvent( NULL, FALSE, FALSE, NULL );
p_aout->p_sys->notification_events[1].hEventNotify =
p_aout->p_sys->p_notif->p_events[1].hEventNotify =
CreateEvent( NULL, FALSE, FALSE, NULL );
/* then launch the notification thread */
msg_Dbg( p_aout, "creating DirectSoundThread" );
if( vlc_thread_create( p_aout, &p_aout->p_sys->notification_thread_id,
"DirectSound Notification Thread",
(void *) DirectSoundThread, (void *) p_aout) )
p_aout->p_sys->p_notif =
vlc_object_create( p_aout, sizeof(notification_thread_t) );
p_aout->p_sys->p_notif->p_aout = p_aout;
if( vlc_thread_create( p_aout->p_sys->p_notif,
"DirectSound Notification Thread", DirectSoundThread, 1 ) )
{
msg_Err( p_aout, "cannot create DirectSoundThread" );
/* Let's go on anyway */
}
vlc_object_attach( p_aout->p_sys->p_notif, p_aout );
return( 0 );
}
......@@ -424,11 +434,14 @@ static void aout_Close( aout_thread_t *p_aout )
msg_Dbg( p_aout, "aout_Close" );
/* kill the position notification thread */
p_aout->p_sys->b_notification_thread_die = 1;
SetEvent( p_aout->p_sys->notification_events[0].hEventNotify );
vlc_thread_join( p_aout, p_aout->p_sys->notification_thread_id );
vlc_mutex_destroy( &p_aout->p_sys->buffer_lock );
/* kill the position notification thread, if any */
vlc_object_unlink_all( p_aout->p_sys->p_notif );
if( p_aout->p_sys->p_notif->b_thread )
{
p_aout->p_sys->p_notif->b_die = 1;
vlc_thread_join( p_aout->p_sys->p_notif );
}
vlc_object_destroy( p_aout->p_sys->p_notif );
/* release the secondary buffer */
DirectxDestroySecondaryBuffer( p_aout );
......@@ -578,8 +591,8 @@ static int DirectxCreateSecondaryBuffer( aout_thread_t *p_aout )
/* Now the secondary buffer is created, we need to setup its position
* notification */
p_aout->p_sys->notification_events[0].dwOffset = 0; /* notif position */
p_aout->p_sys->notification_events[1].dwOffset = dsbcaps.dwBufferBytes / 2;
p_aout->p_sys->p_notif->p_events[0].dwOffset = 0; /* notif position */
p_aout->p_sys->p_notif->p_events[1].dwOffset = dsbcaps.dwBufferBytes / 2;
/* Get the IDirectSoundNotify interface */
if FAILED( IDirectSoundBuffer_QueryInterface( p_aout->p_sys->p_dsbuffer,
......@@ -595,7 +608,7 @@ static int DirectxCreateSecondaryBuffer( aout_thread_t *p_aout )
if FAILED( IDirectSoundNotify_SetNotificationPositions(
p_aout->p_sys->p_dsnotify,
2,
p_aout->p_sys->notification_events ) )
p_aout->p_sys->p_notif->p_events ) )
{
msg_Warn( p_aout, "cannot set position Notification" );
/* Go on anyway */
......@@ -638,7 +651,7 @@ static void DirectxDestroySecondaryBuffer( aout_thread_t *p_aout )
* Using event notification implies blocking the thread until the event is
* signaled so we really need to run this in a separate thread.
*****************************************************************************/
static void DirectSoundThread( aout_thread_t *p_aout )
static void DirectSoundThread( notification_thread_t *p_notif )
{
HANDLE notification_events[2];
VOID *p_write_position, *p_start_buffer;
......@@ -646,26 +659,32 @@ static void DirectSoundThread( aout_thread_t *p_aout )
HRESULT dsresult;
long l_buffer_size, l_play_position, l_data_in_buffer;
notification_events[0]=p_aout->p_sys->notification_events[0].hEventNotify;
notification_events[1]=p_aout->p_sys->notification_events[1].hEventNotify;
aout_thread_t *p_aout = p_notif->p_aout;
#define P_EVENTS p_aout->p_sys->p_notif->p_events
notification_events[0] = P_EVENTS[0].hEventNotify;
notification_events[1] = P_EVENTS[1].hEventNotify;
/* Tell the main thread that we are ready */
vlc_thread_ready( p_notif );
/* this thread must be high-priority */
if( !SetThreadPriority( GetCurrentThread(),
THREAD_PRIORITY_ABOVE_NORMAL ) )
{
msg_Warn( p_aout, "DirectSoundThread could not renice itself" );
msg_Warn( p_notif, "DirectSoundThread could not renice itself" );
}
msg_Dbg( p_aout, "DirectSoundThread ready" );
msg_Dbg( p_notif, "DirectSoundThread ready" );
while( !p_aout->p_sys->b_notification_thread_die )
while( !p_notif->b_die )
{
/* wait for the position notification */
l_play_position = WaitForMultipleObjects( 2, notification_events,
0, INFINITE );
vlc_mutex_lock( &p_aout->p_sys->buffer_lock );
if( p_aout->p_sys->b_notification_thread_die )
if( p_notif->b_die )
{
break;
}
......@@ -680,15 +699,15 @@ static void DirectSoundThread( aout_thread_t *p_aout )
/* detect wrap-around */
if( l_data_in_buffer < (-l_buffer_size/2) )
{
msg_Dbg( p_aout, "DirectSoundThread wrap around: %li",
l_data_in_buffer );
msg_Dbg( p_notif, "DirectSoundThread wrap around: %li",
l_data_in_buffer );
l_data_in_buffer += l_buffer_size;
}
/* detect underflow */
if( l_data_in_buffer <= 0 )
{
msg_Warn( p_aout,
msg_Warn( p_notif,
"DirectSoundThread underflow: %li", l_data_in_buffer );
p_aout->p_sys->b_buffer_underflown = 1;
p_aout->p_sys->l_write_position =
......@@ -723,7 +742,7 @@ static void DirectSoundThread( aout_thread_t *p_aout )
}
if( dsresult != DS_OK )
{
msg_Warn( p_aout, "aout_Play cannot lock buffer" );
msg_Warn( p_notif, "aout_Play cannot lock buffer" );
vlc_mutex_unlock( &p_aout->p_sys->buffer_lock );
return;
}
......@@ -747,6 +766,6 @@ static void DirectSoundThread( aout_thread_t *p_aout )
CloseHandle( notification_events[0] );
CloseHandle( notification_events[1] );
msg_Dbg( p_aout, "DirectSoundThread exiting" );
msg_Dbg( p_notif, "DirectSoundThread exiting" );
}
......@@ -2,7 +2,7 @@
* vout_directx.c: Windows DirectX video output display method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_directx.c,v 1.37 2002/06/01 12:31:58 sam Exp $
* $Id: vout_directx.c,v 1.38 2002/06/01 16:45:34 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -122,7 +122,6 @@ static int vout_Create( vout_thread_t *p_vout )
p_vout->p_sys->hbrush = NULL;
p_vout->p_sys->hwnd = NULL;
p_vout->p_sys->i_changes = 0;
p_vout->p_sys->b_event_thread_die = 0;
p_vout->p_sys->b_caps_overlay_clipping = 0;
SetRectEmpty( &p_vout->p_sys->rect_display );
p_vout->p_sys->b_using_overlay = config_GetInt( p_vout, "overlay" );
......@@ -136,11 +135,6 @@ static int vout_Create( vout_thread_t *p_vout )
p_vout->p_sys->i_window_width = p_vout->i_window_width;
p_vout->p_sys->i_window_height = p_vout->i_window_height;
/* Set locks and condition variables */
vlc_mutex_init( p_vout, &p_vout->p_sys->event_thread_lock );
vlc_cond_init( &p_vout->p_sys->event_thread_wait );
p_vout->p_sys->i_event_thread_status = THREAD_CREATE;
/* Create the DirectXEventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
* Windows can stay blocked inside this call for a long time, and when
......@@ -149,32 +143,30 @@ static int vout_Create( vout_thread_t *p_vout )
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg( p_vout, "creating DirectXEventThread" );
if( vlc_thread_create( p_vout, &p_vout->p_sys->event_thread_id,
"DirectX Events Thread",
(void *) DirectXEventThread, (void *) p_vout) )
p_vout->p_sys->p_event = vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout;
if( vlc_thread_create( p_vout->p_sys->p_event,
"DirectX Events Thread", DirectXEventThread, 1 ) )
{
msg_Err( p_vout, "cannot create DirectXEventThread" );
vlc_object_destroy( p_vout->p_sys->p_event );
free( p_vout->p_sys );
return( 1 );
}
/* We need to wait for the actual creation of the thread and window */
vlc_mutex_lock( &p_vout->p_sys->event_thread_lock );
if( p_vout->p_sys->i_event_thread_status == THREAD_CREATE )
{
vlc_cond_wait ( &p_vout->p_sys->event_thread_wait,
&p_vout->p_sys->event_thread_lock );
}
vlc_mutex_unlock( &p_vout->p_sys->event_thread_lock );
if( p_vout->p_sys->i_event_thread_status != THREAD_READY )
if( p_vout->p_sys->p_event->b_error )
{
msg_Err( p_vout, "DirectXEventThread failed" );
p_vout->p_sys->p_event->b_die = 1;
vlc_thread_join( p_vout->p_sys->p_event );
vlc_object_destroy( p_vout->p_sys->p_event );
free( p_vout->p_sys );
return( 1 );
}
msg_Dbg( p_vout, "DirectXEventThread running" );
vlc_object_attach( p_vout->p_sys->p_event, p_vout );
msg_Dbg( p_vout, "DirectXEventThread running" );
/* Initialise DirectDraw */
if( DirectXInitDDraw( p_vout ) )
......@@ -253,17 +245,20 @@ static void vout_Destroy( vout_thread_t *p_vout )
DirectXCloseDisplay( p_vout );
DirectXCloseDDraw( p_vout );
vlc_object_unlink_all( p_vout->p_sys->p_event );
/* Kill DirectXEventThread */
vlc_mutex_lock( &p_vout->p_sys->event_thread_lock );
p_vout->p_sys->b_event_thread_die = 1;
p_vout->p_sys->p_event->b_die = 1;
/* we need to be sure DirectXEventThread won't stay stuck in GetMessage,
* so we send a fake message */
if( p_vout->p_sys->hwnd )
{
PostMessage( p_vout->p_sys->hwnd, WM_NULL, 0, 0);
}
vlc_mutex_unlock( &p_vout->p_sys->event_thread_lock );
vlc_thread_join( p_vout->p_sys->event_thread_id );
vlc_thread_join( p_vout->p_sys->p_event );
vlc_object_destroy( p_vout->p_sys->p_event );
if( p_vout->p_sys != NULL )
{
......@@ -363,7 +358,7 @@ static int vout_Manage( vout_thread_t *p_vout )
}
/* Check if the event thread is still running */
if( p_vout->p_sys->b_event_thread_die )
if( p_vout->p_sys->p_event->b_die )
return 1; /* exit */
return( 0 );
......@@ -739,7 +734,7 @@ static int DirectXCreateSurface( vout_thread_t *p_vout,
if( !b_overlay )
{
boolean_t b_rgb_surface = ( i_chroma == FOURCC_RGB2 ) ||
vlc_bool_t b_rgb_surface = ( i_chroma == FOURCC_RGB2 ) ||
( i_chroma == FOURCC_RV15 ) || ( i_chroma == FOURCC_RV16 ) ||
( i_chroma == FOURCC_RV24 ) || ( i_chroma == FOURCC_RV32 );
......@@ -904,7 +899,7 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic,
int i_num_pics )
{
int i;
boolean_t b_result_ok;
vlc_bool_t b_result_ok;
LPDIRECTDRAWSURFACE3 p_surface;
msg_Dbg( p_vout, "NewPictureVec" );
......@@ -1081,11 +1076,10 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic,
I_OUTPUTPICTURES = 1;
intf_WarnMsg( 3, "vout: DirectX plain surface created "
"successfully" );
msg_Dbg( p_vout, "DirectX plain surface created successfully" );
}
else
intf_ErrMsg( "vout error: DirectX can't create plain surface." );
msg_Err( p_vout, "DirectX could not create plain surface" );
}
......
......@@ -2,7 +2,7 @@
* vout_directx.h: Windows DirectX video output header file
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vout_directx.h,v 1.7 2002/06/01 12:31:58 sam Exp $
* $Id: vout_directx.h,v 1.8 2002/06/01 16:45:34 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -21,6 +21,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* event_thread_t: DirectX event thread
*****************************************************************************/
typedef struct event_thread_s
{
VLC_COMMON_MEMBERS
vout_thread_t * p_vout;
} event_thread_t;
/*****************************************************************************
* vout_sys_t: video output DirectX method descriptor
*****************************************************************************
......@@ -29,7 +40,6 @@
*****************************************************************************/
struct vout_sys_s
{
LPDIRECTDRAW2 p_ddobject; /* DirectDraw object */
LPDIRECTDRAWSURFACE3 p_display; /* Display device */
LPDIRECTDRAWSURFACE3 p_current_surface; /* surface currently displayed */
......@@ -70,9 +80,7 @@ struct vout_sys_s
volatile vlc_bool_t b_cursor_hidden;
volatile mtime_t i_lastmoved;
vlc_thread_t event_thread_id; /* event thread */
vlc_mutex_t event_thread_lock; /* lock for the event thread */
vlc_cond_t event_thread_wait;
event_thread_t * p_event;
volatile int i_event_thread_status; /* DirectXEventThread status */
volatile vlc_bool_t b_event_thread_die; /* flag to kill the event thread */
......@@ -98,7 +106,7 @@ struct picture_sys_s
/*****************************************************************************
* Prototypes from vout_events.c
*****************************************************************************/
void DirectXEventThread ( vout_thread_t *p_vout );
void DirectXEventThread ( event_thread_t *p_event );
void DirectXUpdateOverlay( vout_thread_t *p_vout );
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* vout_events.c: Windows DirectX video output events handler
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_events.c,v 1.19 2002/06/01 12:31:58 sam Exp $
* $Id: vout_events.c,v 1.20 2002/06/01 16:45:34 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -61,7 +61,7 @@ static long FAR PASCAL DirectXEventProc ( HWND hwnd, UINT message,
* The main goal of this thread is to isolate the Win32 PeekMessage function
* because this one can block for a long time.
*****************************************************************************/
void DirectXEventThread( vout_thread_t *p_vout )
void DirectXEventThread( event_thread_t *p_event )
{
MSG msg;
POINT old_mouse_pos;
......@@ -71,27 +71,22 @@ void DirectXEventThread( vout_thread_t *p_vout )
/* Create a window for the video */
/* Creating a window under Windows also initializes the thread's event
* message qeue */
vlc_mutex_lock( &p_vout->p_sys->event_thread_lock );
if( DirectXCreateWindow( p_vout ) )
if( DirectXCreateWindow( p_event->p_vout ) )
{
msg_Err( p_vout, "out of memory" );
p_vout->p_sys->i_event_thread_status = THREAD_FATAL;
p_vout->p_sys->b_event_thread_die = 1;
msg_Err( p_event, "out of memory" );
p_event->b_dead = 1;
}
else p_vout->p_sys->i_event_thread_status = THREAD_READY;
/* signal the creation of the window */
vlc_cond_signal( &p_vout->p_sys->event_thread_wait );
vlc_mutex_unlock( &p_vout->p_sys->event_thread_lock );
vlc_thread_ready( p_event );
/* Main loop */
/* GetMessage will sleep if there's no message in the queue */
while( !p_vout->p_sys->b_event_thread_die
&& GetMessage( &msg, p_vout->p_sys->hwnd, 0, 0 ) )
while( !p_event->b_die
&& GetMessage( &msg, p_event->p_vout->p_sys->hwnd, 0, 0 ) )
{
/* Check if we are asked to exit */
if( p_vout->b_die || p_vout->p_sys->b_event_thread_die )
if( p_event->b_die )
break;
switch( msg.message )
......@@ -103,11 +98,11 @@ void DirectXEventThread( vout_thread_t *p_vout )
(abs(GET_Y_LPARAM(msg.lParam) - old_mouse_pos.y)) > 2 ) )
{
GetCursorPos( &old_mouse_pos );
p_vout->p_sys->i_lastmoved = mdate