[vlc-commits] va_surface: call NewSurfacePicContext internally

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 18 13:52:56 2019 +0200| [8f6e8502946a06909868e9f245150731fd41c34f] | committer: Steve Lhomme

va_surface: call NewSurfacePicContext internally

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

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

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index d25c8b7c34..be906950e3 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -198,9 +198,9 @@ done:
     return pic_ctx;
 }
 
-static picture_context_t* NewSurfacePicContext(void *opaque, 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 = opaque;
+    vlc_va_sys_t *sys = va->sys;
     ID3D11VideoDecoderOutputView *surface = sys->hw_surface[va_surface_GetIndex(va_surface)];
     ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW];
     ID3D11Resource *p_resource;
@@ -231,7 +231,7 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
     vlc_va_surface_t *va_surface = va_pool_Get(sys->va_pool);
     if (unlikely(va_surface == NULL))
         return VLC_ENOITEM;
-    pic->context = va_surface_GetContext(va_surface);
+    pic->context = NewSurfacePicContext(va, va_surface);
     if (unlikely(pic->context == NULL))
     {
         va_surface_Release(va_surface);
@@ -339,7 +339,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
         DxCreateDecoderSurfaces,
         DxDestroySurfaces,
         SetupAVCodecContext,
-        NewSurfacePicContext,
         sys,
     };
 
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 01bc28a743..486a9a20c3 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -196,9 +196,9 @@ static struct dxva2_pic_context *CreatePicContext(IDirect3DSurface9 *surface, ID
     return pic_ctx;
 }
 
-static picture_context_t* NewSurfacePicContext(void *opaque, 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 = opaque;
+    vlc_va_sys_t *sys = va->sys;
     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;
@@ -224,7 +224,7 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
     if (unlikely(va_surface==NULL))
         return VLC_ENOITEM;
 
-    pic->context = va_surface_GetContext(va_surface);
+    pic->context = NewSurfacePicContext(va, va_surface);
     if (unlikely(pic->context == NULL))
     {
         va_surface_Release(va_surface);
@@ -324,7 +324,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
         DxCreateVideoDecoder,
         DxDestroyVideoDecoder,
         SetupAVCodecContext,
-        NewSurfacePicContext,
         sys,
     };
 
diff --git a/modules/codec/avcodec/va_surface.c b/modules/codec/avcodec/va_surface.c
index 8edfbb7117..13161634b7 100644
--- a/modules/codec/avcodec/va_surface.c
+++ b/modules/codec/avcodec/va_surface.c
@@ -165,14 +165,6 @@ vlc_va_surface_t *va_pool_Get(va_pool_t *va_pool)
     return surface;
 }
 
-picture_context_t *va_surface_GetContext(vlc_va_surface_t *surface)
-{
-    picture_context_t *pic_va_ctx = surface->va_pool->callbacks.pf_new_surface_context(surface->va_pool->callbacks.opaque, surface);
-    if (unlikely(pic_va_ctx==NULL))
-        return NULL;
-    return pic_va_ctx;
-}
-
 void va_surface_AddRef(vlc_va_surface_t *surface)
 {
     atomic_fetch_add(&surface->refcount, 1);
diff --git a/modules/codec/avcodec/va_surface_internal.h b/modules/codec/avcodec/va_surface_internal.h
index ab3c7e01d2..9968e3483a 100644
--- a/modules/codec/avcodec/va_surface_internal.h
+++ b/modules/codec/avcodec/va_surface_internal.h
@@ -55,11 +55,6 @@ struct va_pool_cfg {
      */
     void (*pf_setup_avcodec_ctx)(void *opaque);
 
-    /**
-     * Create a new context for the surface being acquired
-     */
-    picture_context_t* (*pf_new_surface_context)(void *opaque, vlc_va_surface_t *);
-
     void *opaque;
 };
 
@@ -68,7 +63,6 @@ void va_pool_Close(vlc_va_t *va, va_pool_t *);
 int va_pool_SetupDecoder(vlc_va_t *, va_pool_t *, const AVCodecContext *, const video_format_t *, unsigned count);
 vlc_va_surface_t *va_pool_Get(va_pool_t *);
 
-picture_context_t *va_surface_GetContext(vlc_va_surface_t *);
 unsigned va_surface_GetIndex(vlc_va_surface_t *surface);
 void va_surface_AddRef(vlc_va_surface_t *surface);
 void va_surface_Release(vlc_va_surface_t *surface);



More information about the vlc-commits mailing list