diff options
author | wm4 <wm4@nowhere> | 2014-10-23 14:40:38 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-23 15:13:05 +0200 |
commit | dd77f0d37e6b1f73c68bd6155356590477289422 (patch) | |
tree | 8c8d5b472b65007732a247a64dbbca987db347cb /input | |
parent | 6f958be3253ed002251039be9863c130f8d443e1 (diff) | |
download | mpv-dd77f0d37e6b1f73c68bd6155356590477289422.tar.bz2 mpv-dd77f0d37e6b1f73c68bd6155356590477289422.tar.xz |
command: print executed commands with -v
Diffstat (limited to 'input')
-rw-r--r-- | input/cmd_parse.c | 21 | ||||
-rw-r--r-- | input/cmd_parse.h | 2 |
2 files changed, 23 insertions, 0 deletions
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); |