[PATCH 1/6] mf/tests: Add some WMA encoder creation tests.

Rémi Bernon rbernon at codeweavers.com
Mon Jan 24 03:55:33 CST 2022


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

I'm not expecting the encoder transform to be available in Wine anytime
soon, but I'm going to use it in the tests to produce and validate the
WMA data I'm going to feed the decoder.

The problem I faced here was that ffmpeg WMA support is very minimal and
not fully reverse engineered, and although it's seemingly able to decode
WMA that Microsoft encoder produces, it's missing a lot of knowledge of
the codec data blob and is ignoring most of the information in it, and
I wasn't able to produce fully valid WMA stream that Microsoft decoder
would decode properly.

For the tests I needed WMA data that both can decode, and so I'm using
the WMA encoder transform on Windows to produce it.

These tests also should pass on Wine whether the decoder transform stub
is registered or not, as there's already some appropriate todo_wine.
When it's not, the tests are simply skipped.

 dlls/mf/tests/mf.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 1ba1bc4691d..9768491650a 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -5420,6 +5420,59 @@ static BOOL create_transform(GUID category, MFT_REGISTER_TYPE_INFO *input_type,
     return TRUE;
 }
 
+static void test_wma_encoder(void)
+{
+    static const media_type_desc transform_inputs[] =
+    {
+        {
+            ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio),
+            ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_PCM),
+        },
+        {
+            ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio),
+            ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_Float),
+        },
+    };
+    static const media_type_desc transform_outputs[] =
+    {
+        {
+            ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio),
+            ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_WMAudioV8),
+        },
+        {
+            ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio),
+            ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_WMAudioV9),
+        },
+        {
+            ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio),
+            ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_WMAudio_Lossless),
+        },
+    };
+
+    MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Audio, MFAudioFormat_WMAudioV8};
+    MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Audio, MFAudioFormat_Float};
+    IMFTransform *transform;
+    GUID class_id;
+    HRESULT hr;
+    ULONG ret;
+
+    hr = CoInitialize(NULL);
+    ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr);
+
+    if (!create_transform(MFT_CATEGORY_AUDIO_ENCODER, &input_type, &output_type, L"WMAudio Encoder MFT",
+            transform_inputs, ARRAY_SIZE(transform_inputs), transform_outputs, ARRAY_SIZE(transform_outputs),
+            &transform, &class_id))
+        goto failed;
+
+    check_interface(transform, &IID_IMediaObject, TRUE);
+
+    ret = IMFTransform_Release(transform);
+    ok(ret == 0, "Release returned %u\n", ret);
+
+failed:
+    CoUninitialize();
+}
+
 static void test_wma_decoder(void)
 {
     static const media_type_desc transform_inputs[] =
@@ -5511,5 +5564,6 @@ START_TEST(mf)
     test_sample_copier_output_processing();
     test_MFGetTopoNodeCurrentType();
     test_MFRequireProtectedEnvironment();
+    test_wma_encoder();
     test_wma_decoder();
 }
-- 
2.34.1




More information about the wine-devel mailing list