[vlc-devel] [PATCH 28/39] d3d11va: do not use the vlc_va_surface_t picture anymore

Steve Lhomme robux4 at videolabs.io
Fri Jun 2 16:46:31 CEST 2017


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

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index ca94794825..6b924ab677 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -174,11 +174,7 @@ void SetupAVCodecContext(vlc_va_t *va)
 
 static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
 {
-    vlc_va_surface_t *surface = output->p_sys->va_surface;
-    int ret = VLC_SUCCESS;
-
-    picture_sys_t *p_sys_out = surface ? surface->p_pic->p_sys : output->p_sys;
-
+    picture_sys_t *p_sys_out = output->p_sys;
     assert(p_sys_out->texture[KNOWN_DXGI_INDEX] != NULL);
 
 #if D3D11_DIRECT_DECODE
@@ -187,8 +183,8 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
     {
         vlc_va_sys_t *sys = va->sys;
         ID3D11VideoDecoderOutputView *src = (ID3D11VideoDecoderOutputView*)(uintptr_t)data;
-        picture_sys_t *p_sys_in = surface->p_pic->p_sys;
-        assert(p_sys_in->decoder == src);
+        ID3D11Resource *p_texture;
+        ID3D11VideoDecoderOutputView_GetResource(src, &p_texture);
 
         if( sys->context_mutex != INVALID_HANDLE_VALUE ) {
             WaitForSingleObjectEx( sys->context_mutex, INFINITE, FALSE );
@@ -206,19 +202,17 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
         };
         ID3D11DeviceContext_CopySubresourceRegion(sys->d3dctx, p_sys_out->resource[KNOWN_DXGI_INDEX],
                                                   p_sys_out->slice_index, 0, 0, 0,
-                                                  p_sys_in->resource[KNOWN_DXGI_INDEX],
+                                                  p_texture,
                                                   viewDesc.Texture2D.ArraySlice,
                                                   &copyBox);
+        ID3D11Resource_Release(p_texture);
         if( sys->context_mutex  != INVALID_HANDLE_VALUE ) {
             ReleaseMutex( sys->context_mutex );
         }
     }
 #endif
-    if (!output->p_sys && surface->p_pic && surface->p_pic->p_sys)
-        /* HW decoding in a software pipe, pass the texture to upstream filters */
-        output->p_sys = surface->p_pic->p_sys;
 
-    return ret;
+    return VLC_SUCCESS;
 }
 
 static int CheckDevice(vlc_va_t *va)
-- 
2.12.1



More information about the vlc-devel mailing list