diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-09-30 22:02:23 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-09-30 22:02:23 +0200 |
commit | f7606a144b7147e493304278d321ab2ed7996bb8 (patch) | |
tree | 0571a158e1da5824749958fc5db68a5bf02a4a82 /src/main.cpp | |
parent | 09ad7a1eb5ff4a1d00776396c4582252e4bd83fc (diff) |
Give error when using an invalid audio input with pipewire
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index caea9b6..61eb5cf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1073,6 +1073,28 @@ int main(int argc, char **argv) { } Arg &audio_input_arg = args["-a"]; + const std::vector<AudioInput> audio_inputs = get_pulseaudio_inputs(); + + // Manually check if the audio inputs we give exist. This is only needed for pipewire, not pulseaudio. + // Pipewire instead DEFAULTS TO THE DEFAULT AUDIO INPUT. THAT'S RETARDED. + // OH, YOU MISSPELLED THE AUDIO INPUT? FUCK YOU + for(const char *audio_input : audio_input_arg.values) { + bool match = false; + for(const auto &existing_audio_input : audio_inputs) { + if(strcmp(audio_input, existing_audio_input.name.c_str()) == 0) { + match = true; + break; + } + } + + if(!match) { + fprintf(stderr, "Error: Audio input device '%s' is not a valid input device. Expected one of:\n", audio_input); + for(const auto &existing_audio_input : audio_inputs) { + fprintf(stderr, " %s\n", existing_audio_input.name.c_str()); + } + exit(2); + } + } uint32_t region_x = 0; uint32_t region_y = 0; |