[vlc-devel] [PATCH 2/3] d3d11va: move variables where they really used

Steve Lhomme robux4 at videolabs.io
Thu Dec 1 18:04:55 CET 2016


---
 modules/codec/avcodec/d3d11va.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 4b346d5..d840ba7 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -258,10 +258,8 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
     case VLC_CODEC_D3D11_OPAQUE_10B:
     {
         picture_sys_t *p_sys_out = output->p_sys;
-        picture_sys_t *p_sys_in = surface->p_pic->p_sys;
 
         assert(p_sys_out->texture != NULL);
-        assert(p_sys_in->decoder == src);
 
         if( sys->context_mutex != INVALID_HANDLE_VALUE ) {
             WaitForSingleObjectEx( sys->context_mutex, INFINITE, FALSE );
@@ -270,6 +268,8 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
 #ifdef ID3D11VideoContext_VideoProcessorBlt
         if (sys->videoProcessor)
         {
+            picture_sys_t *p_sys_in = surface->p_pic->p_sys;
+            assert(p_sys_in->decoder == src);
             // extract the decoded video to a the output Texture
             if (p_sys_out->decoder == NULL)
             {
@@ -315,13 +315,16 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
             D3D11_TEXTURE2D_DESC dstDesc;
             ID3D11Texture2D_GetDesc( (ID3D11Texture2D*) p_sys_out->texture, &dstDesc);
 
+            ID3D11Resource **pTexture;
+            ID3D11VideoDecoderOutputView_GetResource(src, pTexture);
+
             /* copy decoder slice to surface */
             D3D11_BOX copyBox = {
                 .right = dstDesc.Width, .bottom = dstDesc.Height, .back = 1,
             };
             ID3D11DeviceContext_CopySubresourceRegion(sys->d3dctx, (ID3D11Resource*) p_sys_out->texture,
                                                       p_sys_out->slice_index, 0, 0, 0,
-                                                      (ID3D11Resource*) p_sys_in->texture,
+                                                      pTexture,
                                                       viewDesc.Texture2D.ArraySlice,
                                                       &copyBox);
         }
-- 
2.10.1



More information about the vlc-devel mailing list