[vlc-devel] [PATCH 4/4] directdraw: debug the reason a CreateSurface() fails
Steve Lhomme
robux4 at videolabs.io
Thu May 26 18:16:01 CEST 2016
---
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);
--
2.8.1
More information about the vlc-devel
mailing list