[vlc-commits] nvdec: add NVDEC_PICCONTEXT_FROM_PICCTX macro
Quentin Chateau
git at videolan.org
Fri Apr 3 10:53:42 CEST 2020
vlc | branch: master | Quentin Chateau <quentin.chateau at deepskycorp.com> | Mon Mar 30 11:26:53 2020 +0200| [0537a81aad372ea8f3790d95dedfe579711b0885] | committer: Steve Lhomme
nvdec: add NVDEC_PICCONTEXT_FROM_PICCTX macro
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0537a81aad372ea8f3790d95dedfe579711b0885
---
modules/hw/nvdec/nvdec.c | 6 +++---
modules/hw/nvdec/nvdec_fmt.h | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index b66b9eeb74..928cb009a7 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -406,7 +406,7 @@ static int CUDAAPI HandlePictureDecode(void *p_opaque, CUVIDPICPARAMS *p_picpara
static void NVDecCtxDestroy(struct picture_context_t *picctx)
{
- pic_context_nvdec_t *srcpic = container_of(picctx, pic_context_nvdec_t, ctx);
+ pic_context_nvdec_t *srcpic = NVDEC_PICCONTEXT_FROM_PICCTX(picctx);
free(srcpic);
}
@@ -415,7 +415,7 @@ 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 = container_of(srcctx, pic_context_nvdec_t, ctx);
+ pic_context_nvdec_t *srcpic = NVDEC_PICCONTEXT_FROM_PICCTX(srcctx);
*clonectx = *srcpic;
vlc_video_context_Hold(clonectx->ctx.vctx);
@@ -442,7 +442,7 @@ static int CUDAAPI HandlePictureDisplay(void *p_opaque, CUVIDPARSERDISPINFO *p_d
p_pic = nvdec_pool_Wait(p_sys->out_pool);
if (unlikely(p_pic == NULL))
return 0;
- pic_context_nvdec_t *picctx = container_of(p_pic->context, pic_context_nvdec_t, ctx);
+ pic_context_nvdec_t *picctx = NVDEC_PICCONTEXT_FROM_PICCTX(p_pic->context);
result = CALL_CUDA_DEC(cuCtxPushCurrent, p_sys->devsys->cuCtx);
if (unlikely(result != VLC_SUCCESS))
diff --git a/modules/hw/nvdec/nvdec_fmt.h b/modules/hw/nvdec/nvdec_fmt.h
index 25784cca6d..4ac4e7577c 100644
--- a/modules/hw/nvdec/nvdec_fmt.h
+++ b/modules/hw/nvdec/nvdec_fmt.h
@@ -69,4 +69,7 @@ typedef struct
unsigned int bufferHeight;
} pic_context_nvdec_t;
+#define NVDEC_PICCONTEXT_FROM_PICCTX(pic_ctx) \
+ container_of(pic_ctx, pic_context_nvdec_t, ctx)
+
#endif /* include-guard */
More information about the vlc-commits
mailing list