[pulseaudio-commits] r1641 - in /branches/lennart/src/pulsecore: core.h source-output.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Sat Aug 11 13:29:43 PDT 2007
Author: lennart
Date: Sat Aug 11 22:29:42 2007
New Revision: 1641
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1641&root=3Dpulseaudio&vi=
ew=3Drev
Log:
restore the ability move record streams between sources
Modified:
branches/lennart/src/pulsecore/core.h
branches/lennart/src/pulsecore/source-output.c
Modified: branches/lennart/src/pulsecore/core.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core.h?rev=3D1641&root=3Dpulseaudio&r1=3D1640&r2=3D1641&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core.h (original)
+++ branches/lennart/src/pulsecore/core.h Sat Aug 11 22:29:42 2007
@@ -55,10 +55,14 @@
PA_CORE_HOOK_SINK_INPUT_PUT,
PA_CORE_HOOK_SINK_INPUT_DISCONNECT,
PA_CORE_HOOK_SINK_INPUT_DISCONNECT_POST,
+ PA_CORE_HOOK_SINK_INPUT_MOVE,
+ PA_CORE_HOOK_SINK_INPUT_MOVE_POST,
PA_CORE_HOOK_SOURCE_OUTPUT_NEW,
PA_CORE_HOOK_SOURCE_OUTPUT_PUT,
PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT,
PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT_POST,
+ PA_CORE_HOOK_SOURCE_OUTPUT_MOVE,
+ PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_POST,
PA_CORE_HOOK_MAX
} pa_core_hook_t;
=
Modified: branches/lennart/src/pulsecore/source-output.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
source-output.c?rev=3D1641&root=3Dpulseaudio&r1=3D1640&r2=3D1641&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/source-output.c (original)
+++ branches/lennart/src/pulsecore/source-output.c Sat Aug 11 22:29:42 2007
@@ -229,7 +229,7 @@
void pa_source_output_put(pa_source_output *o) {
pa_source_output_assert_ref(o);
=
- pa_asyncmsgq_post(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SO=
URCE_MESSAGE_ADD_OUTPUT, pa_source_output_ref(o), 0, NULL, (pa_free_cb_t) p=
a_source_output_unref);
+ pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SO=
URCE_MESSAGE_ADD_OUTPUT, o, 0, NULL);
pa_source_update_status(o->source);
=
pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUT=
PUT|PA_SUBSCRIPTION_EVENT_NEW, o->index);
@@ -327,63 +327,73 @@
}
=
int pa_source_output_move_to(pa_source_output *o, pa_source *dest) {
-/* pa_source *origin; */
-/* pa_resampler *new_resampler =3D NULL; */
+ pa_source *origin;
+ pa_resampler *new_resampler =3D NULL;
=
pa_source_output_assert_ref(o);
pa_source_assert_ref(dest);
-
- return -1;
-
-/* origin =3D o->source; */
-
-/* if (dest =3D=3D origin) */
-/* return 0; */
-
-/* if (pa_idxset_size(dest->outputs) >=3D PA_MAX_OUTPUTS_PER_SOURCE) {=
*/
-/* pa_log_warn("Failed to move source output: too many outputs per=
source."); */
-/* return -1; */
-/* } */
-
-/* if (o->resampler && */
-/* pa_sample_spec_equal(&origin->sample_spec, &dest->sample_spec) =
&& */
-/* pa_channel_map_equal(&origin->channel_map, &dest->channel_map))=
*/
-
-/* /\* Try to reuse the old resampler if possible *\/ */
-/* new_resampler =3D o->resampler; */
-
-/* else if (!pa_sample_spec_equal(&o->sample_spec, &dest->sample_spec)=
|| */
-/* !pa_channel_map_equal(&o->channel_map, &dest->channel_map)) { */
-
-/* /\* Okey, we need a new resampler for the new source *\/ */
-
-/* if (!(new_resampler =3D pa_resampler_new( */
-/* dest->core->mempool, */
-/* &dest->sample_spec, &dest->channel_map, */
-/* &o->sample_spec, &o->channel_map, */
-/* o->resample_method))) { */
-/* pa_log_warn("Unsupported resampling operation."); */
-/* return -1; */
-/* } */
-/* } */
-
-/* /\* Okey, let's move it *\/ */
-/* pa_idxset_remove_by_data(origin->outputs, o, NULL); */
-/* pa_idxset_put(dest->outputs, o, NULL); */
-/* o->source =3D dest; */
-
-/* /\* Replace resampler *\/ */
-/* if (new_resampler !=3D o->resampler) { */
-/* if (o->resampler) */
-/* pa_resampler_free(o->resampler); */
-/* o->resampler =3D new_resampler; */
-/* } */
-
-/* /\* Notify everyone *\/ */
-/* pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_=
OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o->index); */
-/* pa_source_notify(o->source); */
-
-/* return 0; */
+ =
+ origin =3D o->source;
+
+ if (dest =3D=3D origin)
+ return 0;
+
+ if (pa_idxset_size(dest->outputs) >=3D PA_MAX_OUTPUTS_PER_SOURCE) {
+ pa_log_warn("Failed to move source output: too many outputs per so=
urce.");
+ return -1;
+ }
+
+ if (o->thread_info.resampler &&
+ pa_sample_spec_equal(&origin->sample_spec, &dest->sample_spec) &&
+ pa_channel_map_equal(&origin->channel_map, &dest->channel_map))
+
+ /* Try to reuse the old resampler if possible */
+ new_resampler =3D o->thread_info.resampler;
+
+ else if (!pa_sample_spec_equal(&o->sample_spec, &dest->sample_spec) ||
+ !pa_channel_map_equal(&o->channel_map, &dest->channel_map)) {
+
+ /* Okey, we need a new resampler for the new source */
+
+ if (!(new_resampler =3D pa_resampler_new(
+ dest->core->mempool,
+ &dest->sample_spec, &dest->channel_map,
+ &o->sample_spec, &o->channel_map,
+ o->resample_method))) {
+ pa_log_warn("Unsupported resampling operation.");
+ return -1;
+ }
+ }
+
+ pa_hook_fire(&o->source->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE],=
o);
+
+ /* Okey, let's move it */
+ pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SO=
URCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL);
+ =
+ pa_idxset_remove_by_data(origin->outputs, o, NULL);
+ pa_idxset_put(dest->outputs, o, NULL);
+ o->source =3D dest;
+
+ /* Replace resampler */
+ if (new_resampler !=3D o->thread_info.resampler) {
+ if (o->thread_info.resampler)
+ pa_resampler_free(o->thread_info.resampler);
+ o->thread_info.resampler =3D new_resampler;
+ }
+
+ pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SO=
URCE_MESSAGE_ADD_OUTPUT, o, 0, NULL);
+
+ pa_source_update_status(origin);
+ pa_source_update_status(dest);
+
+ pa_hook_fire(&o->source->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_P=
OST], o);
+
+ pa_log_debug("Successfully moved source output %i from %s to %s.", o->=
index, origin->name, dest->name);
+
+ /* Notify everyone */
+ pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUT=
PUT|PA_SUBSCRIPTION_EVENT_CHANGE, o->index);
+
+ return 0;
}
=
int pa_source_output_process_msg(pa_msgobject *mo, int code, void *userdat=
a, int64_t offset, pa_memchunk* chunk) {
More information about the pulseaudio-commits
mailing list