summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2018-01-02 21:14:24 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-01-02 15:04:31 -0800
commit48943a73f68b09da9ff7120ca2804cf74f1cc27d (patch)
tree3a1a09780a2944344fc380fd532e44f55f87e1b7
parent08bcf1d92da0ef19499c064cb8bc1b0cb64e5f10 (diff)
downloadmpv-48943a73f68b09da9ff7120ca2804cf74f1cc27d.tar.bz2
mpv-48943a73f68b09da9ff7120ca2804cf74f1cc27d.tar.xz
vo_gpu/context_android: replace both options with android-surface-size
This allows us to automatically trigger a VOCTRL_RESIZE (also contained).
-rw-r--r--DOCS/man/options.rst4
-rw-r--r--options/m_option.h3
-rw-r--r--player/command.c5
-rw-r--r--video/out/opengl/context_android.c7
4 files changed, 11 insertions, 8 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index eabaa2eb96..1a3c5d25cc 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -4753,12 +4753,10 @@ The following video options are currently all specific to ``--vo=gpu`` and
OS X only.
-``--android-surface-width=<number>``, ``--android-surface-height=<number>``
+``--android-surface-size=<WxH>``
Set dimensions of the rendering surface used by the Android gpu context.
Needs to be set by the embedding application if the dimensions change during
runtime (i.e. if the device is rotated), via the surfaceChanged callback.
- Setting these does not re-configure the vo, thus ``vo-resize`` should be
- called afterwards.
Android with ``--gpu-context=android`` only.
diff --git a/options/m_option.h b/options/m_option.h
index d61fde963d..a1039e2a82 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -408,7 +408,8 @@ struct m_option {
#define UPDATE_SCREENSAVER (1 << 16) // --stop-screensaver
#define UPDATE_VOL (1 << 17) // softvol related options
#define UPDATE_LAVFI_COMPLEX (1 << 18) // --lavfi-complex
-#define UPDATE_OPT_LAST (1 << 18)
+#define UPDATE_VO_RESIZE (1 << 19) // --android-surface-size
+#define UPDATE_OPT_LAST (1 << 19)
// All bits between _FIRST and _LAST (inclusive)
#define UPDATE_OPTS_MASK \
diff --git a/player/command.c b/player/command.c
index 48206f527d..541e2d1987 100644
--- a/player/command.c
+++ b/player/command.c
@@ -5819,6 +5819,11 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags)
if (flags & UPDATE_LAVFI_COMPLEX)
update_lavfi_complex(mpctx);
+
+ if (flags & UPDATE_VO_RESIZE) {
+ if (mpctx->video_out)
+ vo_control(mpctx->video_out, VOCTRL_EXTERNAL_RESIZE, NULL);
+ }
}
void mp_notify_property(struct MPContext *mpctx, const char *property)
diff --git a/video/out/opengl/context_android.c b/video/out/opengl/context_android.c
index ca41b7e8b8..d405e79fa0 100644
--- a/video/out/opengl/context_android.c
+++ b/video/out/opengl/context_android.c
@@ -27,14 +27,13 @@
#include "context.h"
struct android_opts {
- int w, h;
+ struct m_geometry surface_size;
};
#define OPT_BASE_STRUCT struct android_opts
const struct m_sub_options android_conf = {
.opts = (const struct m_option[]) {
- OPT_INT("android-surface-width", w, 0),
- OPT_INT("android-surface-height", h, 0),
+ OPT_SIZE_BOX("android-surface-size", surface_size, UPDATE_VO_RESIZE),
{0}
},
.size = sizeof(struct android_opts),
@@ -139,7 +138,7 @@ 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;
+ int w = opts->surface_size.w, h = opts->surface_size.h;
if (!w)
eglQuerySurface(p->egl_display, p->egl_surface, EGL_WIDTH, &w);