Commit 7a9f74a1 authored by Gildas Bazin's avatar Gildas Bazin

* modules/video_output/directx/*: fixes uninitialized variables and memleaks.

parent a1acd9a7
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout.c: Windows DirectX video output display method * vout.c: Windows DirectX video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2004 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id: directx.c,v 1.35 2004/02/05 22:56:11 gbazin Exp $ * $Id: directx.c,v 1.36 2004/02/26 13:58:23 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -184,9 +184,10 @@ static int OpenVideo( vlc_object_t *p_this ) ...@@ -184,9 +184,10 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->p_display = NULL; p_vout->p_sys->p_display = NULL;
p_vout->p_sys->p_current_surface = NULL; p_vout->p_sys->p_current_surface = NULL;
p_vout->p_sys->p_clipper = NULL; p_vout->p_sys->p_clipper = NULL;
p_vout->p_sys->hwnd = NULL; p_vout->p_sys->hwnd = p_vout->p_sys->hvideownd = NULL;
p_vout->p_sys->hparent = NULL; p_vout->p_sys->hparent = NULL;
p_vout->p_sys->i_changes = 0; p_vout->p_sys->i_changes = 0;
SetRectEmpty( &p_vout->p_sys->rect_display );
/* Multimonitor stuff */ /* Multimonitor stuff */
p_vout->p_sys->hmonitor = NULL; p_vout->p_sys->hmonitor = NULL;
...@@ -664,16 +665,16 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc, ...@@ -664,16 +665,16 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc,
vout_thread_t *p_vout = (vout_thread_t *)p_context; vout_thread_t *p_vout = (vout_thread_t *)p_context;
vlc_value_t device; vlc_value_t device;
var_Get( p_vout, "directx-device", &device );
msg_Dbg( p_vout, "DirectXEnumCallback: %s, %s", psz_desc, psz_drivername ); msg_Dbg( p_vout, "DirectXEnumCallback: %s, %s", psz_desc, psz_drivername );
if( hmon ) if( hmon )
{ {
if( ( !device.psz_string || !device.psz_string ) && var_Get( p_vout, "directx-device", &device );
if( ( !device.psz_string || !*device.psz_string ) &&
hmon == p_vout->p_sys->hmonitor ) hmon == p_vout->p_sys->hmonitor )
{ {
; if( device.psz_string ) free( device.psz_string );
} }
else if( strcmp( psz_drivername, device.psz_string ) == 0 ) else if( strcmp( psz_drivername, device.psz_string ) == 0 )
{ {
...@@ -699,8 +700,13 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc, ...@@ -699,8 +700,13 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc,
} }
p_vout->p_sys->hmonitor = hmon; p_vout->p_sys->hmonitor = hmon;
if( device.psz_string ) free( device.psz_string );
}
else
{
if( device.psz_string ) free( device.psz_string );
return TRUE; /* Keep enumerating */
} }
else return TRUE; /* Keep enumerating */
msg_Dbg( p_vout, "selecting %s, %s", psz_desc, psz_drivername ); msg_Dbg( p_vout, "selecting %s, %s", psz_desc, psz_drivername );
p_vout->p_sys->p_display_driver = malloc( sizeof(GUID) ); p_vout->p_sys->p_display_driver = malloc( sizeof(GUID) );
...@@ -751,7 +757,11 @@ static int DirectXInitDDraw( vout_thread_t *p_vout ) ...@@ -751,7 +757,11 @@ static int DirectXInitDDraw( vout_thread_t *p_vout )
vlc_value_t device; vlc_value_t device;
var_Get( p_vout, "directx-device", &device ); var_Get( p_vout, "directx-device", &device );
msg_Dbg( p_vout, "directx-device: %s", device.psz_string ); if( device.psz_string )
{
msg_Dbg( p_vout, "directx-device: %s", device.psz_string );
free( device.psz_string );
}
p_vout->p_sys->hmonitor = p_vout->p_sys->hmonitor =
p_vout->p_sys->MonitorFromWindow( p_vout->p_sys->hwnd, p_vout->p_sys->MonitorFromWindow( p_vout->p_sys->hwnd,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* events.c: Windows DirectX video output events handler * events.c: Windows DirectX video output events handler
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2004 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id: events.c,v 1.37 2004/01/02 22:17:57 gbazin Exp $ * $Id: events.c,v 1.38 2004/02/26 13:58:23 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -498,8 +498,9 @@ void DirectXUpdateRects( vout_thread_t *p_vout, vlc_bool_t b_force ) ...@@ -498,8 +498,9 @@ void DirectXUpdateRects( vout_thread_t *p_vout, vlc_bool_t b_force )
vout_PlacePicture( p_vout, rect.right, rect.bottom, vout_PlacePicture( p_vout, rect.right, rect.bottom,
&i_x, &i_y, &i_width, &i_height ); &i_x, &i_y, &i_width, &i_height );
SetWindowPos( p_vout->p_sys->hvideownd, HWND_TOP, if( p_vout->p_sys->hvideownd )
i_x, i_y, i_width, i_height, 0 ); SetWindowPos( p_vout->p_sys->hvideownd, HWND_TOP,
i_x, i_y, i_width, i_height, 0 );
/* Destination image position and dimensions */ /* Destination image position and dimensions */
rect_dest.left = point.x + i_x; rect_dest.left = point.x + i_x;
......
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