[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test6-38-g8bf2e3f

Lennart Poettering gitmailer-noreply at 0pointer.de
Fri Aug 28 19:31:22 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  300384ce0aa79bd86cdafa88848c6e944c0353b5 (commit)

- Log -----------------------------------------------------------------
8bf2e3f core: initialize sink/source priorities automatically based on their proplists
18b13a8 namereg: select default sink by priority
a7b3125 protocol-native: replace use of pa_namereg_is_valid_name() by pa_namereg_is_valid_name_or_wildcard() where applicable to allow use of @@ wildcards
85a683f namereg: add new pa_namereg_is_valid_name_or_wildcard() call
3b54849 core: add priority field to pa_sink/pa_source
ca2c0f2 sconv: quieten gcc a bit
f029041 suspend-on-idle: don't resume devices for corked streams
84eb661 core: move 'flags' field into 'pa_sink_input_new_data' structure so that hooks can access it
-----------------------------------------------------------------------

Summary of changes:
 src/modules/module-combine.c         |    3 +-
 src/modules/module-ladspa-sink.c     |    2 +-
 src/modules/module-loopback.c        |    5 ++-
 src/modules/module-remap-sink.c      |    3 +-
 src/modules/module-sine.c            |    2 +-
 src/modules/module-suspend-on-idle.c |   30 +++++++++++-------
 src/modules/rtp/module-rtp-recv.c    |    3 +-
 src/modules/rtp/module-rtp-send.c    |    3 +-
 src/pulsecore/cli-text.c             |    4 ++
 src/pulsecore/namereg.c              |   53 ++++++++++++++++++++++++++++------
 src/pulsecore/namereg.h              |    1 +
 src/pulsecore/play-memblockq.c       |    2 +-
 src/pulsecore/protocol-esound.c      |    4 +-
 src/pulsecore/protocol-http.c        |    2 +-
 src/pulsecore/protocol-native.c      |   31 ++++++++++++-------
 src/pulsecore/protocol-simple.c      |    4 +-
 src/pulsecore/sconv_sse.c            |    4 +--
 src/pulsecore/sink-input.c           |   21 ++++++-------
 src/pulsecore/sink-input.h           |    5 ++-
 src/pulsecore/sink.c                 |   48 ++++++++++++++++++++++++++++++
 src/pulsecore/sink.h                 |    3 ++
 src/pulsecore/sound-file-stream.c    |    2 +-
 src/pulsecore/source-output.c        |   21 ++++++-------
 src/pulsecore/source-output.h        |    5 ++-
 src/pulsecore/source.c               |    3 ++
 src/pulsecore/source.h               |    2 +
 26 files changed, 189 insertions(+), 77 deletions(-)

-----------------------------------------------------------------------

commit 84eb6614eb3a4c72d9c529948aff8ffd4c534e19
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Aug 28 23:24:09 2009 +0200

    core: move 'flags' field into 'pa_sink_input_new_data' structure so that hooks can access it

diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
index 4a57ce2..a186c89 100644
--- a/src/modules/module-combine.c
+++ b/src/modules/module-combine.c
@@ -844,8 +844,9 @@ static int output_create_sink_input(struct output *o) {
     pa_sink_input_new_data_set_channel_map(&data, &o->userdata->sink->channel_map);
     data.module = o->userdata->module;
     data.resample_method = o->userdata->resample_method;
+    data.flags = PA_SINK_INPUT_VARIABLE_RATE|PA_SINK_INPUT_DONT_MOVE|PA_SINK_INPUT_NO_CREATE_ON_SUSPEND;
 
-    pa_sink_input_new(&o->sink_input, o->userdata->core, &data, PA_SINK_INPUT_VARIABLE_RATE|PA_SINK_INPUT_DONT_MOVE|PA_SINK_INPUT_NO_CREATE_ON_SUSPEND);
+    pa_sink_input_new(&o->sink_input, o->userdata->core, &data);
 
     pa_sink_input_new_data_done(&data);
 
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index aa28f7f..933fb18 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -812,7 +812,7 @@ int pa__init(pa_module*m) {
     pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
     pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
 
-    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data, 0);
+    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);
     pa_sink_input_new_data_done(&sink_input_data);
 
     if (!u->sink_input)
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 6e4f66d..29c3dda 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -676,8 +676,9 @@ int pa__init(pa_module *m) {
     pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "abstract");
     pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
     pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
+    sink_input_data.flags = PA_SINK_INPUT_VARIABLE_RATE;
 
-    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data, PA_SINK_INPUT_VARIABLE_RATE);
+    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);
     pa_sink_input_new_data_done(&sink_input_data);
 
     if (!u->sink_input)
@@ -709,7 +710,7 @@ int pa__init(pa_module *m) {
     pa_source_output_new_data_set_sample_spec(&source_output_data, &ss);
     pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
 
-    pa_source_output_new(&u->source_output, m->core, &source_output_data, 0);
+    pa_source_output_new(&u->source_output, m->core, &source_output_data);
     pa_source_output_new_data_done(&source_output_data);
 
     if (!u->source_output)
diff --git a/src/modules/module-remap-sink.c b/src/modules/module-remap-sink.c
index becff55..6cfd0d1 100644
--- a/src/modules/module-remap-sink.c
+++ b/src/modules/module-remap-sink.c
@@ -406,8 +406,9 @@ int pa__init(pa_module*m) {
     pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
     pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
     pa_sink_input_new_data_set_channel_map(&sink_input_data, &stream_map);
+    sink_input_data.flags = (remix ? 0 : PA_SINK_INPUT_NO_REMIX);
 
-    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data, (remix ? 0 : PA_SINK_INPUT_NO_REMIX));
+    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);
     pa_sink_input_new_data_done(&sink_input_data);
 
     if (!u->sink_input)
