Commit dd62aca4 authored by Thomas Guillem's avatar Thomas Guillem

Revert "aout: simplify, remove unset_str[]"

This broke the ability to unset an audio device.

This reverts commit 4074b544.
parent d59503ee
......@@ -35,6 +35,8 @@
#include "libvlc.h"
#include "aout_internal.h"
static const char unset_str[1] = ""; /* Non-NULL constant string pointer */
struct aout_dev
{
aout_dev_t *next;
......@@ -187,7 +189,7 @@ audio_output_t *aout_New (vlc_object_t *parent)
vlc_mutex_init (&owner->lock);
vlc_mutex_init (&owner->req.lock);
vlc_mutex_init (&owner->dev.lock);
owner->req.device = NULL;
owner->req.device = (char *)unset_str;
owner->req.volume = -1.f;
owner->req.mute = -1;
......@@ -355,7 +357,7 @@ static void aout_Destructor (vlc_object_t *obj)
free (dev);
}
assert (owner->req.device == NULL);
assert (owner->req.device == unset_str);
vlc_mutex_destroy (&owner->req.lock);
vlc_mutex_destroy (&owner->lock);
}
......@@ -562,11 +564,11 @@ void aout_OutputUnlock (audio_output_t *aout)
vlc_assert_locked (&owner->lock);
vlc_mutex_lock (&owner->req.lock);
if (owner->req.device != NULL)
if (owner->req.device != unset_str)
{
aout_OutputDeviceSet (aout, owner->req.device);
free (owner->req.device);
owner->req.device = NULL;
owner->req.device = (char *)unset_str;
}
if (owner->req.volume >= 0.f)
......@@ -673,7 +675,8 @@ int aout_DeviceSet (audio_output_t *aout, const char *id)
}
vlc_mutex_lock (&owner->req.lock);
free (owner->req.device);
if (owner->req.device != unset_str)
free (owner->req.device);
owner->req.device = dev;
vlc_mutex_unlock (&owner->req.lock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment