Commit e54cc504 authored by Damien Fouilleul's avatar Damien Fouilleul

vout: merged all Microsoft Windows specific vouts under msw directory in order...

vout: merged all Microsoft Windows specific vouts under msw directory in order to leverage common event handling
parent dde6aaf8
......@@ -5916,7 +5916,7 @@ AC_CONFIG_FILES([
modules/video_chroma/Makefile
modules/video_filter/Makefile
modules/video_output/Makefile
modules/video_output/directx/Makefile
modules/video_output/msw/Makefile
modules/video_output/qte/Makefile
modules/video_output/x11/Makefile
modules/visualization/Makefile
......
......@@ -5,8 +5,6 @@ SOURCES_ggi = ggi.c
SOURCES_glide = glide.c
SOURCES_vout_sdl = sdl.c
SOURCES_svgalib = svgalib.c
SOURCES_wingdi = wingdi.c
SOURCES_wingapi = wingdi.c
SOURCES_mga = mga.c
SOURCES_hd1000v = hd1000v.cpp
SOURCES_snapshot = snapshot.c
......
......@@ -15,3 +15,15 @@ SOURCES_glwin32 = \
vout.h \
events.c \
$(NULL)
SOURCES_wingdi = \
wingdi.c \
vout.h \
events.c \
$(NULL)
SOURCES_wingapi = \
windi.c \
vout.h \
events.c \
$(NULL)
......@@ -138,7 +138,7 @@ typedef struct
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1)
/*****************************************************************************
* OpenVideo: allocate DirectX video thread output method
* OpenVideo: allocate Vout video thread output method
*****************************************************************************
* This function allocates and initialize the Direct3D vout method.
*****************************************************************************/
......@@ -172,15 +172,12 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->hwnd = p_vout->p_sys->hvideownd = NULL;
p_vout->p_sys->hparent = p_vout->p_sys->hfswnd = NULL;
p_vout->p_sys->i_changes = 0;
p_vout->p_sys->b_wallpaper = 0;
vlc_mutex_init( p_vout, &p_vout->p_sys->lock );
SetRectEmpty( &p_vout->p_sys->rect_display );
SetRectEmpty( &p_vout->p_sys->rect_parent );
var_Create( p_vout, "directx-hw-yuv", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "directx-device", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
p_vout->p_sys->b_cursor_hidden = 0;
p_vout->p_sys->i_lastmoved = mdate();
......@@ -192,21 +189,21 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->i_window_width = p_vout->i_window_width;
p_vout->p_sys->i_window_height = p_vout->i_window_height;
/* Create the DirectXEventThread, this thread is created by us to isolate
/* Create the Vout EventThread, 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
* this happens it thus blocks vlc's video_output thread.
* DirectXEventThread will take care of the creation of the video
* Vout EventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg( p_vout, "creating DirectXEventThread" );
msg_Dbg( p_vout, "creating Vout EventThread" );
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",
E_(DirectXEventThread), 0, 1 ) )
if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
E_(EventThread), 0, 1 ) )
{
msg_Err( p_vout, "cannot create DirectXEventThread" );
msg_Err( p_vout, "cannot create Vout EventThread" );
vlc_object_destroy( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
......@@ -214,13 +211,13 @@ static int OpenVideo( vlc_object_t *p_this )
if( p_vout->p_sys->p_event->b_error )
{
msg_Err( p_vout, "DirectXEventThread failed" );
msg_Err( p_vout, "Vout EventThread failed" );
goto error;
}
vlc_object_attach( p_vout->p_sys->p_event, p_vout );
msg_Dbg( p_vout, "DirectXEventThread running" );
msg_Dbg( p_vout, "Vout EventThread running" );
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
......@@ -272,10 +269,10 @@ static void CloseVideo( vlc_object_t *p_this )
{
vlc_object_detach( p_vout->p_sys->p_event );
/* Kill DirectXEventThread */
/* Kill Vout EventThread */
p_vout->p_sys->p_event->b_die = VLC_TRUE;
/* we need to be sure DirectXEventThread won't stay stuck in
/* we need to be sure Vout EventThread won't stay stuck in
* GetMessage, so we send a fake message */
if( p_vout->p_sys->hwnd )
{
......@@ -334,7 +331,7 @@ static int Init( vout_thread_t *p_vout )
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
p_vout->fmt_out = p_vout->fmt_in;
E_(DirectXUpdateRects)( p_vout, VLC_TRUE );
E_(UpdateRects)( p_vout, VLC_TRUE );
/* create picture pool */
i_ret = Direct3DVoutCreatePictures(p_vout, 1);
......@@ -451,7 +448,7 @@ static int Manage( vout_thread_t *p_vout )
p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
E_(DirectXUpdateRects)( p_vout, VLC_TRUE );
E_(UpdateRects)( p_vout, VLC_TRUE );
}
/* We used to call the Win32 PeekMessage function here to read the window
......@@ -708,7 +705,8 @@ static int Direct3DVoutOpen( vout_thread_t *p_vout )
// Create the D3DDevice
hr = IDirect3D9_CreateDevice(p_d3dobj, D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, p_vout->p_sys->hvideownd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|
D3DCREATE_MULTITHREADED,
&d3dpp, &p_d3ddev );
if( FAILED(hr) )
{
......
......@@ -264,7 +264,7 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->i_window_width = p_vout->i_window_width;
p_vout->p_sys->i_window_height = p_vout->i_window_height;
/* Create the DirectXEventThread, this thread is created by us to isolate
/* Create the Vout EventThread, 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
* this happens it thus blocks vlc's video_output thread.
......@@ -275,10 +275,10 @@ static int OpenVideo( vlc_object_t *p_this )
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",
E_(DirectXEventThread), 0, 1 ) )
if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
E_(EventThread), 0, 1 ) )
{
msg_Err( p_vout, "cannot create DirectXEventThread" );
msg_Err( p_vout, "cannot create Vout EventThread" );
vlc_object_destroy( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
......@@ -286,25 +286,25 @@ static int OpenVideo( vlc_object_t *p_this )
if( p_vout->p_sys->p_event->b_error )
{
msg_Err( p_vout, "DirectXEventThread failed" );
msg_Err( p_vout, "Vout EventThread failed" );
goto error;
}
vlc_object_attach( p_vout->p_sys->p_event, p_vout );
msg_Dbg( p_vout, "DirectXEventThread running" );
msg_Dbg( p_vout, "Vout EventThread running" );
/* Initialise DirectDraw */
if( DirectXInitDDraw( p_vout ) )
{
msg_Err( p_vout, "cannot initialize DirectDraw" );
msg_Err( p_vout, "cannot initialize DirectX DirectDraw" );
goto error;
}
/* Create the directx display */
if( DirectXCreateDisplay( p_vout ) )
{
msg_Err( p_vout, "cannot initialize DirectDraw" );
msg_Err( p_vout, "cannot initialize DirectX DirectDraw" );
goto error;
}
......@@ -399,7 +399,7 @@ static int Init( vout_thread_t *p_vout )
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
p_vout->fmt_out = p_vout->fmt_in;
E_(DirectXUpdateRects)( p_vout, VLC_TRUE );
E_(UpdateRects)( p_vout, VLC_TRUE );
#define MAX_DIRECTBUFFERS 1
/* Right now we use only 1 directbuffer because we don't want the
......@@ -492,10 +492,10 @@ static void CloseVideo( vlc_object_t *p_this )
{
vlc_object_detach( p_vout->p_sys->p_event );
/* Kill DirectXEventThread */
/* Kill Vout EventThread */
p_vout->p_sys->p_event->b_die = VLC_TRUE;
/* we need to be sure DirectXEventThread won't stay stuck in
/* we need to be sure Vout EventThread won't stay stuck in
* GetMessage, so we send a fake message */
if( p_vout->p_sys->hwnd )
{
......@@ -608,7 +608,7 @@ static int Manage( vout_thread_t *p_vout )
p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
E_(DirectXUpdateRects)( p_vout, VLC_TRUE );
E_(UpdateRects)( p_vout, VLC_TRUE );
}
/* We used to call the Win32 PeekMessage function here to read the window
......@@ -620,7 +620,7 @@ static int Manage( vout_thread_t *p_vout )
{
SwitchWallpaperMode( p_vout, !p_vout->p_sys->b_wallpaper );
p_vout->p_sys->i_changes &= ~DX_WALLPAPER_CHANGE;
E_(DirectXUpdateOverlay)( p_vout );
DirectDrawUpdateOverlay( p_vout );
}
/*
......@@ -722,7 +722,7 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic )
{
if( IDirectDrawSurface2_Restore( p_vout->p_sys->p_display ) == DD_OK &&
p_vout->p_sys->b_using_overlay )
E_(DirectXUpdateOverlay)( p_vout );
DirectDrawUpdateOverlay( p_vout );
}
if( !p_vout->p_sys->b_using_overlay )
......@@ -1056,7 +1056,7 @@ static int DirectXCreateDisplay( vout_thread_t *p_vout )
p_vout->p_sys->i_rgb_colorkey =
DirectXFindColorkey( p_vout, &p_vout->p_sys->i_colorkey );
E_(DirectXUpdateRects)( p_vout, VLC_TRUE );
E_(UpdateRects)( p_vout, VLC_TRUE );
return VLC_SUCCESS;
}
......@@ -1224,7 +1224,7 @@ static int DirectXCreateSurface( vout_thread_t *p_vout,
/* Check the overlay is useable as some graphics cards allow creating
* several overlays but only one can be used at one time. */
p_vout->p_sys->p_current_surface = *pp_surface_final;
if( E_(DirectXUpdateOverlay)( p_vout ) != VLC_SUCCESS )
if( DirectDrawUpdateOverlay( p_vout ) != VLC_SUCCESS )
{
IDirectDrawSurface2_Release( *pp_surface_final );
*pp_surface_final = NULL;
......@@ -1237,13 +1237,13 @@ static int DirectXCreateSurface( vout_thread_t *p_vout,
}
/*****************************************************************************
* DirectXUpdateOverlay: Move or resize overlay surface on video display.
* DirectDrawUpdateOverlay: Move or resize overlay surface on video display.
*****************************************************************************
* This function is used to move or resize an overlay surface on the screen.
* Ususally the overlay is moved by the user and thus, by a move or resize
* event (in Manage).
*****************************************************************************/
int E_(DirectXUpdateOverlay)( vout_thread_t *p_vout )
int DirectDrawUpdateOverlay( vout_thread_t *p_vout )
{
DDOVERLAYFX ddofx;
DWORD dwFlags;
......@@ -1299,7 +1299,7 @@ int E_(DirectXUpdateOverlay)( vout_thread_t *p_vout )
if(dxresult != DD_OK)
{
msg_Warn( p_vout, "DirectXUpdateOverlay cannot move/resize overlay" );
msg_Warn( p_vout, "DirectDrawUpdateOverlay cannot move/resize overlay" );
return VLC_EGENERIC;
}
......@@ -1465,7 +1465,7 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic,
DirectXUnlockSurface( p_vout, &front_pic );
}
E_(DirectXUpdateOverlay)( p_vout );
DirectDrawUpdateOverlay( p_vout );
I_OUTPUTPICTURES = 1;
msg_Dbg( p_vout, "YUV overlay created successfully" );
}
......
......@@ -57,6 +57,13 @@
#include "vlc_keys.h"
#include "vout.h"
#if defined(UNDER_CE) && !defined(__PLUGIN__) /*FIXME*/
# define SHFS_SHOWSIPBUTTON 0x0004
# define SHFS_HIDESIPBUTTON 0x0008
# define MENU_HEIGHT 26
BOOL SHFullScreen(HWND hwndRequester, DWORD dwState);
#endif
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
......@@ -82,14 +89,14 @@ static void DirectXPopupMenu( event_thread_t *p_event, vlc_bool_t b_open )
static int DirectXConvertKey( int i_key );
/*****************************************************************************
* DirectXEventThread: Create video window & handle its messages
* EventThread: Create video window & handle its messages
*****************************************************************************
* This function creates a video window and then enters an infinite loop
* that handles the messages sent to that window.
* The main goal of this thread is to isolate the Win32 PeekMessage function
* because this one can block for a long time.
*****************************************************************************/
void E_(DirectXEventThread)( event_thread_t *p_event )
void E_(EventThread)( event_thread_t *p_event )
{
MSG msg;
POINT old_mouse_pos = {0,0}, mouse_pos;
......@@ -112,6 +119,7 @@ void E_(DirectXEventThread)( event_thread_t *p_event )
/* Signal the creation of the window */
vlc_thread_ready( p_event );
#ifndef UNDER_CE
/* Set power management stuff */
if( (hkernel32 = GetModuleHandle( _T("KERNEL32") ) ) )
{
......@@ -126,6 +134,7 @@ void E_(DirectXEventThread)( event_thread_t *p_event )
else
msg_Dbg( p_event, "no support for SetThreadExecutionState()" );
}
#endif
/* Main loop */
/* GetMessage will sleep if there's no message in the queue */
......@@ -307,6 +316,12 @@ void E_(DirectXEventThread)( event_thread_t *p_event )
{
if( val.psz_string ) free( val.psz_string );
#ifdef MODULE_NAME_IS_wingdi
val.psz_string = strdup( VOUT_TITLE " (WinGDI output)" );
#endif
#ifdef MODULE_NAME_IS_wingapi
val.psz_string = strdup( VOUT_TITLE " (WinGAPI output)" );
#endif
#ifdef MODULE_NAME_IS_glwin32
val.psz_string = strdup( VOUT_TITLE " (OpenGL output)" );
#endif
......@@ -315,11 +330,11 @@ void E_(DirectXEventThread)( event_thread_t *p_event )
#endif
#ifdef MODULE_NAME_IS_vout_directx
if( p_event->p_vout->p_sys->b_using_overlay ) val.psz_string =
strdup( VOUT_TITLE " (hardware YUV overlay DirectX output)" );
strdup( VOUT_TITLE " (hardware YUV overlay DirectX output)" );
else if( p_event->p_vout->p_sys->b_hw_yuv ) val.psz_string =
strdup( VOUT_TITLE " (hardware YUV DirectX output)" );
strdup( VOUT_TITLE " (hardware YUV DirectX output)" );
else val.psz_string =
strdup( VOUT_TITLE " (software RGB DirectX output)" );
strdup( VOUT_TITLE " (software RGB DirectX output)" );
#endif
}
......@@ -585,13 +600,13 @@ static void DirectXCloseWindow( vout_thread_t *p_vout )
}
/*****************************************************************************
* DirectXUpdateRects: update clipping rectangles
* UpdateRects: update clipping rectangles
*****************************************************************************
* This function is called when the window position or size are changed, and
* its job is to update the source and destination RECTs used to display the
* picture.
*****************************************************************************/
void E_(DirectXUpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force )
void E_(UpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force )
{
#define rect_src p_vout->p_sys->rect_src
#define rect_src_clipped p_vout->p_sys->rect_src_clipped
......@@ -682,7 +697,7 @@ void E_(DirectXUpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force )
}
#else /* MODULE_NAME_IS_vout_directx */
/* AFAIK, there are no clipping constraints in Direct3D or OpenGL */
/* AFAIK, there are no clipping constraints in Direct3D, OpenGL and GDI */
rect_dest_clipped = rect_dest;
#endif
......@@ -742,7 +757,7 @@ void E_(DirectXUpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force )
rect_dest_clipped.bottom -= p_vout->p_sys->rect_display.top;
if( p_vout->p_sys->b_using_overlay )
E_(DirectXUpdateOverlay)( p_vout );
DirectDrawUpdateOverlay( p_vout );
#endif
/* Signal the change in size/position */
......@@ -788,6 +803,7 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
}
}
#ifndef UNDER_CE
/* Catch the screensaver and the monitor turn-off */
if( message == WM_SYSCOMMAND &&
( (wParam & 0xFFF0) == SC_SCREENSAVE || (wParam & 0xFFF0) == SC_MONITORPOWER ) )
......@@ -795,6 +811,7 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
//if( p_vout ) msg_Dbg( p_vout, "WinProc WM_SYSCOMMAND screensaver" );
return 0; /* this stops them from happening */
}
#endif
if( hwnd == p_vout->p_sys->hvideownd )
{
......@@ -841,7 +858,7 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
{
case WM_WINDOWPOSCHANGED:
E_(DirectXUpdateRects)( p_vout, VLC_TRUE );
E_(UpdateRects)( p_vout, VLC_TRUE );
return 0;
/* the user wants to close the window */
......@@ -889,6 +906,50 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
case WM_ERASEBKGND:
return DefWindowProc(hwnd, message, wParam, lParam);
case WM_KILLFOCUS:
#ifdef MODULE_NAME_IS_wingapi
p_vout->p_sys->b_focus = VLC_FALSE;
if( !p_vout->p_sys->b_parent_focus ) GXSuspend();
#endif
#ifdef UNDER_CE
if( hWnd == p_vout->p_sys->hfswnd )
{
HWND htbar = FindWindow( _T("HHTaskbar"), NULL );
ShowWindow( htbar, SW_SHOW );
}
if( !p_vout->p_sys->hparent ||
hWnd == p_vout->p_sys->hfswnd )
{
SHFullScreen( hWnd, SHFS_SHOWSIPBUTTON );
}
#endif
return 0;
case WM_SETFOCUS:
#ifdef MODULE_NAME_IS_wingapi
p_vout->p_sys->b_focus = VLC_TRUE;
GXResume();
#endif
#ifdef UNDER_CE
if( p_vout->p_sys->hparent &&
hWnd != p_vout->p_sys->hfswnd && p_vout->b_fullscreen )
p_vout->p_sys->i_changes |= VOUT_FULLSCREEN_CHANGE;
if( hWnd == p_vout->p_sys->hfswnd )
{
HWND htbar = FindWindow( _T("HHTaskbar"), NULL );
ShowWindow( htbar, SW_HIDE );
}
if( !p_vout->p_sys->hparent ||
hWnd == p_vout->p_sys->hfswnd )
{
SHFullScreen( hWnd, SHFS_HIDESIPBUTTON );
}
#endif
return 0;
default:
//msg_Dbg( p_vout, "WinProc WM Default %i", message );
break;
......@@ -1063,6 +1124,15 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
p_vout->p_sys->b_on_top_change = VLC_TRUE;
return VLC_SUCCESS;
#ifdef MODULE_NAME_IS_wingapi
case VOUT_SET_FOCUS:
b_bool = va_arg( args, vlc_bool_t );
p_vout->p_sys->b_parent_focus = b_bool;
if( b_bool ) GXResume();
else if( !p_vout->p_sys->b_focus ) GXSuspend();
return VLC_SUCCESS;
#endif
default:
return vout_vaControlDefault( p_vout, i_query, args );
}
......
......@@ -108,7 +108,6 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->hwnd = p_vout->p_sys->hvideownd = NULL;
p_vout->p_sys->hparent = p_vout->p_sys->hfswnd = NULL;
p_vout->p_sys->i_changes = 0;
p_vout->p_sys->b_wallpaper = 0;
vlc_mutex_init( p_vout, &p_vout->p_sys->lock );
SetRectEmpty( &p_vout->p_sys->rect_display );
SetRectEmpty( &p_vout->p_sys->rect_parent );
......@@ -122,21 +121,21 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->i_window_width = p_vout->i_window_width;
p_vout->p_sys->i_window_height = p_vout->i_window_height;
/* Create the DirectXEventThread, this thread is created by us to isolate
/* Create the Vout EventThread, 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
* this happens it thus blocks vlc's video_output thread.
* DirectXEventThread will take care of the creation of the video
* Vout EventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg( p_vout, "creating DirectXEventThread" );
msg_Dbg( p_vout, "creating Vout EventThread" );
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",
E_(DirectXEventThread), 0, 1 ) )
if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
E_(EventThread), 0, 1 ) )
{
msg_Err( p_vout, "cannot create DirectXEventThread" );
msg_Err( p_vout, "cannot create Vout EventThread" );
vlc_object_destroy( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
......@@ -144,13 +143,13 @@ static int OpenVideo( vlc_object_t *p_this )
if( p_vout->p_sys->p_event->b_error )
{
msg_Err( p_vout, "DirectXEventThread failed" );
msg_Err( p_vout, "Vout EventThread failed" );
goto error;
}
vlc_object_attach( p_vout->p_sys->p_event, p_vout );
msg_Dbg( p_vout, "DirectXEventThread running" );
msg_Dbg( p_vout, "Vout EventThread running" );
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
......@@ -225,10 +224,10 @@ static void CloseVideo( vlc_object_t *p_this )
{
vlc_object_detach( p_vout->p_sys->p_event );
/* Kill DirectXEventThread */
/* Kill Vout EventThread */
p_vout->p_sys->p_event->b_die = VLC_TRUE;
/* we need to be sure DirectXEventThread won't stay stuck in
/* we need to be sure Vout EventThread won't stay stuck in
* GetMessage, so we send a fake message */
if( p_vout->p_sys->hwnd )
{
......@@ -312,7 +311,7 @@ static int Manage( vout_thread_t *p_vout )
p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
E_(DirectXUpdateRects)( p_vout, VLC_TRUE );
E_(UpdateRects)( p_vout, VLC_TRUE );
}
/* We used to call the Win32 PeekMessage function here to read the window
......
/*****************************************************************************
* vout.h: Windows DirectX video output header file
* vout.h: Windows video output header file
*****************************************************************************
* Copyright (C) 2001-2004 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
* Damien Fouilleul <damienf@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -22,7 +23,7 @@
*****************************************************************************/
/*****************************************************************************
* event_thread_t: DirectX event thread
* event_thread_t: event thread
*****************************************************************************/
typedef struct event_thread_t
{
......@@ -33,10 +34,10 @@ typedef struct event_thread_t
} event_thread_t;
/*****************************************************************************
* vout_sys_t: video output DirectX method descriptor
* vout_sys_t: video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the DirectX specific properties of an output thread.
* It describes the module specific properties of an output thread.
*****************************************************************************/
struct vout_sys_t
{
......@@ -75,13 +76,15 @@ struct vout_sys_t
/* Misc */
vlc_bool_t b_on_top_change;
vlc_bool_t b_wallpaper;
#ifndef UNDER_CE
/* screensaver system settings to be restored when vout is closed */
UINT i_spi_lowpowertimeout;
UINT i_spi_powerofftimeout;
UINT i_spi_screensavetimeout;
#endif
/* Coordinates of src and dest images (used when blitting to display) */
RECT rect_src;
RECT rect_src_clipped;
......@@ -90,6 +93,7 @@ struct vout_sys_t
vlc_bool_t b_hw_yuv; /* Should we use hardware YUV->RGB conversions */
#ifdef MODULE_NAME_IS_vout_directx
/* Overlay alignment restrictions */
int i_align_src_boundary;
......@@ -97,6 +101,8 @@ struct vout_sys_t
int i_align_dest_boundary;
int i_align_dest_size;
vlc_bool_t b_wallpaper; /* show as desktop wallpaper ? */
vlc_bool_t b_using_overlay; /* Are we using an overlay surface */
vlc_bool_t b_use_sysmem; /* Should we use system memory for surfaces */
vlc_bool_t b_3buf_overlay; /* Should we use triple buffered overlays */
......@@ -133,20 +139,62 @@ struct vout_sys_t
LPDIRECT3DVERTEXBUFFER9 p_d3dvtc;
#endif
#ifdef MODULE_NAME_IS_wingdi
int i_depth;
/* Our offscreen bitmap and its framebuffer */
HDC off_dc;
HBITMAP off_bitmap;
uint8_t * p_pic_buffer;
int i_pic_pitch;
int i_pic_pixel_pitch;
BITMAPINFO bitmapinfo;
RGBQUAD red;
RGBQUAD green;
RGBQUAD blue;
#endif
#ifdef MODULE_NAME_IS_wingapi
int i_depth;
int render_width;
int render_height;
vlc_bool_t b_focus;
vlc_bool_t b_parent_focus;
HINSTANCE gapi_dll; /* handle of the opened gapi dll */
/* GAPI functions */
int (*GXOpenDisplay)( HWND hWnd, DWORD dwFlags );
int (*GXCloseDisplay)();
void *(*GXBeginDraw)();
int (*GXEndDraw)();
GXDisplayProperties (*GXGetDisplayProperties)();
int (*GXSuspend)();
int (*GXResume)();
#endif
#ifndef UNDER_CE
/* suspend display */
vlc_bool_t b_suspend_display;
#endif
event_thread_t *p_event;
vlc_mutex_t lock;
};
/*****************************************************************************
* Prototypes from vout.c
* Prototypes from directx.c
*****************************************************************************/
int E_(DirectXUpdateOverlay)( vout_thread_t *p_vout );
int DirectDrawUpdateOverlay( vout_thread_t *p_vout );
/*****************************************************************************
* Prototypes from events.c
*****************************************************************************/
void E_(DirectXEventThread) ( event_thread_t *p_event );
void E_(DirectXUpdateRects) ( vout_thread_t *p_vout, vlc_bool_t b_force );
void E_(EventThread) ( event_thread_t *p_event );
void E_(UpdateRects) ( vout_thread_t *p_vout, vlc_bool_t b_force );
void Win32ToggleFullscreen ( vout_thread_t *p_vout );
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* wingdi.c : Win32 / WinCE GDI video output plugin for vlc
*****************************************************************************
* Copyright (C) 2002 the VideoLAN team
* $Id$
* $Id: wingdi.c 18074 2006-11-26 16:26:44Z zorglub $
*
* Authors: Gildas Bazin <gbazin@videolan.org>
* Samuel Hocevar <sam@zoy.org>
......@@ -35,16 +35,7 @@
#include <commctrl.h>
#define SHFS_SHOWSIPBUTTON 0x0004
#define SHFS_HIDESIPBUTTON 0x0008
#if defined(UNDER_CE) && !defined(__PLUGIN__) /*FIXME*/
# define MENU_HEIGHT 26
BOOL SHFullScreen(HWND hwndRequester, DWORD dwState);
#else
# define MENU_HEIGHT 0
# define SHFullScreen(a,b)
#endif
#include "vout.h"
#ifdef MODULE_NAME_IS_wingapi
typedef struct GXDisplayProperties {
......@@ -111,101 +102,26 @@ static void End ( vout_thread_t * );
static int Manage ( vout_thread_t * );
static void Render ( vout_thread_t *, picture_t * );
#ifdef MODULE_NAME_IS_wingapi
static void FirstDisplayGAPI( vout_thread_t *, picture_t * );
static void DisplayGAPI( vout_thread_t *, picture_t * );
static int GAPILockSurface( vout_thread_t *, picture_t * );
static int GAPIUnlockSurface( vout_thread_t *, picture_t * );
#else
static void FirstDisplayGDI( vout_thread_t *, picture_t * );
static void DisplayGDI( vout_thread_t *, picture_t * );
#endif
static void SetPalette( vout_thread_t *, uint16_t *, uint16_t *, uint16_t * );
static void EventThread ( vlc_object_t * );
static long FAR PASCAL WndProc ( HWND, UINT, WPARAM, LPARAM );
static void InitBuffers ( vout_thread_t * );
static void UpdateRects ( vout_thread_t *, vlc_bool_t );
static int Control( vout_thread_t *p_vout, int i_query, va_list args );