]> git.sesse.net Git - vlc/blobdiff - modules/video_output/msw/wingdi.c
Less memleaks in Qt interface.
[vlc] / modules / video_output / msw / wingdi.c
old mode 100755 (executable)
new mode 100644 (file)
index ab5af69..4b5ccb8
@@ -2,7 +2,7 @@
  * wingdi.c : Win32 / WinCE GDI video output plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 the VideoLAN team
- * $Id: wingdi.c 18074 2006-11-26 16:26:44Z zorglub $
+ * $Id$
  *
  * Authors: Gildas Bazin <gbazin@videolan.org>
  *          Samuel Hocevar <sam@zoy.org>
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
 
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_interface.h>
 #include <vlc_playlist.h>
 #include <vlc_vout.h>
@@ -134,11 +137,11 @@ vlc_module_begin();
     set_subcategory( SUBCAT_VIDEO_VOUT );
 #ifdef MODULE_NAME_IS_wingapi
     set_shortname( "Windows GAPI" );
-    set_description( _("Windows GAPI video output") );
+    set_description( N_("Windows GAPI video output") );
     set_capability( "video output", 20 );
 #else
     set_shortname( "Windows GDI" );
-    set_description( _("Windows GDI video output") );
+    set_description( N_("Windows GDI video output") );
     set_capability( "video output", 10 );
 #endif
     set_callbacks( OpenVideo, CloseVideo );
@@ -196,7 +199,7 @@ static int OpenVideo ( vlc_object_t *p_this )
 #endif
 
     p_vout->p_sys->p_event = (vlc_object_t *)
-        vlc_object_create( p_vout, VLC_OBJECT_GENERIC );
+        vlc_object_create( p_vout, sizeof( vlc_object_t ) );
     if( !p_vout->p_sys->p_event )
     {
         free( p_vout->p_sys );
@@ -220,7 +223,7 @@ 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;
-    vlc_mutex_init( p_vout, &p_vout->p_sys->lock );
+    vlc_mutex_init( &p_vout->p_sys->lock );
     SetRectEmpty( &p_vout->p_sys->rect_display );
     SetRectEmpty( &p_vout->p_sys->rect_parent );
 
@@ -229,6 +232,8 @@ static int OpenVideo ( vlc_object_t *p_this )
 
     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;
@@ -246,10 +251,10 @@ static int OpenVideo ( vlc_object_t *p_this )
         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, "VLC Vout Events Thread",
-                           E_(EventThread), 0, 1 ) )
+                           EventThread, 0, 1 ) )
     {
         msg_Err( p_vout, "cannot create Vout EventThread" );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
         p_vout->p_sys->p_event = NULL;
         goto error;
     }
@@ -323,7 +328,7 @@ static void CloseVideo ( vlc_object_t *p_this )
         }
 
         vlc_thread_join( p_vout->p_sys->p_event );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
     }
     vlc_mutex_destroy( &p_vout->p_sys->lock );
 
@@ -447,7 +452,7 @@ static int Init( vout_thread_t *p_vout )
 
     /* Change the window title bar text */
     PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
-    E_(UpdateRects)( p_vout, VLC_TRUE );
+    UpdateRects( p_vout, true );
 
     return VLC_SUCCESS;
 }
@@ -531,7 +536,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_(UpdateRects)( p_vout, VLC_TRUE );
+        UpdateRects( p_vout, true );
     }
 
     /*
@@ -563,7 +568,8 @@ static int Manage( vout_thread_t *p_vout )
      * Pointer change
      */
     if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
-        (mdate() - p_vout->p_sys->i_lastmoved) > 5000000 )
+        (mdate() - p_vout->p_sys->i_lastmoved) >
+            p_vout->p_sys->i_mouse_hide_timeout )
     {
         POINT point;
         HWND hwnd;
@@ -611,11 +617,11 @@ static int Manage( vout_thread_t *p_vout )
                           SWP_NOSIZE | SWP_NOMOVE );
         }
 
-        p_vout->p_sys->b_on_top_change = VLC_FALSE;
+        p_vout->p_sys->b_on_top_change = false;
     }
 
     /* Check if the event thread is still running */
-    if( p_vout->p_sys->p_event->b_die )
+    if( !vlc_object_alive (p_vout->p_sys->p_event) )
     {
         return VLC_EGENERIC; /* exit */
     }
@@ -673,10 +679,10 @@ static void DisplayGDI( vout_thread_t *p_vout, picture_t *p_pic )
 static void FirstDisplayGDI( vout_thread_t *p_vout, picture_t *p_pic )
 {
     /*
-    ** Video window is initially hidden, show it now since we got a 
+    ** Video window is initially hidden, show it now since we got a
     ** picture to show.
     */
-    SetWindowPos( p_vout->p_sys->hvideownd, 0, 0, 0, 0, 0, 
+    SetWindowPos( p_vout->p_sys->hvideownd, 0, 0, 0, 0, 0,
         SWP_ASYNCWINDOWPOS|
         SWP_FRAMECHANGED|
         SWP_SHOWWINDOW|
@@ -794,10 +800,10 @@ static void FirstDisplayGAPI( vout_thread_t *p_vout, picture_t *p_pic )
     DisplayGAPI(p_vout, p_pic);
 
     /*
-    ** Video window is initially hidden, show it now since we got a 
+    ** Video window is initially hidden, show it now since we got a
     ** picture to show.
     */
-    SetWindowPos( p_vout->p_sys->hvideownd, 0, 0, 0, 0, 0, 
+    SetWindowPos( p_vout->p_sys->hvideownd, 0, 0, 0, 0, 0,
         SWP_ASYNCWINDOWPOS|
         SWP_FRAMECHANGED|
         SWP_SHOWWINDOW|
@@ -831,7 +837,6 @@ static void InitBuffers( vout_thread_t *p_vout )
 {
     BITMAPINFOHEADER *p_header = &p_vout->p_sys->bitmapinfo.bmiHeader;
     BITMAPINFO *p_info = &p_vout->p_sys->bitmapinfo;
-    int i_pixels = p_vout->render.i_height * p_vout->render.i_width;
     HDC window_dc = GetDC( p_vout->p_sys->hvideownd );
 
     /* Get screen properties */