Fixed assertion failure in diskaudio target caused by new hotplugging support.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 30 Jun 2015 13:46:06 -0400
changeset 9786d857f324bede
parent 9785 6e87ae760e6d
child 9787 08b2895a935a
Fixed assertion failure in diskaudio target caused by new hotplugging support.

Fixes Bugzilla #3032.
src/audio/disk/SDL_diskaudio.c
     1.1 --- a/src/audio/disk/SDL_diskaudio.c	Mon Jun 29 22:24:00 2015 -0700
     1.2 +++ b/src/audio/disk/SDL_diskaudio.c	Tue Jun 30 13:46:06 2015 -0400
     1.3 @@ -102,8 +102,9 @@
     1.4  static int
     1.5  DISKAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
     1.6  {
     1.7 +    /* handle != NULL means "user specified the placeholder name on the fake detected device list" */
     1.8 +    const char *fname = DISKAUD_GetOutputFilename(handle ? NULL : devname);
     1.9      const char *envr = SDL_getenv(DISKENVR_WRITEDELAY);
    1.10 -    const char *fname = DISKAUD_GetOutputFilename(devname);
    1.11  
    1.12      this->hidden = (struct SDL_PrivateAudioData *)
    1.13          SDL_malloc(sizeof(*this->hidden));
    1.14 @@ -141,6 +142,13 @@
    1.15      return 0;
    1.16  }
    1.17  
    1.18 +static void
    1.19 +DISKAUD_DetectDevices(void)
    1.20 +{
    1.21 +    /* !!! FIXME: stole this literal string from DEFAULT_OUTPUT_DEVNAME in SDL_audio.c */
    1.22 +    SDL_AddAudioDevice(SDL_FALSE, "System audio output device", (void *) 0x1);
    1.23 +}
    1.24 +
    1.25  static int
    1.26  DISKAUD_Init(SDL_AudioDriverImpl * impl)
    1.27  {
    1.28 @@ -150,6 +158,7 @@
    1.29      impl->PlayDevice = DISKAUD_PlayDevice;
    1.30      impl->GetDeviceBuf = DISKAUD_GetDeviceBuf;
    1.31      impl->CloseDevice = DISKAUD_CloseDevice;
    1.32 +    impl->DetectDevices = DISKAUD_DetectDevices;
    1.33  
    1.34      impl->AllowsArbitraryDeviceNames = 1;
    1.35