Commit db37d62c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Win32: get rid of vlc_thread_ready()

By the way, the Win32 video outputs could probably go through some code
factorization. Don't ask me.
parent 6fcdcd0f
...@@ -191,12 +191,16 @@ static void Run( intf_thread_t *p_intf ) ...@@ -191,12 +191,16 @@ static void Run( intf_thread_t *p_intf )
/* The module is used in dialog provider mode */ /* The module is used in dialog provider mode */
/* Create a new thread for the dialogs provider */ /* Create a new thread for the dialogs provider */
p_intf->p_sys->thread_ready = CreateEvent (NULL, TRUE, FALSE, NULL);
if( vlc_thread_create( p_intf, "WinCE Dialogs Thread", if( vlc_thread_create( p_intf, "WinCE Dialogs Thread",
MainLoop, 0, true ) ) MainLoop, 0, false ) )
{ {
msg_Err( p_intf, "cannot create WinCE Dialogs Thread" ); msg_Err( p_intf, "cannot create WinCE Dialogs Thread" );
p_intf->pf_show_dialog = NULL; p_intf->pf_show_dialog = NULL;
} }
else
WaitForSingleObject (p_priv->thread_ready, INFINITE);
CloseHandle (p_priv->thread_ready);
} }
else else
{ {
...@@ -252,7 +256,7 @@ static void* MainLoop( vlc_object_t * p_this ) ...@@ -252,7 +256,7 @@ static void* MainLoop( vlc_object_t * p_this )
p_intf->p_sys->pf_show_dialog = ShowDialog; p_intf->p_sys->pf_show_dialog = ShowDialog;
/* OK, initialization is over */ /* OK, initialization is over */
vlc_thread_ready( p_intf ); SetEvent( p_intf->p_sys->thread_ready );
// Main message loop // Main message loop
while( GetMessage( &msg, NULL, 0, 0 ) > 0 ) while( GetMessage( &msg, NULL, 0, 0 ) > 0 )
......
...@@ -86,6 +86,8 @@ struct intf_sys_t ...@@ -86,6 +86,8 @@ struct intf_sys_t
vector<MenuItemExt*> *p_settings_menu; vector<MenuItemExt*> *p_settings_menu;
VideoWindow *p_video_window; VideoWindow *p_video_window;
HANDLE thread_ready;
}; };
/***************************************************************************** /*****************************************************************************
......
...@@ -203,14 +203,18 @@ static int OpenVideo( vlc_object_t *p_this ) ...@@ -203,14 +203,18 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->p_event = p_vout->p_sys->p_event =
vlc_object_create( p_vout, sizeof(event_thread_t) ); vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout; p_vout->p_sys->p_event->p_vout = p_vout;
p_vout->p_sys->p_event->ready = CreateEvent( NULL, TRUE, FALSE, NULL );
if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread", if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
EventThread, 0, 1 ) ) EventThread, 0, false ) )
{ {
msg_Err( p_vout, "cannot create Vout EventThread" ); msg_Err( p_vout, "cannot create Vout EventThread" );
CloseHandle( p_vout->p_sys->p_event->ready );
vlc_object_release( p_vout->p_sys->p_event ); vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL; p_vout->p_sys->p_event = NULL;
goto error; goto error;
} }
WaitForSingleObject( p_vout->p_sys->p_event->ready, INFINITE )
CloseHandle( p_vout->p_sys->p_event->ready );
if( p_vout->p_sys->p_event->b_error ) if( p_vout->p_sys->p_event->b_error )
{ {
......
...@@ -277,14 +277,18 @@ static int OpenVideo( vlc_object_t *p_this ) ...@@ -277,14 +277,18 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->p_event = p_vout->p_sys->p_event =
vlc_object_create( p_vout, sizeof(event_thread_t) ); vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout; p_vout->p_sys->p_event->p_vout = p_vout;
p_vout->p_sys->p_event->ready = CreateEvent( NULL, TRUE, FALSE, NULL );
if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread", if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
EventThread, 0, 1 ) ) EventThread, 0, false ) )
{ {
msg_Err( p_vout, "cannot create Vout EventThread" ); msg_Err( p_vout, "cannot create Vout EventThread" );
CloseHandle( p_vout->p_sys->p_event->ready );
vlc_object_release( p_vout->p_sys->p_event ); vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL; p_vout->p_sys->p_event = NULL;
goto error; goto error;
} }
WaitForSingleObject( p_vout->p_sys->p_event->ready, INFINITE )
CloseHandle( p_vout->p_sys->p_event->ready );
if( p_vout->p_sys->p_event->b_error ) if( p_vout->p_sys->p_event->b_error )
{ {
......
...@@ -121,7 +121,7 @@ void* EventThread( vlc_object_t *p_this ) ...@@ -121,7 +121,7 @@ void* EventThread( vlc_object_t *p_this )
} }
/* Signal the creation of the window */ /* Signal the creation of the window */
vlc_thread_ready( p_event ); SetEvent( p_event->window_ready );
#ifndef UNDER_CE #ifndef UNDER_CE
/* Set power management stuff */ /* Set power management stuff */
......
...@@ -134,14 +134,18 @@ static int OpenVideo( vlc_object_t *p_this ) ...@@ -134,14 +134,18 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->p_event = p_vout->p_sys->p_event =
vlc_object_create( p_vout, sizeof(event_thread_t) ); vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout; p_vout->p_sys->p_event->p_vout = p_vout;
p_vout->p_sys->p_event->ready = CreateEvent( NULL, TRUE, FALSE, NULL );
if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread", if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
EventThread, 0, 1 ) ) EventThread, 0, false ) )
{ {
msg_Err( p_vout, "cannot create Vout EventThread" ); msg_Err( p_vout, "cannot create Vout EventThread" );
CloseHandle( p_vout->p_sys->p_event->ready );
vlc_object_release( p_vout->p_sys->p_event ); vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL; p_vout->p_sys->p_event = NULL;
goto error; goto error;
} }
WaitForSingleObject( p_vout->p_sys->p_event->ready, INFINITE )
CloseHandle( p_vout->p_sys->p_event->ready );
if( p_vout->p_sys->p_event->b_error ) if( p_vout->p_sys->p_event->b_error )
{ {
......
...@@ -30,6 +30,7 @@ typedef struct event_thread_t ...@@ -30,6 +30,7 @@ typedef struct event_thread_t
VLC_COMMON_MEMBERS VLC_COMMON_MEMBERS
vout_thread_t * p_vout; vout_thread_t * p_vout;
HANDLE window_ready;
} event_thread_t; } event_thread_t;
......
...@@ -242,14 +242,18 @@ static int OpenVideo ( vlc_object_t *p_this ) ...@@ -242,14 +242,18 @@ static int OpenVideo ( vlc_object_t *p_this )
p_vout->p_sys->p_event = p_vout->p_sys->p_event =
vlc_object_create( p_vout, sizeof(event_thread_t) ); vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout; p_vout->p_sys->p_event->p_vout = p_vout;
if( vlc_thread_create( p_vout->p_sys->p_event, "VLC Vout Events Thread", p_vout->p_sys->p_event->ready = CreateEvent( NULL, TRUE, FALSE, NULL );
EventThread, 0, 1 ) ) if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
EventThread, 0, false ) )
{ {
msg_Err( p_vout, "cannot create Vout EventThread" ); msg_Err( p_vout, "cannot create Vout EventThread" );
CloseHandle( p_vout->p_sys->p_event->ready );
vlc_object_release( p_vout->p_sys->p_event ); vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL; p_vout->p_sys->p_event = NULL;
goto error; goto error;
} }
WaitForSingleObject( p_vout->p_sys->p_event->ready, INFINITE )
CloseHandle( p_vout->p_sys->p_event->ready );
if( p_vout->p_sys->p_event->b_error ) if( p_vout->p_sys->p_event->b_error )
{ {
......
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