[vlc-devel] [PATCHv2 1/3] mmdevice: rename variable
Thomas Guillem
thomas at gllm.fr
Thu Jul 6 11:28:26 CEST 2017
On Thu, Jul 6, 2017, at 11:24, Thomas Guillem wrote:
> This variable is used to request a specific device to the MMThread.
> ---
> modules/audio_output/mmdevice.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/modules/audio_output/mmdevice.c
> b/modules/audio_output/mmdevice.c
> index 2494eee994..8446c1cab3 100644
> --- a/modules/audio_output/mmdevice.c
> +++ b/modules/audio_output/mmdevice.c
> @@ -93,7 +93,7 @@ struct aout_sys_t
> unsigned ducks;
> float gain; /**< Current software gain volume */
>
> - wchar_t *device; /**< Requested device identifier, NULL if none */
> + wchar_t *selecting_device; /**< Requesting device identifier, NULL
> if none */
Maybe a better naming would be:
wchar_t *requested_device; /**< Requested device identifier, NULL
> if none */
> float volume; /**< Requested volume, negative if none */
> signed char mute; /**< Requested mute, negative if none */
> CRITICAL_SECTION lock;
> @@ -732,11 +732,11 @@ static int DeviceSelectLocked(audio_output_t *aout,
> const char *id)
> else
> device = default_device;
>
> - assert(sys->device == NULL);
> - sys->device = device;
> + assert(sys->selecting_device == NULL);
> + sys->selecting_device = device;
>
> WakeConditionVariable(&sys->work);
> - while (sys->device != NULL)
> + while (sys->selecting_device != NULL)
> SleepConditionVariableCS(&sys->ready, &sys->lock, INFINITE);
>
> if (sys->stream != NULL && sys->dev != NULL)
> @@ -787,17 +787,17 @@ static HRESULT MMSession(audio_output_t *aout,
> IMMDeviceEnumerator *it)
> void *pv;
> HRESULT hr;
>
> - assert(sys->device != NULL);
> + assert(sys->selecting_device != NULL);
> assert(sys->dev == NULL);
>
> - if (sys->device != default_device) /* Device selected explicitly */
> + if (sys->selecting_device != default_device) /* Device selected
> explicitly */
> {
> - msg_Dbg(aout, "using selected device %ls", sys->device);
> - hr = IMMDeviceEnumerator_GetDevice(it, sys->device, &sys->dev);
> + msg_Dbg(aout, "using selected device %ls",
> sys->selecting_device);
> + hr = IMMDeviceEnumerator_GetDevice(it, sys->selecting_device,
> &sys->dev);
> if (FAILED(hr))
> msg_Err(aout, "cannot get selected device %ls (error
> 0x%lx)",
> - sys->device, hr);
> - free(sys->device);
> + sys->selecting_device, hr);
> + free(sys->selecting_device);
> }
> else
> hr = AUDCLNT_E_DEVICE_INVALIDATED;
> @@ -812,7 +812,7 @@ static HRESULT MMSession(audio_output_t *aout,
> IMMDeviceEnumerator *it)
> msg_Err(aout, "cannot get default device (error 0x%lx)",
> hr);
> }
>
> - sys->device = NULL;
> + sys->selecting_device = NULL;
> WakeConditionVariable(&sys->ready);
>
> if (SUCCEEDED(hr))
> @@ -923,7 +923,7 @@ static HRESULT MMSession(audio_output_t *aout,
> IMMDeviceEnumerator *it)
> msg_Err(aout, "cannot activate endpoint volume (error %lx)",
> hr);
>
> /* Main loop (adjust volume as long as device is unchanged) */
> - while (sys->device == NULL)
> + while (sys->selecting_device == NULL)
> {
> if (volume != NULL)
> {
> @@ -1134,7 +1134,7 @@ static int Open(vlc_object_t *obj)
> sys->refs = 1;
> sys->ducks = 0;
>
> - sys->device = default_device;
> + sys->selecting_device = default_device;
> sys->gain = 1.f;
> sys->volume = -1.f;
> sys->mute = -1;
> @@ -1165,7 +1165,7 @@ static int Open(vlc_object_t *obj)
> }
>
> EnterCriticalSection(&sys->lock);
> - while (sys->device != NULL)
> + while (sys->selecting_device != NULL)
> SleepConditionVariableCS(&sys->ready, &sys->lock, INFINITE);
> LeaveCriticalSection(&sys->lock);
> LeaveMTA(); /* Leave MTA after thread has entered MTA */
> @@ -1193,7 +1193,7 @@ static void Close(vlc_object_t *obj)
> aout_sys_t *sys = aout->sys;
>
> EnterCriticalSection(&sys->lock);
> - sys->device = default_device; /* break out of MMSession() loop */
> + sys->selecting_device = default_device; /* break out of MMSession()
> loop */
> sys->it = NULL; /* break out of MMThread() loop */
> WakeConditionVariable(&sys->work);
> LeaveCriticalSection(&sys->lock);
> --
> 2.11.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list