[vlc-commits] nvdec: move and rename picture context callback

Quentin Chateau git at videolan.org
Fri Apr 3 10:53:44 CEST 2020


vlc | branch: master | Quentin Chateau <quentin.chateau at deepskycorp.com> | Mon Mar 30 11:26:54 2020 +0200| [4d1baa22165db8edc68efa8639f2e7d77c71d802] | committer: Steve Lhomme

nvdec: move and rename picture context callback

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

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

 modules/hw/nvdec/nvdec.c | 45 ++++++++++++++++++++-------------------------
 1 file changed, 20 insertions(+), 25 deletions(-)

diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index 928cb009a7..ecf6a5958a 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -115,10 +115,6 @@ typedef struct nvdec_ctx {
 #define CALL_CUVID(func, ...)    CudaCheckErr(VLC_OBJECT(p_dec),  p_sys->devsys->cudaFunctions, p_sys->cuvidFunctions->func(__VA_ARGS__), #func)
 #define CALL_CUDA_POOL(func, ...) pool->nvdec_dev->cudaFunctions->func(__VA_ARGS__)
 
-
-static void NVDecCtxDestroy(struct picture_context_t *picctx);
-static struct picture_context_t *NVDecCtxClone(struct picture_context_t *srcctx);
-
 static void nvdec_pool_Destroy(nvdec_pool_t *pool)
 {
     for (size_t i=0; i < ARRAY_SIZE(pool->outputDevicePtr); i++)
@@ -195,6 +191,24 @@ error:
     return NULL;
 }
 
+static void nvdec_picture_CtxDestroy(struct picture_context_t *picctx)
+{
+    pic_context_nvdec_t *srcpic = NVDEC_PICCONTEXT_FROM_PICCTX(picctx);
+    free(srcpic);
+}
+
+static struct picture_context_t *nvdec_picture_CtxClone(struct picture_context_t *srcctx)
+{
+    pic_context_nvdec_t *clonectx = malloc(sizeof(*clonectx));
+    if (unlikely(clonectx == NULL))
+        return NULL;
+    pic_context_nvdec_t *srcpic = NVDEC_PICCONTEXT_FROM_PICCTX(srcctx);
+
+    *clonectx = *srcpic;
+    vlc_video_context_Hold(clonectx->ctx.vctx);
+    return &clonectx->ctx;
+}
+
 static picture_t* nvdec_pool_Wait(nvdec_pool_t *pool)
 {
     picture_t *pic = picture_pool_Wait(pool->picture_pool);
@@ -206,8 +220,8 @@ static picture_t* nvdec_pool_Wait(nvdec_pool_t *pool)
         goto error;
 
     picctx->ctx = (picture_context_t) {
-        NVDecCtxDestroy,
-        NVDecCtxClone,
+        nvdec_picture_CtxDestroy,
+        nvdec_picture_CtxClone,
         pool->vctx,
     };
     vlc_video_context_Hold(picctx->ctx.vctx);
@@ -404,25 +418,6 @@ static int CUDAAPI HandlePictureDecode(void *p_opaque, CUVIDPICPARAMS *p_picpara
     return (ret == VLC_SUCCESS);
 }
 
-static void NVDecCtxDestroy(struct picture_context_t *picctx)
-{
-    pic_context_nvdec_t *srcpic = NVDEC_PICCONTEXT_FROM_PICCTX(picctx);
-    free(srcpic);
-}
-
-static struct picture_context_t *NVDecCtxClone(struct picture_context_t *srcctx)
-{
-    pic_context_nvdec_t *clonectx = malloc(sizeof(*clonectx));
-    if (unlikely(clonectx == NULL))
-        return NULL;
-    pic_context_nvdec_t *srcpic = NVDEC_PICCONTEXT_FROM_PICCTX(srcctx);
-
-    *clonectx = *srcpic;
-    vlc_video_context_Hold(clonectx->ctx.vctx);
-    return &clonectx->ctx;
-}
-
-
 static int CUDAAPI HandlePictureDisplay(void *p_opaque, CUVIDPARSERDISPINFO *p_dispinfo)
 {
     decoder_t *p_dec = (decoder_t *) p_opaque;



More information about the vlc-commits mailing list