[vlc-commits] d3d9_fmt: add D3D9_ReleaseDevice() to match D3D9_CreateDevice()

Steve Lhomme git at videolan.org
Mon Nov 20 19:00:01 CET 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Sat Nov 18 14:26:37 2017 +0100| [8e00a8615536069350780831d0c9d2b0ab9193a7] | committer: Jean-Baptiste Kempf

d3d9_fmt: add D3D9_ReleaseDevice() to match D3D9_CreateDevice()

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8e00a8615536069350780831d0c9d2b0ab9193a7
---

 modules/video_chroma/d3d9_fmt.c        |  9 +++++++++
 modules/video_chroma/d3d9_fmt.h        |  2 ++
 modules/video_output/win32/direct3d9.c | 15 +++------------
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/modules/video_chroma/d3d9_fmt.c b/modules/video_chroma/d3d9_fmt.c
index 01951535a1..833ba6e6cf 100644
--- a/modules/video_chroma/d3d9_fmt.c
+++ b/modules/video_chroma/d3d9_fmt.c
@@ -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.
diff --git a/modules/video_chroma/d3d9_fmt.h b/modules/video_chroma/d3d9_fmt.h
index 7785ef9a4d..843553b38a 100644
--- a/modules/video_chroma/d3d9_fmt.h
+++ b/modules/video_chroma/d3d9_fmt.h
@@ -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);
 
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 55f3de7508..04d1ca0657 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -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);
 }



More information about the vlc-commits mailing list