From d90d5ee1a0914239ee3048fe567fed14adbe1127 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 7 Dec 2019 14:16:30 +0100 Subject: vo_gpu: hwdec_vaapi_gl: use gl_check_extension() instead of strstr() In theory, using strstr() to search for extensions is a bad idea, because some extension names might be prefixes for other names, so you could get false positives. gl_check_extension() avoids this case. It's not clear whether this is really needed; maybe not. Surely the EGL committee is aware of these practices (many GL clients do this, which is why it's widely considered bad practice), and would avoid defining new extension names which contain existing names as sub-strings, but whatever. --- video/out/hwdec/hwdec_vaapi_gl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/video/out/hwdec/hwdec_vaapi_gl.c b/video/out/hwdec/hwdec_vaapi_gl.c index f256028d5a..3e3edbed0a 100644 --- a/video/out/hwdec/hwdec_vaapi_gl.c +++ b/video/out/hwdec/hwdec_vaapi_gl.c @@ -251,9 +251,9 @@ bool vaapi_gl_init(const struct ra_hwdec *hw) return false; GL *gl = ra_gl_get(hw->ra); - if (!strstr(exts, "EXT_image_dma_buf_import") || - !strstr(exts, "EGL_KHR_image_base") || - !strstr(gl->extensions, "GL_OES_EGL_image") || + if (!gl_check_extension(exts, "EGL_EXT_image_dma_buf_import") || + !gl_check_extension(exts, "EGL_KHR_image_base") || + !gl_check_extension(gl->extensions, "GL_OES_EGL_image") || !(gl->mpgl_caps & MPGL_CAP_TEX_RG)) return false; -- cgit v1.2.3