From 348f966219df7389494a915cc2736df172be47c0 Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Sat, 18 May 2002 22:41:43 +0000 Subject: [PATCH] * updated INSTALL.win32 * a little bit of clean-up in the directx video output plugin --- INSTALL.win32 | 11 +++++------ plugins/directx/vout_directx.c | 32 +++++++++----------------------- plugins/directx/vout_events.c | 16 +++++++++++----- 3 files changed, 25 insertions(+), 34 deletions(-) diff --git a/INSTALL.win32 b/INSTALL.win32 index 58f6c9e76a..bc0bd9f04e 100644 --- a/INSTALL.win32 +++ b/INSTALL.win32 @@ -53,7 +53,7 @@ to remove the make utility included with MINGW as it conflicts with the one from MSYS (just rename or remove c:\msys\1.0\mingw\bin\make.exe). http://www.mingw.org/download.shtml -http://prdownloads.sourceforge.net/mingw/MSYS-1.0.7-i686-2002.04.24-1.exe +http://prdownloads.sourceforge.net/mingw/MSYS-1.0.7-i686-2.exe http://prdownloads.sourceforge.net/mingw/MinGW-1.1.tar.gz You must also not forget to install the extra development packages if you want @@ -81,8 +81,8 @@ If you are cross-compiling from Debian, you can use something along those lines: make distclean ; \ - ./configure --host=i586-mingw32msvc --target=i586-mingw32msvc \ - --build=i386-linux \ + CC=i586-mingw32msvc-gcc \ + ./configure --host=i586-mingw32msvc --build=i386-linux \ --with-gtk-config-path=/usr/local/gtk-win32/bin \ --with-sdl-config-path=/usr/local/SDL-1.2.3-win32/i386-mingw32msvc/bin \ --with-directx=/usr/local/dxheaders \ @@ -91,10 +91,9 @@ along those lines: If you are cross-compiling using the mingw32 package provided by www.videolan.org, you have to use something along those lines: - CC=/usr/local/cross-tools/bin/i586-mingw32msvc-gcc \ + CC=i586-mingw32msvc-gcc \ PATH=/usr/local/cross-tools/bin:$PATH \ - ./configure --host=i586-mingw32msvc --target=i586-mingw32msvc \ - --build=i386-linux \ + ./configure --host=i586-mingw32msvc --build=i386-linux \ --with-gtk-config-path=/usr/local/gtk-win32/bin \ --with-sdl-config-path=/usr/local/SDL-1.2.3-win32/i386-mingw32msvc/bin \ --with-directx=/usr/local/dxheaders \ diff --git a/plugins/directx/vout_directx.c b/plugins/directx/vout_directx.c index 416b87c82a..c2efdffaec 100644 --- a/plugins/directx/vout_directx.c +++ b/plugins/directx/vout_directx.c @@ -2,7 +2,7 @@ * vout_directx.c: Windows DirectX video output display method ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: vout_directx.c,v 1.34 2002/05/18 15:34:04 gbazin Exp $ + * $Id: vout_directx.c,v 1.35 2002/05/18 22:41:43 gbazin Exp $ * * Authors: Gildas Bazin * @@ -179,19 +179,11 @@ static int vout_Create( vout_thread_t *p_vout ) intf_WarnMsg( 3, "vout: vout_Create DirectXEventThread running" ); - /* Initialise DirectDraw */ if( DirectXInitDDraw( p_vout ) ) { intf_ErrMsg( "vout error: can't initialise DirectDraw" ); - - /* Kill DirectXEventThread */ - p_vout->p_sys->b_event_thread_die = 1; - /* we need to be sure DirectXEventThread won't stay stuck in - * GetMessage, so we send a fake message */ - PostMessage( p_vout->p_sys->hwnd, WM_NULL, 0, 0); - vlc_thread_join( p_vout->p_sys->event_thread_id ); - + vout_Destroy( p_vout ); return ( 1 ); } @@ -200,14 +192,7 @@ static int vout_Create( vout_thread_t *p_vout ) { intf_ErrMsg( "vout error: can't initialise DirectDraw" ); DirectXCloseDDraw( p_vout ); - - /* Kill DirectXEventThread */ - p_vout->p_sys->b_event_thread_die = 1; - /* we need to be sure DirectXEventThread won't stay stuck in - * GetMessage, so we send a fake message */ - PostMessage( p_vout->p_sys->hwnd, WM_NULL, 0, 0); - vlc_thread_join( p_vout->p_sys->event_thread_id ); - + vout_Destroy( p_vout ); return ( 1 ); } @@ -272,15 +257,16 @@ static void vout_Destroy( vout_thread_t *p_vout ) DirectXCloseDDraw( p_vout ); /* Kill DirectXEventThread */ + vlc_mutex_lock( &p_vout->p_sys->event_thread_lock ); p_vout->p_sys->b_event_thread_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->i_event_thread_status == THREAD_READY && - p_vout->p_sys->hwnd ) - { + if( p_vout->p_sys->hwnd ) PostMessage( p_vout->p_sys->hwnd, WM_NULL, 0, 0); - vlc_thread_join( p_vout->p_sys->event_thread_id ); - } + + vlc_mutex_unlock( &p_vout->p_sys->event_thread_lock ); + vlc_thread_join( p_vout->p_sys->event_thread_id ); if( p_vout->p_sys != NULL ) { diff --git a/plugins/directx/vout_events.c b/plugins/directx/vout_events.c index 6b01e0f4f4..f07957e1d4 100644 --- a/plugins/directx/vout_events.c +++ b/plugins/directx/vout_events.c @@ -2,7 +2,7 @@ * vout_events.c: Windows DirectX video output events handler ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: vout_events.c,v 1.17 2002/05/18 15:34:04 gbazin Exp $ + * $Id: vout_events.c,v 1.18 2002/05/18 22:41:43 gbazin Exp $ * * Authors: Gildas Bazin * @@ -142,7 +142,7 @@ void DirectXEventThread( vout_thread_t *p_vout ) case VK_ESCAPE: case VK_F12: /* exit application */ - p_main->p_intf->b_die = p_vout->p_sys->b_event_thread_die = 1; + p_main->p_intf->b_die = 1; break; } TranslateMessage(&msg); @@ -154,7 +154,7 @@ void DirectXEventThread( vout_thread_t *p_vout ) case 'q': case 'Q': /* exit application */ - p_main->p_intf->b_die = p_vout->p_sys->b_event_thread_die = 1; + p_main->p_intf->b_die = 1; break; case 'f': /* switch to fullscreen */ @@ -379,12 +379,19 @@ static int DirectXCreateWindow( vout_thread_t *p_vout ) static void DirectXCloseWindow( vout_thread_t *p_vout ) { intf_WarnMsg( 3, "vout: DirectXCloseWindow" ); + + vlc_mutex_lock( &p_vout->p_sys->event_thread_lock ); + if( p_vout->p_sys->hwnd != NULL ) { DestroyWindow( p_vout->p_sys->hwnd ); p_vout->p_sys->hwnd = NULL; } + p_vout->p_sys->i_event_thread_status = THREAD_OVER; + + vlc_mutex_unlock( &p_vout->p_sys->event_thread_lock ); + /* We don't unregister the Window Class because it could lead to race * conditions and it will be done anyway by the system when the app will * exit */ @@ -527,8 +534,7 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message, case WM_CLOSE: intf_WarnMsg( 4, "vout: WinProc WM_CLOSE" ); /* exit application */ - p_vout = (vout_thread_t *)GetWindowLong( hwnd, GWL_USERDATA ); - p_main->p_intf->b_die = p_vout->p_sys->b_event_thread_die = 1; + p_main->p_intf->b_die = 1; return 0; break;