Index: input/input.c =================================================================== --- input/input.c (revision 25326) +++ input/input.c (working copy) @@ -21,6 +21,7 @@ #include "osdep/getch2.h" #include "osdep/keycodes.h" #include "osdep/timer.h" +#include "avstring.h" #include "mp_msg.h" #include "help_mp.h" #include "m_config.h" @@ -707,7 +708,28 @@ mp_input_rm_key_fd(fd); } +int mp_input_parse_and_queue_cmds(const char *str) { + int cmd_num = 0; + mp_cmd_t *cmd; + while (*str == '\n') + ++str; + while (*str) { + size_t len = strcspn(str, "\n"); + char cmdbuf[len+1]; + av_strlcpy(cmdbuf, str, len+1); + cmd = mp_input_parse_cmd(cmdbuf); + if (cmd) { + mp_input_queue_cmd(cmd); + ++cmd_num; + } + str += len; + while (*str == '\n') + ++str; + } + return cmd_num; +} + mp_cmd_t* mp_input_parse_cmd(char* str) { int i,l; 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(const 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