mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
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)
This commit is contained in:
parent
fdf3a08814
commit
dffc4d18d3
21 changed files with 1980 additions and 219 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue