mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
pulse: respect flags to set volume/mute
This commit is contained in:
parent
a4874abc46
commit
ab4def7e5f
1 changed files with 15 additions and 5 deletions
|
|
@ -305,6 +305,8 @@ struct stream {
|
||||||
|
|
||||||
uint32_t drain_tag;
|
uint32_t drain_tag;
|
||||||
unsigned int corked:1;
|
unsigned int corked:1;
|
||||||
|
unsigned int volume_set:1;
|
||||||
|
unsigned int muted_set:1;
|
||||||
unsigned int adjust_latency:1;
|
unsigned int adjust_latency:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1364,11 +1366,15 @@ static void stream_param_changed(void *data, uint32_t id, const struct spa_pod *
|
||||||
stream->frame_size = sample_spec_frame_size(&stream->ss);
|
stream->frame_size = sample_spec_frame_size(&stream->ss);
|
||||||
|
|
||||||
if (stream->create_tag != SPA_ID_INVALID) {
|
if (stream->create_tag != SPA_ID_INVALID) {
|
||||||
float val = stream->muted ? 1.0f : 0.0f;
|
if (stream->volume_set) {
|
||||||
pw_stream_set_control(stream->stream,
|
pw_stream_set_control(stream->stream,
|
||||||
SPA_PROP_channelVolumes, stream->volume.channels, stream->volume.values,
|
SPA_PROP_channelVolumes, stream->volume.channels, stream->volume.values, 0);
|
||||||
SPA_PROP_mute, 1, &val,
|
}
|
||||||
0);
|
if (stream->muted_set) {
|
||||||
|
float val = stream->muted ? 1.0f : 0.0f;
|
||||||
|
pw_stream_set_control(stream->stream,
|
||||||
|
SPA_PROP_mute, 1, &val, 0);
|
||||||
|
}
|
||||||
if (stream->corked)
|
if (stream->corked)
|
||||||
pw_stream_set_active(stream->stream, false);
|
pw_stream_set_active(stream->stream, false);
|
||||||
if (stream->direction == PW_DIRECTION_OUTPUT)
|
if (stream->direction == PW_DIRECTION_OUTPUT)
|
||||||
|
|
@ -1664,7 +1670,9 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui
|
||||||
stream->ss = ss;
|
stream->ss = ss;
|
||||||
stream->map = map;
|
stream->map = map;
|
||||||
stream->volume = volume;
|
stream->volume = volume;
|
||||||
|
stream->volume_set = volume_set;
|
||||||
stream->muted = muted;
|
stream->muted = muted;
|
||||||
|
stream->muted_set = muted_set;
|
||||||
|
|
||||||
fix_playback_buffer_attr(stream, &attr);
|
fix_playback_buffer_attr(stream, &attr);
|
||||||
stream->attr = attr;
|
stream->attr = attr;
|
||||||
|
|
@ -2078,6 +2086,7 @@ static int do_set_stream_volume(struct client *client, uint32_t command, uint32_
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
stream->volume = volume;
|
stream->volume = volume;
|
||||||
|
stream->volume_set = true;
|
||||||
|
|
||||||
pw_stream_set_control(stream->stream,
|
pw_stream_set_control(stream->stream,
|
||||||
SPA_PROP_channelVolumes, volume.channels, volume.values,
|
SPA_PROP_channelVolumes, volume.channels, volume.values,
|
||||||
|
|
@ -2109,6 +2118,7 @@ static int do_set_stream_mute(struct client *client, uint32_t command, uint32_t
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
stream->muted = mute;
|
stream->muted = mute;
|
||||||
|
stream->muted_set = true;
|
||||||
|
|
||||||
val = mute ? 1.0f : 0.0f;
|
val = mute ? 1.0f : 0.0f;
|
||||||
pw_stream_set_control(stream->stream,
|
pw_stream_set_control(stream->stream,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue