aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out
diff options
context:
space:
mode:
authorGravatar Aman Gupta <aman@tmm1.net>2017-12-29 22:45:55 -0800
committerGravatar Kevin Mitchell <kevmitch@gmail.com>2018-01-01 22:21:44 -0800
commit2dd020efc297454fb50ddef0eb56db17e33530a0 (patch)
treefaa2aeb4ef138674da9c42ab1b48dcb717ffd496 /video/out
parentd7188ce7531f6dcefa68d9a2de037749a4edf814 (diff)
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 <aman@tmm1.net>
Diffstat (limited to 'video/out')
-rw-r--r--video/out/opengl/context_android.c18
1 files changed, 15 insertions, 3 deletions
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;