mirror of
https://github.com/mpv-player/mpv
synced 2025-03-02 20:28:02 +00:00
command: make vf and af commands more verbose
On success, print the filter chain on the OSD. Otherwise, show an error message on the OSD (just enough so that the user knows whether the command worked).
This commit is contained in:
parent
cdc6810e59
commit
2710ae8017
@ -289,6 +289,11 @@ Input Commands that are Possibly Subject to Change
|
||||
refer to filters by name in all of the filter chain modification commands.
|
||||
For ``add``, using an already used label will replace the existing filter.
|
||||
|
||||
The ``vf`` command shows the list of requested filters on the OSD after
|
||||
changing the filter chain. This is roughly equivalent to
|
||||
``show_text ${vf}``. Note that auto-inserted filters for format conversion
|
||||
are not shown on the list, only what was requested by the user.
|
||||
|
||||
.. admonition:: Example for input.conf
|
||||
|
||||
- ``a vf set flip`` turn video upside-down on the ``a`` key
|
||||
|
@ -2096,6 +2096,22 @@ static int edit_filters(struct MPContext *mpctx, enum stream_type mediatype,
|
||||
return r >= 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
static int edit_filters_osd(struct MPContext *mpctx, enum stream_type mediatype,
|
||||
const char *cmd, const char *arg, bool on_osd)
|
||||
{
|
||||
int r = edit_filters(mpctx, mediatype, cmd, arg);
|
||||
if (on_osd) {
|
||||
if (r >= 0) {
|
||||
const char *prop = filter_opt[mediatype];
|
||||
show_property_osd(mpctx, prop, MP_ON_OSD_MSG);
|
||||
} else {
|
||||
set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, mpctx->opts->osd_duration,
|
||||
"Changing filters failed!");
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
static void change_video_filters(MPContext *mpctx, const char *cmd,
|
||||
const char *arg)
|
||||
{
|
||||
@ -2623,11 +2639,13 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
||||
break;
|
||||
|
||||
case MP_CMD_AF:
|
||||
edit_filters(mpctx, STREAM_AUDIO, cmd->args[0].v.s, cmd->args[1].v.s);
|
||||
edit_filters_osd(mpctx, STREAM_AUDIO, cmd->args[0].v.s,
|
||||
cmd->args[1].v.s, msg_osd);
|
||||
break;
|
||||
|
||||
case MP_CMD_VF:
|
||||
edit_filters(mpctx, STREAM_VIDEO, cmd->args[0].v.s, cmd->args[1].v.s);
|
||||
edit_filters_osd(mpctx, STREAM_VIDEO, cmd->args[0].v.s,
|
||||
cmd->args[1].v.s, msg_osd);
|
||||
break;
|
||||
|
||||
case MP_CMD_COMMAND_LIST: {
|
||||
|
Loading…
Reference in New Issue
Block a user