diff options
author | wm4 <wm4@nowhere> | 2019-12-07 14:16:30 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-12-07 14:16:30 +0100 |
commit | d90d5ee1a0914239ee3048fe567fed14adbe1127 (patch) | |
tree | 226d42bbf47b16b6b25dfdb4be4e1454790f80f6 /video/out/hwdec | |
parent | 16b9c4c952168f2fd16dc9511d06ee3ea638a1b6 (diff) | |
download | mpv-d90d5ee1a0914239ee3048fe567fed14adbe1127.tar.bz2 mpv-d90d5ee1a0914239ee3048fe567fed14adbe1127.tar.xz |
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.
Diffstat (limited to 'video/out/hwdec')
-rw-r--r-- | video/out/hwdec/hwdec_vaapi_gl.c | 6 |
1 files 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; |