[vlc-commits] hw:d3d11: replace local structures by d3d11_processor_t

Steve Lhomme git at videolan.org
Mon May 28 13:24:54 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu Nov 30 09:34:45 2017 +0100| [59aceafcc982489d2fbdfb721e5b9264025c1c3e] | committer: Steve Lhomme

hw:d3d11: replace local structures by d3d11_processor_t

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

 modules/hw/d3d11/d3d11_deinterlace.c | 64 +++++++++++++++++-----------------
 modules/hw/d3d11/d3d11_filters.c     | 60 ++++++++++++++++----------------
 modules/hw/d3d11/d3d11_surface.c     | 66 +++++++++++++++++-------------------
 3 files changed, 92 insertions(+), 98 deletions(-)

diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index 2a4e6a60e4..076d9396ee 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -36,6 +36,7 @@
 #include <d3d11.h>
 
 #include "d3d11_filters.h"
+#include "d3d11_processor.h"
 #include "../../video_chroma/d3d11_fmt.h"
 #include "../../video_filter/deinterlace/common.h"
 
@@ -53,10 +54,7 @@ typedef struct
 {
     d3d11_handle_t                 hd3d;
     d3d11_device_t                 d3d_dev;
-    ID3D11VideoDevice              *d3dviddev;
-    ID3D11VideoContext             *d3dvidctx;
-    ID3D11VideoProcessor           *videoProcessor;
-    ID3D11VideoProcessorEnumerator *procEnumerator;
+    d3d11_processor_t              d3d_proc;
 
     union {
         ID3D11Texture2D            *outTexture;
@@ -100,9 +98,9 @@ static int assert_ProcessorInput(filter_t *p_filter, picture_sys_t *p_sys_src)
         };
         HRESULT hr;
 
-        hr = ID3D11VideoDevice_CreateVideoProcessorInputView(p_sys->d3dviddev,
+        hr = ID3D11VideoDevice_CreateVideoProcessorInputView(p_sys->d3d_proc.d3dviddev,
                                                              p_sys_src->resource[KNOWN_DXGI_INDEX],
-                                                             p_sys->procEnumerator,
+                                                             p_sys->d3d_proc.procEnumerator,
                                                              &inDesc,
                                                              &p_sys_src->processorInput);
         if (FAILED(hr))
@@ -139,7 +137,7 @@ static int RenderPic( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,
                 D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST :
                 D3D11_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST;
 
-    ID3D11VideoContext_VideoProcessorSetStreamFrameFormat(p_sys->d3dvidctx, p_sys->videoProcessor, 0, frameFormat);
+    ID3D11VideoContext_VideoProcessorSetStreamFrameFormat(p_sys->d3d_proc.d3dvidctx, p_sys->d3d_proc.videoProcessor, 0, frameFormat);
 
     D3D11_VIDEO_PROCESSOR_STREAM stream = {0};
     stream.Enable = TRUE;
@@ -191,12 +189,12 @@ static int RenderPic( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,
     srcRect.top    = p_pic->format.i_y_offset;
     srcRect.right  = srcRect.left + p_pic->format.i_visible_width;
     srcRect.bottom = srcRect.top  + p_pic->format.i_visible_height;
-    ID3D11VideoContext_VideoProcessorSetStreamSourceRect(p_sys->d3dvidctx, p_sys->videoProcessor,
+    ID3D11VideoContext_VideoProcessorSetStreamSourceRect(p_sys->d3d_proc.d3dvidctx, p_sys->d3d_proc.videoProcessor,
                                                          0, TRUE, &srcRect);
-    ID3D11VideoContext_VideoProcessorSetStreamDestRect(p_sys->d3dvidctx, p_sys->videoProcessor,
+    ID3D11VideoContext_VideoProcessorSetStreamDestRect(p_sys->d3d_proc.d3dvidctx, p_sys->d3d_proc.videoProcessor,
                                                          0, TRUE, &srcRect);
 
-    hr = ID3D11VideoContext_VideoProcessorBlt(p_sys->d3dvidctx, p_sys->videoProcessor,
+    hr = ID3D11VideoContext_VideoProcessorBlt(p_sys->d3d_proc.d3dvidctx, p_sys->d3d_proc.videoProcessor,
                                               p_sys->processorOutput,
                                               0, 1, &stream);
     if (FAILED(hr))
@@ -370,13 +368,13 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
     if (D3D11_Create(filter, &sys->hd3d) != VLC_SUCCESS)
         goto error;
 
-    hr = ID3D11Device_QueryInterface(sys->d3d_dev.d3ddevice, &IID_ID3D11VideoDevice, (void **)&sys->d3dviddev);
+    hr = ID3D11Device_QueryInterface(sys->d3d_dev.d3ddevice, &IID_ID3D11VideoDevice, (void **)&sys->d3d_proc.d3dviddev);
     if (FAILED(hr)) {
        msg_Err(filter, "Could not Query ID3D11VideoDevice Interface. (hr=0x%lX)", hr);
        goto error;
     }
 
-    hr = ID3D11DeviceContext_QueryInterface(sys->d3d_dev.d3dcontext, &IID_ID3D11VideoContext, (void **)&sys->d3dvidctx);
+    hr = ID3D11DeviceContext_QueryInterface(sys->d3d_dev.d3dcontext, &IID_ID3D11VideoContext, (void **)&sys->d3d_proc.d3dvidctx);
     if (FAILED(hr)) {
        msg_Err(filter, "Could not Query ID3D11VideoContext Interface from the picture. (hr=0x%lX)", hr);
        goto error;
@@ -400,7 +398,7 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
         },
         .Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL,
     };
-    hr = ID3D11VideoDevice_CreateVideoProcessorEnumerator(sys->d3dviddev, &processorDesc, &processorEnumerator);
+    hr = ID3D11VideoDevice_CreateVideoProcessorEnumerator(sys->d3d_proc.d3dviddev, &processorDesc, &processorEnumerator);
     if ( processorEnumerator == NULL )
     {
         msg_Dbg(filter, "Can't get a video processor for the video.");
@@ -446,13 +444,13 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
         if (!(rateCaps.ProcessorCaps & p_mode->i_mode))
             continue;
 
-        hr = ID3D11VideoDevice_CreateVideoProcessor(sys->d3dviddev,
-                                                    processorEnumerator, type, &sys->videoProcessor);
+        hr = ID3D11VideoDevice_CreateVideoProcessor(sys->d3d_proc.d3dviddev,
+                                                    processorEnumerator, type, &sys->d3d_proc.videoProcessor);
         if (SUCCEEDED(hr))
             break;
-        sys->videoProcessor = NULL;
+        sys->d3d_proc.videoProcessor = NULL;
     }
-    if ( sys->videoProcessor==NULL &&
+    if ( sys->d3d_proc.videoProcessor==NULL &&
          p_mode->i_mode != D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB )
     {
         msg_Dbg(filter, "mode %s not available, trying bob", psz_mode);
@@ -463,15 +461,15 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
             if (!(rateCaps.ProcessorCaps & D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB))
                 continue;
 
-            hr = ID3D11VideoDevice_CreateVideoProcessor(sys->d3dviddev,
-                                                        processorEnumerator, type, &sys->videoProcessor);
+            hr = ID3D11VideoDevice_CreateVideoProcessor(sys->d3d_proc.d3dviddev,
+                                                        processorEnumerator, type, &sys->d3d_proc.videoProcessor);
             if (SUCCEEDED(hr))
                 break;
-            sys->videoProcessor = NULL;
+            sys->d3d_proc.videoProcessor = NULL;
         }
     }
 
-    if (sys->videoProcessor == NULL)
+    if (sys->d3d_proc.videoProcessor == NULL)
     {
         msg_Dbg(filter, "couldn't find a deinterlacing filter");
         goto error;
@@ -501,7 +499,7 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
         .ViewDimension = D3D11_VPOV_DIMENSION_TEXTURE2D,
     };
 
-    hr = ID3D11VideoDevice_CreateVideoProcessorOutputView(sys->d3dviddev,
+    hr = ID3D11VideoDevice_CreateVideoProcessorOutputView(sys->d3d_proc.d3dviddev,
                                                          sys->outResource,
                                                          processorEnumerator,
                                                          &outDesc,
@@ -512,7 +510,7 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
         goto error;
     }
 
-    sys->procEnumerator  = processorEnumerator;
+    sys->d3d_proc.procEnumerator  = processorEnumerator;
 
     InitDeinterlacingContext( &sys->context );
 
@@ -547,14 +545,14 @@ error:
         ID3D11VideoProcessorOutputView_Release(sys->processorOutput);
     if (sys->outTexture)
         ID3D11Texture2D_Release(sys->outTexture);
-    if (sys->videoProcessor)
-        ID3D11VideoProcessor_Release(sys->videoProcessor);
+    if (sys->d3d_proc.videoProcessor)
+        ID3D11VideoProcessor_Release(sys->d3d_proc.videoProcessor);
     if (processorEnumerator)
         ID3D11VideoProcessorEnumerator_Release(processorEnumerator);
-    if (sys->d3dvidctx)
-        ID3D11VideoContext_Release(sys->d3dvidctx);
-    if (sys->d3dviddev)
-        ID3D11VideoDevice_Release(sys->d3dviddev);
+    if (sys->d3d_proc.d3dvidctx)
+        ID3D11VideoContext_Release(sys->d3d_proc.d3dvidctx);
+    if (sys->d3d_proc.d3dviddev)
+        ID3D11VideoDevice_Release(sys->d3d_proc.d3dviddev);
     if (sys->d3d_dev.d3dcontext)
         D3D11_FilterReleaseInstance(&sys->d3d_dev);
     D3D11_Destroy(&sys->hd3d);
@@ -571,10 +569,10 @@ void D3D11CloseDeinterlace(vlc_object_t *obj)
     if (likely(sys->processorOutput))
         ID3D11VideoProcessorOutputView_Release(sys->processorOutput);
     ID3D11Texture2D_Release(sys->outTexture);
-    ID3D11VideoProcessor_Release(sys->videoProcessor);
-    ID3D11VideoProcessorEnumerator_Release(sys->procEnumerator);
-    ID3D11VideoContext_Release(sys->d3dvidctx);
-    ID3D11VideoDevice_Release(sys->d3dviddev);
+    ID3D11VideoProcessor_Release(sys->d3d_proc.videoProcessor);
+    ID3D11VideoProcessorEnumerator_Release(sys->d3d_proc.procEnumerator);
+    ID3D11VideoContext_Release(sys->d3d_proc.d3dvidctx);
+    ID3D11VideoDevice_Release(sys->d3d_proc.d3dviddev);
     D3D11_FilterReleaseInstance(&sys->d3d_dev);
     D3D11_Destroy(&sys->hd3d);
 
diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c
index cba82af128..dc0556ffd4 100644
--- a/modules/hw/d3d11/d3d11_filters.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -39,6 +39,7 @@
 #include <d3d11.h>
 
 #include "d3d11_filters.h"
+#include "d3d11_processor.h"
 #include "../../video_chroma/d3d11_fmt.h"
 
 #ifdef __MINGW32__
@@ -70,10 +71,7 @@ typedef struct
     struct filter_level Saturation;
 
     d3d11_device_t                 d3d_dev;
-    ID3D11VideoDevice              *d3dviddev;
-    ID3D11VideoContext             *d3dvidctx;
-    ID3D11VideoProcessor           *videoProcessor;
-    ID3D11VideoProcessorEnumerator *procEnumerator;
+    d3d11_processor_t              d3d_proc;
 
     union {
         ID3D11Texture2D            *texture;
@@ -116,9 +114,9 @@ static int assert_ProcessorInput(filter_t *p_filter, picture_sys_t *p_sys_src)
         };
         HRESULT hr;
 
-        hr = ID3D11VideoDevice_CreateVideoProcessorInputView(p_sys->d3dviddev,
+        hr = ID3D11VideoDevice_CreateVideoProcessorInputView(p_sys->d3d_proc.d3dviddev,
                                                              p_sys_src->resource[KNOWN_DXGI_INDEX],
-                                                             p_sys->procEnumerator,
+                                                             p_sys->d3d_proc.procEnumerator,
                                                              &inDesc,
                                                              &p_sys_src->processorInput);
         if (FAILED(hr))
@@ -145,8 +143,8 @@ static bool ApplyFilter( filter_sys_t *p_sys,
     if (level == p_level->Range.Default)
         return false;
 
-    ID3D11VideoContext_VideoProcessorSetStreamFilter(p_sys->d3dvidctx,
-                                                     p_sys->videoProcessor,
+    ID3D11VideoContext_VideoProcessorSetStreamFilter(p_sys->d3d_proc.d3dvidctx,
+                                                     p_sys->d3d_proc.videoProcessor,
                                                      0,
                                                      filter,
                                                      TRUE,
@@ -157,17 +155,17 @@ static bool ApplyFilter( filter_sys_t *p_sys,
     srcRect.top    = fmt->i_y_offset;
     srcRect.right  = srcRect.left + fmt->i_visible_width;
     srcRect.bottom = srcRect.top  + fmt->i_visible_height;
-    ID3D11VideoContext_VideoProcessorSetStreamSourceRect(p_sys->d3dvidctx, p_sys->videoProcessor,
+    ID3D11VideoContext_VideoProcessorSetStreamSourceRect(p_sys->d3d_proc.d3dvidctx, p_sys->d3d_proc.videoProcessor,
                                                          0, TRUE, &srcRect);
-    ID3D11VideoContext_VideoProcessorSetStreamDestRect(p_sys->d3dvidctx, p_sys->videoProcessor,
+    ID3D11VideoContext_VideoProcessorSetStreamDestRect(p_sys->d3d_proc.d3dvidctx, p_sys->d3d_proc.videoProcessor,
                                                        0, TRUE, &srcRect);
 
     D3D11_VIDEO_PROCESSOR_STREAM stream = {0};
     stream.Enable = TRUE;
     stream.pInputSurface = input;
 
-    hr = ID3D11VideoContext_VideoProcessorBlt(p_sys->d3dvidctx,
-                                              p_sys->videoProcessor,
+    hr = ID3D11VideoContext_VideoProcessorBlt(p_sys->d3d_proc.d3dvidctx,
+                                              p_sys->d3d_proc.videoProcessor,
                                               output,
                                               0, 1, &stream);
     return SUCCEEDED(hr);
@@ -367,13 +365,13 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
         return VLC_ENOOBJ;
     }
 
-    hr = ID3D11Device_QueryInterface(sys->d3d_dev.d3ddevice, &IID_ID3D11VideoDevice, (void **)&sys->d3dviddev);
+    hr = ID3D11Device_QueryInterface(sys->d3d_dev.d3ddevice, &IID_ID3D11VideoDevice, (void **)&sys->d3d_proc.d3dviddev);
     if (FAILED(hr)) {
        msg_Err(filter, "Could not Query ID3D11VideoDevice Interface. (hr=0x%lX)", hr);
        goto error;
     }
 
-    hr = ID3D11DeviceContext_QueryInterface(sys->d3d_dev.d3dcontext, &IID_ID3D11VideoContext, (void **)&sys->d3dvidctx);
+    hr = ID3D11DeviceContext_QueryInterface(sys->d3d_dev.d3dcontext, &IID_ID3D11VideoContext, (void **)&sys->d3d_proc.d3dvidctx);
     if (FAILED(hr)) {
        msg_Err(filter, "Could not Query ID3D11VideoContext Interface from the picture. (hr=0x%lX)", hr);
        goto error;
@@ -397,7 +395,7 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
         },
         .Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL,
     };
-    hr = ID3D11VideoDevice_CreateVideoProcessorEnumerator(sys->d3dviddev, &processorDesc, &processorEnumerator);
+    hr = ID3D11VideoDevice_CreateVideoProcessorEnumerator(sys->d3d_proc.d3dviddev, &processorDesc, &processorEnumerator);
     if ( processorEnumerator == NULL )
     {
         msg_Dbg(filter, "Can't get a video processor for the video.");
@@ -480,10 +478,10 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
     var_AddCallback( filter, "brightness-threshold",
                                              AdjustCallback, sys );
 
-    hr = ID3D11VideoDevice_CreateVideoProcessor(sys->d3dviddev,
+    hr = ID3D11VideoDevice_CreateVideoProcessor(sys->d3d_proc.d3dviddev,
                                                 processorEnumerator, 0,
-                                                &sys->videoProcessor);
-    if (FAILED(hr) || sys->videoProcessor == NULL)
+                                                &sys->d3d_proc.videoProcessor);
+    if (FAILED(hr) || sys->d3d_proc.videoProcessor == NULL)
     {
         msg_Dbg(filter, "failed to create the processor");
         goto error;
@@ -527,7 +525,7 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
 
     for (int i=0; i<PROCESSOR_SLICES; i++)
     {
-        hr = ID3D11VideoDevice_CreateVideoProcessorOutputView(sys->d3dviddev,
+        hr = ID3D11VideoDevice_CreateVideoProcessorOutputView(sys->d3d_proc.d3dviddev,
                                                              sys->out[i].resource,
                                                              processorEnumerator,
                                                              &outDesc,
@@ -538,7 +536,7 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
             goto error;
         }
 
-        hr = ID3D11VideoDevice_CreateVideoProcessorInputView(sys->d3dviddev,
+        hr = ID3D11VideoDevice_CreateVideoProcessorInputView(sys->d3d_proc.d3dviddev,
                                                              sys->out[0].resource,
                                                              processorEnumerator,
                                                              &inDesc,
@@ -551,7 +549,7 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
         }
     }
 
-    sys->procEnumerator  = processorEnumerator;
+    sys->d3d_proc.procEnumerator  = processorEnumerator;
 
     filter->pf_video_filter = Filter;
     filter->p_sys = sys;
@@ -570,14 +568,14 @@ error:
         ID3D11Texture2D_Release(sys->out[0].texture);
     if (sys->out[1].texture)
         ID3D11Texture2D_Release(sys->out[1].texture);
-    if (sys->videoProcessor)
-        ID3D11VideoProcessor_Release(sys->videoProcessor);
+    if (sys->d3d_proc.videoProcessor)
+        ID3D11VideoProcessor_Release(sys->d3d_proc.videoProcessor);
     if (processorEnumerator)
         ID3D11VideoProcessorEnumerator_Release(processorEnumerator);
-    if (sys->d3dvidctx)
-        ID3D11VideoContext_Release(sys->d3dvidctx);
-    if (sys->d3dviddev)
-        ID3D11VideoDevice_Release(sys->d3dviddev);
+    if (sys->d3d_proc.d3dvidctx)
+        ID3D11VideoContext_Release(sys->d3d_proc.d3dvidctx);
+    if (sys->d3d_proc.d3dviddev)
+        ID3D11VideoDevice_Release(sys->d3d_proc.d3dviddev);
     if (sys->d3d_dev.d3dcontext)
         D3D11_FilterReleaseInstance(&sys->d3d_dev);
     free(sys);
@@ -605,10 +603,10 @@ static void D3D11CloseAdjust(vlc_object_t *obj)
     }
     ID3D11Texture2D_Release(sys->out[0].texture);
     ID3D11Texture2D_Release(sys->out[1].texture);
-    ID3D11VideoProcessor_Release(sys->videoProcessor);
-    ID3D11VideoProcessorEnumerator_Release(sys->procEnumerator);
-    ID3D11VideoContext_Release(sys->d3dvidctx);
-    ID3D11VideoDevice_Release(sys->d3dviddev);
+    ID3D11VideoProcessor_Release(sys->d3d_proc.videoProcessor);
+    ID3D11VideoProcessorEnumerator_Release(sys->d3d_proc.procEnumerator);
+    ID3D11VideoContext_Release(sys->d3d_proc.d3dvidctx);
+    ID3D11VideoDevice_Release(sys->d3d_proc.d3dviddev);
 
     D3D11_FilterReleaseInstance(&sys->d3d_dev);
 
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index a9b35ba446..dcc88db0ff 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -42,6 +42,7 @@
 #include <d3d11.h>
 
 #include "d3d11_filters.h"
+#include "d3d11_processor.h"
 #include "../../video_chroma/d3d11_fmt.h"
 
 #ifdef ID3D11VideoContext_VideoProcessorBlt
@@ -65,11 +66,8 @@ typedef struct
         ID3D11Resource   *procOutResource;
     };
     /* 420_OPAQUE processor */
-    ID3D11VideoDevice              *d3dviddev;
-    ID3D11VideoContext             *d3dvidctx;
     ID3D11VideoProcessorOutputView *processorOutput;
-    ID3D11VideoProcessorEnumerator *procEnumerator;
-    ID3D11VideoProcessor           *videoProcessor;
+    d3d11_processor_t              d3d_proc;
 #endif
     d3d11_device_t                 d3d_dev;
 
@@ -88,11 +86,11 @@ static int SetupProcessor(filter_t *p_filter, d3d11_device_t *d3d_dev,
     HRESULT hr;
     ID3D11VideoProcessorEnumerator *processorEnumerator = NULL;
 
-    hr = ID3D11DeviceContext_QueryInterface(d3d_dev->d3dcontext, &IID_ID3D11VideoContext, (void **)&sys->d3dvidctx);
+    hr = ID3D11DeviceContext_QueryInterface(d3d_dev->d3dcontext, &IID_ID3D11VideoContext, (void **)&sys->d3d_proc.d3dvidctx);
     if (unlikely(FAILED(hr)))
         goto error;
 
-    hr = ID3D11Device_QueryInterface( d3d_dev->d3ddevice, &IID_ID3D11VideoDevice, (void **)&sys->d3dviddev);
+    hr = ID3D11Device_QueryInterface( d3d_dev->d3ddevice, &IID_ID3D11VideoDevice, (void **)&sys->d3d_proc.d3dviddev);
     if (unlikely(FAILED(hr)))
         goto error;
 
@@ -109,7 +107,7 @@ static int SetupProcessor(filter_t *p_filter, d3d11_device_t *d3d_dev,
         .OutputHeight = fmt->i_height,
         .Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL,
     };
-    hr = ID3D11VideoDevice_CreateVideoProcessorEnumerator(sys->d3dviddev, &processorDesc, &processorEnumerator);
+    hr = ID3D11VideoDevice_CreateVideoProcessorEnumerator(sys->d3d_proc.d3dviddev, &processorDesc, &processorEnumerator);
     if ( processorEnumerator == NULL )
     {
         msg_Dbg(p_filter, "Can't get a video processor for the video.");
@@ -138,15 +136,15 @@ static int SetupProcessor(filter_t *p_filter, d3d11_device_t *d3d_dev,
     hr = ID3D11VideoProcessorEnumerator_GetVideoProcessorCaps(processorEnumerator, &processorCaps);
     for (UINT type = 0; type < processorCaps.RateConversionCapsCount; ++type)
     {
-        hr = ID3D11VideoDevice_CreateVideoProcessor(sys->d3dviddev,
-                                                    processorEnumerator, type, &sys->videoProcessor);
+        hr = ID3D11VideoDevice_CreateVideoProcessor(sys->d3d_proc.d3dviddev,
+                                                    processorEnumerator, type, &sys->d3d_proc.videoProcessor);
         if (SUCCEEDED(hr))
         {
             D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC outDesc = {
                 .ViewDimension = D3D11_VPOV_DIMENSION_TEXTURE2D,
             };
 
-            hr = ID3D11VideoDevice_CreateVideoProcessorOutputView(sys->d3dviddev,
+            hr = ID3D11VideoDevice_CreateVideoProcessorOutputView(sys->d3d_proc.d3dviddev,
                                                              sys->procOutResource,
                                                              processorEnumerator,
                                                              &outDesc,
@@ -155,24 +153,24 @@ static int SetupProcessor(filter_t *p_filter, d3d11_device_t *d3d_dev,
                 msg_Err(p_filter, "Failed to create the processor output. (hr=0x%lX)", hr);
             else
             {
-                sys->procEnumerator  = processorEnumerator;
+                sys->d3d_proc.procEnumerator  = processorEnumerator;
                 return VLC_SUCCESS;
             }
         }
-        if (sys->videoProcessor)
+        if (sys->d3d_proc.videoProcessor)
         {
-            ID3D11VideoProcessor_Release(sys->videoProcessor);
-            sys->videoProcessor = NULL;
+            ID3D11VideoProcessor_Release(sys->d3d_proc.videoProcessor);
+            sys->d3d_proc.videoProcessor = NULL;
         }
     }
 
 error:
     if (processorEnumerator)
         ID3D11VideoProcessorEnumerator_Release(processorEnumerator);
-    if (sys->d3dvidctx)
-        ID3D11VideoContext_Release(sys->d3dvidctx);
-    if (sys->d3dviddev)
-        ID3D11VideoDevice_Release(sys->d3dviddev);
+    if (sys->d3d_proc.d3dvidctx)
+        ID3D11VideoContext_Release(sys->d3d_proc.d3dvidctx);
+    if (sys->d3d_proc.d3dviddev)
+        ID3D11VideoDevice_Release(sys->d3d_proc.d3dviddev);
     return VLC_EGENERIC;
 }
 #endif
@@ -295,7 +293,7 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
     ID3D11Resource *srcResource = p_sys->resource[KNOWN_DXGI_INDEX];
 
 #if CAN_PROCESSOR
-    if (sys->procEnumerator)
+    if (sys->d3d_proc.procEnumerator)
     {
         HRESULT hr;
         if (!p_sys->processorInput)
@@ -307,9 +305,9 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
                 .Texture2D.ArraySlice = viewDesc.Texture2D.ArraySlice,
             };
 
-            hr = ID3D11VideoDevice_CreateVideoProcessorInputView(sys->d3dviddev,
+            hr = ID3D11VideoDevice_CreateVideoProcessorInputView(sys->d3d_proc.d3dviddev,
                                                                  p_sys->resource[KNOWN_DXGI_INDEX],
-                                                                 sys->procEnumerator,
+                                                                 sys->d3d_proc.procEnumerator,
                                                                  &inDesc,
                                                                  &p_sys->processorInput);
             if (FAILED(hr))
@@ -325,7 +323,7 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
             .pInputSurface = p_sys->processorInput,
         };
 
-        hr = ID3D11VideoContext_VideoProcessorBlt(sys->d3dvidctx, sys->videoProcessor,
+        hr = ID3D11VideoContext_VideoProcessorBlt(sys->d3d_proc.d3dvidctx, sys->d3d_proc.videoProcessor,
                                                           sys->processorOutput,
                                                           0, 1, &stream);
         if (FAILED(hr))
@@ -437,7 +435,7 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
     UINT srcSlice = viewDesc.Texture2D.ArraySlice;
 
 #if CAN_PROCESSOR
-    if (sys->procEnumerator)
+    if (sys->d3d_proc.procEnumerator)
     {
         HRESULT hr;
         if (!p_sys->processorInput)
@@ -449,9 +447,9 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
                 .Texture2D.ArraySlice = viewDesc.Texture2D.ArraySlice,
             };
 
-            hr = ID3D11VideoDevice_CreateVideoProcessorInputView(sys->d3dviddev,
+            hr = ID3D11VideoDevice_CreateVideoProcessorInputView(sys->d3d_proc.d3dviddev,
                                                                  p_sys->resource[KNOWN_DXGI_INDEX],
-                                                                 sys->procEnumerator,
+                                                                 sys->d3d_proc.procEnumerator,
                                                                  &inDesc,
                                                                  &p_sys->processorInput);
             if (FAILED(hr))
@@ -467,7 +465,7 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
             .pInputSurface = p_sys->processorInput,
         };
 
-        hr = ID3D11VideoContext_VideoProcessorBlt(sys->d3dvidctx, sys->videoProcessor,
+        hr = ID3D11VideoContext_VideoProcessorBlt(sys->d3d_proc.d3dvidctx, sys->d3d_proc.videoProcessor,
                                                           sys->processorOutput,
                                                           0, 1, &stream);
         if (FAILED(hr))
@@ -899,14 +897,14 @@ void D3D11CloseConverter( vlc_object_t *obj )
     filter_t *p_filter = (filter_t *)obj;
     filter_sys_t *p_sys = p_filter->p_sys;
 #if CAN_PROCESSOR
-    if (p_sys->d3dviddev)
-        ID3D11VideoDevice_Release(p_sys->d3dviddev);
-    if (p_sys->d3dvidctx)
-        ID3D11VideoContext_Release(p_sys->d3dvidctx);
-    if (p_sys->procEnumerator)
-        ID3D11VideoProcessorEnumerator_Release(p_sys->procEnumerator);
-    if (p_sys->videoProcessor)
-        ID3D11VideoProcessor_Release(p_sys->videoProcessor);
+    if (p_sys->d3d_proc.d3dviddev)
+        ID3D11VideoDevice_Release(p_sys->d3d_proc.d3dviddev);
+    if (p_sys->d3d_proc.d3dvidctx)
+        ID3D11VideoContext_Release(p_sys->d3d_proc.d3dvidctx);
+    if (p_sys->d3d_proc.procEnumerator)
+        ID3D11VideoProcessorEnumerator_Release(p_sys->d3d_proc.procEnumerator);
+    if (p_sys->d3d_proc.videoProcessor)
+        ID3D11VideoProcessor_Release(p_sys->d3d_proc.videoProcessor);
 #endif
     CopyCleanCache(&p_sys->cache);
     vlc_mutex_destroy(&p_sys->staging_lock);



More information about the vlc-commits mailing list