]> code.delx.au - pulseaudio/commitdiff
pass destination source/sink when moving streams so that we can access them
authorLennart Poettering <lennart@poettering.net>
Wed, 1 Apr 2009 01:04:39 +0000 (03:04 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 1 Apr 2009 01:04:39 +0000 (03:04 +0200)
src/pulsecore/protocol-native.c
src/pulsecore/sink-input.c
src/pulsecore/sink-input.h
src/pulsecore/source-output.c
src/pulsecore/source-output.h

index 4f1d9b4b97d523dcb8eeab2926f4a2e37d5fac15..e11d7a6cdfba7610735bee282bbc3ae87d184a74 100644 (file)
@@ -213,7 +213,7 @@ enum {
 static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk);
 static void sink_input_kill_cb(pa_sink_input *i);
 static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend);
-static void sink_input_moving_cb(pa_sink_input *i);
+static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest);
 static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes);
 static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes);
 static void sink_input_update_max_request_cb(pa_sink_input *i, size_t nbytes);
@@ -225,7 +225,7 @@ static void playback_stream_request_bytes(struct playback_stream*s);
 static void source_output_kill_cb(pa_source_output *o);
 static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk);
 static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspend);
-static void source_output_moving_cb(pa_source_output *o);
+static void source_output_moving_cb(pa_source_output *o, pa_source *dest);
 static pa_usec_t source_output_get_latency_cb(pa_source_output *o);
 static void source_output_send_event_cb(pa_source_output *o, const char *event, pa_proplist *pl);
 
@@ -1572,7 +1572,7 @@ static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend) {
 }
 
 /* Called from main context */
-static void sink_input_moving_cb(pa_sink_input *i) {
+static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
     playback_stream *s;
     pa_tagstruct *t;
 
@@ -1591,9 +1591,9 @@ static void sink_input_moving_cb(pa_sink_input *i) {
     pa_tagstruct_putu32(t, PA_COMMAND_PLAYBACK_STREAM_MOVED);
     pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */
     pa_tagstruct_putu32(t, s->index);
-    pa_tagstruct_putu32(t, i->sink->index);
-    pa_tagstruct_puts(t, i->sink->name);
-    pa_tagstruct_put_boolean(t, pa_sink_get_state(i->sink) == PA_SINK_SUSPENDED);
+    pa_tagstruct_putu32(t, dest->index);
+    pa_tagstruct_puts(t, dest->name);
+    pa_tagstruct_put_boolean(t, pa_sink_get_state(dest) == PA_SINK_SUSPENDED);
 
     if (s->connection->version >= 13) {
         pa_tagstruct_putu32(t, s->buffer_attr.maxlength);
@@ -1685,7 +1685,7 @@ static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspend) {
 }
 
 /* Called from main context */
-static void source_output_moving_cb(pa_source_output *o) {
+static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
     record_stream *s;
     pa_tagstruct *t;
 
@@ -1705,9 +1705,9 @@ static void source_output_moving_cb(pa_source_output *o) {
     pa_tagstruct_putu32(t, PA_COMMAND_RECORD_STREAM_MOVED);
     pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */
     pa_tagstruct_putu32(t, s->index);
-    pa_tagstruct_putu32(t, o->source->index);
-    pa_tagstruct_puts(t, o->source->name);
-    pa_tagstruct_put_boolean(t, pa_source_get_state(o->source) == PA_SOURCE_SUSPENDED);
+    pa_tagstruct_putu32(t, dest->index);
+    pa_tagstruct_puts(t, dest->name);
+    pa_tagstruct_put_boolean(t, pa_source_get_state(dest) == PA_SOURCE_SUSPENDED);
 
     if (s->connection->version >= 13) {
         pa_tagstruct_putu32(t, s->buffer_attr.maxlength);
index 537f198d9d6dbc44e2df564ce3f72c16ccf0fae4..0ed16dd868307a03968428984fe9b91dbb2554ba 100644 (file)
@@ -1167,7 +1167,7 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) {
         new_resampler = NULL;
 
     if (i->moving)
-        i->moving(i);
+        i->moving(i, dest);
 
     i->sink = dest;
     i->save_sink = save;
index 4e29be674264c95899c30231ec4d002c2ab59d2d..e7a555df0b443bc887b8f1e1ddb03a1178c09a70 100644 (file)
@@ -144,13 +144,15 @@ struct pa_sink_input {
      * disconnected from its sink. Called from IO thread context */
     void (*detach) (pa_sink_input *i);           /* may be NULL */
 
-    /* If non-NULL called whenever the the sink this input is attached
+    /* If non-NULL called whenever the sink this input is attached
      * to suspends or resumes. Called from main context */
     void (*suspend) (pa_sink_input *i, pa_bool_t b);   /* may be NULL */
 
-    /* If non-NULL called whenever the the sink this input is attached
-     * to changes. Called from main context */
-    void (*moving) (pa_sink_input *i);   /* may be NULL */
+    /* If non-NULL called whenever the sink input is moved to a new
+     * sink. Called from main context after the sink input has been
+     * detached from the old sink and before it has been attached to
+     * the new sink. */
+    void (*moving) (pa_sink_input *i, pa_sink *dest);   /* may be NULL */
 
     /* Supposed to unlink and destroy this stream. Called from main
      * context. */
index 5c2400634f6e8a5215a0d407b139dfc7eb724574..27f24cd17866fd13d3f8b61093cea05d5ed6ef66 100644 (file)
@@ -747,7 +747,7 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, pa_bool_t
         new_resampler = NULL;
 
     if (o->moving)
-        o->moving(o);
+        o->moving(o, dest);
 
     o->source = dest;
     o->save_source = save;
index 8d57ded465505333e44fe12712b2599e057ba642..9f5f7744120feadc4c4896089f8dad50bbe5c13d 100644 (file)
@@ -116,13 +116,15 @@ struct pa_source_output {
      * disconnected from its source. Called from IO thread context */
     void (*detach) (pa_source_output *o);           /* may be NULL */
 
-    /* If non-NULL called whenever the the source this output is attached
+    /* If non-NULL called whenever the source this output is attached
      * to suspends or resumes. Called from main context */
     void (*suspend) (pa_source_output *o, pa_bool_t b);   /* may be NULL */
 
-    /* If non-NULL called whenever the the source this output is attached
-     * to changes. Called from main context */
-    void (*moving) (pa_source_output *o);   /* may be NULL */
+    /* If non-NULL called whenever the source output is moved to a new
+     * source. Called from main context after the stream was detached
+     * from the old source and before it is attached to the new
+     * source. */
+    void (*moving) (pa_source_output *o, pa_source *dest);   /* may be NULL */
 
     /* Supposed to unlink and destroy this stream. Called from main
      * context. */