[pulseaudio-discuss] [PATCHv3] modules: Remove obsolete may_move_to callbacks

Stefan Huber s.huber at bct-electronic.com
Wed Mar 6 01:35:37 PST 2013


Hi Tanu!

Thank you very much for applying the other patches.

> Would you mind removing redundant sink_input_may_move_to_cb()
> implementations in the same patch too?

The following patch removes all trivial/redundant callback
implementations.

> > diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
> > index 461c4a7..22ebc17 100644
> > --- a/src/modules/module-loopback.c
> > +++ b/src/modules/module-loopback.c
> > @@ -379,17 +379,6 @@ static void source_output_kill_cb(pa_source_output *o) {
> >  }
> >  
> >  /* Called from main thread */
> > -static pa_bool_t source_output_may_move_to_cb(pa_source_output *o, pa_source *dest) {
> > -    struct userdata *u;
> > -
> > -    pa_source_output_assert_ref(o);
> > -    pa_assert_ctl_context();
> > -    pa_assert_se(u = o->userdata);
> > -
> > -    return dest != u->sink_input->sink->monitor_source;
> > -}
> 
> This is actually not redundant, because the core doesn't have a way to
> know that the data pushed to the loopback modules's source output ends
> up in the loopback module's sink input.

I removed this part of the patch.


Best
Stefan

-- >8 --

Some modules have source_output_may_move_to_cb() and
sink_input_may_move_to_cb() implemented that duplicate the default behavior.
Remove them.
---
 src/modules/module-ladspa-sink.c           |   11 -----------
 src/modules/module-remap-sink.c            |   11 -----------
 src/modules/module-virtual-sink.c          |   11 -----------
 src/modules/module-virtual-source.c        |   15 ---------------
 src/modules/module-virtual-surround-sink.c |   11 -----------
 5 files changed, 59 deletions(-)

diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index b361493..951cbc1 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -656,16 +656,6 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
 }
 
 /* Called from main context */
-static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) {
-    struct userdata *u;
-
-    pa_sink_input_assert_ref(i);
-    pa_assert_se(u = i->userdata);
-
-    return u->sink != dest;
-}
-
-/* Called from main context */
 static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
     struct userdata *u;
 
@@ -1318,7 +1308,6 @@ int pa__init(pa_module*m) {
     u->sink_input->attach = sink_input_attach_cb;
     u->sink_input->detach = sink_input_detach_cb;
     u->sink_input->state_change = sink_input_state_change_cb;
-    u->sink_input->may_move_to = sink_input_may_move_to_cb;
     u->sink_input->moving = sink_input_moving_cb;
     u->sink_input->volume_changed = sink_input_volume_changed_cb;
     u->sink_input->mute_changed = sink_input_mute_changed_cb;
diff --git a/src/modules/module-remap-sink.c b/src/modules/module-remap-sink.c
index 41a07fc..3d9567b 100644
--- a/src/modules/module-remap-sink.c
+++ b/src/modules/module-remap-sink.c
@@ -290,16 +290,6 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
 }
 
 /* Called from main context */
-static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) {
-    struct userdata *u;
-
-    pa_sink_input_assert_ref(i);
-    pa_assert_se(u = i->userdata);
-
-    return u->sink != dest;
-}
-
-/* Called from main context */
 static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
     struct userdata *u;
 
@@ -445,7 +435,6 @@ int pa__init(pa_module*m) {
     u->sink_input->detach = sink_input_detach_cb;
     u->sink_input->kill = sink_input_kill_cb;
     u->sink_input->state_change = sink_input_state_change_cb;
-    u->sink_input->may_move_to = sink_input_may_move_to_cb;
     u->sink_input->moving = sink_input_moving_cb;
     u->sink_input->userdata = u;
 
diff --git a/src/modules/module-virtual-sink.c b/src/modules/module-virtual-sink.c
index 59e9ce6..4f91fe0 100644
--- a/src/modules/module-virtual-sink.c
+++ b/src/modules/module-virtual-sink.c
@@ -418,16 +418,6 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
 }
 
 /* Called from main context */
-static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) {
-    struct userdata *u;
-
-    pa_sink_input_assert_ref(i);
-    pa_assert_se(u = i->userdata);
-
-    return u->sink != dest;
-}
-
-/* Called from main context */
 static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
     struct userdata *u;
 
@@ -605,7 +595,6 @@ int pa__init(pa_module*m) {
     u->sink_input->attach = sink_input_attach_cb;
     u->sink_input->detach = sink_input_detach_cb;
     u->sink_input->state_change = sink_input_state_change_cb;
-    u->sink_input->may_move_to = sink_input_may_move_to_cb;
     u->sink_input->moving = sink_input_moving_cb;
     u->sink_input->volume_changed = use_volume_sharing ? NULL : sink_input_volume_changed_cb;
     u->sink_input->mute_changed = sink_input_mute_changed_cb;
diff --git a/src/modules/module-virtual-source.c b/src/modules/module-virtual-source.c
index c0f6342..58041e7 100644
--- a/src/modules/module-virtual-source.c
+++ b/src/modules/module-virtual-source.c
@@ -440,20 +440,6 @@ static void source_output_kill_cb(pa_source_output *o) {
 }
 
 /* Called from main thread */
-static pa_bool_t source_output_may_move_to_cb(pa_source_output *o, pa_source *dest) {
-    struct userdata *u;
-
-    pa_source_output_assert_ref(o);
-    pa_assert_ctl_context();
-    pa_assert_se(u = o->userdata);
-
-    /* FIXME */
-    //return dest != u->source_input->source->monitor_source;
-
-    return TRUE;
-}
-
-/* Called from main thread */
 static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
     struct userdata *u;
 
@@ -618,7 +604,6 @@ int pa__init(pa_module*m) {
     u->source_output->attach = source_output_attach_cb;
     u->source_output->detach = source_output_detach_cb;
     u->source_output->state_change = source_output_state_change_cb;
-    u->source_output->may_move_to = source_output_may_move_to_cb;
     u->source_output->moving = source_output_moving_cb;
     u->source_output->userdata = u;
 
diff --git a/src/modules/module-virtual-surround-sink.c b/src/modules/module-virtual-surround-sink.c
index adaa58f..bcca8d0 100644
--- a/src/modules/module-virtual-surround-sink.c
+++ b/src/modules/module-virtual-surround-sink.c
@@ -430,16 +430,6 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
 }
 
 /* Called from main context */
-static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) {
-    struct userdata *u;
-
-    pa_sink_input_assert_ref(i);
-    pa_assert_se(u = i->userdata);
-
-    return u->sink != dest;
-}
-
-/* Called from main context */
 static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
     struct userdata *u;
 
@@ -707,7 +697,6 @@ int pa__init(pa_module*m) {
     u->sink_input->attach = sink_input_attach_cb;
     u->sink_input->detach = sink_input_detach_cb;
     u->sink_input->state_change = sink_input_state_change_cb;
-    u->sink_input->may_move_to = sink_input_may_move_to_cb;
     u->sink_input->moving = sink_input_moving_cb;
     u->sink_input->volume_changed = use_volume_sharing ? NULL : sink_input_volume_changed_cb;
     u->sink_input->mute_changed = sink_input_mute_changed_cb;
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list