Commit b6c753c6 authored by Rémi Duraffort's avatar Rémi Duraffort

vout_msw: use var_TriggerCallback and some cleaning.

parent 68ab6616
/*****************************************************************************
* direct3d.c: Windows Direct3D video output module
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* Copyright (C) 2006-2009 the VideoLAN team
*$Id$
*
* Authors: Damien Fouilleul <damienf@videolan.org>
......@@ -158,15 +158,12 @@ typedef struct
static int OpenVideo( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
p_vout->p_sys = calloc( 1, sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
return VLC_ENOMEM;
memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
if( VLC_SUCCESS != Direct3DVoutCreate( p_vout ) )
{
msg_Err( p_vout, "Direct3D could not be initialized !");
......@@ -238,15 +235,13 @@ static int OpenVideo( vlc_object_t *p_this )
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_Get( p_vout, "video-on-top", &val );
var_Set( p_vout, "video-on-top", val );
var_TriggerCallback( p_vout, "video-on-top" );
/* disable screensaver by temporarily changing system settings */
p_vout->p_sys->i_spi_lowpowertimeout = 0;
p_vout->p_sys->i_spi_powerofftimeout = 0;
p_vout->p_sys->i_spi_screensavetimeout = 0;
var_Get( p_vout, "disable-screensaver", &val);
if( val.b_bool ) {
if( var_GetBool( p_vout, "disable-screensaver" ) ) {
msg_Dbg(p_vout, "disabling screen saver");
SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT,
0, &(p_vout->p_sys->i_spi_lowpowertimeout), 0);
......@@ -266,7 +261,7 @@ static int OpenVideo( vlc_object_t *p_this )
}
return VLC_SUCCESS;
error:
error:
CloseVideo( VLC_OBJECT(p_vout) );
return VLC_EGENERIC;
}
......@@ -334,10 +329,8 @@ static void CloseVideo( vlc_object_t *p_this )
static int Init( vout_thread_t *p_vout )
{
int i_ret;
vlc_value_t val;
var_Get( p_vout, "directx-hw-yuv", &val );
p_vout->p_sys->b_hw_yuv = val.b_bool;
p_vout->p_sys->b_hw_yuv = var_GetBool( p_vout, "directx-hw-yuv" );
/* Initialise Direct3D */
if( VLC_SUCCESS != Direct3DVoutOpen( p_vout ) )
......
/*****************************************************************************
* vout.c: Windows DirectX video output display method
*****************************************************************************
* Copyright (C) 2001-2004 the VideoLAN team
* Copyright (C) 2001-2009 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
......@@ -208,10 +208,9 @@ static int OpenVideo( vlc_object_t *p_this )
HMODULE huser32;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
p_vout->p_sys = calloc( 1, sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
return VLC_ENOMEM;
memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
/* Initialisations */
p_vout->pf_init = Init;
......@@ -316,8 +315,7 @@ static int OpenVideo( vlc_object_t *p_this )
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_Get( p_vout, "video-on-top", &val );
var_Set( p_vout, "video-on-top", val );
var_TriggerCallback( p_vout, "video-on-top" );
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
......@@ -325,15 +323,13 @@ static int OpenVideo( vlc_object_t *p_this )
val.psz_string = _("Wallpaper");
var_Change( p_vout, "directx-wallpaper", VLC_VAR_SETTEXT, &val, NULL );
var_AddCallback( p_vout, "directx-wallpaper", WallpaperCallback, NULL );
var_Get( p_vout, "directx-wallpaper", &val );
var_Set( p_vout, "directx-wallpaper", val );
var_TriggerCallback( p_vout, "directx-wallpaper" );
/* disable screensaver by temporarily changing system settings */
p_vout->p_sys->i_spi_lowpowertimeout = 0;
p_vout->p_sys->i_spi_powerofftimeout = 0;
p_vout->p_sys->i_spi_screensavetimeout = 0;
var_Get( p_vout, "disable-screensaver", &val);
if( val.b_bool ) {
if( var_GetBool( p_vout, "disable-screensaver" ) ) {
msg_Dbg(p_vout, "disabling screen saver");
SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT,
0, &(p_vout->p_sys->i_spi_lowpowertimeout), 0);
......@@ -368,17 +364,12 @@ static int OpenVideo( vlc_object_t *p_this )
static int Init( vout_thread_t *p_vout )
{
int i_chroma_backup;
vlc_value_t val;
/* Get a few default parameters */
var_Get( p_vout, "overlay", &val );
p_vout->p_sys->b_using_overlay = val.b_bool;
var_Get( p_vout, "directx-use-sysmem", &val );
p_vout->p_sys->b_use_sysmem = val.b_bool;
var_Get( p_vout, "directx-hw-yuv", &val );
p_vout->p_sys->b_hw_yuv = val.b_bool;
var_Get( p_vout, "directx-3buffering", &val );
p_vout->p_sys->b_3buf_overlay = val.b_bool;
p_vout->p_sys->b_using_overlay = var_GetBool( p_vout, "overlay" );
p_vout->p_sys->b_use_sysmem = var_GetBool( p_vout, "directx-use-sysmem" );
p_vout->p_sys->b_hw_yuv = var_GetBool( p_vout, "directx-hw-yuv" );
p_vout->p_sys->b_3buf_overlay = var_GetBool( p_vout, "directx-3buffering" );
/* Initialise DirectDraw if not already done.
* We do this here because on multi-monitor systems we may have to
......
/*****************************************************************************
* events.c: Windows DirectX video output events handler
*****************************************************************************
* Copyright (C) 2001-2004 the VideoLAN team
* Copyright (C) 2001-2009 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
......@@ -176,8 +176,7 @@ void* EventThread( vlc_object_t *p_this )
p_event->p_vout->fmt_in.i_y_offset;
var_Set( p_event->p_vout, "mouse-y", val );
val.b_bool = true;
var_Set( p_event->p_vout, "mouse-moved", val );
var_SetBool( p_event->p_vout, "mouse-moved", true );
}
case WM_NCMOUSEMOVE:
......@@ -1208,8 +1207,6 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
}
vlc_value_t val;
/* Update the object variable and trigger callback */
val.b_bool = p_vout->b_fullscreen;
var_Set( p_vout, "fullscreen", val );
var_SetBool( p_vout, "fullscreen", p_vout->b_fullscreen );
}
/*****************************************************************************
* glwin32.c: Windows OpenGL provider
*****************************************************************************
* Copyright (C) 2001-2004 the VideoLAN team
* Copyright (C) 2001-2009 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
......@@ -91,13 +91,11 @@ vlc_module_end ()
static int OpenVideo( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
p_vout->p_sys = calloc( 1, sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
return VLC_ENOMEM;
memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
/* Initialisations */
p_vout->pf_init = Init;
......@@ -159,8 +157,7 @@ static int OpenVideo( vlc_object_t *p_this )
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_Get( p_vout, "video-on-top", &val );
var_Set( p_vout, "video-on-top", val );
var_TriggerCallback( p_vout, "video-on-top" );
return VLC_SUCCESS;
......
/*****************************************************************************
* vout.h: Windows video output header file
*****************************************************************************
* Copyright (C) 2001-2004 the VideoLAN team
* Copyright (C) 2001-2009 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
......
/*****************************************************************************
* wingdi.c : Win32 / WinCE GDI video output plugin for vlc
*****************************************************************************
* Copyright (C) 2002 the VideoLAN team
* Copyright (C) 2002-2009 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
......@@ -145,11 +145,9 @@ vlc_module_end ()
static int OpenVideo ( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
p_vout->p_sys = (vout_sys_t *)malloc( sizeof(vout_sys_t) );
p_vout->p_sys = (vout_sys_t *)calloc( 1, sizeof(vout_sys_t) );
if( !p_vout->p_sys ) return VLC_ENOMEM;
memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
#ifdef MODULE_NAME_IS_wingapi
/* Load GAPI */
......@@ -268,15 +266,13 @@ static int OpenVideo ( vlc_object_t *p_this )
#ifndef UNDER_CE
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_Get( p_vout, "video-on-top", &val );
var_Set( p_vout, "video-on-top", val );
var_TriggerCallback( p_vout, "video-on-top" );
/* disable screensaver by temporarily changing system settings */
p_vout->p_sys->i_spi_lowpowertimeout = 0;
p_vout->p_sys->i_spi_powerofftimeout = 0;
p_vout->p_sys->i_spi_screensavetimeout = 0;
var_Get( p_vout, "disable-screensaver", &val);
if( val.b_bool ) {
if( var_GetBool( p_vout, "disable-screensaver" ) ) {
msg_Dbg(p_vout, "disabling screen saver");
SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT,
0, &(p_vout->p_sys->i_spi_lowpowertimeout), 0);
......
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