[PATCH 2/7] wmp: Implement playback via quartz

Zebediah Figura z.figura12 at gmail.com
Tue Mar 13 10:05:09 CDT 2018


On 12/03/18 23:34, Anton Romanov wrote:
>  static HRESULT WINAPI WMPPlayer4_get_openState(IWMPPlayer4 *iface, WMPOpenState *pwmpos)
> @@ -1357,16 +1366,53 @@ static HRESULT WINAPI WMPControls_get_isAvailable(IWMPControls *iface, BSTR bstr
>  
>  static HRESULT WINAPI WMPControls_play(IWMPControls *iface)
>  {
> +    HRESULT hres;
>      WindowsMediaPlayer *This = impl_from_IWMPControls(iface);
> -    FIXME("(%p)\n", This);
> -    return E_NOTIMPL;
> +    WMPMedia *media;
> +    TRACE("(%p)\n", This);
> +    if (!This->wmpmedia) {
> +        return NS_S_WMPCORE_COMMAND_NOT_AVAILABLE;
> +    }
> +    media = impl_from_IWMPMedia(This->wmpmedia);
> +    if (!This->pFilterGraph) {
> +        hres = CoCreateInstance(&CLSID_FilterGraph,
> +                NULL,
> +                CLSCTX_INPROC_SERVER,
> +                &IID_IGraphBuilder,
> +                (void **)&This->pFilterGraph);
> +        if (SUCCEEDED(hres))
> +            hres = IGraphBuilder_RenderFile(This->pFilterGraph, media->url, NULL);
> +        if (SUCCEEDED(hres))
> +            hres = IGraphBuilder_QueryInterface(This->pFilterGraph, &IID_IMediaControl,
> +                    (void**)&This->media_control);
> +    }
> +    hres = IMediaControl_Run(This->media_control);

This will crash if either of the above calls fail.

> +    if (hres == S_FALSE) {
> +        OAFilterState fs;
> +        hres = IMediaControl_GetState(This->media_control, 1000, &fs);
> +        if (hres != S_OK || fs != State_Running) {
> +            hres = S_FALSE;
> +        }
> +    }

1 second seems arbitrary, especially given that IWMPControls has no
similar method to force a state change.

> +    return hres;
>  }
>  

This function on the whole (and several others in the file) could use
some spacing.



More information about the wine-devel mailing list