summaryrefslogtreecommitdiffstats
path: root/src/pulse/stream.c
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-05-17 22:31:10 +0100
committerColin Guthrie <colin@mageia.org>2011-06-22 22:45:27 +0100
commitdffc4d18d3a9f608f8b316f1e7057d13978ef44f (patch)
tree2967eec64a3884b1b2ae5b7e5f59fafc92097ebf /src/pulse/stream.c
parentfdf3a0881445560e962924a02319fc5cd2506231 (diff)
capture: Implement per-stream volume control for capture streams.
This piggy backs onto the previous changes for protocol 22 and thus does not bump the version. This and the previous commits should be seen as mostly atomic. Apologies for any bisecting issues this causes (although I would expect these to be minimal)
Diffstat (limited to 'src/pulse/stream.c')
-rw-r--r--src/pulse/stream.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index 32936848..d60b864b 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -1149,7 +1149,8 @@ static int create_stream(
pa_tagstruct *t;
uint32_t tag;
- pa_bool_t volume_set = FALSE;
+ pa_bool_t volume_set = !!volume;
+ pa_cvolume cv;
uint32_t i;
pa_assert(s);
@@ -1246,9 +1247,18 @@ static int create_stream(
PA_TAG_BOOLEAN, s->corked,
PA_TAG_INVALID);
- if (s->direction == PA_STREAM_PLAYBACK) {
- pa_cvolume cv;
+ if (!volume) {
+ if (pa_sample_spec_valid(&s->sample_spec))
+ volume = pa_cvolume_reset(&cv, s->sample_spec.channels);
+ else {
+ /* This is not really relevant, since no volume was set, and
+ * the real number of channels is embedded in the format_info
+ * structure */
+ volume = pa_cvolume_reset(&cv, PA_CHANNELS_MAX);
+ }
+ }
+ if (s->direction == PA_STREAM_PLAYBACK) {
pa_tagstruct_put(
t,
PA_TAG_U32, s->buffer_attr.tlength,
@@ -1257,19 +1267,6 @@ static int create_stream(
PA_TAG_U32, s->syncid,
PA_TAG_INVALID);
- volume_set = !!volume;
-
- if (!volume) {
- if (pa_sample_spec_valid(&s->sample_spec))
- volume = pa_cvolume_reset(&cv, s->sample_spec.channels);
- else {
- /* This is not really relevant, since no volume was set, and
- * the real number of channels is embedded in the format_info
- * structure */
- volume = pa_cvolume_reset(&cv, PA_CHANNELS_MAX);
- }
- }
-
pa_tagstruct_put_cvolume(t, volume);
} else
pa_tagstruct_putu32(t, s->buffer_attr.fragsize);
@@ -1335,6 +1332,15 @@ static int create_stream(
pa_tagstruct_put_format_info(t, s->req_formats[i]);
}
+ if (s->context->version >= 22 && s->direction == PA_STREAM_RECORD) {
+ pa_tagstruct_put_cvolume(t, volume);
+ pa_tagstruct_put_boolean(t, flags & PA_STREAM_START_MUTED);
+ pa_tagstruct_put_boolean(t, volume_set);
+ pa_tagstruct_put_boolean(t, flags & (PA_STREAM_START_MUTED|PA_STREAM_START_UNMUTED));
+ pa_tagstruct_put_boolean(t, flags & PA_STREAM_RELATIVE_VOLUME);
+ pa_tagstruct_put_boolean(t, flags & (PA_STREAM_PASSTHROUGH));
+ }
+
pa_pstream_send_tagstruct(s->context->pstream, t);
pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL);