[vlc-commits] d3d11_fmt: make the d3d11_handle_t private

Steve Lhomme git at videolan.org
Thu Feb 13 09:31:46 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Feb 12 15:20:55 2020 +0100| [97bd7ac8be5b8f9da277c8ef0bec02f1112f2aeb] | committer: Steve Lhomme

d3d11_fmt: make the d3d11_handle_t private

It's not used outside and doesn't need to be shared.

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

 modules/video_chroma/d3d11_fmt.c | 102 +++++++++++++++++++++------------------
 modules/video_chroma/d3d11_fmt.h |  15 ------
 2 files changed, 56 insertions(+), 61 deletions(-)

diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 692b5e1779..0c6ffa3887 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -223,6 +223,17 @@ static void D3D11_GetDriverVersion(vlc_object_t *obj, d3d11_device_t *d3d_dev)
 }
 #endif /* VLC_WINSTORE_APP */
 
+typedef struct
+{
+#if !VLC_WINSTORE_APP
+    HINSTANCE                 hdll;         /* handle of the opened d3d11 dll */
+#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
+    HINSTANCE                 dxgidebug_dll;
+    HRESULT (WINAPI * pf_DXGIGetDebugInterface)(const GUID *riid, void **ppDebug);
+#endif
+#endif
+} d3d11_handle_t;
+
 typedef struct {
     struct {
         void                            *opaque;
@@ -233,6 +244,51 @@ typedef struct {
     d3d11_decoder_device_t              dec_device;
 } d3d11_decoder_device;
 
+static int D3D11_Create(vlc_object_t *obj, d3d11_handle_t *hd3d)
+{
+#if !VLC_WINSTORE_APP
+    hd3d->hdll = LoadLibrary(TEXT("D3D11.DLL"));
+    if (!hd3d->hdll)
+    {
+        msg_Warn(obj, "cannot load d3d11.dll, aborting");
+        return VLC_EGENERIC;
+    }
+
+# if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
+    hd3d->dxgidebug_dll = NULL;
+    hd3d->pf_DXGIGetDebugInterface = NULL;
+    if (IsDebuggerPresent())
+    {
+        hd3d->dxgidebug_dll = LoadLibrary(TEXT("DXGIDEBUG.DLL"));
+        if (hd3d->dxgidebug_dll)
+        {
+            hd3d->pf_DXGIGetDebugInterface =
+                    (void *)GetProcAddress(hd3d->dxgidebug_dll, "DXGIGetDebugInterface");
+            if (unlikely(!hd3d->pf_DXGIGetDebugInterface))
+            {
+                FreeLibrary(hd3d->dxgidebug_dll);
+                hd3d->dxgidebug_dll = NULL;
+            }
+        }
+    }
+# endif // !NDEBUG && HAVE_DXGIDEBUG_H
+#endif // !VLC_WINSTORE_APP
+    return VLC_SUCCESS;
+}
+
+static void D3D11_Destroy(d3d11_handle_t *hd3d)
+{
+#if !VLC_WINSTORE_APP
+    if (hd3d->hdll)
+        FreeLibrary(hd3d->hdll);
+
+#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
+    if (hd3d->dxgidebug_dll)
+        FreeLibrary(hd3d->dxgidebug_dll);
+#endif
+#endif
+}
+
 void D3D11_ReleaseDevice(d3d11_decoder_device_t *dev_sys)
 {
     d3d11_decoder_device *sys = container_of(dev_sys, d3d11_decoder_device, dec_device);
@@ -782,39 +838,6 @@ error:
     return VLC_EGENERIC;
 }
 
-#undef D3D11_Create
-int D3D11_Create(vlc_object_t *obj, d3d11_handle_t *hd3d)
-{
-#if !VLC_WINSTORE_APP
-    hd3d->hdll = LoadLibrary(TEXT("D3D11.DLL"));
-    if (!hd3d->hdll)
-    {
-        msg_Warn(obj, "cannot load d3d11.dll, aborting");
-        return VLC_EGENERIC;
-    }
-
-# if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
-    hd3d->dxgidebug_dll = NULL;
-    hd3d->pf_DXGIGetDebugInterface = NULL;
-    if (IsDebuggerPresent())
-    {
-        hd3d->dxgidebug_dll = LoadLibrary(TEXT("DXGIDEBUG.DLL"));
-        if (hd3d->dxgidebug_dll)
-        {
-            hd3d->pf_DXGIGetDebugInterface =
-                    (void *)GetProcAddress(hd3d->dxgidebug_dll, "DXGIGetDebugInterface");
-            if (unlikely(!hd3d->pf_DXGIGetDebugInterface))
-            {
-                FreeLibrary(hd3d->dxgidebug_dll);
-                hd3d->dxgidebug_dll = NULL;
-            }
-        }
-    }
-# endif // !NDEBUG && HAVE_DXGIDEBUG_H
-#endif
-    return VLC_SUCCESS;
-}
-
 void D3D11_LogResources(d3d11_decoder_device_t *dev_sys)
 {
 #if !VLC_WINSTORE_APP
@@ -831,19 +854,6 @@ void D3D11_LogResources(d3d11_decoder_device_t *dev_sys)
 #endif
 }
 
-void D3D11_Destroy(d3d11_handle_t *hd3d)
-{
-#if !VLC_WINSTORE_APP
-    if (hd3d->hdll)
-        FreeLibrary(hd3d->hdll);
-
-#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
-    if (hd3d->dxgidebug_dll)
-        FreeLibrary(hd3d->dxgidebug_dll);
-#endif
-#endif
-}
-
 const struct vlc_video_context_operations d3d11_vctx_ops = {
     NULL,
 };
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index a1ef9b37a5..53258bcdc0 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -51,17 +51,6 @@ typedef struct
     DXGI_ADAPTER_DESC        adapterDesc;
 } d3d11_device_t;
 
-typedef struct
-{
-#if !VLC_WINSTORE_APP
-    HINSTANCE                 hdll;         /* handle of the opened d3d11 dll */
-#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
-    HINSTANCE                 dxgidebug_dll;
-    HRESULT (WINAPI * pf_DXGIGetDebugInterface)(const GUID *riid, void **ppDebug);
-#endif
-#endif
-} d3d11_handle_t;
-
 /* owned by the vout for VLC_CODEC_D3D11_OPAQUE */
 typedef struct
 {
@@ -157,10 +146,6 @@ HRESULT D3D11_CreateDeviceExternal(vlc_object_t *obj, ID3D11DeviceContext *,
 
 void D3D11_ReleaseDevice(d3d11_decoder_device_t *);
 
-int D3D11_Create(vlc_object_t *, d3d11_handle_t *);
-#define D3D11_Create(a,b) D3D11_Create( VLC_OBJECT(a), b )
-
-void D3D11_Destroy(d3d11_handle_t *);
 void D3D11_LogResources(d3d11_decoder_device_t *);
 
 bool isXboxHardware(const d3d11_device_t *);



More information about the vlc-commits mailing list