Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/mediatype.c | 27 +++++++++++++++++++++++++++ dlls/mfplat/mfplat.spec | 2 +- include/mfapi.h | 1 + 3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index fb90053c605..92d219f26e1 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3063,6 +3063,33 @@ HRESULT WINAPI MFCreateVideoMediaTypeFromSubtype(const GUID *subtype, IMFVideoMe return S_OK; }
+/*********************************************************************** + * MFCreateAudioMediaType (mfplat.@) + */ +HRESULT WINAPI MFCreateAudioMediaType(const WAVEFORMATEX *format, IMFAudioMediaType **media_type) +{ + struct media_type *object; + HRESULT hr; + + TRACE("%p, %p.\n", format, media_type); + + if (!media_type) + return E_INVALIDARG; + + if (FAILED(hr = create_media_type(&object))) + return hr; + + if (FAILED(hr = MFInitMediaTypeFromWaveFormatEx(&object->IMFMediaType_iface, format, sizeof(*format) + format->cbSize))) + { + IMFMediaType_Release(&object->IMFMediaType_iface); + return hr; + } + + *media_type = &object->IMFAudioMediaType_iface; + + return S_OK; +} + static void media_type_get_ratio(IMFMediaType *media_type, const GUID *attr, UINT32 *numerator, UINT32 *denominator) { diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec index e8dc01c200c..9a78c2fb0bc 100644 --- a/dlls/mfplat/mfplat.spec +++ b/dlls/mfplat/mfplat.spec @@ -43,7 +43,7 @@ @ stdcall MFCreateAlignedMemoryBuffer(long long ptr) @ stdcall MFCreateAsyncResult(ptr ptr ptr ptr) rtworkq.RtwqCreateAsyncResult @ stdcall MFCreateAttributes(ptr long) -@ stub MFCreateAudioMediaType +@ stdcall MFCreateAudioMediaType(ptr ptr) @ stdcall MFCreateCollection(ptr) @ stdcall MFCreateDXGIDeviceManager(ptr ptr) @ stdcall MFCreateDXGISurfaceBuffer(ptr ptr long long ptr) diff --git a/include/mfapi.h b/include/mfapi.h index 986f5b9e3e4..2ac70793d7a 100644 --- a/include/mfapi.h +++ b/include/mfapi.h @@ -508,6 +508,7 @@ HRESULT WINAPI MFCreate2DMediaBuffer(DWORD width, DWORD height, DWORD fourcc, BO HRESULT WINAPI MFCreateAlignedMemoryBuffer(DWORD max_length, DWORD alignment, IMFMediaBuffer **buffer); HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size); HRESULT WINAPI MFCreateAsyncResult(IUnknown *object, IMFAsyncCallback *callback, IUnknown *state, IMFAsyncResult **result); +HRESULT WINAPI MFCreateAudioMediaType(const WAVEFORMATEX *audioformat, IMFAudioMediaType **mediatype); HRESULT WINAPI MFCreateCollection(IMFCollection **collection); HRESULT WINAPI MFCreateDXGIDeviceManager(UINT *token, IMFDXGIDeviceManager **manager); HRESULT WINAPI MFCreateDXGISurfaceBuffer(REFIID riid, IUnknown *surface, UINT subresource, BOOL bottomup,