1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-22 06:42:03 +00:00

command: print executed commands with -v

This commit is contained in:
wm4 2014-10-23 14:40:38 +02:00
parent 6f958be325
commit dd77f0d37e
3 changed files with 25 additions and 0 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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) {