summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/pactl.1.xml.in8
-rw-r--r--man/pulse-cli-syntax.5.xml.in6
-rw-r--r--src/pulsecore/cli-command.c8
-rw-r--r--src/pulsecore/protocol-native.c28
4 files changed, 35 insertions, 15 deletions
diff --git a/man/pactl.1.xml.in b/man/pactl.1.xml.in
index d4eb03458..ca365dc23 100644
--- a/man/pactl.1.xml.in
+++ b/man/pactl.1.xml.in
@@ -174,7 +174,9 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
<option>
<p><opt>set-default-sink</opt> <arg>SINK</arg></p>
- <optdesc><p>Make the specified sink (identified by its symbolic name or numerical index) the default sink.</p></optdesc>
+ <optdesc><p>Make the specified sink (identified by its symbolic name or numerical index) the default sink.
+ Use the special name \@NONE@ to unset the user defined default sink. This will make pulseaudio return to the default
+ sink selection based on sink priority.</p></optdesc>
</option>
<option>
@@ -189,7 +191,9 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
<option>
<p><opt>set-default-source</opt> <arg>SOURCE</arg></p>
- <optdesc><p>Make the specified source (identified by its symbolic name or numerical index) the default source.</p></optdesc>
+ <optdesc><p>Make the specified source (identified by its symbolic name or numerical index) the default source.
+ Use the special name \@NONE@ to unset the user defined default source. This will make pulseaudio return to the default
+ source selection based on source priority.</p></optdesc>
</option>
<option>
diff --git a/man/pulse-cli-syntax.5.xml.in b/man/pulse-cli-syntax.5.xml.in
index 5bc94b9c9..ecd495a79 100644
--- a/man/pulse-cli-syntax.5.xml.in
+++ b/man/pulse-cli-syntax.5.xml.in
@@ -143,8 +143,10 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
<p><opt>set-default-sink|set-default-source</opt> <arg>index|name</arg></p>
<optdesc><p>Make a sink (resp. source) the default. You may specify the
sink (resp. source) by its index in the sink (resp. source) list or by its
- name.</p><p>Note that defaults may be overridden by various policy modules
- or by specific stream configurations.</p></optdesc>
+ name. Use the special name \@NONE@ to unset the user defined default sink or
+ source. In this case, pulseaudio will return to the default sink or source
+ selection based on priority.</p><p>Note that defaults may be overridden by
+ various policy modules or by specific stream configurations.</p></optdesc>
</option>
<option>
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index ae75064f0..1a49677be 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -1038,7 +1038,9 @@ static int pa_cli_command_sink_default(pa_core *c, pa_tokenizer *t, pa_strbuf *b
return -1;
}
- if ((s = pa_namereg_get(c, n, PA_NAMEREG_SINK)))
+ if (pa_streq(n, "@NONE@"))
+ pa_core_set_configured_default_sink(c, NULL);
+ else if ((s = pa_namereg_get(c, n, PA_NAMEREG_SINK)))
pa_core_set_configured_default_sink(c, s->name);
else
pa_strbuf_printf(buf, "Sink %s does not exist.\n", n);
@@ -1060,7 +1062,9 @@ static int pa_cli_command_source_default(pa_core *c, pa_tokenizer *t, pa_strbuf
return -1;
}
- if ((s = pa_namereg_get(c, n, PA_NAMEREG_SOURCE)))
+ if (pa_streq(n, "@NONE@"))
+ pa_core_set_configured_default_source(c, NULL);
+ else if ((s = pa_namereg_get(c, n, PA_NAMEREG_SOURCE)))
pa_core_set_configured_default_source(c, s->name);
else
pa_strbuf_printf(buf, "Source %s does not exist.\n", n);
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 98b8795d9..231d640aa 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -4379,23 +4379,33 @@ static void command_set_default_sink_or_source(pa_pdispatch *pd, uint32_t comman
}
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
- CHECK_VALIDITY(c->pstream, !s || pa_namereg_is_valid_name(s), tag, PA_ERR_INVALID);
+ CHECK_VALIDITY(c->pstream, !s || pa_namereg_is_valid_name(s) || pa_safe_streq(s,"@NONE@"), tag, PA_ERR_INVALID);
if (command == PA_COMMAND_SET_DEFAULT_SOURCE) {
- pa_source *source;
+ char *source_name = NULL;
- source = pa_namereg_get(c->protocol->core, s, PA_NAMEREG_SOURCE);
- CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY);
+ if (!pa_safe_streq(s,"@NONE@")) {
+ pa_source *source;
+
+ source = pa_namereg_get(c->protocol->core, s, PA_NAMEREG_SOURCE);
+ CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY);
+ source_name = source->name;
+ }
- pa_core_set_configured_default_source(c->protocol->core, source->name);
+ pa_core_set_configured_default_source(c->protocol->core, source_name);
} else {
- pa_sink *sink;
+ char *sink_name = NULL;
pa_assert(command == PA_COMMAND_SET_DEFAULT_SINK);
- sink = pa_namereg_get(c->protocol->core, s, PA_NAMEREG_SINK);
- CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY);
+ if (!pa_safe_streq(s,"@NONE@")) {
+ pa_sink *sink;
+
+ sink = pa_namereg_get(c->protocol->core, s, PA_NAMEREG_SINK);
+ CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY);
+ sink_name = sink->name;
+ }
- pa_core_set_configured_default_sink(c->protocol->core, sink->name);
+ pa_core_set_configured_default_sink(c->protocol->core, sink_name);
}
pa_pstream_send_simple_ack(c->pstream, tag);