diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-04-01 03:04:39 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-04-01 03:04:39 +0200 |
commit | 75a8d18285f247b8a15dda8a3b545455d564d119 (patch) | |
tree | 96ae5f16f9a154faef7b182d65a2ed351212a393 | |
parent | c2f6d090c795bba9ef405908cee06bba79a87f1f (diff) |
pass destination source/sink when moving streams so that we can access them
-rw-r--r-- | src/pulsecore/protocol-native.c | 20 | ||||
-rw-r--r-- | src/pulsecore/sink-input.c | 2 | ||||
-rw-r--r-- | src/pulsecore/sink-input.h | 10 | ||||
-rw-r--r-- | src/pulsecore/source-output.c | 2 | ||||
-rw-r--r-- | src/pulsecore/source-output.h | 10 |
5 files changed, 24 insertions, 20 deletions
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 4f1d9b4b..e11d7a6c 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -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); diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 537f198d..0ed16dd8 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -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; diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h index 4e29be67..e7a555df 100644 --- a/src/pulsecore/sink-input.h +++ b/src/pulsecore/sink-input.h @@ -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. */ diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 5c240063..27f24cd1 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -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; diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h index 8d57ded4..9f5f7744 100644 --- a/src/pulsecore/source-output.h +++ b/src/pulsecore/source-output.h @@ -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. */ |