[pulseaudio-commits] man/pactl.1.xml.in src/utils
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Thu Jan 31 21:16:58 PST 2013
man/pactl.1.xml.in | 10 ++++++++++
src/utils/pactl.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
New commits:
commit 831cae16d4db15a72b13bd48488b092ab19cfbeb
Author: poljar (Damir JeliÄ) <poljarinho at gmail.com>
Date: Wed Jan 30 18:51:57 2013 +0100
pactl: Add a command for setting the default sink/source.
This adds two new commands to pactl:
set-default-sink
set-default-source
This command has been part of the native protocol for a long time,
no reason not to expose it in pactl.
diff --git a/man/pactl.1.xml.in b/man/pactl.1.xml.in
index 1dc063d..29071b3 100644
--- a/man/pactl.1.xml.in
+++ b/man/pactl.1.xml.in
@@ -163,11 +163,21 @@ USA.
</option>
<option>
+ <p><opt>set-default-sink</opt> <arg>SINK</arg></p>
+ <optdesc><p>Make the specified sink (identified by its symbolic name) the default sink.</p></optdesc>
+ </option>
+
+ <option>
<p><opt>set-sink-port</opt> <arg>SINK</arg> <arg>PORT</arg></p>
<optdesc><p>Set the specified sink (identified by its symbolic name or numerical index) to the specified port (identified by its symbolic name).</p></optdesc>
</option>
<option>
+ <p><opt>set-default-source</opt> <arg>SOURCE</arg></p>
+ <optdesc><p>Make the specified source (identified by its symbolic name) the default source.</p></optdesc>
+ </option>
+
+ <option>
<p><opt>set-source-port</opt> <arg>SOURCE</arg> <arg>PORT</arg></p>
<optdesc><p>Set the specified source (identified by its symbolic name or numerical index) to the specified port (identified by its symbolic name).</p></optdesc>
</option>
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index 79b1545..020085d 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -114,7 +114,9 @@ static enum {
SUSPEND_SOURCE,
SET_CARD_PROFILE,
SET_SINK_PORT,
+ SET_DEFAULT_SINK,
SET_SOURCE_PORT,
+ SET_DEFAULT_SOURCE,
SET_SINK_VOLUME,
SET_SOURCE_VOLUME,
SET_SINK_INPUT_VOLUME,
@@ -1284,10 +1286,18 @@ static void context_state_callback(pa_context *c, void *userdata) {
pa_operation_unref(pa_context_set_sink_port_by_name(c, sink_name, port_name, simple_callback, NULL));
break;
+ case SET_DEFAULT_SINK:
+ pa_operation_unref(pa_context_set_default_sink(c, sink_name, simple_callback, NULL));
+ break;
+
case SET_SOURCE_PORT:
pa_operation_unref(pa_context_set_source_port_by_name(c, source_name, port_name, simple_callback, NULL));
break;
+ case SET_DEFAULT_SOURCE:
+ pa_operation_unref(pa_context_set_default_source(c, source_name, simple_callback, NULL));
+ break;
+
case SET_SINK_MUTE:
if (mute == TOGGLE_MUTE)
pa_operation_unref(pa_context_get_sink_info_by_name(c, sink_name, sink_toggle_mute_callback, NULL));
@@ -1491,6 +1501,7 @@ static void help(const char *argv0) {
printf("%s %s %s %s\n", argv0, _("[options]"), "move-(sink-input|source-output)", _("#N SINK|SOURCE"));
printf("%s %s %s %s\n", argv0, _("[options]"), "suspend-(sink|source)", _("NAME|#N 1|0"));
printf("%s %s %s %s\n", argv0, _("[options]"), "set-card-profile ", _("CARD PROFILE"));
+ printf("%s %s %s %s\n", argv0, _("[options]"), "set-default-(sink|source)", _("NAME"));
printf("%s %s %s %s\n", argv0, _("[options]"), "set-(sink|source)-port", _("NAME|#N PORT"));
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"));
@@ -1779,6 +1790,16 @@ int main(int argc, char *argv[]) {
sink_name = pa_xstrdup(argv[optind+1]);
port_name = pa_xstrdup(argv[optind+2]);
+ } else if (pa_streq(argv[optind], "set-default-sink")) {
+ action = SET_DEFAULT_SINK;
+
+ if (argc != optind+2) {
+ pa_log(_("You have to specify a sink name"));
+ goto quit;
+ }
+
+ sink_name = pa_xstrdup(argv[optind+1]);
+
} else if (pa_streq(argv[optind], "set-source-port")) {
action = SET_SOURCE_PORT;
@@ -1790,6 +1811,16 @@ int main(int argc, char *argv[]) {
source_name = pa_xstrdup(argv[optind+1]);
port_name = pa_xstrdup(argv[optind+2]);
+ } else if (pa_streq(argv[optind], "set-default-source")) {
+ action = SET_DEFAULT_SOURCE;
+
+ if (argc != optind+2) {
+ pa_log(_("You have to specify a source name"));
+ goto quit;
+ }
+
+ source_name = pa_xstrdup(argv[optind+1]);
+
} else if (pa_streq(argv[optind], "set-sink-volume")) {
action = SET_SINK_VOLUME;
More information about the pulseaudio-commits
mailing list