[pulseaudio-commits] r1735 - /branches/lennart/src/modules/module-combine.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Thu Aug 30 17:22:32 PDT 2007
Author: lennart
Date: Fri Aug 31 02:22:31 2007
New Revision: 1735
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1735&root=3Dpulseaudio&vi=
ew=3Drev
Log:
- fix suspend handling
- set sink description properly
- honour resample_method setting
Modified:
branches/lennart/src/modules/module-combine.c
Modified: branches/lennart/src/modules/module-combine.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-combine.c?rev=3D1735&root=3Dpulseaudio&r1=3D1734&r2=3D1735&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/modules/module-combine.c (original)
+++ branches/lennart/src/modules/module-combine.c Fri Aug 31 02:22:31 2007
@@ -462,9 +462,12 @@
/* Let's suspend by unlinking all streams */
=
for (o =3D pa_idxset_first(u->outputs, &idx); o; o =3D pa_idxset_next(=
u->outputs, &idx)) {
- pa_sink_input_unlink(o->sink_input);
- pa_sink_input_unref(o->sink_input);
- o->sink_input =3D NULL;
+
+ if (o->sink_input) {
+ pa_sink_input_unlink(o->sink_input);
+ pa_sink_input_unref(o->sink_input);
+ o->sink_input =3D NULL;
+ }
}
=
if (pick_master(u) < 0)
@@ -484,11 +487,15 @@
/* Let's resume */
=
for (o =3D pa_idxset_first(u->outputs, &idx); o; o =3D pa_idxset_next(=
u->outputs, &idx)) {
- =
- if (output_create_sink_input(u, o) < 0)
- output_free(o);
- else
- pa_sink_input_put(o->sink_input);
+
+ pa_sink_suspend(o->sink, 0);
+ =
+ if (PA_SINK_OPENED(pa_sink_get_state(o->sink))) {
+ if (output_create_sink_input(u, o) < 0)
+ output_free(o);
+ else
+ pa_sink_input_put(o->sink_input);
+ }
}
=
if (pick_master(u) < 0)
@@ -765,7 +772,8 @@
pa_sink_input_new_data_set_sample_spec(&data, &u->sink->sample_spec);
pa_sink_input_new_data_set_channel_map(&data, &u->sink->channel_map);
data.module =3D u->module;
-
+ data.resample_method =3D u->resample_method;
+ =
o->sink_input =3D pa_sink_input_new(u->core, &data, PA_SINK_INPUT_VARI=
ABLE_RATE|PA_SINK_INPUT_DONT_MOVE);
=
pa_xfree(t);
@@ -785,7 +793,7 @@
return 0;
}
=
-static struct output *output_new(struct userdata *u, pa_sink *sink, int re=
sample_method) {
+static struct output *output_new(struct userdata *u, pa_sink *sink) {
struct output *o;
=
pa_assert(u);
@@ -808,17 +816,22 @@
NULL);
=
=
+ pa_assert_se(pa_idxset_put(u->outputs, o, NULL) =3D=3D 0);
+
update_description(u);
=
- pa_assert_se(pa_idxset_put(u->outputs, o, NULL) =3D=3D 0);
if (u->sink && PA_SINK_LINKED(pa_sink_get_state(u->sink)))
pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_=
MESSAGE_ADD_OUTPUT, o, 0, NULL);
else
PA_LLIST_PREPEND(struct output, u->thread_info.outputs, o);
=
- if (PA_SINK_OPENED(pa_sink_get_state(sink)))
- if (output_create_sink_input(u, o) < 0)
- goto fail;
+ if (PA_SINK_OPENED(pa_sink_get_state(u->sink)) || pa_sink_get_state(u-=
>sink) =3D=3D PA_SINK_INIT) {
+ pa_sink_suspend(sink, 0);
+ =
+ if (PA_SINK_OPENED(pa_sink_get_state(sink)))
+ if (output_create_sink_input(u, o) < 0)
+ goto fail;
+ }
=
return o;
=
@@ -855,7 +868,7 @@
=
pa_log_info("Configuring new sink: %s", s->name);
=
- if (!(o =3D output_new(u, s, u->resample_method))) {
+ if (!(o =3D output_new(u, s))) {
pa_log("Failed to create sink input on sink '%s'.", s->name);
return PA_HOOK_OK;
}
@@ -914,7 +927,7 @@
=
state =3D pa_sink_get_state(s);
=
- if (PA_SINK_OPENED(state) && !o->sink_input) {
+ if (PA_SINK_OPENED(state) && PA_SINK_OPENED(pa_sink_get_state(u->sink)=
) && !o->sink_input) {
output_create_sink_input(u, o);
=
if (pick_master(u) < 0)
@@ -943,7 +956,7 @@
pa_modargs *ma =3D NULL;
const char *master_name, *slaves, *rm;
pa_sink *master_sink =3D NULL;
- int resample_method =3D -1;
+ int resample_method =3D PA_RESAMPLER_TRIVIAL;
pa_sample_spec ss;
pa_channel_map map;
struct output *o;
@@ -1051,7 +1064,7 @@
=
/* The master and slaves have been specified manually */
=
- if (!(u->master =3D output_new(u, master_sink, resample_method))) {
+ if (!(u->master =3D output_new(u, master_sink))) {
pa_log("Failed to create master sink input on sink '%s'.", mas=
ter_sink->name);
goto fail;
}
@@ -1068,7 +1081,7 @@
=
pa_xfree(n);
=
- if (!output_new(u, slave_sink, resample_method)) {
+ if (!output_new(u, slave_sink)) {
pa_log("Failed to create slave sink input on sink '%s'.", =
slave_sink->name);
goto fail;
}
@@ -1090,7 +1103,7 @@
if (!(s->flags & PA_SINK_HARDWARE) || s =3D=3D u->sink)
continue;
=
- if (!output_new(u, s, resample_method)) {
+ if (!output_new(u, s)) {
pa_log("Failed to create sink input on sink '%s'.", s->nam=
e);
goto fail;
}
@@ -1104,12 +1117,14 @@
=
if (pick_master(u) < 0)
goto fail;
-
+ =
/* Activate the sink and the sink inputs */
pa_sink_put(u->sink);
+ =
for (o =3D pa_idxset_first(u->outputs, &idx); o; o =3D pa_idxset_next(=
u->outputs, &idx))
- pa_sink_input_put(o->sink_input);
- =
+ if (o->sink_input)
+ pa_sink_input_put(o->sink_input);
+
if (u->adjust_time > 0) {
struct timeval tv;
pa_gettimeofday(&tv);
More information about the pulseaudio-commits
mailing list