diff --git a/src/modules/module-sine.c b/src/modules/module-sine.c
index 0be1d72..69b2002 100644
--- a/src/modules/module-sine.c
+++ b/src/modules/module-sine.c
@@ -163,7 +163,7 @@ int pa__init(pa_module*m) {
     pa_proplist_setf(data.proplist, "sine.hz", "%u", frequency);
     pa_sink_input_new_data_set_sample_spec(&data, &ss);
 
-    pa_sink_input_new(&u->sink_input, m->core, &data, 0);
+    pa_sink_input_new(&u->sink_input, m->core, &data);
     pa_sink_input_new_data_done(&data);
 
     if (!u->sink_input)
diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index c195c04..1a05f57 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -501,8 +501,9 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
     pa_proplist_setf(data.proplist, "rtp.payload", "%u", (unsigned) sdp_info->payload);
     data.module = u->module;
     pa_sink_input_new_data_set_sample_spec(&data, &sdp_info->sample_spec);
+    data.flags = PA_SINK_INPUT_VARIABLE_RATE;
 
-    pa_sink_input_new(&s->sink_input, u->module->core, &data, PA_SINK_INPUT_VARIABLE_RATE);
+    pa_sink_input_new(&s->sink_input, u->module->core, &data);
     pa_sink_input_new_data_done(&data);
 
     if (!s->sink_input) {
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index f147364..8e1cfe3 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -330,8 +330,9 @@ int pa__init(pa_module*m) {
     data.source = s;
     pa_source_output_new_data_set_sample_spec(&data, &ss);
     pa_source_output_new_data_set_channel_map(&data, &cm);
+    data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND;
 
-    pa_source_output_new(&o, m->core, &data, PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND);
+    pa_source_output_new(&o, m->core, &data);
     pa_source_output_new_data_done(&data);
 
     if (!o) {
diff --git a/src/pulsecore/play-memblockq.c b/src/pulsecore/play-memblockq.c
index b0d7699..f528c49 100644
--- a/src/pulsecore/play-memblockq.c
+++ b/src/pulsecore/play-memblockq.c
@@ -199,7 +199,7 @@ pa_sink_input* pa_memblockq_sink_input_new(
     pa_sink_input_new_data_set_volume(&data, volume);
     pa_proplist_update(data.proplist, PA_UPDATE_REPLACE, p);
 
-    pa_sink_input_new(&u->sink_input, sink->core, &data, 0);
+    pa_sink_input_new(&u->sink_input, sink->core, &data);
     pa_sink_input_new_data_done(&data);
 
     if (!u->sink_input)
diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c
index cfbaee6..480af6d 100644
--- a/src/pulsecore/protocol-esound.c
+++ b/src/pulsecore/protocol-esound.c
@@ -429,7 +429,7 @@ static int esd_proto_stream_play(connection *c, esd_proto_t request, const void
     sdata.sink = sink;
     pa_sink_input_new_data_set_sample_spec(&sdata, &ss);
 
-    pa_sink_input_new(&c->sink_input, c->protocol->core, &sdata, 0);
+    pa_sink_input_new(&c->sink_input, c->protocol->core, &sdata);
     pa_sink_input_new_data_done(&sdata);
 
     CHECK_VALIDITY(c->sink_input, "Failed to create sink input.");
@@ -525,7 +525,7 @@ static int esd_proto_stream_record(connection *c, esd_proto_t request, const voi
     sdata.source = source;
     pa_source_output_new_data_set_sample_spec(&sdata, &ss);
 
-    pa_source_output_new(&c->source_output, c->protocol->core, &sdata, 0);
+    pa_source_output_new(&c->source_output, c->protocol->core, &sdata);
     pa_source_output_new_data_done(&sdata);
 
     CHECK_VALIDITY(c->source_output, "Failed to create source output.");
diff --git a/src/pulsecore/protocol-http.c b/src/pulsecore/protocol-http.c
index 5220cc9..c09e534 100644
--- a/src/pulsecore/protocol-http.c
+++ b/src/pulsecore/protocol-http.c
@@ -533,7 +533,7 @@ static void handle_listen_prefix(struct connection *c, const char *source_name)
     pa_source_output_new_data_set_sample_spec(&data, &ss);
     pa_source_output_new_data_set_channel_map(&data, &cm);
 
-    pa_source_output_new(&c->source_output, c->protocol->core, &data, 0);
+    pa_source_output_new(&c->source_output, c->protocol->core, &data);
     pa_source_output_new_data_done(&data);
 
     if (!c->source_output) {
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 956767a..4bf5b3f 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -648,8 +648,9 @@ static record_stream* record_stream_new(
     pa_source_output_new_data_set_channel_map(&data, map);
     if (peak_detect)
         data.resample_method = PA_RESAMPLER_PEAKS;
+    data.flags = flags;
 
-    *ret = -pa_source_output_new(&source_output, c->protocol->core, &data, flags);
+    *ret = -pa_source_output_new(&source_output, c->protocol->core, &data);
 
     pa_source_output_new_data_done(&data);
 
@@ -1050,8 +1051,9 @@ static playback_stream* playback_stream_new(
     if (muted_set)
         pa_sink_input_new_data_set_muted(&data, muted);
     data.sync_base = ssync ? ssync->sink_input : NULL;
+    data.flags = flags;
 
-    *ret = -pa_sink_input_new(&sink_input, c->protocol->core, &data, flags);
+    *ret = -pa_sink_input_new(&sink_input, c->protocol->core, &data);
 
     pa_sink_input_new_data_done(&data);
 
diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c
index 488d757..d66db4b 100644
--- a/src/pulsecore/protocol-simple.c
+++ b/src/pulsecore/protocol-simple.c
@@ -541,7 +541,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp
         pa_proplist_update(data.proplist, PA_UPDATE_MERGE, c->client->proplist);
         pa_sink_input_new_data_set_sample_spec(&data, &o->sample_spec);
 
-        pa_sink_input_new(&c->sink_input, p->core, &data, 0);
+        pa_sink_input_new(&c->sink_input, p->core, &data);
         pa_sink_input_new_data_done(&data);
 
         if (!c->sink_input) {
@@ -593,7 +593,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp
         pa_proplist_update(data.proplist, PA_UPDATE_MERGE, c->client->proplist);
         pa_source_output_new_data_set_sample_spec(&data, &o->sample_spec);
 
-        pa_source_output_new(&c->source_output, p->core, &data, 0);
+        pa_source_output_new(&c->source_output, p->core, &data);
         pa_source_output_new_data_done(&data);
 
         if (!c->source_output) {
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 484421b..d3e7a45 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -134,8 +134,7 @@ static void reset_callbacks(pa_sink_input *i) {
 int pa_sink_input_new(
         pa_sink_input **_i,
         pa_core *core,
-        pa_sink_input_new_data *data,
-        pa_sink_input_flags_t flags) {
+        pa_sink_input_new_data *data) {
 
     pa_sink_input *i;
     pa_resampler *resampler = NULL;
@@ -198,15 +197,15 @@ int pa_sink_input_new(
     if (!data->muted_is_set)
         data->muted = FALSE;
 
-    if (flags & PA_SINK_INPUT_FIX_FORMAT)
+    if (data->flags & PA_SINK_INPUT_FIX_FORMAT)
         data->sample_spec.format = data->sink->sample_spec.format;
 
-    if (flags & PA_SINK_INPUT_FIX_RATE)
+    if (data->flags & PA_SINK_INPUT_FIX_RATE)
         data->sample_spec.rate = data->sink->sample_spec.rate;
 
     original_cm = data->channel_map;
 
-    if (flags & PA_SINK_INPUT_FIX_CHANNELS) {
+    if (data->flags & PA_SINK_INPUT_FIX_CHANNELS) {
         data->sample_spec.channels = data->sink->sample_spec.channels;
         data->channel_map = data->sink->channel_map;
     }
@@ -225,7 +224,7 @@ int pa_sink_input_new(
     if ((r = pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], data)) < 0)
         return r;
 
-    if ((flags & PA_SINK_INPUT_NO_CREATE_ON_SUSPEND) &&
+    if ((data->flags & PA_SINK_INPUT_NO_CREATE_ON_SUSPEND) &&
         pa_sink_get_state(data->sink) == PA_SINK_SUSPENDED) {
         pa_log_warn("Failed to create sink input: sink is suspended.");
         return -PA_ERR_BADSTATE;
@@ -236,7 +235,7 @@ int pa_sink_input_new(
         return -PA_ERR_TOOLARGE;
     }
 
-    if ((flags & PA_SINK_INPUT_VARIABLE_RATE) ||
+    if ((data->flags & PA_SINK_INPUT_VARIABLE_RATE) ||
         !pa_sample_spec_equal(&data->sample_spec, &data->sink->sample_spec) ||
         !pa_channel_map_equal(&data->channel_map, &data->sink->channel_map)) {
 
@@ -245,9 +244,9 @@ int pa_sink_input_new(
                       &data->sample_spec, &data->channel_map,
                       &data->sink->sample_spec, &data->sink->channel_map,
                       data->resample_method,
-                      ((flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
-                      ((flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
-                      (core->disable_remixing || (flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
+                      ((data->flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
+                      ((data->flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
+                      (core->disable_remixing || (data->flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
                       (core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {
             pa_log_warn("Unsupported resampling operation.");
             return -PA_ERR_NOTSUPPORTED;
@@ -260,7 +259,7 @@ int pa_sink_input_new(
 
     i->core = core;
     i->state = PA_SINK_INPUT_INIT;
-    i->flags = flags;
+    i->flags = data->flags;
     i->proplist = pa_proplist_copy(data->proplist);
     i->driver = pa_xstrdup(pa_path_get_filename(data->driver));
     i->module = data->module;
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index 06e9e4f..59eabe3 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -256,6 +256,8 @@ typedef struct pa_sink_input_send_event_hook_data {
 } pa_sink_input_send_event_hook_data;
 
 typedef struct pa_sink_input_new_data {
+    pa_sink_input_flags_t flags;
+
     pa_proplist *proplist;
 
     const char *driver;
@@ -298,8 +300,7 @@ void pa_sink_input_new_data_done(pa_sink_input_new_data *data);
 int pa_sink_input_new(
         pa_sink_input **i,
         pa_core *core,
-        pa_sink_input_new_data *data,
-        pa_sink_input_flags_t flags);
+        pa_sink_input_new_data *data);
 
 void pa_sink_input_put(pa_sink_input *i);
 void pa_sink_input_unlink(pa_sink_input* i);
diff --git a/src/pulsecore/sound-file-stream.c b/src/pulsecore/sound-file-stream.c
index c4b4d1a..16de492 100644
--- a/src/pulsecore/sound-file-stream.c
+++ b/src/pulsecore/sound-file-stream.c
@@ -311,7 +311,7 @@ int pa_play_file(
     pa_proplist_sets(data.proplist, PA_PROP_MEDIA_FILENAME, fname);
     pa_sndfile_init_proplist(u->sndfile, data.proplist);
 
-    pa_sink_input_new(&u->sink_input, sink->core, &data, 0);
+    pa_sink_input_new(&u->sink_input, sink->core, &data);
     pa_sink_input_new_data_done(&data);
 
     if (!u->sink_input)
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 4373340..1509807 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -101,8 +101,7 @@ static void reset_callbacks(pa_source_output *o) {
 int pa_source_output_new(
         pa_source_output**_o,
         pa_core *core,
-        pa_source_output_new_data *data,
-        pa_source_output_flags_t flags) {
+        pa_source_output_new_data *data) {
 
     pa_source_output *o;
     pa_resampler *resampler = NULL;
@@ -146,13 +145,13 @@ int pa_source_output_new(
     pa_return_val_if_fail(pa_channel_map_valid(&data->channel_map), -PA_ERR_INVALID);
     pa_return_val_if_fail(pa_channel_map_compatible(&data->channel_map, &data->sample_spec), -PA_ERR_INVALID);
 
-    if (flags & PA_SOURCE_OUTPUT_FIX_FORMAT)
+    if (data->flags & PA_SOURCE_OUTPUT_FIX_FORMAT)
         data->sample_spec.format = data->source->sample_spec.format;
 
-    if (flags & PA_SOURCE_OUTPUT_FIX_RATE)
+    if (data->flags & PA_SOURCE_OUTPUT_FIX_RATE)
         data->sample_spec.rate = data->source->sample_spec.rate;
 
-    if (flags & PA_SOURCE_OUTPUT_FIX_CHANNELS) {
+    if (data->flags & PA_SOURCE_OUTPUT_FIX_CHANNELS) {
         data->sample_spec.channels = data->source->sample_spec.channels;
         data->channel_map = data->source->channel_map;
     }
@@ -168,7 +167,7 @@ int pa_source_output_new(
     if ((r = pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE], data)) < 0)
         return r;
 
-    if ((flags & PA_SOURCE_OUTPUT_NO_CREATE_ON_SUSPEND) &&
+    if ((data->flags & PA_SOURCE_OUTPUT_NO_CREATE_ON_SUSPEND) &&
         pa_source_get_state(data->source) == PA_SOURCE_SUSPENDED) {
         pa_log("Failed to create source output: source is suspended.");
         return -PA_ERR_BADSTATE;
@@ -179,7 +178,7 @@ int pa_source_output_new(
         return -PA_ERR_TOOLARGE;
     }
 
-    if ((flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ||
+    if ((data->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ||
         !pa_sample_spec_equal(&data->sample_spec, &data->source->sample_spec) ||
         !pa_channel_map_equal(&data->channel_map, &data->source->channel_map)) {
 
@@ -188,9 +187,9 @@ int pa_source_output_new(
                       &data->source->sample_spec, &data->source->channel_map,
                       &data->sample_spec, &data->channel_map,
                       data->resample_method,
-                      ((flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
-                      ((flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
-                      (core->disable_remixing || (flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
+                      ((data->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
+                      ((data->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
+                      (core->disable_remixing || (data->flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
                       (core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {
             pa_log_warn("Unsupported resampling operation.");
             return -PA_ERR_NOTSUPPORTED;
@@ -203,7 +202,7 @@ int pa_source_output_new(
 
     o->core = core;
     o->state = PA_SOURCE_OUTPUT_INIT;
-    o->flags = flags;
+    o->flags = data->flags;
     o->proplist = pa_proplist_copy(data->proplist);
     o->driver = pa_xstrdup(pa_path_get_filename(data->driver));
     o->module = data->module;
diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h
index aca9ddf..273b78f 100644
--- a/src/pulsecore/source-output.h
+++ b/src/pulsecore/source-output.h
@@ -201,6 +201,8 @@ typedef struct pa_source_output_send_event_hook_data {
 } pa_source_output_send_event_hook_data;
 
 typedef struct pa_source_output_new_data {
+    pa_source_output_flags_t flags;
+
     pa_proplist *proplist;
     pa_sink_input *direct_on_input;
 
@@ -231,8 +233,7 @@ void pa_source_output_new_data_done(pa_source_output_new_data *data);
 int pa_source_output_new(
         pa_source_output**o,
         pa_core *core,
-        pa_source_output_new_data *data,
-        pa_source_output_flags_t flags);
+        pa_source_output_new_data *data);
 
 void pa_source_output_put(pa_source_output *o);
 void pa_source_output_unlink(pa_source_output*o);

commit f0290413726f98a5a59bb7f1e70cf516f123b8bd
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Aug 28 23:24:37 2009 +0200

    suspend-on-idle: don't resume devices for corked streams

diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c
index 70a7b04..7adaa0b 100644
--- a/src/modules/module-suspend-on-idle.c
+++ b/src/modules/module-suspend-on-idle.c
@@ -145,6 +145,9 @@ static pa_hook_result_t sink_input_fixate_hook_cb(pa_core *c, pa_sink_input_new_
     pa_assert(data);
     pa_assert(u);
 
+    if (data->flags & PA_SINK_INPUT_START_CORKED)
+        return PA_HOOK_OK;
+
     if ((d = pa_hashmap_get(u->device_infos, data->sink)))
         resume(d);
 
@@ -158,6 +161,9 @@ static pa_hook_result_t source_output_fixate_hook_cb(pa_core *c, pa_source_outpu
     pa_assert(data);
     pa_assert(u);
 
+    if (data->flags & PA_SOURCE_OUTPUT_START_CORKED)
+        return PA_HOOK_OK;
+
     if (data->source->monitor_of)
         d = pa_hashmap_get(u->device_infos, data->source->monitor_of);
     else
@@ -226,11 +232,16 @@ static pa_hook_result_t sink_input_move_start_hook_cb(pa_core *c, pa_sink_input
 
 static pa_hook_result_t sink_input_move_finish_hook_cb(pa_core *c, pa_sink_input *s, struct userdata *u) {
     struct device_info *d;
+    pa_sink_input_state_t state;
 
     pa_assert(c);
     pa_sink_input_assert_ref(s);
     pa_assert(u);
 
+    state = pa_sink_input_get_state(s);
+    if (state != PA_SINK_INPUT_RUNNING && state != PA_SINK_INPUT_DRAINED)
+        return PA_HOOK_OK;
+
     if ((d = pa_hashmap_get(u->device_infos, s->sink)))
         resume(d);
 
@@ -265,6 +276,9 @@ static pa_hook_result_t source_output_move_finish_hook_cb(pa_core *c, pa_source_
     pa_source_output_assert_ref(s);
     pa_assert(u);
 
+    if (pa_source_output_get_state(s) != PA_SOURCE_OUTPUT_RUNNING)
+        return PA_HOOK_OK;
+
     if (s->source->monitor_of)
         d = pa_hashmap_get(u->device_infos, s->source->monitor_of);
     else
@@ -279,6 +293,7 @@ static pa_hook_result_t source_output_move_finish_hook_cb(pa_core *c, pa_source_
 static pa_hook_result_t sink_input_state_changed_hook_cb(pa_core *c, pa_sink_input *s, struct userdata *u) {
     struct device_info *d;
     pa_sink_input_state_t state;
+
     pa_assert(c);
     pa_sink_input_assert_ref(s);
     pa_assert(u);
@@ -292,15 +307,11 @@ static pa_hook_result_t sink_input_state_changed_hook_cb(pa_core *c, pa_sink_inp
 }
 
 static pa_hook_result_t source_output_state_changed_hook_cb(pa_core *c, pa_source_output *s, struct userdata *u) {
-    pa_source_output_state_t state;
-
     pa_assert(c);
     pa_source_output_assert_ref(s);
     pa_assert(u);
 
-    state = pa_source_output_get_state(s);
-
-    if (state == PA_SOURCE_OUTPUT_RUNNING) {
+    if (pa_source_output_get_state(s) == PA_SOURCE_OUTPUT_RUNNING) {
         struct device_info *d;
 
         if (s->source->monitor_of)
@@ -387,22 +398,17 @@ static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object *o, s
         pa_sink *s = PA_SINK(o);
         pa_sink_state_t state = pa_sink_get_state(s);
 
-        if (pa_sink_check_suspend(s) <= 0) {
-
+        if (pa_sink_check_suspend(s) <= 0)
             if (PA_SINK_IS_OPENED(state))
                 restart(d);
 
-        }
-
     } else if (pa_source_isinstance(o)) {
         pa_source *s = PA_SOURCE(o);
         pa_source_state_t state = pa_source_get_state(s);
 
-        if (pa_source_check_suspend(s) <= 0) {
-
+        if (pa_source_check_suspend(s) <= 0)
             if (PA_SOURCE_IS_OPENED(state))
                 restart(d);
-        }
     }
 
     return PA_HOOK_OK;

commit ca2c0f22d8c2cf68f2119ca6f45fe08865451526
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Aug 28 23:30:15 2009 +0200

    sconv: quieten gcc a bit

diff --git a/src/pulsecore/sconv_sse.c b/src/pulsecore/sconv_sse.c
index b213d99..ef78fc2 100644
--- a/src/pulsecore/sconv_sse.c
+++ b/src/pulsecore/sconv_sse.c
@@ -35,8 +35,6 @@
 #include "cpu-x86.h"
 #include "sconv.h"
 
-static pa_convert_func_t func;
-
 #if defined (__i386__) || defined (__amd64__)
 
 static const PA_DECLARE_ALIGNED (16, float, one[4]) = { 1.0, 1.0, 1.0, 1.0 };
@@ -178,6 +176,7 @@ static void run_test (void) {
     float floats[SAMPLES];
     int i;
     pa_usec_t start, stop;
+    pa_convert_func_t func;
 
     printf ("checking SSE %zd\n", sizeof (samples));
 
@@ -232,4 +231,3 @@ void pa_convert_func_init_sse (pa_cpu_x86_flag_t flags) {
 
 #endif /* defined (__i386__) || defined (__amd64__) */
 }
-

commit 3b54849a089a492fdc67dce41795afaf3c0c3b50
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Aug 28 23:30:41 2009 +0200

    core: add priority field to pa_sink/pa_source

diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
index c7a178d..23a57d3 100644
--- a/src/pulsecore/cli-text.c
+++ b/src/pulsecore/cli-text.c
@@ -232,6 +232,7 @@ char *pa_sink_list_to_string(pa_core *c) {
             "\tflags: %s%s%s%s%s%s%s%s\n"
             "\tstate: %s\n"
             "\tsuspend cause: %s%s%s%s\n"
+            "\tpriority: %u\n"
             "\tvolume: %s%s%s\n"
             "\t        balance %0.2f\n"
             "\tbase volume: %s%s%s\n"
@@ -262,6 +263,7 @@ char *pa_sink_list_to_string(pa_core *c) {
             sink->suspend_cause & PA_SUSPEND_APPLICATION ? "APPLICATION " : "",
             sink->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "",
             sink->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "",
+            sink->priority,
             pa_cvolume_snprint(cv, sizeof(cv), pa_sink_get_volume(sink, FALSE)),
             sink->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t        " : "",
             sink->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_sink_get_volume(sink, FALSE)) : "",
@@ -356,6 +358,7 @@ char *pa_source_list_to_string(pa_core *c) {
             "\tflags: %s%s%s%s%s%s%s\n"
             "\tstate: %s\n"
             "\tsuspend cause: %s%s%s%s\n"
+            "\tpriority: %u\n"
             "\tvolume: %s%s%s\n"
             "\t        balance %0.2f\n"
             "\tbase volume: %s%s%s\n"
@@ -383,6 +386,7 @@ char *pa_source_list_to_string(pa_core *c) {
             source->suspend_cause & PA_SUSPEND_APPLICATION ? "APPLICATION " : "",
             source->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "",
             source->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "",
+            source->priority,
             pa_cvolume_snprint(cv, sizeof(cv), pa_source_get_volume(source, FALSE)),
             source->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t        " : "",
             source->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_source_get_volume(source, FALSE)) : "",
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 5cec774..49a5167 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -236,6 +236,7 @@ pa_sink* pa_sink_new(
     s->core = core;
     s->state = PA_SINK_INIT;
     s->flags = flags;
+    s->priority = 0;
     s->suspend_cause = 0;
     s->name = pa_xstrdup(name);
     s->proplist = pa_proplist_copy(data->proplist);
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index b5284b7..1e4d0e3 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -109,6 +109,8 @@ struct pa_sink {
     pa_hashmap *ports;
     pa_device_port *active_port;
 
+    unsigned priority;
+
     /* Called when the main loop requests a state change. Called from
      * main loop context. If returns -1 the state change will be
      * inhibited */
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 3026654..6600b74 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -205,6 +205,7 @@ pa_source* pa_source_new(
     s->core = core;
     s->state = PA_SOURCE_INIT;
     s->flags = flags;
+    s->priority = 0;
     s->suspend_cause = 0;
     s->name = pa_xstrdup(name);
     s->proplist = pa_proplist_copy(data->proplist);
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index df3f99d..e3e56bc 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -96,6 +96,8 @@ struct pa_source {
     pa_hashmap *ports;
     pa_device_port *active_port;
 
+    unsigned priority;
+
     /* Called when the main loop requests a state change. Called from
      * main loop context. If returns -1 the state change will be
      * inhibited */

commit 85a683f39228f506f6a4af3165e84993d283e74d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Aug 29 03:56:03 2009 +0200

    namereg: add new pa_namereg_is_valid_name_or_wildcard() call

diff --git a/src/pulsecore/namereg.c b/src/pulsecore/namereg.c
index e26923d..7d221aa 100644
--- a/src/pulsecore/namereg.c
+++ b/src/pulsecore/namereg.c
@@ -57,6 +57,8 @@ static pa_bool_t is_valid_char(char c) {
 pa_bool_t pa_namereg_is_valid_name(const char *name) {
     const char *c;
 
+    pa_assert(name);
+
     if (*name == 0)
         return FALSE;
 
@@ -70,6 +72,25 @@ pa_bool_t pa_namereg_is_valid_name(const char *name) {
     return TRUE;
 }
 
+pa_bool_t pa_namereg_is_valid_name_or_wildcard(const char *name, pa_namereg_type_t type) {
+
+    pa_assert(name);
+
+    if (pa_namereg_is_valid_name(name))
+        return TRUE;
+
+    if (type == PA_NAMEREG_SINK &&
+        pa_streq(name, "@DEFAULT_SINK@"))
+        return TRUE;
+
+    if (type == PA_NAMEREG_SOURCE &&
+        (pa_streq(name, "@DEFAULT_SOURCE@") ||
+         pa_streq(name, "@DEFAULT_MONITOR@")))
+        return TRUE;
+
+    return FALSE;
+}
+
 char* pa_namereg_make_valid_name(const char *name) {
     const char *a;
     char *b, *n;
@@ -191,7 +212,6 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type) {
 
         if ((s = pa_namereg_get(c, NULL, PA_NAMEREG_SINK)))
             return s->monitor_source;
-
     }
 
     if (!name)
diff --git a/src/pulsecore/namereg.h b/src/pulsecore/namereg.h
index 38fae6f..b5a976d 100644
--- a/src/pulsecore/namereg.h
+++ b/src/pulsecore/namereg.h
@@ -45,6 +45,7 @@ pa_sink *pa_namereg_get_default_sink(pa_core *c);
 pa_source *pa_namereg_get_default_source(pa_core *c);
 
 pa_bool_t pa_namereg_is_valid_name(const char *name);
+pa_bool_t pa_namereg_is_valid_name_or_wildcard(const char *name, pa_namereg_type_t type);
 char* pa_namereg_make_valid_name(const char *name);
 
 #endif

commit a7b312520600de2315a8ceb9935faabdf929f6db
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Aug 29 03:57:53 2009 +0200

    protocol-native: replace use of pa_namereg_is_valid_name() by pa_namereg_is_valid_name_or_wildcard() where applicable to allow use of @@ wildcards

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 4bf5b3f..a5e952a 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -1868,7 +1868,7 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
     }
 
     CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
-    CHECK_VALIDITY(c->pstream, !sink_name || pa_namereg_is_valid_name(sink_name), tag, PA_ERR_INVALID);
+    CHECK_VALIDITY(c->pstream, !sink_name || pa_namereg_is_valid_name_or_wildcard(sink_name, PA_NAMEREG_SINK), tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, sink_index == PA_INVALID_INDEX || !sink_name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, !sink_name || sink_index == PA_INVALID_INDEX, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, pa_channel_map_valid(&map), tag, PA_ERR_INVALID);
@@ -2117,7 +2117,7 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin
     }
 
     CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
-    CHECK_VALIDITY(c->pstream, !source_name || pa_namereg_is_valid_name(source_name), tag, PA_ERR_INVALID);
+    CHECK_VALIDITY(c->pstream, !source_name || pa_namereg_is_valid_name_or_wildcard(source_name, PA_NAMEREG_SOURCE), tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, source_index == PA_INVALID_INDEX || !source_name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, !source_name || source_index == PA_INVALID_INDEX, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, pa_sample_spec_valid(&ss), tag, PA_ERR_INVALID);
@@ -2463,7 +2463,7 @@ static void command_lookup(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_
     }
 
     CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
-    CHECK_VALIDITY(c->pstream, name && pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
+    CHECK_VALIDITY(c->pstream, name && pa_namereg_is_valid_name_or_wildcard(name, command == PA_COMMAND_LOOKUP_SINK ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE), tag, PA_ERR_INVALID);
 
     if (command == PA_COMMAND_LOOKUP_SINK) {
         pa_sink *sink;
@@ -2734,7 +2734,7 @@ static void command_play_sample(pa_pdispatch *pd, uint32_t command, uint32_t tag
         return;
     }
 
-    CHECK_VALIDITY(c->pstream, !sink_name || pa_namereg_is_valid_name(sink_name), tag, PA_ERR_INVALID);
+    CHECK_VALIDITY(c->pstream, !sink_name || pa_namereg_is_valid_name_or_wildcard(sink_name, PA_NAMEREG_SINK), tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, sink_index == PA_INVALID_INDEX || !sink_name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, !sink_name || sink_index == PA_INVALID_INDEX, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, name && pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
@@ -3108,7 +3108,12 @@ static void command_get_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
     }
 
     CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
-    CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
+    CHECK_VALIDITY(c->pstream, !name ||
+                   (command == PA_COMMAND_GET_SINK_INFO &&
+                    pa_namereg_is_valid_name_or_wildcard(name, PA_NAMEREG_SINK)) ||
+                   (command == PA_COMMAND_GET_SOURCE_INFO &&
+                    pa_namereg_is_valid_name_or_wildcard(name, PA_NAMEREG_SOURCE)) ||
+                   pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx == PA_INVALID_INDEX || !name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, !name || idx == PA_INVALID_INDEX, tag, PA_ERR_INVALID);
@@ -3350,7 +3355,7 @@ static void command_set_volume(
     }
 
     CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
-    CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
+    CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name_or_wildcard(name, command == PA_COMMAND_SET_SINK_VOLUME ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE), tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx == PA_INVALID_INDEX || !name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, !name || idx == PA_INVALID_INDEX, tag, PA_ERR_INVALID);
@@ -3428,7 +3433,7 @@ static void command_set_mute(
     }
 
     CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
-    CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
+    CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name_or_wildcard(name, command == PA_COMMAND_SET_SINK_MUTE ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE), tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx == PA_INVALID_INDEX || !name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, !name || idx == PA_INVALID_INDEX, tag, PA_ERR_INVALID);
@@ -4094,7 +4099,7 @@ static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag
     CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
     CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX, tag, PA_ERR_INVALID);
 
-    CHECK_VALIDITY(c->pstream, !name_device || pa_namereg_is_valid_name(name_device), tag, PA_ERR_INVALID);
+    CHECK_VALIDITY(c->pstream, !name_device || pa_namereg_is_valid_name_or_wildcard(name_device, command == PA_COMMAND_MOVE_SINK_INPUT ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE), tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx_device != PA_INVALID_INDEX || name_device, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx_device == PA_INVALID_INDEX || !name_device, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, !name_device || idx_device == PA_INVALID_INDEX, tag, PA_ERR_INVALID);
@@ -4158,7 +4163,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
     }
 
     CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
-    CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name(name) || *name == 0, tag, PA_ERR_INVALID);
+    CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name_or_wildcard(name, command == PA_COMMAND_SUSPEND_SINK ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE) || *name == 0, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx == PA_INVALID_INDEX || !name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, !name || idx == PA_INVALID_INDEX, tag, PA_ERR_INVALID);
@@ -4318,7 +4323,7 @@ static void command_set_sink_or_source_port(pa_pdispatch *pd, uint32_t command,
     }
 
     CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
-    CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
+    CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name_or_wildcard(name, command == PA_COMMAND_SET_SINK_PORT ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE), tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, idx == PA_INVALID_INDEX || !name, tag, PA_ERR_INVALID);
     CHECK_VALIDITY(c->pstream, !name || idx == PA_INVALID_INDEX, tag, PA_ERR_INVALID);

commit 18b13a89a516dbc33acbddbd9600c05cb9cb0246
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Aug 29 03:58:57 2009 +0200

    namereg: select default sink by priority

diff --git a/src/pulsecore/namereg.c b/src/pulsecore/namereg.c
index 7d221aa..3775577 100644
--- a/src/pulsecore/namereg.c
+++ b/src/pulsecore/namereg.c
@@ -269,7 +269,7 @@ pa_source* pa_namereg_set_default_source(pa_core*c, pa_source *s) {
 }
 
 pa_sink *pa_namereg_get_default_sink(pa_core *c) {
-    pa_sink *s;
+    pa_sink *s, *best = NULL;
     uint32_t idx;
 
     pa_assert(c);
@@ -277,18 +277,19 @@ pa_sink *pa_namereg_get_default_sink(pa_core *c) {
     if (c->default_sink && PA_SINK_IS_LINKED(pa_sink_get_state(c->default_sink)))
         return c->default_sink;
 
-    /* FIXME: the selection here should be based priority values on
-     * the sinks */
-
     PA_IDXSET_FOREACH(s, c->sinks, idx)
         if (PA_SINK_IS_LINKED(pa_sink_get_state(s)))
-            return pa_namereg_set_default_sink(c, s);
+            if (!best || s->priority > best->priority)
+                best = s;
+
+    if (best)
+        return pa_namereg_set_default_sink(c, best);
 
     return NULL;
 }
 
 pa_source *pa_namereg_get_default_source(pa_core *c) {
-    pa_source *s;
+    pa_source *s, *best = NULL;
     uint32_t idx;
 
     pa_assert(c);
@@ -299,12 +300,26 @@ pa_source *pa_namereg_get_default_source(pa_core *c) {
     /* First, try to find one that isn't a monitor */
     PA_IDXSET_FOREACH(s, c->sources, idx)
         if (!s->monitor_of && PA_SOURCE_IS_LINKED(pa_source_get_state(s)))
-            return pa_namereg_set_default_source(c, s);
+            if (!best ||
+                s->priority > best->priority)
+                best = s;
+
+    if (best)
+        return pa_namereg_set_default_source(c, best);
 
     /* Then, fallback to a monitor */
     PA_IDXSET_FOREACH(s, c->sources, idx)
         if (PA_SOURCE_IS_LINKED(pa_source_get_state(s)))
-            return pa_namereg_set_default_source(c, s);
+            if (!best ||
+                s->priority > best->priority ||
+                (s->priority == best->priority &&
+                 s->monitor_of &&
+                 best->monitor_of &&
+                 s->monitor_of->priority > best->monitor_of->priority))
+                best = s;
+
+    if (best)
+        return pa_namereg_set_default_source(c, best);
 
     return NULL;
 }

commit 8bf2e3fe94e0dcd0a39a67c461b787d79adcd0dd
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Aug 29 04:31:33 2009 +0200

    core: initialize sink/source priorities automatically based on their proplists

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 49a5167..48c50b0 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -244,6 +244,8 @@ pa_sink* pa_sink_new(
     s->module = data->module;
     s->card = data->card;
 
+    s->priority = pa_device_init_priority(s->proplist);
+
     s->sample_spec = data->sample_spec;
     s->channel_map = data->channel_map;
 
@@ -2696,3 +2698,48 @@ pa_bool_t pa_device_init_intended_roles(pa_proplist *p) {
 
     return FALSE;
 }
+
+unsigned pa_device_init_priority(pa_proplist *p) {
+    const char *s;
+    unsigned priority = 0;
+
+    pa_assert(p);
+
+    if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_CLASS))) {
+
+        if (pa_streq(s, "sound"))
+            priority += 9000;
+        else if (!pa_streq(s, "modem"))
+            priority += 1000;
+    }
+
+    if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR))) {
+
+        if (pa_streq(s, "internal"))
+            priority += 900;
+        else if (pa_streq(s, "speaker"))
+            priority += 500;
+        else if (pa_streq(s, "headphone"))
+            priority += 400;
+    }
+
+    if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_BUS))) {
+
+        if (pa_streq(s, "pci"))
+            priority += 50;
+        else if (pa_streq(s, "usb"))
+            priority += 40;
+        else if (pa_streq(s, "bluetooth"))
+            priority += 30;
+    }
+
+    if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_PROFILE_NAME))) {
+
+        if (pa_startswith(s, "analog-"))
+            priority += 9;
+        else if (pa_startswith(s, "iec958-"))
+            priority += 8;
+    }
+
+    return priority;
+}
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index 1e4d0e3..ba547fc 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -290,6 +290,7 @@ void pa_sink_update_flags(pa_sink *s, pa_sink_flags_t mask, pa_sink_flags_t valu
 pa_bool_t pa_device_init_description(pa_proplist *p);
 pa_bool_t pa_device_init_icon(pa_proplist *p, pa_bool_t is_sink);
 pa_bool_t pa_device_init_intended_roles(pa_proplist *p);
+unsigned pa_device_init_priority(pa_proplist *p);
 
 /**** May be called by everyone, from main context */
 
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 6600b74..1c77e0b 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -213,6 +213,8 @@ pa_source* pa_source_new(
     s->module = data->module;
     s->card = data->card;
 
+    s->priority = pa_device_init_priority(s->proplist);
+
     s->sample_spec = data->sample_spec;
     s->channel_map = data->channel_map;
 

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list