From 0030e049cd1707762f6f8cd76c7414b95baf928f Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 26 Dec 2017 01:38:32 +0100 Subject: player: add internal `vo-resize` command Intended to be used with the properties from previous commit. --- DOCS/man/input.rst | 2 +- DOCS/man/options.rst | 3 ++- input/cmd_list.c | 1 + input/cmd_list.h | 1 + player/command.c | 7 +++++++ video/out/vo.h | 3 +++ video/out/vo_gpu.c | 4 ++++ 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index b67b490d8b..2294197368 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -732,7 +732,7 @@ Input Commands that are Possibly Subject to Change Load a script, similar to the ``--script`` option. Undocumented commands: ``tv-last-channel`` (TV/DVB only), -``ao-reload`` (experimental/internal). +``ao-reload``, ``vo-resize`` (experimental/internal). Hooks ~~~~~ diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 3a2c1a9fc4..e76f5a115a 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -4744,7 +4744,8 @@ The following video options are currently all specific to ``--vo=gpu`` and ``--android-surface-width=`` ``--android-surface-height=`` Set dimensions of the rendering surface used by the Android gpu context. - Needs to be set by the embedding application. + Needs to be set by the embedding application. Setting these does not re- + configure the vo, thus ``vo-resize`` should be called afterwards. Android with ``--gpu-context=android`` only. diff --git a/input/cmd_list.c b/input/cmd_list.c index 333f2cb223..44cd65fbce 100644 --- a/input/cmd_list.c +++ b/input/cmd_list.c @@ -191,6 +191,7 @@ const struct mp_cmd_def mp_cmds[] = { { MP_CMD_VF, "vf", { ARG_STRING, ARG_STRING } }, { MP_CMD_VF_COMMAND, "vf-command", { ARG_STRING, ARG_STRING, ARG_STRING } }, + { MP_CMD_VO_RESIZE, "vo-resize", }, { MP_CMD_SCRIPT_BINDING, "script-binding", { ARG_STRING }, .allow_auto_repeat = true, .on_updown = true}, diff --git a/input/cmd_list.h b/input/cmd_list.h index 6590158c31..6b1b19795c 100644 --- a/input/cmd_list.h +++ b/input/cmd_list.h @@ -99,6 +99,7 @@ enum mp_command_type { /// Video filter commands MP_CMD_VF, MP_CMD_VF_COMMAND, + MP_CMD_VO_RESIZE, /// Internal for Lua scripts MP_CMD_SCRIPT_BINDING, diff --git a/player/command.c b/player/command.c index 2d91c09435..6f2c15b047 100644 --- a/player/command.c +++ b/player/command.c @@ -5419,6 +5419,13 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re reload_audio_output(mpctx); break; + case MP_CMD_VO_RESIZE: { + if (!mpctx->video_out) + return -1; + vo_control(mpctx->video_out, VOCTRL_EXTERNAL_RESIZE, NULL); + break; + } + case MP_CMD_AF: return edit_filters_osd(mpctx, STREAM_AUDIO, cmd->args[0].v.s, cmd->args[1].v.s, msg_osd); diff --git a/video/out/vo.h b/video/out/vo.h index 995d6b97f5..cc86a632e7 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -111,6 +111,9 @@ enum mp_voctrl { VOCTRL_GET_DISPLAY_FPS, // double* VOCTRL_GET_PREF_DEINT, // int* + + /* private to vo_gpu */ + VOCTRL_EXTERNAL_RESIZE, }; // VOCTRL_SET_EQUALIZER diff --git a/video/out/vo_gpu.c b/video/out/vo_gpu.c index 95318d36df..c59be48bd0 100644 --- a/video/out/vo_gpu.c +++ b/video/out/vo_gpu.c @@ -207,6 +207,10 @@ static int control(struct vo *vo, uint32_t request, void *data) case VOCTRL_PERFORMANCE_DATA: gl_video_perfdata(p->renderer, (struct voctrl_performance_data *)data); return true; + case VOCTRL_EXTERNAL_RESIZE: + p->ctx->fns->reconfig(p->ctx); + resize(vo); + return true; } int events = 0; -- cgit v1.2.3