From 50c053a80c27e0512911f694c32f43b0fab1a48a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 30 Jun 2015 13:46:06 -0400 Subject: [PATCH] Fixed assertion failure in diskaudio target caused by new hotplugging support. Fixes Bugzilla #3032. --HG-- extra : rebase_source : aa80f1133f83b9149da70a4840c8600d0dd1c9b1 --- src/audio/disk/SDL_diskaudio.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/audio/disk/SDL_diskaudio.c b/src/audio/disk/SDL_diskaudio.c index df17bfb96..ef8bc0dcb 100644 --- a/src/audio/disk/SDL_diskaudio.c +++ b/src/audio/disk/SDL_diskaudio.c @@ -102,8 +102,9 @@ DISKAUD_CloseDevice(_THIS) static int DISKAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { + /* handle != NULL means "user specified the placeholder name on the fake detected device list" */ + const char *fname = DISKAUD_GetOutputFilename(handle ? NULL : devname); const char *envr = SDL_getenv(DISKENVR_WRITEDELAY); - const char *fname = DISKAUD_GetOutputFilename(devname); this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); @@ -141,6 +142,13 @@ DISKAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return 0; } +static void +DISKAUD_DetectDevices(void) +{ + /* !!! FIXME: stole this literal string from DEFAULT_OUTPUT_DEVNAME in SDL_audio.c */ + SDL_AddAudioDevice(SDL_FALSE, "System audio output device", (void *) 0x1); +} + static int DISKAUD_Init(SDL_AudioDriverImpl * impl) { @@ -150,6 +158,7 @@ DISKAUD_Init(SDL_AudioDriverImpl * impl) impl->PlayDevice = DISKAUD_PlayDevice; impl->GetDeviceBuf = DISKAUD_GetDeviceBuf; impl->CloseDevice = DISKAUD_CloseDevice; + impl->DetectDevices = DISKAUD_DetectDevices; impl->AllowsArbitraryDeviceNames = 1;