summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaarten Bosmans <mkbosmans@gmail.com>2011-08-15 22:05:41 +0200
committerColin Guthrie <colin@mageia.org>2011-08-16 11:01:34 +0100
commit0d349462c776eee50a13e743bdc4a3ac220b086a (patch)
tree42e0a5c7ac448cdb91915cd4bce835b09ed72c67
parent1c7e29ef32e5047b6a7771db0862b595d2c188ef (diff)
pactl: Add set-source-output-mute command
-rw-r--r--man/pactl.1.xml.in5
-rw-r--r--src/utils/pactl.c28
2 files changed, 32 insertions, 1 deletions
diff --git a/man/pactl.1.xml.in b/man/pactl.1.xml.in
index f0060fb4..688ac38b 100644
--- a/man/pactl.1.xml.in
+++ b/man/pactl.1.xml.in
@@ -218,6 +218,11 @@ USA.
</option>
<option>
+ <p><opt>set-source-output-mute</opt> <arg>INPUT</arg> <arg>1|0</arg></p>
+ <optdesc><p>Set the mute status of the specified source output (identified by its numerical index).</p></optdesc>
+ </option>
+
+ <option>
<p><opt>set-sink-formats</opt> <arg>SINK</arg> <arg>FORMATS</arg></p>
<optdesc><p>Set the supported formats of the specified sink (identified by its numerical index) if supported by the sink.
<arg>FORMATS</arg> is specified as a semi-colon (;) separated list of formats in the form
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index 21ceecee..b35e397b 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -114,6 +114,7 @@ static enum {
SET_SINK_MUTE,
SET_SOURCE_MUTE,
SET_SINK_INPUT_MUTE,
+ SET_SOURCE_OUTPUT_MUTE,
SET_SINK_FORMATS,
SUBSCRIBE
} action = NONE;
@@ -1160,6 +1161,10 @@ static void context_state_callback(pa_context *c, void *userdata) {
pa_operation_unref(pa_context_set_sink_input_mute(c, sink_input_idx, mute, simple_callback, NULL));
break;
+ case SET_SOURCE_OUTPUT_MUTE:
+ pa_operation_unref(pa_context_set_source_output_mute(c, source_output_idx, mute, simple_callback, NULL));
+ break;
+
case SET_SINK_VOLUME:
if ((volume_flags & VOL_RELATIVE) == VOL_RELATIVE) {
pa_operation_unref(pa_context_get_sink_info_by_name(c, sink_name, get_sink_volume_callback, NULL));
@@ -1316,7 +1321,7 @@ static void help(const char *argv0) {
printf("%s %s %s %s\n", argv0, _("[options]"), "set-(sink|source)-volume", _("NAME|#N VOLUME"));
printf("%s %s %s %s\n", argv0, _("[options]"), "set-(sink-input|source-output)-volume", _("#N VOLUME"));
printf("%s %s %s %s\n", argv0, _("[options]"), "set-(sink|source)-mute", _("NAME|#N 1|0"));
- printf("%s %s %s %s\n", argv0, _("[options]"), "set-sink-input-mute", _("#N 1|0"));
+ printf("%s %s %s %s\n", argv0, _("[options]"), "set-(sink-input|source-output)-mute", _("#N 1|0"));
printf("%s %s %s %s\n", argv0, _("[options]"), "set-sink-formats", _("#N FORMATS"));
printf("%s %s %s\n", argv0, _("[options]"), "subscribe");
@@ -1706,6 +1711,27 @@ int main(int argc, char *argv[]) {
mute = b;
+ } else if (pa_streq(argv[optind], "set-source-output-mute")) {
+ int b;
+ action = SET_SOURCE_OUTPUT_MUTE;
+
+ if (argc != optind+3) {
+ pa_log(_("You have to specify a source output index and a mute boolean"));
+ goto quit;
+ }
+
+ if (pa_atou(argv[optind+1], &source_output_idx) < 0) {
+ pa_log(_("Invalid source output index specification"));
+ goto quit;
+ }
+
+ if ((b = pa_parse_boolean(argv[optind+2])) < 0) {
+ pa_log(_("Invalid mute specification"));
+ goto quit;
+ }
+
+ mute = b;
+
} else if (pa_streq(argv[optind], "subscribe"))
action = SUBSCRIBE;