diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2009-08-16 21:25:48 +0300 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2009-08-16 21:25:48 +0300 |
commit | bcaba0b1b43d6a1b32aadfa98860f40b2c93e136 (patch) | |
tree | 6bd0d60a8fa822bfd688b90d062d0f73eee2e47e /src/modules/module-intended-roles.c | |
parent | 2bb3eef414f80189cf6af6cd66c519630e4c0a43 (diff) | |
parent | 01e4b61a910afdd21f860fadbe98075735c2bf51 (diff) |
Merge branch 'master' of git://0pointer.de/pulseaudio into dbus-work
Conflicts:
src/Makefile.am
src/daemon/daemon-conf.c
src/daemon/daemon.conf.in
src/modules/module-stream-restore.c
src/pulse/client-conf.c
src/pulsecore/namereg.c
Diffstat (limited to 'src/modules/module-intended-roles.c')
-rw-r--r-- | src/modules/module-intended-roles.c | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/src/modules/module-intended-roles.c b/src/modules/module-intended-roles.c index c697209a..b9924dfd 100644 --- a/src/modules/module-intended-roles.c +++ b/src/modules/module-intended-roles.c @@ -127,6 +127,9 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n if (s == def) continue; + if (!PA_SINK_IS_LINKED(pa_sink_get_state(s))) + continue; + if (role_match(s->proplist, role)) { new_data->sink = s; new_data->save_sink = FALSE; @@ -173,6 +176,9 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou if (s == def) continue; + if (!PA_SOURCE_IS_LINKED(pa_source_get_state(s))) + continue; + if (role_match(s->proplist, role)) { new_data->source = s; new_data->save_source = FALSE; @@ -201,6 +207,17 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, struct if (si->save_sink) continue; + /* Skip this if it is already in the process of being moved + * anyway */ + if (!si->sink) + continue; + + /* It might happen that a stream and a sink are set up at the + same time, in which case we want to make sure we don't + interfere with that */ + if (!PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(si))) + continue; + if (!(role = pa_proplist_gets(si->proplist, PA_PROP_MEDIA_ROLE))) continue; @@ -237,6 +254,17 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source, if (so->direct_on_input) continue; + /* Skip this if it is already in the process of being moved + * anyway */ + if (!so->source) + continue; + + /* It might happen that a stream and a source are set up at the + same time, in which case we want to make sure we don't + interfere with that */ + if (!PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_get_state(so))) + continue; + if (!(role = pa_proplist_gets(so->proplist, PA_PROP_MEDIA_ROLE))) continue; @@ -275,24 +303,28 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str uint32_t jdx; pa_sink *d; + if (!si->sink) + continue; + if (!(role = pa_proplist_gets(si->proplist, PA_PROP_MEDIA_ROLE))) continue; /* Would the default sink fit? If so, let's use it */ - if (def != sink && role_match(def->proplist, role)) { - pa_sink_input_move_to(si, def, FALSE); - continue; - } + if (def != sink && role_match(def->proplist, role)) + if (pa_sink_input_move_to(si, def, FALSE) >= 0) + continue; /* Try to find some other fitting sink */ PA_IDXSET_FOREACH(d, c->sinks, jdx) { if (d == def || d == sink) continue; - if (role_match(d->proplist, role)) { - pa_sink_input_move_to(si, d, FALSE); - break; - } + if (!PA_SINK_IS_LINKED(pa_sink_get_state(d))) + continue; + + if (role_match(d->proplist, role)) + if (pa_sink_input_move_to(si, d, FALSE) >= 0) + break; } } @@ -325,6 +357,9 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc if (so->direct_on_input) continue; + if (!so->source) + continue; + if (!(role = pa_proplist_gets(so->proplist, PA_PROP_MEDIA_ROLE))) continue; @@ -339,6 +374,9 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc if (d == def || d == source) continue; + if (!PA_SOURCE_IS_LINKED(pa_source_get_state(d))) + continue; + if (role_match(d->proplist, role) && !source->monitor_of == !d->monitor_of) { pa_source_output_move_to(so, d, FALSE); break; |