summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-21 13:32:29 +0100
committerwm4 <wm4@nowhere>2016-01-21 13:32:29 +0100
commit03b50d4bf6cbedafdb2817a03c6389e10cb86080 (patch)
treef9fa1acfa131dfc6f0b9b88823b786bb10b0bd2a /video
parent9a2a0b0bba600a76d405c64c7c8331ad3fade22f (diff)
downloadmpv-03b50d4bf6cbedafdb2817a03c6389e10cb86080.tar.bz2
mpv-03b50d4bf6cbedafdb2817a03c6389e10cb86080.tar.xz
vo_opengl: vaapi: reorganize platform entrypoints as table
Diffstat (limited to 'video')
-rw-r--r--video/out/opengl/hwdec_vaegl.c35
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 {