Commit 8e00a861 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

d3d9_fmt: add D3D9_ReleaseDevice() to match D3D9_CreateDevice()

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent efa18c59
......@@ -125,6 +125,15 @@ HRESULT D3D9_CreateDevice(vlc_object_t *o, d3d9_handle_t *hd3d, HWND hwnd,
return hr;
}
void D3D9_ReleaseDevice(d3d9_device_t *d3d_dev)
{
if (d3d_dev->dev)
{
IDirect3DDevice9_Release(d3d_dev->dev);
d3d_dev->dev = NULL;
}
}
/**
* It setup vout_display_sys_t::d3dpp and vout_display_sys_t::rect_display
* from the default adapter.
......
......@@ -76,6 +76,8 @@ HRESULT D3D9_CreateDevice(vlc_object_t *, d3d9_handle_t *, HWND,
const video_format_t *, d3d9_device_t *out);
#define D3D9_CreateDevice(a,b,c,d,e) D3D9_CreateDevice( VLC_OBJECT(a), b, c, d, e )
void D3D9_ReleaseDevice(d3d9_device_t *);
int D3D9_FillPresentationParameters(vlc_object_t *, d3d9_handle_t *, UINT AdapterToUse, HWND,
const video_format_t *, d3d9_device_t *out);
......
......@@ -805,15 +805,6 @@ static void Direct3D9Destroy(vlc_object_t *o, struct d3dctx *d3dctx)
static int Direct3D9CreateResources (vout_display_t *, video_format_t *);
static void Direct3D9DestroyResources(vout_display_t *);
static void Direct3D9DestroyDevice(vlc_object_t *o, struct d3dctx *d3dctx)
{
VLC_UNUSED(o);
if (d3dctx->d3d_dev.dev)
IDirect3DDevice9_Release(d3dctx->d3d_dev.dev);
d3dctx->d3d_dev.dev = NULL;
}
/**
* It creates a Direct3D9 device and the associated resources.
*/
......@@ -865,7 +856,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
return VLC_SUCCESS;
error:
Direct3D9DestroyDevice(VLC_OBJECT(vd), &sys->d3dctx);
D3D9_ReleaseDevice(&sys->d3dctx.d3d_dev);
return VLC_EGENERIC;
}
......@@ -877,7 +868,7 @@ static void Direct3D9Close(vout_display_t *vd)
vout_display_sys_t *sys = vd->sys;
Direct3D9DestroyResources(vd);
Direct3D9DestroyDevice(VLC_OBJECT(vd), &sys->d3dctx);
D3D9_ReleaseDevice(&sys->d3dctx.d3d_dev);
}
/**
......@@ -1976,7 +1967,7 @@ GLConvClose(vlc_object_t *obj)
if (priv->dx_render)
IDirect3DSurface9_Release(priv->dx_render);
Direct3D9DestroyDevice(obj, &priv->d3dctx);
D3D9_ReleaseDevice(&priv->d3dctx.d3d_dev);
Direct3D9Destroy(obj, &priv->d3dctx);
free(tc->priv);
}
......
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