[vlc-devel] [PATCH 36/36] dxva2_deinterlace: use the d3d9_device_t from the decoder device

Steve Lhomme robux4 at ycbcr.xyz
Thu Nov 21 15:14:27 CET 2019


---
 modules/hw/d3d9/dxva2_deinterlace.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/modules/hw/d3d9/dxva2_deinterlace.c b/modules/hw/d3d9/dxva2_deinterlace.c
index 460566381dc..a4caeeb0836 100644
--- a/modules/hw/d3d9/dxva2_deinterlace.c
+++ b/modules/hw/d3d9/dxva2_deinterlace.c
@@ -45,7 +45,6 @@ typedef struct
     HINSTANCE                      hdecoder_dll;
     /* keep a reference in case the vout is released first */
     d3d9_handle_t                  hd3d;
-    d3d9_device_t                  d3d_dev;
     IDirectXVideoProcessor         *processor;
     IDirect3DSurface9              *hw_surface;
 
@@ -248,7 +247,9 @@ static int RenderPic( filter_t *filter, picture_t *p_outpic, picture_t *src,
     if (FAILED(hr))
         return VLC_EGENERIC;
 
-    hr = IDirect3DDevice9_StretchRect( sys->d3d_dev.dev,
+    d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueContext(filter->vctx_out);
+
+    hr = IDirect3DDevice9_StretchRect( d3d9_decoder->d3ddev.dev,
                                        sys->hw_surface, NULL,
                                        p_out_sys->surface, NULL,
                                        D3DTEXF_NONE);
@@ -304,7 +305,9 @@ picture_t *AllocPicture( filter_t *p_filter )
                 return NULL;
             pic->p_sys = pic_sys;
 
-            HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(p_sys->d3d_dev.dev,
+            d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueContext(p_filter->vctx_out);
+
+            HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(d3d9_decoder->d3ddev.dev,
                                                               p_filter->fmt_out.video.i_width,
                                                               p_filter->fmt_out.video.i_height,
                                                               dstDesc.Format,
@@ -375,11 +378,7 @@ int D3D9OpenDeinterlace(vlc_object_t *obj)
         goto error;
     }
 
-    if (FAILED(D3D9_CreateDeviceExternal( vtcx_sys->dev, &sys->hd3d, &sys->d3d_dev )))
-    {
-        msg_Dbg(filter, "Failed to use the given video context");
-        goto error;
-    }
+    d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueContext( filter->vctx_in );
 
     HRESULT (WINAPI *CreateVideoService)(IDirect3DDevice9 *,
                                          REFIID riid,
@@ -388,7 +387,7 @@ int D3D9OpenDeinterlace(vlc_object_t *obj)
       (void *)GetProcAddress(hdecoder_dll, "DXVA2CreateVideoService");
     if (CreateVideoService == NULL)
         goto error;
-    hr = CreateVideoService( sys->d3d_dev.dev, &IID_IDirectXVideoProcessorService,
+    hr = CreateVideoService( d3d9_decoder->d3ddev.dev, &IID_IDirectXVideoProcessorService,
                             (void**)&processor);
     if (FAILED(hr))
         goto error;
@@ -543,7 +542,6 @@ error:
         IDirectXVideoProcessor_Release( sys->processor );
     if (processor)
         IDirectXVideoProcessorService_Release(processor);
-    D3D9_ReleaseDevice( &sys->d3d_dev );
     if (hdecoder_dll)
         FreeLibrary(hdecoder_dll);
     D3D9_Destroy( &sys->hd3d );
@@ -559,7 +557,6 @@ void D3D9CloseDeinterlace(vlc_object_t *obj)
 
     IDirect3DSurface9_Release( sys->hw_surface );
     IDirectXVideoProcessor_Release( sys->processor );
-    D3D9_ReleaseDevice( &sys->d3d_dev );
     FreeLibrary( sys->hdecoder_dll );
     vlc_video_context_Release(filter->vctx_out);
     D3D9_Destroy( &sys->hd3d );
-- 
2.17.1



More information about the vlc-devel mailing list