* vout.c: Windows DirectX video output display method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: directx.c,v 1.24 2003/11/19 23:44:35 gbazin Exp $
+ * $Id: directx.c,v 1.25 2003/11/20 17:48:44 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
p_vout->p_sys->hwnd = NULL;
p_vout->p_sys->hparent = NULL;
p_vout->p_sys->i_changes = 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" );
p_vout->p_sys->b_use_sysmem = config_GetInt( p_vout, "directx-use-sysmem");
ddofx.dckDestColorkey.dwColorSpaceLowValue = p_vout->p_sys->i_colorkey;
ddofx.dckDestColorkey.dwColorSpaceHighValue = p_vout->p_sys->i_colorkey;
- dwFlags = DDOVER_SHOW;
- if( !p_vout->p_sys->b_caps_overlay_clipping )
- dwFlags |= DDOVER_KEYDESTOVERRIDE;
+ dwFlags = DDOVER_SHOW | DDOVER_KEYDESTOVERRIDE;
dxresult = IDirectDrawSurface2_UpdateOverlay(
p_vout->p_sys->p_current_surface,
}
else
{
- BOOL bHasOverlay, bHasOverlayFourCC, bCanClipOverlay,
+ BOOL bHasOverlay, bHasOverlayFourCC, bCanDeinterlace,
bHasColorKey, bCanStretch, bCanBltFourcc;
/* Determine if the hardware supports overlay surfaces */
/* Determine if the hardware supports overlay surfaces */
bHasOverlayFourCC = ((ddcaps.dwCaps & DDCAPS_OVERLAYFOURCC) ==
DDCAPS_OVERLAYFOURCC) ? TRUE : FALSE;
- /* Determine if the hardware supports overlay surfaces */
- bCanClipOverlay = ((ddcaps.dwCaps & DDCAPS_OVERLAYCANTCLIP) ==
+ /* Determine if the hardware supports overlay deinterlacing */
+ bCanDeinterlace = ((ddcaps.dwCaps & DDCAPS2_CANFLIPODDEVEN) ==
0 ) ? TRUE : FALSE;
/* Determine if the hardware supports colorkeying */
bHasColorKey = ((ddcaps.dwCaps & DDCAPS_COLORKEY) ==
DDCAPS_BLTFOURCC) ? TRUE : FALSE;
msg_Dbg( p_vout, "DirectDraw Capabilities: overlay=%i yuvoverlay=%i "
- "can_clip_overlay=%i colorkey=%i stretch=%i "
+ "can_deinterlace_overlay=%i colorkey=%i stretch=%i "
"bltfourcc=%i",
- bHasOverlay, bHasOverlayFourCC, bCanClipOverlay,
+ bHasOverlay, bHasOverlayFourCC, bCanDeinterlace,
bHasColorKey, bCanStretch, bCanBltFourcc );
- /* Overlay clipping support is interesting for us as it means we can
- * get rid of the colorkey alltogether */
- p_vout->p_sys->b_caps_overlay_clipping = bCanClipOverlay;
-
/* Don't ask for troubles */
if( !bCanBltFourcc ) p_vout->p_sys->b_hw_yuv = FALSE;
}
* events.c: Windows DirectX video output events handler
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: events.c,v 1.29 2003/11/19 23:44:35 gbazin Exp $
+ * $Id: events.c,v 1.30 2003/11/20 17:48:44 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
*****************************************************************************/
static int DirectXCreateWindow( vout_thread_t *p_vout );
static void DirectXCloseWindow ( vout_thread_t *p_vout );
-static long FAR PASCAL DirectXEventProc ( HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam );
+static long FAR PASCAL DirectXEventProc( HWND, UINT, WPARAM, LPARAM );
+static long FAR PASCAL DirectXVideoEventProc( HWND, UINT, WPARAM, LPARAM );
static void DirectXPopupMenu( event_thread_t *p_event, vlc_bool_t b_open )
{
if( p_event->b_die )
break;
- if( p_event->p_vout->p_sys->hparent ) msleep( INTF_IDLE_SLEEP );
+ if( p_event->p_vout->p_sys->hparent )
+ {
+ /* Parent window was created in another thread so we can't
+ * access the window messages. */
+ msleep( INTF_IDLE_SLEEP );
+ continue;
+ }
switch( msg.message )
{
GWL_WNDPROC, (LONG)DirectXEventProc );
/* Blam! Erase everything that might have been there. */
- RedrawWindow( p_vout->p_sys->hwnd, NULL, NULL,
- RDW_INVALIDATE | RDW_ERASE );
+ InvalidateRect( p_vout->p_sys->hwnd, NULL, TRUE );
}
else
{
}
else if( p_vout->p_sys->hparent )
{
+ /* Get rid of the video sub-window */
+ PostMessage( p_vout->p_sys->hvideownd, WM_VLC_DESTROY_VIDEO_WIN, 0, 0);
+
/* We don't want our windowproc to be called anymore */
SetWindowLong( p_vout->p_sys->hwnd,
GWL_WNDPROC, (LONG)p_vout->p_sys->pf_wndproc );
+ SetWindowLong( p_vout->p_sys->hwnd, GWL_USERDATA, (LONG)NULL );
/* Blam! Erase everything that might have been there. */
InvalidateRect( p_vout->p_sys->hwnd, NULL, TRUE );
p_vout = (vout_thread_t *)GetWindowLong( hwnd, GWL_USERDATA );
}
+ if( !p_vout )
+ {
+ /* Hmmm mozilla does manage somehow to save the pointer to our
+ * windowproc and still calls it after the vout has been closed. */
+ return DefWindowProc(hwnd, message, wParam, lParam);
+ }
+
switch( message )
{
if( !p_vout->p_sys->hvideownd )
{
- msg_Warn( p_vout, "Can create video sub-window" );
+ msg_Warn( p_vout, "Can't create video sub-window" );
}
else
{
SetWindowLong( p_vout->p_sys->hvideownd,
- GWL_WNDPROC, (LONG)DefWindowProc );
+ GWL_WNDPROC, (LONG)DirectXVideoEventProc );
}
break;
return DefWindowProc(hwnd, message, wParam, lParam);
}
+static long FAR PASCAL DirectXVideoEventProc( HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam )
+{
+ switch( message )
+ {
+ case WM_VLC_DESTROY_VIDEO_WIN:
+ /* Destroy video sub-window */
+ DestroyWindow( hwnd );
+ break;
+ }
+
+ return DefWindowProc(hwnd, message, wParam, lParam);
+}
static struct
{
* vout.h: Windows DirectX video output header file
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vout.h,v 1.8 2003/11/19 23:44:35 gbazin Exp $
+ * $Id: vout.h,v 1.9 2003/11/20 17:48:44 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
*****************************************************************************/
#define WM_VLC_HIDE_MOUSE WM_APP
#define WM_VLC_CREATE_VIDEO_WIN WM_APP + 1
+#define WM_VLC_DESTROY_VIDEO_WIN WM_APP + 2
#define IDM_TOGGLE_ON_TOP WM_USER + 1
* vlcshell.cpp: a VLC plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: vlcshell.cpp,v 1.26 2003/10/23 17:04:40 sam Exp $
+ * $Id: vlcshell.cpp,v 1.27 2003/11/20 17:48:44 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
# define VOUT_PLUGINS "directx,wingdi,dummy"
# define AOUT_PLUGINS "directx,waveout,dummy"
-HINSTANCE g_hDllInstance = NULL;
-
-BOOL WINAPI DllMain( HINSTANCE hinstDLL, /* handle of DLL module */
- DWORD fdwReason, /* reason for calling the function */
- LPVOID lpvReserved )
-{
- switch( fdwReason )
- {
- case DLL_PROCESS_ATTACH:
- g_hDllInstance = hinstDLL;
- break;
- case DLL_THREAD_ATTACH:
- case DLL_PROCESS_DETACH:
- case DLL_THREAD_DETACH:
- break;
- }
- return TRUE;
-}
-
+#if defined(XP_WIN) && !USE_LIBVLC
LRESULT CALLBACK Manage( HWND, UINT, WPARAM, LPARAM );
#endif
+#endif
/******************************************************************************
* UNIX-only API calls
/* Window was destroyed. Invalidate everything. */
if( p_plugin->p_npwin )
{
+#if !USE_LIBVLC
SetWindowLong( p_plugin->p_hwnd, GWL_WNDPROC,
(LONG)p_plugin->pf_wndproc );
+#endif
p_plugin->pf_wndproc = NULL;
p_plugin->p_hwnd = NULL;
}
{
/* Same window, but something may have changed. First we
* update the plugin structure, then we redraw the window */
- InvalidateRect( p_plugin->p_hwnd, NULL, TRUE );
p_plugin->i_width = window->width;
p_plugin->i_height = window->height;
p_plugin->p_npwin = window;
+#if !USE_LIBVLC
+ InvalidateRect( p_plugin->p_hwnd, NULL, TRUE );
UpdateWindow( p_plugin->p_hwnd );
+#endif
return NPERR_NO_ERROR;
}
/* Window has changed. Destroy the one we have, and go
* on as if it was a real initialization. */
+#if !USE_LIBVLC
SetWindowLong( p_plugin->p_hwnd, GWL_WNDPROC,
(LONG)p_plugin->pf_wndproc );
+#endif
p_plugin->pf_wndproc = NULL;
p_plugin->p_hwnd = NULL;
}
+#if !USE_LIBVLC
p_plugin->pf_wndproc = (WNDPROC)SetWindowLong( (HWND)window->window,
GWL_WNDPROC, (LONG)Manage );
+#endif
+
p_plugin->p_hwnd = (HWND)window->window;
SetProp( p_plugin->p_hwnd, "w00t", (HANDLE)p_plugin );
InvalidateRect( p_plugin->p_hwnd, NULL, TRUE );
/******************************************************************************
* Windows-only methods
*****************************************************************************/
-#ifdef XP_WIN
+#if defined(XP_WIN) && !USE_LIBVLC
LRESULT CALLBACK Manage( HWND p_hwnd, UINT i_msg, WPARAM wpar, LPARAM lpar )
{
VlcPlugin* p_plugin = (VlcPlugin*) GetProp( p_hwnd, "w00t" );
switch( i_msg )
{
-#if !USE_LIBVLC
case WM_PAINT:
{
PAINTSTRUCT paintstruct;
EndPaint( p_hwnd, &paintstruct );
break;
}
-#endif
default:
p_plugin->pf_wndproc( p_hwnd, i_msg, wpar, lpar );
break;