mirror of https://github.com/mpv-player/mpv
vo_gpu/context_android: replace both options with android-surface-size
This allows us to automatically trigger a VOCTRL_RESIZE (also contained).
This commit is contained in:
parent
08bcf1d92d
commit
48943a73f6
|
@ -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.
|
||||
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue