|
@@ -875,7 +875,6 @@ static void ALSA_HotplugIteration(SDL_bool *has_default_output, SDL_bool *has_de
|
|
|
//SDL_LogInfo(SDL_LOG_CATEGORY_AUDIO, "ALSA: removing %s device '%s'", dev->iscapture ? "capture" : "output", dev->name);
|
|
|
next = dev->next;
|
|
|
SDL_AudioDeviceDisconnected(SDL_FindPhysicalAudioDeviceByHandle(dev->name));
|
|
|
- SDL_free(dev->name);
|
|
|
SDL_free(dev);
|
|
|
}
|
|
|
}
|
|
@@ -910,10 +909,10 @@ static void ALSA_DetectDevices(SDL_AudioDevice **default_output, SDL_AudioDevice
|
|
|
SDL_bool has_default_output = SDL_FALSE, has_default_capture = SDL_FALSE;
|
|
|
ALSA_HotplugIteration(&has_default_output, &has_default_capture); // run once now before a thread continues to check.
|
|
|
if (has_default_output) {
|
|
|
- *default_output = SDL_AddAudioDevice(/*iscapture=*/SDL_FALSE, "ALSA default output device", NULL, "default");
|
|
|
+ *default_output = SDL_AddAudioDevice(/*iscapture=*/SDL_FALSE, "ALSA default output device", NULL, SDL_strdup("default"));
|
|
|
}
|
|
|
if (has_default_capture) {
|
|
|
- *default_capture = SDL_AddAudioDevice(/*iscapture=*/SDL_TRUE, "ALSA default capture device", NULL, "default");
|
|
|
+ *default_capture = SDL_AddAudioDevice(/*iscapture=*/SDL_TRUE, "ALSA default capture device", NULL, SDL_strdup("default"));
|
|
|
}
|
|
|
|
|
|
#if SDL_ALSA_HOTPLUG_THREAD
|
|
@@ -940,12 +939,16 @@ static void ALSA_DeinitializeStart(void)
|
|
|
for (dev = hotplug_devices; dev; dev = next) {
|
|
|
//SDL_LogInfo(SDL_LOG_CATEGORY_AUDIO, "ALSA: at shutdown, removing %s device '%s'", dev->iscapture ? "capture" : "output", dev->name);
|
|
|
next = dev->next;
|
|
|
- SDL_free(dev->name);
|
|
|
SDL_free(dev);
|
|
|
}
|
|
|
hotplug_devices = NULL;
|
|
|
}
|
|
|
|
|
|
+static void ALSA_FreeDeviceHandle(SDL_AudioDevice *device)
|
|
|
+{
|
|
|
+ SDL_free(device->handle);
|
|
|
+}
|
|
|
+
|
|
|
static void ALSA_Deinitialize(void)
|
|
|
{
|
|
|
UnloadALSALibrary();
|
|
@@ -968,6 +971,7 @@ static SDL_bool ALSA_Init(SDL_AudioDriverImpl *impl)
|
|
|
impl->WaitCaptureDevice = ALSA_WaitDevice;
|
|
|
impl->CaptureFromDevice = ALSA_CaptureFromDevice;
|
|
|
impl->FlushCapture = ALSA_FlushCapture;
|
|
|
+ impl->FreeDeviceHandle = ALSA_FreeDeviceHandle;
|
|
|
|
|
|
impl->HasCaptureSupport = SDL_TRUE;
|
|
|
|