diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/out/opengl/hwdec_vaegl.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/video/out/opengl/hwdec_vaegl.c b/video/out/opengl/hwdec_vaegl.c index d37c9d55dc..62a555b1c9 100644 --- a/video/out/opengl/hwdec_vaegl.c +++ b/video/out/opengl/hwdec_vaegl.c @@ -78,27 +78,32 @@ static VADisplay *create_drm_va_display(GL *gl) } #endif -static VADisplay *create_native_va_display(GL *gl) -{ - if (!gl->MPGetNativeDisplay) - return NULL; - VADisplay *display = NULL; +struct va_create_native { + VADisplay *(*create)(GL *gl); +}; + +static const struct va_create_native create_native_cbs[] = { #if HAVE_VAAPI_X11 - display = create_x11_va_display(gl); - if (display) - return display; + {create_x11_va_display}, #endif #if HAVE_VAAPI_WAYLAND - display = create_wayland_va_display(gl); - if (display) - return display; + {create_wayland_va_display}, #endif #if HAVE_VAAPI_DRM - display = create_drm_va_display(gl); - if (display) - return display; + {create_drm_va_display}, #endif - return display; +}; + +static VADisplay *create_native_va_display(GL *gl) +{ + if (!gl->MPGetNativeDisplay) + return NULL; + for (int n = 0; n < MP_ARRAY_SIZE(create_native_cbs); n++) { + VADisplay *display = create_native_cbs[n].create(gl); + if (display) + return display; + } + return NULL; } struct priv { |