summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-03 13:54:02 +0200
committerwm4 <wm4@nowhere>2013-08-03 14:56:27 +0200
commit2710ae801738c81bc8739f89072d068d90dbfb7e (patch)
tree34839f5414826d38fd80ae9745349364d7d31c64 /core
parentcdc6810e599c6ad15aaa1431d52b4236516cceaa (diff)
downloadmpv-2710ae801738c81bc8739f89072d068d90dbfb7e.tar.bz2
mpv-2710ae801738c81bc8739f89072d068d90dbfb7e.tar.xz
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).
Diffstat (limited to 'core')
-rw-r--r--core/command.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/core/command.c b/core/command.c
index a9620990a5..e50121fede 100644
--- a/core/command.c
+++ b/core/command.c
@@ -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: {