mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
pactl: Validate volume before setting
This makes sure that a valid volume is provided before setting on sink/sink-input/source.
This commit is contained in:
parent
0edbb2c6aa
commit
3265424f27
1 changed files with 15 additions and 0 deletions
|
|
@ -1248,6 +1248,11 @@ int main(int argc, char *argv[]) {
|
|||
goto quit;
|
||||
}
|
||||
|
||||
if (!PA_VOLUME_IS_VALID(v)) {
|
||||
pa_log(_("Volume outside permissible range.\n"));
|
||||
goto quit;
|
||||
}
|
||||
|
||||
sink_name = pa_xstrdup(argv[optind+1]);
|
||||
volume = (pa_volume_t) v;
|
||||
|
||||
|
|
@ -1265,6 +1270,11 @@ int main(int argc, char *argv[]) {
|
|||
goto quit;
|
||||
}
|
||||
|
||||
if (!PA_VOLUME_IS_VALID(v)) {
|
||||
pa_log(_("Volume outside permissible range.\n"));
|
||||
goto quit;
|
||||
}
|
||||
|
||||
source_name = pa_xstrdup(argv[optind+1]);
|
||||
volume = (pa_volume_t) v;
|
||||
|
||||
|
|
@ -1287,6 +1297,11 @@ int main(int argc, char *argv[]) {
|
|||
goto quit;
|
||||
}
|
||||
|
||||
if (!PA_VOLUME_IS_VALID(v)) {
|
||||
pa_log(_("Volume outside permissible range.\n"));
|
||||
goto quit;
|
||||
}
|
||||
|
||||
volume = (pa_volume_t) v;
|
||||
|
||||
} else if (pa_streq(argv[optind], "set-sink-mute")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue