summaryrefslogtreecommitdiffstats
path: root/src/polypcore/sink-input.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-05-14 00:41:18 +0000
committerLennart Poettering <lennart@poettering.net>2006-05-14 00:41:18 +0000
commitbe05b18c6fb6f0e2e2b74ffdf251692a45eaa045 (patch)
tree7974db8d050c3fd6e19dcd3aaa7dde5875f91168 /src/polypcore/sink-input.c
parente46f8f8eb3fd586f8728e43292509434e0e8b089 (diff)
* add new parameter to pa_open_config_file() to specify open mode
* modify pa_sink_input_new() to take initial volume settings as argument * call pa_sink_input_set_volume() when changing stream volume in protocol-esound.c to make sure that subscribe events are issued properly git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@858 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/polypcore/sink-input.c')
-rw-r--r--src/polypcore/sink-input.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/polypcore/sink-input.c b/src/polypcore/sink-input.c
index e1703b97..26e63b85 100644
--- a/src/polypcore/sink-input.c
+++ b/src/polypcore/sink-input.c
@@ -43,6 +43,7 @@ pa_sink_input* pa_sink_input_new(
const char *name,
const pa_sample_spec *spec,
const pa_channel_map *map,
+ const pa_cvolume *volume,
int variable_rate,
int resample_method) {
@@ -56,6 +57,7 @@ pa_sink_input* pa_sink_input_new(
assert(spec);
assert(s->state == PA_SINK_RUNNING);
+
if (pa_idxset_size(s->inputs) >= PA_MAX_INPUTS_PER_SINK) {
pa_log_warn(__FILE__": Failed to create sink input: too many inputs per sink.");
return NULL;
@@ -64,8 +66,16 @@ pa_sink_input* pa_sink_input_new(
if (resample_method == PA_RESAMPLER_INVALID)
resample_method = s->core->resample_method;
+ if (map && spec->channels != map->channels)
+ return NULL;
+
+ if (volume && spec->channels != volume->channels)
+ return NULL;
+
if (!map) {
- pa_channel_map_init_auto(&tmap, spec->channels);
+ if (!(pa_channel_map_init_auto(&tmap, spec->channels)))
+ return NULL;
+
map = &tmap;
}
@@ -85,7 +95,10 @@ pa_sink_input* pa_sink_input_new(
i->sample_spec = *spec;
i->channel_map = *map;
- pa_cvolume_reset(&i->volume, spec->channels);
+ if (volume)
+ i->volume = *volume;
+ else
+ pa_cvolume_reset(&i->volume, spec->channels);
i->peek = NULL;
i->drop = NULL;