[vlc-devel] [PATCH 11/14] d3d11_fmt: keep track if we own the device or not

Steve Lhomme robux4 at videolabs.io
Sat Nov 18 14:29:25 CET 2017


---
 modules/codec/avcodec/d3d11va.c  | 1 +
 modules/video_chroma/d3d11_fmt.c | 6 ++++++
 modules/video_chroma/d3d11_fmt.h | 1 +
 3 files changed, 8 insertions(+)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 93ef39188b..95542f9363 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -359,6 +359,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
 
             dx_sys->d3ddev = sys->d3d_dev.d3ddevice;
             sys->d3d_dev.d3dcontext = p_sys->context;
+            sys->d3d_dev.owner = false;
             sys->d3dvidctx = d3dvidctx;
 
             assert(p_sys->texture[KNOWN_DXGI_INDEX] != NULL);
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 1b9fe27eb5..19e93e217c 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -218,6 +218,12 @@ HRESULT D3D11_CreateDevice(vlc_object_t *obj, d3d11_handle_t *hd3d,
             hr = E_NOTIMPL;
         }
     }
+
+    if (SUCCEEDED(hr))
+    {
+        out->owner = true;
+    }
+
     return hr;
 }
 
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index d639046f50..9ed889edf9 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -33,6 +33,7 @@ typedef struct
 {
     ID3D11Device             *d3ddevice;       /* D3D device */
     ID3D11DeviceContext      *d3dcontext;      /* D3D context */
+    bool                     owner;
 } d3d11_device_t;
 
 typedef struct
-- 
2.14.2



More information about the vlc-devel mailing list