summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-23 14:40:38 +0200
committerwm4 <wm4@nowhere>2014-10-23 15:13:05 +0200
commitdd77f0d37e6b1f73c68bd6155356590477289422 (patch)
tree8c8d5b472b65007732a247a64dbbca987db347cb
parent6f958be3253ed002251039be9863c130f8d443e1 (diff)
downloadmpv-dd77f0d37e6b1f73c68bd6155356590477289422.tar.bz2
mpv-dd77f0d37e6b1f73c68bd6155356590477289422.tar.xz
command: print executed commands with -v
-rw-r--r--input/cmd_parse.c21
-rw-r--r--input/cmd_parse.h2
-rw-r--r--player/command.c2
3 files changed, 25 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);
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) {