[PATCH v2 4/4] mfplat: Implement GetAudioFormat method for IMFAudioMediaType interface.
Connor McAdams
cmcadams at codeweavers.com
Wed Apr 21 09:20:07 CDT 2021
Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
---
dlls/mfplat/mediatype.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c
index 60b86aa40b6..fae4d3e5055 100644
--- a/dlls/mfplat/mediatype.c
+++ b/dlls/mfplat/mediatype.c
@@ -41,6 +41,7 @@ struct media_type
IMFVideoMediaType IMFVideoMediaType_iface;
IMFAudioMediaType IMFAudioMediaType_iface;
MFVIDEOFORMAT *video_format;
+ WAVEFORMATEX *audio_format;
};
struct stream_desc
@@ -155,6 +156,7 @@ static ULONG WINAPI mediatype_Release(IMFMediaType *iface)
{
clear_attributes_object(&media_type->attributes);
CoTaskMemFree(media_type->video_format);
+ CoTaskMemFree(media_type->audio_format);
heap_free(media_type);
}
@@ -1369,9 +1371,18 @@ static HRESULT WINAPI audio_mediatype_FreeRepresentation(IMFAudioMediaType *ifac
static const WAVEFORMATEX * WINAPI audio_mediatype_GetAudioFormat(IMFAudioMediaType *iface)
{
- FIXME("%p.\n", iface);
+ struct media_type *media_type = impl_from_IMFAudioMediaType(iface);
+ unsigned int size;
+ HRESULT hr;
+
+ TRACE("%p.\n", iface);
+
+ CoTaskMemFree(media_type->audio_format);
+ if (FAILED(hr = MFCreateWaveFormatExFromMFMediaType((IMFMediaType *)iface, &media_type->audio_format, &size,
+ MFWaveFormatExConvertFlag_Normal)))
+ WARN("Failed to create wave format description, hr %#x.\n", hr);
- return NULL;
+ return media_type->audio_format;
}
static const IMFAudioMediaTypeVtbl audiomediatypevtbl =
--
2.25.1
More information about the wine-devel
mailing list