]> code.delx.au - pulseaudio/commitdiff
pactl: Add set-source-output-mute command
authorMaarten Bosmans <mkbosmans@gmail.com>
Mon, 15 Aug 2011 20:05:41 +0000 (22:05 +0200)
committerColin Guthrie <colin@mageia.org>
Tue, 16 Aug 2011 10:01:34 +0000 (11:01 +0100)
man/pactl.1.xml.in
src/utils/pactl.c

index f0060fb43a2f912b3098ddf3b51bdd7fe5e49878..688ac38bd38f1d59124a13dc8893d2e9206ec90d 100644 (file)
@@ -217,6 +217,11 @@ USA.
       <optdesc><p>Set the mute status of the specified sink input (identified by its numerical index).</p></optdesc>
     </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.
index 21ceecee181b653220ed9aa9599cdb4aa10a9f2a..b35e397bdc047ee675315adb24be40864451f474 100644 (file)
@@ -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;