[vlc-commits] d3d11va: store the DXGI format in the video context

Steve Lhomme git at videolan.org
Fri Oct 25 11:11:26 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jul 11 09:41:32 2019 +0200| [e90a513ad22dddfe9fdc054c2b64b41d1ee41225] | committer: Steve Lhomme

d3d11va: store the DXGI format in the video context

It's better than guessing it from the chroma.

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

 modules/codec/avcodec/d3d11va.c  | 9 +++++----
 modules/video_chroma/d3d11_fmt.h | 1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index d6cb7d6910..3540b2769d 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -305,10 +305,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
     }
     sys->hw.video_context = d3dvidctx;
 
-    d3d11_video_context_t *priv = GetD3D11ContextPrivate(sys->vctx);
-    priv->device = sys->d3d_dev.d3dcontext;
-    ID3D11DeviceContext_Release(priv->device);
-
     struct va_pool_cfg pool_cfg = {
         D3dCreateDevice,
         DxDestroySurfaces,
@@ -348,6 +344,11 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
         IDXGIAdapter_Release(p_adapter);
     }
 
+    d3d11_video_context_t *priv = GetD3D11ContextPrivate(sys->vctx);
+    priv->format = sys->render;
+    priv->device = sys->d3d_dev.d3dcontext;
+    ID3D11DeviceContext_Release(priv->device);
+
     va->ops = &ops;
     *vtcx_out = sys->vctx;
     return VLC_SUCCESS;
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index b7452a2287..b69f0ffd22 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -94,6 +94,7 @@ typedef struct
 typedef struct
 {
     ID3D11DeviceContext *device;
+    DXGI_FORMAT         format;
 } d3d11_video_context_t;
 
 /* index to use for texture/resource that use a known DXGI format



More information about the vlc-commits mailing list