Index: input/input.c =================================================================== --- input/input.c (revision 25326) +++ input/input.c (working copy) @@ -707,6 +707,25 @@ mp_input_rm_key_fd(fd); } +int mp_input_parse_and_queue_cmds(char *str) { + char *cmdstr = str; + char *nextcmd = cmdstr; + int cmd_num = 0; + mp_cmd_t *cmd; + for (;;) { + strsep(&nextcmd, "\n"); + cmd = mp_input_parse_cmd(cmdstr); + if (cmd) { + mp_input_queue_cmd(cmd); + ++cmd_num; + } + if (!nextcmd) + break; + nextcmd[-1] = '\n'; + cmdstr = nextcmd; + } + return cmd_num; +} mp_cmd_t* mp_input_parse_cmd(char* str) { @@ -719,6 +738,10 @@ assert(str != NULL); #endif + // Ignore heading spaces. + while (str[0] == ' ' || str[0] == '\t') + ++str; + if (strncmp(str, "pausing ", 8) == 0) { pausing = 1; str = &str[8]; Index: input/input.h =================================================================== --- input/input.h (revision 25326) +++ input/input.h (working copy) @@ -255,6 +255,10 @@ mp_cmd_t* mp_input_parse_cmd(char* str); +/// Parse and queue commands seperated by '\n'. +/// Return count of commands new queued. +int mp_input_parse_and_queue_cmds(char *str); + /// These filters allow you to process the command before MPlayer. /// If a filter returns a true value mp_input_get_cmd will return NULL. void