From dd77f0d37e6b1f73c68bd6155356590477289422 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 23 Oct 2014 14:40:38 +0200 Subject: command: print executed commands with -v --- input/cmd_parse.c | 21 +++++++++++++++++++++ input/cmd_parse.h | 2 ++ player/command.c | 2 ++ 3 files changed, 25 insertions(+) diff --git a/input/cmd_parse.c b/input/cmd_parse.c index 335d0d96b4..90d2650cf9 100644 --- a/input/cmd_parse.c +++ b/input/cmd_parse.c @@ -423,6 +423,27 @@ mp_cmd_t *mp_cmd_clone(mp_cmd_t *cmd) return ret; } +void mp_cmd_dump(struct mp_log *log, int msgl, char *header, struct mp_cmd *cmd) +{ + if (!mp_msg_test(log, msgl)) + return; + if (header) + mp_msg(log, msgl, "%s: ", header); + if (!cmd) { + mp_msg(log, msgl, "(NULL)\n"); + return; + } + mp_msg(log, msgl, "%s, flags=%d args=[", cmd->name, cmd->flags); + for (int n = 0; n < cmd->nargs; n++) { + char *s = m_option_print(cmd->args[n].type, &cmd->args[n].v); + if (n) + mp_msg(log, msgl, ", "); + mp_msg(log, msgl, "%s", s ? s : "(NULL)"); + talloc_free(s); + } + mp_msg(log, msgl, "]\n"); +} + static int parse_cycle_dir(struct mp_log *log, const struct m_option *opt, struct bstr name, struct bstr param, void *dst) { diff --git a/input/cmd_parse.h b/input/cmd_parse.h index b5b0c3e0f4..6c4d100752 100644 --- a/input/cmd_parse.h +++ b/input/cmd_parse.h @@ -40,6 +40,8 @@ struct mp_cmd *mp_input_parse_cmd_node(struct mp_log *log, struct mpv_node *node // function void mp_cmd_free(struct mp_cmd *cmd); +void mp_cmd_dump(struct mp_log *log, int msgl, char *header, struct mp_cmd *cmd); + // This creates a copy of a command (used by the auto repeat stuff). struct mp_cmd *mp_cmd_clone(struct mp_cmd *cmd); diff --git a/player/command.c b/player/command.c index 8887338a6e..d4e462a014 100644 --- a/player/command.c +++ b/player/command.c @@ -3720,6 +3720,8 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) bool msg_or_nobar_osd = msg_osd && !(auto_osd && opts->osd_bar_visible); int osdl = msg_osd ? 1 : OSD_LEVEL_INVISIBLE; + mp_cmd_dump(mpctx->log, MSGL_V, "Run: ", cmd); + if (cmd->flags & MP_EXPAND_PROPERTIES) { for (int n = 0; n < cmd->nargs; n++) { if (cmd->args[n].type->type == CONF_TYPE_STRING) { -- cgit v1.2.3