summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/cli-command.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2008-10-31 18:43:38 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2009-01-13 16:59:46 +0200
commit9d6e9f51df19c161646448cf922d6b216ea5c3f6 (patch)
tree142325dfc9751d9150b221a3cd469f2b6858eb37 /src/pulsecore/cli-command.c
parent01f71ac7a1fc2cb2f7b29e563a3468c2ffe05313 (diff)
cli: update-sink-proplist
Diffstat (limited to 'src/pulsecore/cli-command.c')
-rw-r--r--src/pulsecore/cli-command.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index b5ff98db..3cb2a14e 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -121,6 +121,7 @@ static int pa_cli_command_log_level(pa_core *c, pa_tokenizer *t, pa_strbuf *buf,
static int pa_cli_command_log_meta(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
static int pa_cli_command_log_time(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
static int pa_cli_command_log_backtrace(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
+static int pa_cli_command_update_sink_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
/* A method table for all available commands */
@@ -146,6 +147,7 @@ static const struct command commands[] = {
{ "set-sink-mute", pa_cli_command_sink_mute, "Set the mute switch of a sink (args: index|name, bool)", 3},
{ "set-sink-input-mute", pa_cli_command_sink_input_mute, "Set the mute switch of a sink input (args: index, bool)", 3},
{ "set-source-mute", pa_cli_command_source_mute, "Set the mute switch of a source (args: index|name, bool)", 3},
+ { "update-sink-proplist", pa_cli_command_update_sink_proplist, "Update the properties of a sink (args: index|name, properties)", 3},
{ "set-default-sink", pa_cli_command_sink_default, "Set the default sink (args: index|name)", 2},
{ "set-default-source", pa_cli_command_source_default, "Set the default source (args: index|name)", 2},
{ "kill-client", pa_cli_command_kill_client, "Kill a client (args: index)", 2},
@@ -650,6 +652,38 @@ static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *bu
return 0;
}
+static int pa_cli_command_update_sink_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
+ const char *n, *s;
+ pa_sink *sink;
+ pa_proplist *p;
+
+ pa_core_assert_ref(c);
+ pa_assert(t);
+ pa_assert(buf);
+ pa_assert(fail);
+
+ if (!(n = pa_tokenizer_get(t, 1))) {
+ pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
+ return -1;
+ }
+
+ if (!(s = pa_tokenizer_get(t, 2))) {
+ pa_strbuf_puts(buf, "You need to specify a \"key=value\" argument.\n");
+ return -1;
+ }
+
+ if (!(sink = pa_namereg_get(c, n, PA_NAMEREG_SINK, 1))) {
+ pa_strbuf_puts(buf, "No sink found by this name or index.\n");
+ return -1;
+ }
+
+ p = pa_proplist_from_string(s);
+
+ pa_sink_update_proplist(sink, PA_UPDATE_REPLACE, p);
+
+ return 0;
+}
+
static int pa_cli_command_sink_input_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
const char *n, *v;
pa_sink_input *si;
@@ -1513,7 +1547,7 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b
size_t l;
if (ifstate && *ifstate == IFSTATE_FALSE)
- return 0;
+ return 0;
l = strcspn(cs, whitespace);