[vlc-devel] [PATCH] wasapi: implement pass-through
Rémi Denis-Courmont
remi at remlab.net
Mon May 2 17:21:27 CEST 2016
Le 2016-05-02 17:20, Rémi Denis-Courmont a écrit :
> Le 2016-05-02 16:34, Thomas Guillem a écrit :
>> @@ -371,15 +395,37 @@ static HRESULT Start(aout_stream_t *s,
>> audio_sample_format_t *restrict fmt,
>> /* Configure audio stream */
>> WAVEFORMATEXTENSIBLE wf;
>> WAVEFORMATEX *pwf;
>> + AUDCLNT_SHAREMODE shared_mode;
>>
>> - vlc_ToWave(&wf, fmt);
>> - hr = IAudioClient_IsFormatSupported(sys->client,
>> AUDCLNT_SHAREMODE_SHARED,
>> - &wf.Format, &pwf);
>> - if (FAILED(hr))
>> + do
>> {
>> - msg_Err(s, "cannot negotiate audio format (error 0x%lx)",
>> hr);
>> - goto error;
>> - }
>> + if (AOUT_FMT_SPDIF(fmt) && var_InheritBool(s, "spdif"))
>> + {
>> + vlc_SpdifToWave(&wf, fmt);
>> + shared_mode = AUDCLNT_SHAREMODE_EXCLUSIVE;
>> + }
>> + else
>> + {
>> + vlc_ToWave(&wf, fmt);
>> + shared_mode = AUDCLNT_SHAREMODE_SHARED;
>> + }
>> +
>> + hr = IAudioClient_IsFormatSupported(sys->client,
>> shared_mode,
>> + &wf.Format, &pwf);
>> + if (FAILED(hr))
>> + {
>> + if (AOUT_FMT_SPDIF(fmt))
>> + {
>> + /* Device may not support SPDIF: try again with
>> FL32 */
>> + fmt->i_format = VLC_CODEC_FL32;
>> + }
>> + else
>> + {
>> + msg_Err(s, "cannot negotiate audio format (error
>> 0x%lx)", hr);
>> + goto error;
>> + }
>> + }
>> + } while (FAILED(hr));
>
> Potentially infinite loop??
Actually not. But I would unroll for better clarity.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list