]> git.sesse.net Git - vlc/commitdiff
vout_msw: use var_TriggerCallback and some cleaning.
authorRémi Duraffort <ivoire@videolan.org>
Wed, 18 Mar 2009 14:18:41 +0000 (15:18 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Thu, 19 Mar 2009 07:23:21 +0000 (08:23 +0100)
modules/video_output/msw/direct3d.c
modules/video_output/msw/directx.c
modules/video_output/msw/events.c
modules/video_output/msw/glwin32.c
modules/video_output/msw/vout.h
modules/video_output/msw/wingdi.c

index 1b15c01d6f0e117a64620e6d79046384d06e7eb0..dcebe6fc0c8d1b0eb1c8a3fe7bb393510edbd923 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * 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 ) )
index 122877f270d6b8ec4f5ccacd735687993c2a60d1..7ab540876eb89d4d2866a61c3e13fed817bc9918 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * 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
index 73822ac6f1eb6255263d92f8ef8f6bdac2f63904..2e887d8c0b8d0154fefb7c3bc8a8d6f25ac5b539 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * 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 );
 }
index 5248e9903e5e5155580938dfbac0b4022c93bd4a..4f1d81e7a90b72c35a0ab7346f226417c09fa495 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * 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;
 
index 945899b0e9a45598fe0b5380504ceb911978b7dc..b2b1f82bf9ec9fc0537c11d57bdc13f5ac0a70b7 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * 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>
index af58156f9beb93f2e29f19504f4300a6d102d6f5..a4ac84ab0ed1348f93322615d6a73bd55673abe2 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * 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);