Connor McAdams : mfplat: Implement GetAudioFormat method for IMFAudioMediaType interface.

Alexandre Julliard julliard at winehq.org
Wed Apr 21 15:57:54 CDT 2021


Module: wine
Branch: master
Commit: 94d33c1daa2a8a2683936efc19f6640b25e00c61
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=94d33c1daa2a8a2683936efc19f6640b25e00c61

Author: Connor McAdams <cmcadams at codeweavers.com>
Date:   Wed Apr 21 10:20:07 2021 -0400

mfplat: Implement GetAudioFormat method for IMFAudioMediaType interface.

Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 =




More information about the wine-cvs mailing list