[vlc-commits] directdraw: debug the reason a CreateSurface() fails
Steve Lhomme
git at videolan.org
Thu May 26 18:37:43 CEST 2016
vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu May 26 18:16:01 2016 +0200| [1f0d4481522838fb24ce150b94cfee49ee5b11c7] | committer: Jean-Baptiste Kempf
directdraw: debug the reason a CreateSurface() fails
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1f0d4481522838fb24ce150b94cfee49ee5b11c7
---
modules/video_output/win32/directdraw.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/modules/video_output/win32/directdraw.c b/modules/video_output/win32/directdraw.c
index 6e4d262..c2f5eea 100644
--- a/modules/video_output/win32/directdraw.c
+++ b/modules/video_output/win32/directdraw.c
@@ -882,13 +882,22 @@ static int DirectXCreateSurface(vout_display_t *vd,
/* Create the video surface */
LPDIRECTDRAWSURFACE surface_v1;
- if (IDirectDraw2_CreateSurface(sys->ddobject, &ddsd, &surface_v1, NULL) != DD_OK)
+ HRESULT hr = IDirectDraw2_CreateSurface(sys->ddobject, &ddsd, &surface_v1, NULL);
+ if (hr == DDERR_INVALIDCAPS)
+ {
+ msg_Dbg(vd, "failed to create a DirectDrawSurface with invalid caps %lx", ddsd.ddsCaps.dwCaps);
+ return VLC_EGENERIC;
+ }
+ if (hr != DD_OK)
+ {
+ msg_Dbg(vd, "failed to create a DirectDrawSurface (error %li)", hr);
return VLC_EGENERIC;
+ }
/* Now that the surface is created, try to get a newer DirectX interface */
- HRESULT hr = IDirectDrawSurface_QueryInterface(surface_v1,
- &IID_IDirectDrawSurface2,
- (LPVOID *)surface);
+ hr = IDirectDrawSurface_QueryInterface(surface_v1,
+ &IID_IDirectDrawSurface2,
+ (LPVOID *)surface);
IDirectDrawSurface_Release(surface_v1);
if (hr != DD_OK) {
msg_Err(vd, "cannot query IDirectDrawSurface2 interface (error %li)", hr);
More information about the vlc-commits
mailing list