[PATCH v3 02/12] winegstreamer: Add MFT registration helper for gstreamer-backed MFTs.

Zebediah Figura (she/her) zfigura at codeweavers.com
Wed Dec 2 14:42:31 CST 2020


On 12/2/20 1:54 PM, Derek Lesho wrote:
> Signed-off-by: Derek Lesho <dlesho at codeweavers.com>
> ---
>  dlls/winegstreamer/gst_private.h |  1 +
>  dlls/winegstreamer/main.c        |  3 +-
>  dlls/winegstreamer/mfplat.c      | 48 ++++++++++++++++++++++++++++++++
>  3 files changed, 51 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
> index 28e424439d8..9752b242ad6 100644
> --- a/dlls/winegstreamer/gst_private.h
> +++ b/dlls/winegstreamer/gst_private.h
> @@ -76,6 +76,7 @@ BOOL init_gstreamer(void) DECLSPEC_HIDDEN;
>  void start_dispatch_thread(void) DECLSPEC_HIDDEN;
>  
>  extern HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj) DECLSPEC_HIDDEN;
> +extern HRESULT mfplat_DllRegisterServer(void) DECLSPEC_HIDDEN;
>  
>  HRESULT winegstreamer_stream_handler_create(REFIID riid, void **obj) DECLSPEC_HIDDEN;
>  IMFMediaType *mf_media_type_from_caps(const GstCaps *caps) DECLSPEC_HIDDEN;
> diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c
> index 4ca371d58bd..385c5550235 100644
> --- a/dlls/winegstreamer/main.c
> +++ b/dlls/winegstreamer/main.c
> @@ -368,7 +368,8 @@ HRESULT WINAPI DllRegisterServer(void)
>      IFilterMapper2_RegisterFilter(mapper, &CLSID_WAVEParser, wave_parserW, NULL, NULL, NULL, &reg_wave_parser);
>  
>      IFilterMapper2_Release(mapper);
> -    return S_OK;
> +
> +    return mfplat_DllRegisterServer();
>  }
>  
>  HRESULT WINAPI DllUnregisterServer(void)
> diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c
> index c5b133c824e..9d5a7e0427e 100644
> --- a/dlls/winegstreamer/mfplat.c
> +++ b/dlls/winegstreamer/mfplat.c
> @@ -442,6 +442,54 @@ HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj)
>      return CLASS_E_CLASSNOTAVAILABLE;
>  }
>  
> +static const struct mft
> +{
> +    const GUID *clsid;
> +    const GUID *category;
> +    LPWSTR name;
> +    const UINT32 flags;
> +    const GUID *major_type;
> +    const UINT32 input_types_count;
> +    const GUID **input_types;
> +    const UINT32 output_types_count;
> +    const GUID **output_types;
> +    IMFAttributes *attributes;
> +}
> +mfts[] = {};

I'm not sure if declaring an empty array like this is valid, and I had
in mind moving the entire registration to this patch. Note that your
patch 3/12 isn't dead code without it, as you're still able to create
the object through CoCreateInstance() directly.

> +
> +HRESULT mfplat_DllRegisterServer(void)
> +{
> +    unsigned int i, j;
> +    HRESULT hr;
> +    MFT_REGISTER_TYPE_INFO input_types[1], output_types[1];
> +
> +    for (i = 0; i < ARRAY_SIZE(mfts); i++)
> +    {
> +        const struct mft *cur = &mfts[i];
> +
> +        for (j = 0; j < cur->input_types_count; j++)
> +        {
> +            input_types[j].guidMajorType = *(cur->major_type);
> +            input_types[j].guidSubtype = *(cur->input_types[j]);
> +        }
> +        for (j = 0; j < cur->output_types_count; j++)
> +        {
> +            output_types[j].guidMajorType = *(cur->major_type);
> +            output_types[j].guidSubtype = *(cur->output_types[j]);
> +        }
> +
> +        hr = MFTRegister(*(cur->clsid), *(cur->category), cur->name, cur->flags, cur->input_types_count,
> +                    input_types, cur->output_types_count, output_types, cur->attributes);
> +
> +        if (FAILED(hr))
> +        {
> +            FIXME("Failed to register MFT, hr %#x\n", hr);
> +            return hr;
> +        }
> +    }
> +    return S_OK;
> +}
> +
>  static const struct
>  {
>      const GUID *subtype;
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x0D9D358A07A17840.asc
Type: application/pgp-keys
Size: 1769 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20201202/d2c3b7ff/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20201202/d2c3b7ff/attachment-0001.sig>


More information about the wine-devel mailing list