diff options
author | wm4 <wm4@nowhere> | 2016-01-21 13:32:29 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-01-21 13:32:29 +0100 |
commit | 03b50d4bf6cbedafdb2817a03c6389e10cb86080 (patch) | |
tree | f9fa1acfa131dfc6f0b9b88823b786bb10b0bd2a /video/out/opengl | |
parent | 9a2a0b0bba600a76d405c64c7c8331ad3fade22f (diff) | |
download | mpv-03b50d4bf6cbedafdb2817a03c6389e10cb86080.tar.bz2 mpv-03b50d4bf6cbedafdb2817a03c6389e10cb86080.tar.xz |
vo_opengl: vaapi: reorganize platform entrypoints as table
Diffstat (limited to 'video/out/opengl')
-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 { |