[vlc-devel] [PATCH] wasapi: implement pass-through

Thomas Guillem thomas at gllm.fr
Mon May 2 18:07:26 CEST 2016



On Mon, May 2, 2016, at 17:21, Rémi Denis-Courmont wrote:
> 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.

OK, I'll do that.

> 
> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
> _______________________________________________
> 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