[vlc-devel] [PATCH 20/36] vaapi: set the video context in the picture context
Steve Lhomme
robux4 at ycbcr.xyz
Thu Nov 21 15:14:11 CET 2019
---
modules/codec/avcodec/vaapi.c | 3 ++-
modules/hw/vaapi/vlc_vaapi.c | 5 ++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 110a6492d2d..bc6dae2148a 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -145,6 +145,7 @@ static picture_context_t *vaapi_dec_pic_context_copy(picture_context_t *src)
if (unlikely(pic_ctx == NULL))
return NULL;
*pic_ctx = *src_ctx;
+ vlc_video_context_Hold(pic_ctx->ctx.s.vctx);
va_surface_AddRef(pic_ctx->va_surface);
return &pic_ctx->ctx.s;
}
@@ -163,7 +164,7 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
}
vaapi_ctx->ctx.s = (picture_context_t) {
vaapi_dec_pic_context_destroy, vaapi_dec_pic_context_copy,
- NULL /*TODO*/
+ sys->vctx,
};
vaapi_ctx->ctx.surface = sys->render_targets[va_surface_GetIndex(va_surface)];
vaapi_ctx->ctx.va_dpy = sys->hw_ctx.display;
diff --git a/modules/hw/vaapi/vlc_vaapi.c b/modules/hw/vaapi/vlc_vaapi.c
index 6270271b571..7777a757946 100644
--- a/modules/hw/vaapi/vlc_vaapi.c
+++ b/modules/hw/vaapi/vlc_vaapi.c
@@ -454,6 +454,7 @@ pic_ctx_copy_cb(struct picture_context_t *opaque)
return NULL;
*dst_ctx = *src_ctx;
+ vlc_video_context_Hold(dst_ctx->ctx.s.vctx);
dst_ctx->ctx.s.destroy = pic_ctx_destroy_cb;
picture_Hold(dst_ctx->picref);
return &dst_ctx->ctx.s;
@@ -508,7 +509,7 @@ vlc_vaapi_PoolNew(vlc_object_t *o, vlc_video_context *vctx,
p_sys->instance = instance;
p_sys->ctx.ctx.s = (picture_context_t) {
pic_sys_ctx_destroy_cb, pic_ctx_copy_cb,
- NULL /*TODO*/
+ vctx,
};
p_sys->ctx.ctx.surface = instance->render_targets[i];
p_sys->ctx.ctx.va_dpy = dpy;
@@ -524,6 +525,7 @@ vlc_vaapi_PoolNew(vlc_object_t *o, vlc_video_context *vctx,
count = i;
goto error_pic;
}
+ vlc_video_context_Hold(p_sys->ctx.ctx.s.vctx);
}
picture_pool_t *pool = picture_pool_New(count, pics);
@@ -569,6 +571,7 @@ vlc_vaapi_PicSetContext(picture_t *pic, struct vaapi_pic_context *vaapi_ctx)
assert(pic->context == NULL);
pic->context = &vaapi_ctx->s;
+ vlc_video_context_Hold(vaapi_ctx->s.vctx);
}
void
--
2.17.1
More information about the vlc-devel
mailing list