[PATCH v4 03/12] winegstreamer: Add MFT registration helper for gstreamer-backed MFTs.
Zebediah Figura (she/her)
zfigura at codeweavers.com
Thu Dec 3 10:29:15 CST 2020
I'd go with something more like "register the audio converter MFT" for a
patch subject, since that's the functional change this patch achieves.
On 12/2/20 4:36 PM, Derek Lesho wrote:
> Signed-off-by: Derek Lesho <dlesho at codeweavers.com>
> ---
> v4: Fix tracing of 'param' parameter for ::ProcessMessage.
> ---
> dlls/winegstreamer/gst_private.h | 1 +
> dlls/winegstreamer/main.c | 3 +-
> dlls/winegstreamer/mfplat.c | 69 ++++++++++++++++++++++++++++++++
> 3 files changed, 72 insertions(+), 1 deletion(-)
>
> diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
> index 7889c996204..9518f721504 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, ®_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 095a9b81091..f300988fc5c 100644
> --- a/dlls/winegstreamer/mfplat.c
> +++ b/dlls/winegstreamer/mfplat.c
> @@ -445,6 +445,75 @@ HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj)
> return CLASS_E_CLASSNOTAVAILABLE;
> }
>
> +static WCHAR audio_converterW[] = {'A','u','d','i','o',' ','C','o','n','v','e','r','t','e','r',0};
> +static const GUID *audio_converter_supported_types[] =
> +{
> + &MFAudioFormat_PCM,
> + &MFAudioFormat_Float,
> +};
> +
> +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[] =
> +{
> + {
> + &CLSID_WINEAudioConverter,
> + &MFT_CATEGORY_AUDIO_EFFECT,
> + audio_converterW,
> + MFT_ENUM_FLAG_SYNCMFT,
> + &MFMediaType_Audio,
> + ARRAY_SIZE(audio_converter_supported_types),
> + audio_converter_supported_types,
> + ARRAY_SIZE(audio_converter_supported_types),
> + audio_converter_supported_types,
> + NULL
> + },
> +};
> +
> +HRESULT mfplat_DllRegisterServer(void)
> +{
> + unsigned int i, j;
> + HRESULT hr;
> + MFT_REGISTER_TYPE_INFO input_types[2], output_types[2];
> +
> + 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/20201203/54f2cac1/attachment.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/20201203/54f2cac1/attachment.sig>
More information about the wine-devel
mailing list