[vlc-commits] va_surface: don't pass the surface index to allocate a picture context

Steve Lhomme git at videolan.org
Fri Oct 18 14:50:36 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 18 14:04:02 2019 +0200| [96f66f06b8d7089fcb23614fe3efa797977b0d8d] | committer: Steve Lhomme

va_surface: don't pass the surface index to allocate a picture context

We get it from the va_surface directly.

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

 modules/codec/avcodec/d3d11va.c             | 4 ++--
 modules/codec/avcodec/dxva2.c               | 4 ++--
 modules/codec/avcodec/va_surface.c          | 2 +-
 modules/codec/avcodec/va_surface_internal.h | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index ba2c6931b0..ef0c142f2a 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -198,10 +198,10 @@ done:
     return pic_ctx;
 }
 
-static picture_context_t* NewSurfacePicContext(vlc_va_t *va, int surface_index, vlc_va_surface_t *va_surface)
+static picture_context_t* NewSurfacePicContext(vlc_va_t *va, vlc_va_surface_t *va_surface)
 {
     vlc_va_sys_t *sys = va->sys;
-    ID3D11VideoDecoderOutputView *surface = sys->hw_surface[surface_index];
+    ID3D11VideoDecoderOutputView *surface = sys->hw_surface[va_surface_GetIndex(va_surface)];
     ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW];
     ID3D11Resource *p_resource;
     ID3D11VideoDecoderOutputView_GetResource(surface, &p_resource);
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 0972725f01..dd5b0ce529 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -196,10 +196,10 @@ static struct dxva2_pic_context *CreatePicContext(IDirect3DSurface9 *surface, ID
     return pic_ctx;
 }
 
-static picture_context_t* NewSurfacePicContext(vlc_va_t *va, int surface_index, vlc_va_surface_t *va_surface)
+static picture_context_t* NewSurfacePicContext(vlc_va_t *va, vlc_va_surface_t *va_surface)
 {
     vlc_va_sys_t *sys = va->sys;
-    struct dxva2_pic_context *pic_ctx = CreatePicContext(sys->hw_surface[surface_index], sys->hw.decoder);
+    struct dxva2_pic_context *pic_ctx = CreatePicContext(sys->hw_surface[va_surface_GetIndex(va_surface)], sys->hw.decoder);
     if (unlikely(pic_ctx==NULL))
         return NULL;
     /* all the resources are acquired during surfaces init, and a second time in
diff --git a/modules/codec/avcodec/va_surface.c b/modules/codec/avcodec/va_surface.c
index 52a9e3e5d1..e9052e01cb 100644
--- a/modules/codec/avcodec/va_surface.c
+++ b/modules/codec/avcodec/va_surface.c
@@ -118,7 +118,7 @@ static int SetupSurfaces(vlc_va_t *va, va_pool_t *va_pool)
             goto done;
         p_surface->index = i;
         p_surface->va_pool = va_pool;
-        p_surface->pic_va_ctx = va_pool->callbacks.pf_new_surface_context(va, i, p_surface);
+        p_surface->pic_va_ctx = va_pool->callbacks.pf_new_surface_context(va, p_surface);
         if (unlikely(p_surface->pic_va_ctx==NULL))
         {
             free(p_surface);
diff --git a/modules/codec/avcodec/va_surface_internal.h b/modules/codec/avcodec/va_surface_internal.h
index deb25125b0..0458d484ea 100644
--- a/modules/codec/avcodec/va_surface_internal.h
+++ b/modules/codec/avcodec/va_surface_internal.h
@@ -58,7 +58,7 @@ struct va_pool_cfg {
     /**
      * Create a new context for the surface being acquired
      */
-    picture_context_t* (*pf_new_surface_context)(vlc_va_t *, int surface_index, vlc_va_surface_t *);
+    picture_context_t* (*pf_new_surface_context)(vlc_va_t *, vlc_va_surface_t *);
 
     void *opaque;
 };



More information about the vlc-commits mailing list