From ba850c47f7beca7f98f345e8c896723e8bb676ef Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Tue, 26 Nov 2002 19:31:50 +0000 Subject: [PATCH] * modules/video_output/directx/directx.c: fixed to work with DirectDraw 3 (ie. with NT4). --- modules/video_output/directx/directx.c | 37 +++++++++++++++++--------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/modules/video_output/directx/directx.c b/modules/video_output/directx/directx.c index 89fba187b1..6abeb1a12b 100644 --- a/modules/video_output/directx/directx.c +++ b/modules/video_output/directx/directx.c @@ -2,7 +2,7 @@ * vout.c: Windows DirectX video output display method ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: directx.c,v 1.7 2002/11/26 10:55:19 gbazin Exp $ + * $Id: directx.c,v 1.8 2002/11/26 19:31:50 gbazin Exp $ * * Authors: Gildas Bazin * @@ -1409,20 +1409,31 @@ static int DirectXGetSurfaceDesc( vout_thread_t *p_vout, picture_t *p_pic ) NULL, &p_pic->p_sys->ddsd, DDLOCK_NOSYSLOCK | DDLOCK_WAIT, NULL ); - if ( dxresult == DDERR_SURFACELOST ) - { - /* Your surface can be lost so be sure - * to check this and restore it if needed */ - dxresult = IDirectDrawSurface2_Restore( p_pic->p_sys->p_surface ); - dxresult = IDirectDrawSurface2_Lock( p_pic->p_sys->p_surface, NULL, - &p_pic->p_sys->ddsd, - DDLOCK_NOSYSLOCK | DDLOCK_WAIT, - NULL); - } if( dxresult != DD_OK ) { - msg_Err( p_vout, "DirectXGetSurfaceDesc cannot lock surface" ); - return VLC_EGENERIC; + if( dxresult == DDERR_INVALIDPARAMS ) + { + /* DirectX 3 doesn't support the DDLOCK_NOSYSLOCK flag, resulting + * in an invalid params error */ + dxresult = IDirectDrawSurface2_Restore( p_pic->p_sys->p_surface ); + dxresult = IDirectDrawSurface2_Lock( p_pic->p_sys->p_surface, NULL, + &p_pic->p_sys->ddsd, + DDLOCK_WAIT, NULL); + } + if( dxresult == DDERR_SURFACELOST ) + { + /* Your surface can be lost so be sure + * to check this and restore it if needed */ + dxresult = IDirectDrawSurface2_Restore( p_pic->p_sys->p_surface ); + dxresult = IDirectDrawSurface2_Lock( p_pic->p_sys->p_surface, NULL, + &p_pic->p_sys->ddsd, + DDLOCK_WAIT, NULL); + } + if( dxresult != DD_OK ) + { + msg_Err( p_vout, "DirectXGetSurfaceDesc cannot lock surface" ); + return VLC_EGENERIC; + } } /* Unlock the Surface */ -- 2.20.1