[pulseaudio-commits] r1158 - /trunk/src/pulsecore/namereg.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Thu Jul 27 11:03:01 PDT 2006
Author: lennart
Date: Thu Jul 27 20:02:59 2006
New Revision: 1158
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1158&root=pulseaudio&view=rev
Log:
introduce three virtual sink/source names: @DEFAULT_SINK@, @DEFAULT_SOURCE@, @DEFAULT_MONITOR at . Especially the latter is useful for connecting to the monitor source of the default sink.
Modified:
trunk/src/pulsecore/namereg.c
Modified: trunk/src/pulsecore/namereg.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/namereg.c?rev=1158&root=pulseaudio&r1=1157&r2=1158&view=diff
==============================================================================
--- trunk/src/pulsecore/namereg.c (original)
+++ trunk/src/pulsecore/namereg.c Thu Jul 27 20:02:59 2006
@@ -58,7 +58,13 @@
char *n = NULL;
int r;
- assert(c && name && data);
+ assert(c);
+ assert(name);
+ assert(data);
+
+ /* Don't allow registration of special names */
+ if (*name == '@')
+ return NULL;
if (!c->namereg) {
c->namereg = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
@@ -118,11 +124,29 @@
assert(c);
if (!name) {
+
if (type == PA_NAMEREG_SOURCE)
name = pa_namereg_get_default_source_name(c);
else if (type == PA_NAMEREG_SINK)
name = pa_namereg_get_default_sink_name(c);
- }
+
+ } else if (strcmp(name, "@DEFAULT_SINK@") == 0) {
+ if (type == PA_NAMEREG_SINK)
+ name = pa_namereg_get_default_sink_name(c);
+
+ } else if (strcmp(name, "@DEFAULT_SOURCE@") == 0) {
+ if (type == PA_NAMEREG_SOURCE)
+ name = pa_namereg_get_default_source_name(c);
+
+ } else if (strcmp(name, "@DEFAULT_MONITOR@") == 0) {
+ if (type == PA_NAMEREG_SOURCE) {
+ pa_sink *k;
+
+ if ((k = pa_namereg_get(c, NULL, PA_NAMEREG_SINK, autoload)))
+ return k->monitor_source;
+ }
+ } else if (*name == '@')
+ name = NULL;
if (!name)
return NULL;
More information about the pulseaudio-commits
mailing list