From 2dd020efc297454fb50ddef0eb56db17e33530a0 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Fri, 29 Dec 2017 22:45:55 -0800 Subject: vo_gpu/android: fallback to EGL_WIDTH/HEIGHT Uses the EGL width/height by default when the user fails to set the android-surface-width/android-surface-height options. This means the vo-resize command is optional, and does not need to be implemented on android devices which do not support rotation. Signed-off-by: Aman Gupta --- video/out/opengl/context_android.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'video') diff --git a/video/out/opengl/context_android.c b/video/out/opengl/context_android.c index dec420a120..ca41b7e8b8 100644 --- a/video/out/opengl/context_android.c +++ b/video/out/opengl/context_android.c @@ -136,12 +136,24 @@ fail: static bool android_reconfig(struct ra_ctx *ctx) { + struct priv *p = ctx->priv; void *tmp = talloc_new(NULL); struct android_opts *opts = mp_get_config_group(tmp, ctx->global, &android_conf); + int w = opts->w, h = opts->h; + + if (!w) + eglQuerySurface(p->egl_display, p->egl_surface, EGL_WIDTH, &w); + if (!h) + eglQuerySurface(p->egl_display, p->egl_surface, EGL_HEIGHT, &h); + + if (!w || !h) { + MP_FATAL(ctx, "Failed to get height and width!\n"); + return false; + } - ctx->vo->dwidth = opts->w; - ctx->vo->dheight = opts->h; - ra_gl_ctx_resize(ctx->swapchain, opts->w, opts->h, 0); + ctx->vo->dwidth = w; + ctx->vo->dheight = h; + ra_gl_ctx_resize(ctx->swapchain, w, h, 0); talloc_free(tmp); return true; -- cgit v1.2.3