mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-28 05:40:21 -04:00
allow clients to not specify the volume for their streams
This commit is contained in:
parent
c35d1bbec3
commit
ec62596f49
3 changed files with 29 additions and 3 deletions
4
PROTOCOL
4
PROTOCOL
|
|
@ -140,3 +140,7 @@ new message:
|
|||
new message:
|
||||
|
||||
PA_COMMAND_EXTENSION
|
||||
|
||||
PA_COMMAND_CREATE_RECORD_STREAM, PA_COMMAND_CREATE_PLAYBACK_STREAM:
|
||||
|
||||
bool volume_set at the end
|
||||
|
|
|
|||
|
|
@ -865,6 +865,7 @@ static int create_stream(
|
|||
|
||||
pa_tagstruct *t;
|
||||
uint32_t tag;
|
||||
pa_bool_t volume_set = FALSE;
|
||||
|
||||
pa_assert(s);
|
||||
pa_assert(PA_REFCNT_VALUE(s) >= 1);
|
||||
|
|
@ -957,6 +958,8 @@ static int create_stream(
|
|||
PA_TAG_U32, s->syncid,
|
||||
PA_TAG_INVALID);
|
||||
|
||||
volume_set = !!volume;
|
||||
|
||||
if (!volume)
|
||||
volume = pa_cvolume_reset(&cv, s->sample_spec.channels);
|
||||
|
||||
|
|
@ -994,6 +997,15 @@ static int create_stream(
|
|||
pa_tagstruct_putu32(t, s->direct_on_input);
|
||||
}
|
||||
|
||||
if (s->context->version >= 14 &&
|
||||
s->direction == PA_STREAM_PLAYBACK) {
|
||||
|
||||
pa_tagstruct_put(
|
||||
t,
|
||||
PA_TAG_BOOLEAN, volume_set,
|
||||
PA_TAG_INVALID);
|
||||
}
|
||||
|
||||
pa_pstream_send_tagstruct(s->context->pstream, t);
|
||||
pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -883,7 +883,6 @@ static playback_stream* playback_stream_new(
|
|||
pa_assert(tlength);
|
||||
pa_assert(prebuf);
|
||||
pa_assert(minreq);
|
||||
pa_assert(volume);
|
||||
pa_assert(missing);
|
||||
pa_assert(p);
|
||||
|
||||
|
|
@ -916,7 +915,8 @@ static playback_stream* playback_stream_new(
|
|||
data.sink = sink;
|
||||
pa_sink_input_new_data_set_sample_spec(&data, ss);
|
||||
pa_sink_input_new_data_set_channel_map(&data, map);
|
||||
pa_sink_input_new_data_set_volume(&data, volume);
|
||||
if (volume)
|
||||
pa_sink_input_new_data_set_volume(&data, volume);
|
||||
pa_sink_input_new_data_set_muted(&data, muted);
|
||||
data.sync_base = ssync ? ssync->sink_input : NULL;
|
||||
|
||||
|
|
@ -1596,6 +1596,7 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
|
|||
|
||||
pa_sink_input_flags_t flags = 0;
|
||||
pa_proplist *p;
|
||||
pa_bool_t volume_set = TRUE;
|
||||
|
||||
pa_native_connection_assert_ref(c);
|
||||
pa_assert(t);
|
||||
|
|
@ -1662,6 +1663,15 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
|
|||
}
|
||||
}
|
||||
|
||||
if (c->version >= 14) {
|
||||
|
||||
if (pa_tagstruct_get_boolean(t, &volume_set) < 0) {
|
||||
protocol_error(c);
|
||||
pa_proplist_free(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pa_tagstruct_eof(t)) {
|
||||
protocol_error(c);
|
||||
pa_proplist_free(p);
|
||||
|
|
@ -1695,7 +1705,7 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
|
|||
(no_move ? PA_SINK_INPUT_DONT_MOVE : 0) |
|
||||
(variable_rate ? PA_SINK_INPUT_VARIABLE_RATE : 0);
|
||||
|
||||
s = playback_stream_new(c, sink, &ss, &map, &maxlength, &tlength, &prebuf, &minreq, &volume, muted, syncid, &missing, flags, p, adjust_latency);
|
||||
s = playback_stream_new(c, sink, &ss, &map, &maxlength, &tlength, &prebuf, &minreq, volume_set ? &volume : NULL, muted, syncid, &missing, flags, p, adjust_latency);
|
||||
pa_proplist_free(p);
|
||||
|
||||
CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_INVALID);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue