audio/video: Skip preferred drivers when loading a driver on demand

Preferred driver entries have special conditions for initializing, which aren't relevant when a specific driver was explicitly requested.
This commit is contained in:
Frank Praznik committed 2025-02-12 11:51:36 -05:00
1 parent 715c18739b
commit 706de78a9e
6 files changed
+8 -4

No files matched your search

+1 -1
View File
@@ -964,7 +964,7 @@ bool SDL_InitAudio(const char *driver_name)
}
for (int i = 0; bootstrap[i]; ++i) {
if (SDL_strcasecmp(bootstrap[i]->name, driver_attempt) == 0) {
if (!bootstrap[i]->is_preferred && SDL_strcasecmp(bootstrap[i]->name, driver_attempt) == 0) {
tried_to_init = true;
SDL_zero(current_audio);
current_audio.pending_events_tail = &current_audio.pending_events;
+1
View File
@@ -360,6 +360,7 @@ typedef struct AudioBootStrap
const char *desc;
bool (*init)(SDL_AudioDriverImpl *impl);
bool demand_only; // if true: request explicitly, or it won't be available.
bool is_preferred;
} AudioBootStrap;
// Not all of these are available in a given build. Use #ifdefs, etc.
+1 -1
View File
@@ -1337,7 +1337,7 @@ static bool PIPEWIRE_Init(SDL_AudioDriverImpl *impl)
}
AudioBootStrap PIPEWIRE_PREFERRED_bootstrap = {
"pipewire", "Pipewire", PIPEWIRE_PREFERRED_Init, false
"pipewire", "Pipewire", PIPEWIRE_PREFERRED_Init, false, true
};
AudioBootStrap PIPEWIRE_bootstrap = {
"pipewire", "Pipewire", PIPEWIRE_Init, false