summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/cli-command.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-07-29 15:07:15 +0000
committerLennart Poettering <lennart@poettering.net>2006-07-29 15:07:15 +0000
commita1e8b0968b9637e9813c320e0d1ca63e5fedf8ba (patch)
tree89795043461d111c3a2df947e903d763a79a0277 /src/pulsecore/cli-command.c
parent5e9295037f073fc768c1011253685ef35dba6331 (diff)
add new CLI function "move-sink-input" as wrapper around pa_sink_input_move_to()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1169 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/cli-command.c')
-rw-r--r--src/pulsecore/cli-command.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index 4ba3e0af..f04c710b 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -98,7 +98,7 @@ static int pa_cli_command_autoload_add(pa_core *c, pa_tokenizer *t, pa_strbuf *b
static int pa_cli_command_autoload_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail);
static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail);
static int pa_cli_command_list_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail);
-
+static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail);
/* A method table for all available commands */
@@ -141,6 +141,7 @@ static const struct command commands[] = {
{ "remove-autoload-source", pa_cli_command_autoload_remove, "Remove autoload entry for a source (args: name)", 2},
{ "dump", pa_cli_command_dump, "Dump daemon configuration", 1},
{ "list-props", pa_cli_command_list_props, NULL, 1},
+ { "move-sink-input", pa_cli_command_move_sink_input, "Move Sink input to another sink (args: index, sink)", 3},
{ NULL, NULL, NULL, 0 }
};
@@ -728,6 +729,44 @@ static int pa_cli_command_list_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf
return 0;
}
+static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
+ const char *n, *k;
+ pa_sink_input *si;
+ pa_sink *sink;
+ uint32_t idx;
+
+ if (!(n = pa_tokenizer_get(t, 1))) {
+ pa_strbuf_puts(buf, "You need to specify a sink input by its index.\n");
+ return -1;
+ }
+
+ if ((idx = parse_index(n)) == PA_IDXSET_INVALID) {
+ pa_strbuf_puts(buf, "Failed to parse index.\n");
+ return -1;
+ }
+
+ if (!(k = pa_tokenizer_get(t, 2))) {
+ pa_strbuf_puts(buf, "You need to specify a sink.\n");
+ return -1;
+ }
+
+ if (!(si = pa_idxset_get_by_index(c->sink_inputs, (uint32_t) idx))) {
+ pa_strbuf_puts(buf, "No sink input found with this index.\n");
+ return -1;
+ }
+
+ if (!(sink = pa_namereg_get(c, k, PA_NAMEREG_SINK, 1))) {
+ pa_strbuf_puts(buf, "No sink found by this name or index.\n");
+ return -1;
+ }
+
+ if (pa_sink_input_move_to(si, sink, 0) < 0) {
+ pa_strbuf_puts(buf, "Moved failed.\n");
+ return -1;
+ }
+ return 0;
+}
+
static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
pa_module *m;
pa_sink *sink;
@@ -835,7 +874,6 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
return 0;
}
-
int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, int *fail) {
const char *cs;