#include <tchar.h>
#include <commctrl.h>
-/*#ifdef MODULE_NAME_IS_wingapi
- typedef struct GXDisplayProperties {
- DWORD cxWidth;
- DWORD cyHeight;
- long cbxPitch;
- long cbyPitch;
- long cBPP;
- DWORD ffFormat;
- } GXDisplayProperties;
-
- typedef struct GXScreenRect {
- DWORD dwTop;
- DWORD dwLeft;
- DWORD dwWidth;
- DWORD dwHeight;
- } GXScreenRect;
-
-# define GX_FULLSCREEN 0x01
-# define GX_NORMALKEYS 0x02
-# define GX_LANDSCAPEKEYS 0x03
-
-# ifndef kfLandscape
-# define kfLandscape 0x8
-# define kfPalette 0x10
-# define kfDirect 0x20
-# define kfDirect555 0x40
-# define kfDirect565 0x80
-# define kfDirect888 0x100
-# define kfDirect444 0x200
-# define kfDirectInverted 0x400
-# endif
-#endif */ /* MODULE_NAME_IS_wingapi */
-
#include "vout.h"
#define MAX_DIRECTBUFFERS 10
-#ifdef UNDER_CE
-#ifndef WS_OVERLAPPEDWINDOW
-# define WS_OVERLAPPEDWINDOW 0xcf0000
-#endif
-#ifndef WS_EX_NOPARENTNOTIFY
-# define WS_EX_NOPARENTNOTIFY 4
-#endif
-#ifndef WS_EX_APPWINDOW
-#define WS_EX_APPWINDOW 0x40000
-#endif
-//#define SetWindowLongPtr SetWindowLong
-//#define GetWindowLongPtr GetWindowLong
-//#define GWLP_USERDATA GWL_USERDATA
-#define AdjustWindowRect(a,b,c)
-#endif //UNDER_CE
-
#ifndef WS_NONAVDONEBUTTON
#define WS_NONAVDONEBUTTON 0
#endif
p_vout->p_sys->render_height = p_vout->render.i_height;
#endif
- p_vout->p_sys->p_event = (vlc_object_t *)
- vlc_object_create( p_vout, sizeof( vlc_object_t ) );
- if( !p_vout->p_sys->p_event )
- {
- free( p_vout->p_sys );
- return VLC_ENOMEM;
- }
-
p_vout->pf_init = Init;
p_vout->pf_end = End;
p_vout->pf_manage = Manage;
p_vout->pf_render = Render;
+ p_vout->pf_control = Control;
#ifdef MODULE_NAME_IS_wingapi
p_vout->pf_display = FirstDisplayGAPI;
- p_vout->p_sys->b_focus = 0;
p_vout->p_sys->b_parent_focus = 0;
-
#else
p_vout->pf_display = FirstDisplayGDI;
#endif
- 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;
- vlc_mutex_init( &p_vout->p_sys->lock );
- SetRectEmpty( &p_vout->p_sys->rect_display );
- SetRectEmpty( &p_vout->p_sys->rect_parent );
-
- var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
- var_Create( p_vout, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
+ if( CommonInit( p_vout ) )
+ goto error;
- p_vout->p_sys->b_cursor_hidden = 0;
- p_vout->p_sys->i_lastmoved = mdate();
- p_vout->p_sys->i_mouse_hide_timeout =
- var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
-
- /* Set main window's size */
- p_vout->p_sys->i_window_width = p_vout->i_window_width;
- p_vout->p_sys->i_window_height = p_vout->i_window_height;
-
- if ( CreateEventThread( p_vout ) )
- {
-
-#ifndef UNDER_CE
- /* Variable to indicate if the window should be on top of others */
- /* Trigger a callback right now */
- var_TriggerCallback( p_vout, "video-on-top" );
+ return VLC_SUCCESS;
- DisableScreensaver ( p_vout );
-#endif
- return VLC_SUCCESS;
- }
- else
- {
- CloseVideo( VLC_OBJECT(p_vout) );
- return VLC_EGENERIC;
- }
+error:
+ CloseVideo( VLC_OBJECT(p_vout) );
+ return VLC_EGENERIC;
}
/*****************************************************************************
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
- StopEventThread( p_vout );
-
-#ifndef UNDER_CE
- RestoreScreensaver( p_vout );
-#endif
+ CommonClean( p_vout );
#ifdef MODULE_NAME_IS_wingapi
FreeLibrary( p_vout->p_sys->gapi_dll );
#endif
free( p_vout->p_sys );
- p_vout->p_sys = NULL;
}
/*****************************************************************************
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
- /* If we do not control our window, we check for geometry changes
- * ourselves because the parent might not send us its events. */
- vlc_mutex_lock( &p_vout->p_sys->lock );
- if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )
- {
- RECT rect_parent;
- POINT point;
-
- vlc_mutex_unlock( &p_vout->p_sys->lock );
-
- GetClientRect( p_vout->p_sys->hparent, &rect_parent );
- point.x = point.y = 0;
- ClientToScreen( p_vout->p_sys->hparent, &point );
- OffsetRect( &rect_parent, point.x, point.y );
-
- if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )
- {
- int i_x, i_y, i_width, i_height;
- p_vout->p_sys->rect_parent = rect_parent;
-
- /* This one is to force the update even if only
- * the position has changed */
- SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1,
- rect_parent.right - rect_parent.left,
- rect_parent.bottom - rect_parent.top, 0 );
-
- SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
- rect_parent.right - rect_parent.left,
- rect_parent.bottom - rect_parent.top, 0 );
-
- vout_PlacePicture( p_vout, rect_parent.right - rect_parent.left,
- rect_parent.bottom - rect_parent.top,
- &i_x, &i_y, &i_width, &i_height );
-
- SetWindowPos( p_vout->p_sys->hvideownd, HWND_TOP,
- i_x, i_y, i_width, i_height, 0 );
- }
- }
- else
- {
- vlc_mutex_unlock( &p_vout->p_sys->lock );
- }
-
- /* autoscale toggle */
- if( p_vout->i_changes & VOUT_SCALE_CHANGE )
- {
- p_vout->i_changes &= ~VOUT_SCALE_CHANGE;
-
- p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" );
- p_vout->i_zoom = (int) ZOOM_FP_FACTOR;
-
- UpdateRects( p_vout, true );
- }
-
- /* scaling factor */
- if( p_vout->i_changes & VOUT_ZOOM_CHANGE )
- {
- p_vout->i_changes &= ~VOUT_ZOOM_CHANGE;
-
- p_vout->b_autoscale = false;
- p_vout->i_zoom =
- (int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) );
- UpdateRects( p_vout, true );
- }
-
- /* Check for cropping / aspect changes */
- if( p_vout->i_changes & VOUT_CROP_CHANGE ||
- p_vout->i_changes & VOUT_ASPECT_CHANGE )
- {
- p_vout->i_changes &= ~VOUT_CROP_CHANGE;
- p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;
-
- p_vout->fmt_out.i_x_offset = p_vout->fmt_in.i_x_offset;
- p_vout->fmt_out.i_y_offset = p_vout->fmt_in.i_y_offset;
- p_vout->fmt_out.i_visible_width = p_vout->fmt_in.i_visible_width;
- p_vout->fmt_out.i_visible_height = p_vout->fmt_in.i_visible_height;
- p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect;
- 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;
- UpdateRects( p_vout, true );
- }
-
/*
* Position Change
*/
p_vout->p_sys->i_changes &= ~DX_POSITION_CHANGE;
}
- /* We used to call the Win32 PeekMessage function here to read the window
- * messages. But since window can stay blocked into this function for a
- * long time (for example when you move your window on the screen), I
- * decided to isolate PeekMessage in another thread. */
-
- /*
- * Fullscreen change
- */
- if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
- || p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
- {
- Win32ToggleFullscreen( p_vout );
-
- p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
- p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
- }
-
- /*
- * Pointer change
- */
- if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
- (mdate() - p_vout->p_sys->i_lastmoved) >
- p_vout->p_sys->i_mouse_hide_timeout )
- {
- POINT point;
- HWND hwnd;
-
- /* Hide the cursor only if it is inside our window */
- GetCursorPos( &point );
- hwnd = WindowFromPoint(point);
- if( hwnd == p_vout->p_sys->hwnd || hwnd == p_vout->p_sys->hvideownd )
- {
- PostMessage( p_vout->p_sys->hwnd, WM_VLC_HIDE_MOUSE, 0, 0 );
- }
- else
- {
- p_vout->p_sys->i_lastmoved = mdate();
- }
- }
-
- /*
- * "Always on top" status change
- */
- if( p_vout->p_sys->b_on_top_change )
- {
- vlc_value_t val;
- HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
-
- var_Get( p_vout, "video-on-top", &val );
-
- /* Set the window on top if necessary */
- if( val.b_bool && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
- & WS_EX_TOPMOST ) )
- {
- CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
- MF_BYCOMMAND | MFS_CHECKED );
- SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE );
- }
- else
- /* The window shouldn't be on top */
- if( !val.b_bool && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
- & WS_EX_TOPMOST ) )
- {
- CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
- MF_BYCOMMAND | MFS_UNCHECKED );
- SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE );
- }
-
- p_vout->p_sys->b_on_top_change = false;
- }
-
- /* Check if the event thread is still running */
- if( !vlc_object_alive (p_vout->p_sys->p_event) )
- {
- return VLC_EGENERIC; /* exit */
- }
+ CommonManage( p_vout );
return VLC_SUCCESS;
}
#ifndef MODULE_NAME_IS_wingapi
static void DisplayGDI( vout_thread_t *p_vout, picture_t *p_pic )
{
+ VLC_UNUSED( p_pic );
+
vout_sys_t *p_sys = p_vout->p_sys;
RECT rect_dst = rect_dest_clipped;
HDC hdc = GetDC( p_sys->hvideownd );
return VLC_EGENERIC;
}
-#if 0
- msg_Err( p_vout, "video (%d,%d,%d,%d) display (%d,%d,%d,%d) "
+#ifndef NDEBUG
+ msg_Dbg( p_vout, "video (%d,%d,%d,%d) display (%d,%d,%d,%d) "
"dest (%d,%d,%d,%d)",
video_rect.left, video_rect.right,
video_rect.top, video_rect.bottom,
if( !(p_dest = GXBeginDraw()) )
{
-#if 0
+#ifndef NDEBUG
msg_Err( p_vout, "GXBeginDraw error %d ", GetLastError() );
#endif
return VLC_EGENERIC;
static void SetPalette( vout_thread_t *p_vout,
uint16_t *red, uint16_t *green, uint16_t *blue )
{
+ VLC_UNUSED( red ); VLC_UNUSED( green );VLC_UNUSED( blue );
msg_Err( p_vout, "FIXME: SetPalette unimplemented" );
}
p_vout->p_sys->off_bitmap =
CreateDIBSection( window_dc, (BITMAPINFO *)p_header, DIB_RGB_COLORS,
- (void**)&p_vout->p_sys->p_pic_buffer, NULL, 0 );
+ &p_vout->p_sys->p_pic_buffer, NULL, 0 );
p_vout->p_sys->off_dc = CreateCompatibleDC( window_dc );