[vlc-commits] va: remove vlc_va_Release() and vlc_va_Extract()

Steve Lhomme git at videolan.org
Thu Jun 22 17:27:15 CEST 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Mon Jun 19 17:29:25 2017 +0200| [1108c2c71c760394de9db03223fb9c3e0361d538] | committer: Jean-Baptiste Kempf

va: remove vlc_va_Release() and vlc_va_Extract()

Noone is using them anymore.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/avcodec/d3d11va.c |  8 --------
 modules/codec/avcodec/dxva2.c   |  8 --------
 modules/codec/avcodec/va.h      | 36 +-----------------------------------
 modules/codec/avcodec/vaapi.c   | 10 ----------
 modules/codec/avcodec/video.c   | 10 ++--------
 modules/hw/vdpau/avcodec.c      |  8 --------
 6 files changed, 3 insertions(+), 77 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 059727175b..c279568107 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -173,12 +173,6 @@ void SetupAVCodecContext(vlc_va_t *va)
         sys->hw.workaround |= FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO;
 }
 
-static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
-{
-    VLC_UNUSED(va); VLC_UNUSED(output); VLC_UNUSED(data);
-    return VLC_SUCCESS;
-}
-
 static void d3d11_pic_context_destroy(struct picture_context_t *opaque)
 {
     struct va_pic_context *pic_ctx = (struct va_pic_context*)opaque;
@@ -422,8 +416,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     va->description = DxDescribe(dx_sys);
     va->setup   = Setup;
     va->get     = Get;
-    va->release = NULL;
-    va->extract = Extract;
 
     return VLC_SUCCESS;
 
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index d0f39bf064..7b2abe9e33 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -174,12 +174,6 @@ void SetupAVCodecContext(vlc_va_t *va)
         sys->hw.workaround |= FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO;
 }
 
-static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
-{
-    VLC_UNUSED(va); VLC_UNUSED(output); VLC_UNUSED(data);
-    return VLC_SUCCESS;
-}
-
 static void d3d9_pic_context_destroy(struct picture_context_t *opaque)
 {
     struct va_pic_context *pic_ctx = (struct va_pic_context*)opaque;
@@ -336,8 +330,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     va->description = DxDescribe(sys);
     va->setup   = Setup;
     va->get     = Get;
-    va->release = NULL;
-    va->extract = Extract;
     return VLC_SUCCESS;
 
 error:
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index 99bc5ba259..04986ec983 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -41,8 +41,6 @@ struct vlc_va_t {
     void (*setup)(vlc_va_t *, vlc_fourcc_t *output);
 #endif
     int  (*get)(vlc_va_t *, picture_t *pic, uint8_t **data);
-    void (*release)(void *pic, uint8_t *data);
-    int  (*extract)(vlc_va_t *, picture_t *pic, uint8_t *data);
 };
 
 /**
@@ -72,9 +70,7 @@ vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *,
  * @param pic pointer to VLC picture being allocated [IN/OUT]
  * @param data pointer to the AVFrame data[0] and data[3] pointers [OUT]
  *
- * @note This function needs not be reentrant. However it may be called
- * concurrently with vlc_va_Extract() and/or vlc_va_Release() from other
- * threads and other frames.
+ * @note This function needs not be reentrant.
  *
  * @return VLC_SUCCESS on success, otherwise an error code.
  */
@@ -84,36 +80,6 @@ static inline int vlc_va_Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
 }
 
 /**
- * Releases a hardware surface from a libavcodec frame.
- * The surface has been previously allocated with vlc_va_Get().
- *
- * @param pic VLC picture being released [IN/OUT]
- *
- * @note This function needs not be reentrant. However it may be called
- * concurrently with vlc_va_Get() and/or vlc_va_Extract() from other threads
- * and other frames.
- */
-static inline void vlc_va_Release(vlc_va_t *va, picture_t *pic)
-{
-    va->release(pic, NULL);
-}
-
-/**
- * Extracts a hardware surface from a libavcodec frame into a VLC picture.
- * The surface has been previously allocated with vlc_va_Get() and decoded
- * by the libavcodec hardware acceleration.
- * The surface may still be used by libavcodec as a reference frame until it is
- * freed with vlc_va_Release().
- *
- * @note This function needs not be reentrant, but it may run concurrently with
- * vlc_va_Get() or vlc_va_Release() in other threads (with distinct frames).
- */
-static inline int vlc_va_Extract(vlc_va_t *va, picture_t *pic, uint8_t *data)
-{
-    return va->extract(va, pic, data);
-}
-
-/**
  * Destroys a libavcodec hardware acceleration back-end.
  * All allocated surfaces shall have been released beforehand.
  */
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index ff270425a9..2a0f1f58ce 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -126,12 +126,6 @@ static int GetVaProfile(AVCodecContext *ctx, VAProfile *va_profile,
     return VLC_SUCCESS;
 }
 
-static int Extract(vlc_va_t *va, picture_t *pic, uint8_t *data)
-{
-    (void) va; (void) pic; (void) data;
-    return VLC_SUCCESS;
-}
-
 #ifdef VLC_VA_BACKEND_DR
 
 static int GetDR(vlc_va_t *va, picture_t *pic, uint8_t **data)
@@ -216,8 +210,6 @@ static int CreateDR(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     va->sys = sys;
     va->description = vaQueryVendorString(sys->hw_ctx.display);
     va->get = GetDR;
-    va->release = NULL;
-    va->extract = Extract;
     return VLC_SUCCESS;
 
 error:
@@ -390,8 +382,6 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     va->sys = sys;
     va->description = vaQueryVendorString(sys->hw_ctx.display);
     va->get = Get;
-    va->release = NULL;
-    va->extract = Extract;
     return VLC_SUCCESS;
 
 error:
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 5bf2b67e35..ef9a8a769a 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1158,8 +1158,6 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
         }
         else
         {
-            if( p_sys->p_va != NULL )
-                vlc_va_Extract( p_sys->p_va, p_pic, frame->data[3] );
             picture_Hold( p_pic );
         }
 
@@ -1337,14 +1335,10 @@ static int lavc_va_GetFrame(struct AVCodecContext *ctx, AVFrame *frame,
      * data[3] actually contains the format-specific surface handle. */
     frame->data[3] = frame->data[0];
 
-    void (*release)(void *, uint8_t *) = va->release;
-    if (va->release == NULL)
-        release = lavc_ReleaseFrame;
-
-    frame->buf[0] = av_buffer_create(frame->data[0], 0, release, pic, 0);
+    frame->buf[0] = av_buffer_create(frame->data[0], 0, lavc_ReleaseFrame, pic, 0);
     if (unlikely(frame->buf[0] == NULL))
     {
-        release(pic, frame->data[0]);
+        lavc_ReleaseFrame(pic, frame->data[0]);
         return -1;
     }
 
diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 36eecefe51..c98832329a 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -108,12 +108,6 @@ static int Lock(vlc_va_t *va, picture_t *pic, uint8_t **data)
     return VLC_SUCCESS;
 }
 
-static int Copy(vlc_va_t *va, picture_t *pic, uint8_t *data)
-{
-    (void) va; (void) pic; (void) data;
-    return VLC_SUCCESS;
-}
-
 static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
                 const es_format_t *fmt, picture_sys_t *p_sys)
 {
@@ -203,8 +197,6 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
 
     va->description = infos;
     va->get = Lock;
-    va->release = NULL;
-    va->extract = Copy;
     return VLC_SUCCESS;
 
 error:



More information about the vlc-commits mailing list