[vlc-devel] [PATCH 1/9] vaapi: gl: check that the image can be derived
Steve Lhomme
robux4 at ycbcr.xyz
Fri Oct 18 17:11:06 CEST 2019
From: Thomas Guillem <thomas at gllm.fr>
The check was done initially in the pf_pool callback.
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
---
modules/video_output/opengl/converter_vaapi.c | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/modules/video_output/opengl/converter_vaapi.c b/modules/video_output/opengl/converter_vaapi.c
index 36e3e974ec4..2336e38a119 100644
--- a/modules/video_output/opengl/converter_vaapi.c
+++ b/modules/video_output/opengl/converter_vaapi.c
@@ -327,6 +327,28 @@ tc_va_check_interop_blacklist(opengl_tex_converter_t *tc, VADisplay *vadpy)
return VLC_SUCCESS;
}
+static int
+tc_va_check_derive_image(opengl_tex_converter_t *tc,
+ vlc_decoder_device *dec_device)
+{
+ vlc_object_t *o = VLC_OBJECT(tc->gl);
+ struct priv *priv = tc->priv;
+ VASurfaceID *va_surface_ids;
+
+ picture_pool_t *pool = vlc_vaapi_PoolNew(o, dec_device, priv->vadpy, 1,
+ &va_surface_ids, &tc->fmt, true);
+ if (!pool)
+ return VLC_EGENERIC;
+
+ VAImage va_image = { .image_id = VA_INVALID_ID };
+ int ret = vlc_vaapi_DeriveImage(o, priv->vadpy, va_surface_ids[0],
+ &va_image);
+
+ picture_pool_Release(pool);
+
+ return ret;
+}
+
static int
Open(vlc_object_t *obj)
{
@@ -393,6 +415,9 @@ Open(vlc_object_t *obj)
if (tc_va_check_interop_blacklist(tc, priv->vadpy))
goto error;
+ if (tc_va_check_derive_image(tc, dec_device))
+ goto error;
+
tc->fshader = opengl_fragment_shader_init(tc, GL_TEXTURE_2D, vlc_sw_chroma,
tc->fmt.space);
if (tc->fshader == 0)
--
2.17.1
More information about the vlc-devel
mailing list