[vlc-devel] [PATCH 25/39] vaapi: use the decoder device to get the VADisplay
Steve Lhomme
robux4 at ycbcr.xyz
Mon Oct 7 16:29:04 CEST 2019
And remove the locally held decoder device that used to come from the
picture_sys_t.
---
modules/codec/avcodec/vaapi.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 5dee6687d40..d7766608fcc 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -50,7 +50,6 @@
struct vlc_va_sys_t
{
- vlc_decoder_device *dec_device;
struct vaapi_context hw_ctx;
};
@@ -139,16 +138,16 @@ static void Delete(vlc_va_t *va)
vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
- vlc_decoder_device_Release(sys->dec_device);
free(sys);
}
static const struct vlc_va_operations ops = { Get, Delete, };
static int Create(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
- const es_format_t *fmt, void *p_sys, vlc_decoder_device *device)
+ const es_format_t *fmt, void *p_sys, vlc_decoder_device *dec_device)
{
- if (pix_fmt != AV_PIX_FMT_VAAPI_VLD || p_sys == NULL)
+ if (pix_fmt != AV_PIX_FMT_VAAPI_VLD || dec_device == NULL ||
+ dec_device->type != VLC_DECODER_DEVICE_VAAPI)
return VLC_EGENERIC;
vlc_va_sys_t *sys = malloc(sizeof *sys);
@@ -160,10 +159,7 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
int ret = VLC_EGENERIC;
- /* The picture must be allocated by the vout */
- VADisplay va_dpy;
- vlc_decoder_device *dec_device =
- vlc_vaapi_PicSysHoldInstance(p_sys, &va_dpy);
+ VADisplay va_dpy = dec_device->opaque;
VASurfaceID *render_targets;
unsigned num_render_targets;
@@ -181,7 +177,6 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
goto error;
/* */
- sys->dec_device = dec_device;
sys->hw_ctx.display = va_dpy;
sys->hw_ctx.config_id = VA_INVALID_ID;
sys->hw_ctx.context_id = VA_INVALID_ID;
@@ -213,7 +208,6 @@ error:
if (sys->hw_ctx.config_id != VA_INVALID_ID)
vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
free(sys);
- vlc_decoder_device_Release(dec_device);
return ret;
}
--
2.17.1
More information about the vlc-devel
mailing list