Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
v2: Use a generic function to check media type items against expected items, instead of hardcoding attributes.
dlls/propsys/propvar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/propsys/propvar.c b/dlls/propsys/propvar.c index 977fbebb918..be27c5cb641 100644 --- a/dlls/propsys/propvar.c +++ b/dlls/propsys/propvar.c @@ -865,7 +865,7 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2 CMP_NUM_VALUE(lVal); break; case VT_UI4: - CMP_NUM_VALUE(uiVal); + CMP_NUM_VALUE(ulVal); break; case VT_I8: CMP_NUM_VALUE(hVal.QuadPart);
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- include/mfidl.idl | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/mfidl.idl b/include/mfidl.idl index 511f97e3ac6..4df1d0c85ba 100644 --- a/include/mfidl.idl +++ b/include/mfidl.idl @@ -1589,6 +1589,9 @@ cpp_quote("EXTERN_GUID(MR_AUDIO_POLICY_SERVICE, 0x911fd737, 0x6775, 0x4ab0, 0xa6 cpp_quote("EXTERN_GUID(MF_PROPERTY_HANDLER_SERVICE, 0xa3face02, 0x32b8, 0x41dd, 0x90, 0xe7, 0x5f, 0xef, 0x7c, 0x89, 0x91, 0xb5);") cpp_quote("EXTERN_GUID(MF_WORKQUEUE_SERVICES, 0x8e37d489, 0x41e0, 0x413a, 0x90, 0x68, 0x28, 0x7c, 0x88, 0x6d, 0x8d, 0xda);")
+cpp_quote("EXTERN_GUID(MF_PROGRESSIVE_CODING_CONTENT, 0x8f020eea, 0x1508, 0x471f, 0x9d, 0xa6, 0x50, 0x7d, 0x7c, 0xfa, 0x40, 0xdb);") +cpp_quote("EXTERN_GUID(MF_NALU_LENGTH_SET, 0xa7911d53, 0x12a4, 0x4965, 0xae, 0x70, 0x6e, 0xad, 0xd6, 0xff, 0x05, 0x51);") + cpp_quote("EXTERN_GUID(MF_SAMPLEGRABBERSINK_SAMPLE_TIME_OFFSET, 0x62e3d776, 0x8100, 0x4e03, 0xa6, 0xe8, 0xbd, 0x38, 0x57, 0xac, 0x9c, 0x47);") cpp_quote("EXTERN_GUID(MF_SAMPLEGRABBERSINK_IGNORE_CLOCK, 0x0efda2c0, 0x2b69, 0x4e2e, 0xab, 0x8d, 0x46, 0xdc, 0xbf, 0xf7, 0xd2, 0x5d);")
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mfreadwrite/tests/Makefile.in | 2 +- dlls/mfreadwrite/tests/mfplat.c | 293 ++++++++++++++++++++++++++ dlls/mfreadwrite/tests/resource.rc | 4 + dlls/mfreadwrite/tests/test-48000.wav | Bin 0 -> 2104 bytes 4 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 dlls/mfreadwrite/tests/test-48000.wav
diff --git a/dlls/mfreadwrite/tests/Makefile.in b/dlls/mfreadwrite/tests/Makefile.in index c7476c14c6b..f37a371ef2c 100644 --- a/dlls/mfreadwrite/tests/Makefile.in +++ b/dlls/mfreadwrite/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = mfreadwrite.dll -IMPORTS = ole32 user32 d3d9 dxva2 mfplat mfreadwrite mfuuid +IMPORTS = ole32 user32 d3d9 dxva2 mfplat mfreadwrite mfuuid propsys
C_SRCS = \ mfplat.c diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index e3ff7f6e7aa..5a7d021ef84 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -39,6 +39,7 @@ DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); #include "mfreadwrite.h" #include "d3d9.h" #include "dxva2api.h" +#include "propvarutil.h"
#include "wine/heap.h" #include "wine/test.h" @@ -1230,6 +1231,297 @@ done: DestroyWindow(window); }
+static const char *debugstr_propvariant(const PROPVARIANT *var) +{ + if (!var) return "(null)"; + switch (var->vt) + { + case VT_NULL: return "type null"; + case VT_EMPTY: return "type empty"; + case VT_BOOL: return wine_dbg_sprintf("type %#x, value %s", var->vt, var->boolVal ? "true" : "false"); + case VT_I1: return wine_dbg_sprintf("type %#x, value %d", var->vt, var->cVal); + case VT_UI1: return wine_dbg_sprintf("type %#x, value %u", var->vt, var->bVal); + case VT_I2: return wine_dbg_sprintf("type %#x, value %d", var->vt, var->iVal); + case VT_UI2: return wine_dbg_sprintf("type %#x, value %u", var->vt, var->uiVal); + case VT_I4: return wine_dbg_sprintf("type %#x, value %d", var->vt, var->lVal); + case VT_UI4: return wine_dbg_sprintf("type %#x, value %u", var->vt, var->ulVal); + case VT_I8: return wine_dbg_sprintf("type %#x, value %I64d", var->vt, (INT64)var->hVal.QuadPart); + case VT_UI8: return wine_dbg_sprintf("type %#x, value %I64u", var->vt, (UINT64)var->uhVal.QuadPart); + case VT_R4: return wine_dbg_sprintf("type %#x, value %f", var->vt, var->fltVal); + case VT_R8: return wine_dbg_sprintf("type %#x, value %f", var->vt, var->dblVal); + case VT_BSTR: + case VT_LPWSTR: return debugstr_w(var->bstrVal); + case VT_LPSTR: return debugstr_a(var->pszVal); + case VT_CLSID: return debugstr_guid(var->puuid); + default: return wine_dbg_sprintf("type %#x", var->vt); + } +} + +struct media_type_item +{ + const GUID *key; + const PROPVARIANT value; + BOOL todo_missing; +}; + +struct media_type_desc +{ + struct media_type_item items[1024]; + UINT todo_spurious; +}; + +static void check_media_type_items(IMFMediaType *media_type, const struct media_type_desc *expect) +{ + UINT32 i, j, count, spurious_count = 0; + BOOL found[1024] = {0}; + PROPVARIANT value; + HRESULT hr; + GUID key; + + hr = IMFMediaType_GetCount(media_type, &count); + ok(hr == S_OK, "GetCount returned hr %#x\n", hr); + + for (i = 0; i < count; i++) + { + PropVariantInit(&value); + hr = IMFMediaType_GetItemByIndex(media_type, i, &key, &value); + ok(hr == S_OK, "GetItemByIndex returned hr %#x\n", hr); + + for (j = 0; expect->items[j].key; j++) if (IsEqualGUID(expect->items[j].key, &key)) break; + if (!expect->items[j].key) + { + todo_wine_if(expect->todo_spurious > spurious_count) + ok(0, "spurious attribute %s\n", debugstr_guid(&key)); + spurious_count++; + continue; + } + + ok(!found[j], "duplicate attribute %s\n", debugstr_guid(&key)); + found[j] = TRUE; + + if (!strcmp(winetest_platform, "wine")) + ok(!expect->items[j].todo_missing, "attribute not missing %s\n", debugstr_guid(&key)); + ok(!PropVariantCompareEx(&value, &expect->items[j].value, 0, 0), "got %s, expected %s.\n", + debugstr_propvariant(&value), debugstr_propvariant(&expect->items[j].value)); + PropVariantClear(&value); + } + + if (!strcmp(winetest_platform, "wine")) + ok(expect->todo_spurious == spurious_count, "%u spurious attribute\n", spurious_count); + + for (j = 0; expect->items[j].key; j++) + { + if (found[j]) continue; + todo_wine_if(expect->items[j].todo_missing) + ok(0, "missing attribute %s\n", debugstr_guid(expect->items[j].key)); + } +} + +static void test_media_types(void) +{ + static const struct media_type_desc audio_44100_s8_desc = + { + .items = + { + {.key = &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 44100}, .todo_missing = TRUE}, + {.key = &MF_MT_AUDIO_BLOCK_ALIGNMENT, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_AUDIO_NUM_CHANNELS, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Audio}}, + {.key = &MF_MT_AUDIO_SAMPLES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 44100}}, + {.key = &MF_MT_AUDIO_PREFER_WAVEFORMATEX, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_AUDIO_BITS_PER_SAMPLE, .value = {.vt = VT_UI4, .ulVal = 8}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFAudioFormat_PCM}}, + }, + .todo_spurious = 1, + }; + static const struct media_type_desc audio_48000_s8_desc = + { + .items = + { + {.key = &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 48000}, .todo_missing = TRUE}, + {.key = &MF_MT_AUDIO_BLOCK_ALIGNMENT, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_AUDIO_NUM_CHANNELS, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Audio}}, + {.key = &MF_MT_AUDIO_SAMPLES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 48000}}, + {.key = &MF_MT_AUDIO_PREFER_WAVEFORMATEX, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_AUDIO_BITS_PER_SAMPLE, .value = {.vt = VT_UI4, .ulVal = 8}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFAudioFormat_PCM}}, + }, + .todo_spurious = 1, + }; + static const struct media_type_desc audio_48000_s16_desc = + { + .items = + { + {.key = &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 96000}, .todo_missing = TRUE}, + {.key = &MF_MT_AUDIO_BLOCK_ALIGNMENT, .value = {.vt = VT_UI4, .ulVal = 2}, .todo_missing = TRUE}, + {.key = &MF_MT_AUDIO_NUM_CHANNELS, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Audio}}, + {.key = &MF_MT_AUDIO_SAMPLES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 48000}}, + {.key = &MF_MT_AUDIO_PREFER_WAVEFORMATEX, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_AUDIO_BITS_PER_SAMPLE, .value = {.vt = VT_UI4, .ulVal = 16}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFAudioFormat_PCM}}, + }, + .todo_spurious = 1, + }; + static const struct media_type_desc audio_44100_f32_desc= + { + .items = + { + {.key = &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 176400}, .todo_missing = TRUE}, + {.key = &MF_MT_AUDIO_BLOCK_ALIGNMENT, .value = {.vt = VT_UI4, .ulVal = 4}, .todo_missing = TRUE}, + {.key = &MF_MT_AUDIO_NUM_CHANNELS, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Audio}}, + {.key = &MF_MT_AUDIO_SAMPLES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 44100}}, + {.key = &MF_MT_AUDIO_PREFER_WAVEFORMATEX, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_AUDIO_BITS_PER_SAMPLE, .value = {.vt = VT_UI4, .ulVal = 32}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFAudioFormat_Float}}, + }, + .todo_spurious = 1, + }; + static const struct media_type_desc audio_48000_f32_desc = + { + .items = + { + {.key = &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 192000}, .todo_missing = TRUE}, + {.key = &MF_MT_AUDIO_BLOCK_ALIGNMENT, .value = {.vt = VT_UI4, .ulVal = 4}, .todo_missing = TRUE}, + {.key = &MF_MT_AUDIO_NUM_CHANNELS, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Audio}}, + {.key = &MF_MT_AUDIO_SAMPLES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 48000}}, + {.key = &MF_MT_AUDIO_PREFER_WAVEFORMATEX, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_AUDIO_BITS_PER_SAMPLE, .value = {.vt = VT_UI4, .ulVal = 32}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFAudioFormat_Float}}, + }, + .todo_spurious = 1, + }; + + struct test_audio_format + { + GUID subtype; + UINT32 bits; + UINT32 rate; + const struct media_type_desc *current; + }; + + struct test_media_type + { + const char *resource; + const struct media_type_desc *native; + struct test_audio_format *audio_formats; + UINT audio_format_count; + }; + + struct test_audio_format test_audio_formats[] = + { + {.subtype = MFAudioFormat_PCM, .bits = 8, .rate = 44100, .current = &audio_44100_s8_desc}, + {.subtype = MFAudioFormat_Float, .bits = 32, .rate = 44100, .current = &audio_44100_f32_desc}, + {.subtype = MFAudioFormat_PCM, .bits = 8, .rate = 48000, .current = &audio_48000_s8_desc}, + {.subtype = MFAudioFormat_Float, .bits = 32, .rate = 48000, .current = &audio_48000_f32_desc}, + }; + + struct test_media_type tests[] = + { + { + .resource = "test.wav", + .native = &audio_44100_s8_desc, + .audio_formats = test_audio_formats, + .audio_format_count = ARRAY_SIZE(test_audio_formats), + }, + { + .resource = "test-48000.wav", + .native = &audio_48000_s16_desc, + .audio_formats = test_audio_formats, + .audio_format_count = ARRAY_SIZE(test_audio_formats), + }, + }; + + struct test_audio_format audio_format; + IMFMediaType *media_type; + IMFSourceReader *reader; + IMFByteStream *stream; + HRESULT hr; + int i, j; + + if (!pMFCreateMFByteStreamOnStream) + { + win_skip("MFCreateMFByteStreamOnStream() not found\n"); + return; + } + + for (i = 0; i < ARRAY_SIZE(tests); ++i) + { + winetest_push_context(tests[i].resource); + + for (j = 0; j < tests[i].audio_format_count; ++j) + { + audio_format = tests[i].audio_formats[j]; + stream = get_resource_stream(tests[i].resource); + if (FAILED(hr = MFCreateSourceReaderFromByteStream(stream, NULL, &reader))) + { + todo_wine + win_skip("MFCreateSourceReaderFromByteStream() failed\n"); + IMFByteStream_Release(stream); + continue; + } + ok(hr == S_OK, "Failed to create source reader, hr %#x.\n", hr); + + hr = IMFSourceReader_GetNativeMediaType(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &media_type); + ok(hr == S_OK, "Failed to get native mediatype, hr %#x.\n", hr); + winetest_push_context("native audio"); + check_media_type_items(media_type, tests[i].native); + IMFMediaType_Release(media_type); + winetest_pop_context(); + + hr = IMFSourceReader_GetNativeMediaType(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 1, &media_type); + todo_wine + ok(hr == MF_E_NO_MORE_TYPES, "Expected only one native mediatype, hr %#x.\n", hr); + if (hr == S_OK) IMFMediaType_Release(media_type); + + hr = IMFSourceReader_SetStreamSelection(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, TRUE); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &audio_format.subtype); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BITS_PER_SAMPLE, audio_format.bits); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, audio_format.rate); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, audio_format.bits / 8); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, audio_format.rate * audio_format.bits / 8); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = IMFSourceReader_SetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, NULL, media_type); + todo_wine + ok(hr == S_OK || broken(hr == MF_E_TOPO_CODEC_NOT_FOUND) /* <= win7 */, "Failed setting current media type %u, hr %#x.\n", j, hr); + IMFMediaType_Release(media_type); + if (hr != S_OK) continue; + + hr = IMFSourceReader_GetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, &media_type); + ok(hr == S_OK, "Failed to get current mediatype, hr %#x.\n", hr); + winetest_push_context("current audio %u", j); + check_media_type_items(media_type, audio_format.current); + winetest_pop_context(); + IMFMediaType_Release(media_type); + + IMFSourceReader_Release(reader); + IMFByteStream_Release(stream); + } + + winetest_pop_context(); + } +} + START_TEST(mfplat) { HRESULT hr; @@ -1242,6 +1534,7 @@ START_TEST(mfplat) test_factory(); test_source_reader(); test_source_reader_from_media_source(); + test_media_types(); test_reader_d3d9();
hr = MFShutdown(); diff --git a/dlls/mfreadwrite/tests/resource.rc b/dlls/mfreadwrite/tests/resource.rc index f54212a8c8f..5b3269fef1d 100644 --- a/dlls/mfreadwrite/tests/resource.rc +++ b/dlls/mfreadwrite/tests/resource.rc @@ -20,3 +20,7 @@
/* @makedep: test.wav */ test.wav RCDATA test.wav + +/* @makedep: test-48000.wav */ +test-48000.wav RCDATA test-48000.wav + diff --git a/dlls/mfreadwrite/tests/test-48000.wav b/dlls/mfreadwrite/tests/test-48000.wav new file mode 100644 index 0000000000000000000000000000000000000000..dedd660bb9a97a9cacedabaddc1b1bafd2f4a176 GIT binary patch literal 2104 zcmV-82*>wQNk&F62mk<AK~_a(ZFC?I000010097iy8r+HcL4wb01yCVVRT^t2mk=& z1;h)Q5n&e<9j_uRD2FY(GQ>BYJVimYMdwM}O^;FiR3ljZT8mxDU$$XSW0houWgli@ zW=>|~Wg=w@WS?T-V9s7_T)SDmR(DhBPZ&%FNVh{SKX5vLHDfRwE3qXeAb=Xf6!i`o z2{!{${crb^@x$u{=3L;;+F;cd(Dljz#y-KYyj-|Mv~952tc<CMrqH8ip-rELof4e$ znk$;PnVgx}nQEF+n~<C$o(G^lqQs<_r?;veuFJ8ywdlE0zVpJ#$Ii_D(N@>c+-Tw% z=-%zK^ON~^|62t-3lkCC7Lgn-BCaP4EkrU=H!nQfKu<-8NrO#1QLt3pSH4<PU6@~t zVJ>5PWOHQ{W?yDgX7Ob=Whi9CVhmvcU#49ASq4|eQ$J92OlL?QM4CU~I`uW&Fqtbc zCaE9=8%h;@526Xc1Kj=i_Z#v`?1|>z;7;4!)sWC@%W}r6!5F>1xS_Peuqmz8smrDe zq?@67pRAoQoC=#cn!lNwna`P7nmL<qocf*Dp9i9bq*JGBs?4o&v0Sx;x#_)y!dAyu z%!JX{)=%8!;gsiB?JM&N`R@MG1hfi_5LOlq9IPQPCy*@6G2J%6J8(eiL?}rqP3TZ# zRF+qMS{hwuUt(bkV_;-pWeH|nW>{wZWlUv6WawfyVKiUhTs~S(R~1y0P|r-rNQ6WM zKv6qsHdHYcEU+dkA&DE%6$B6~3P}WI{(<<T^3m)L=VIZ{+gjEN(c#PF#u&nYy&<{& zv>UN{tstror%9yIp{bwJoll%0n@O6+nVXr$nMs-<n@^n5ovEMEp-H3<ry#0&tsAla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(!9;D$kD?kzp=V_wtce1u28Eas6wT! zqG+IWp3<C!n~j?6nW34jnGc%Dn%J8>o%Ejnpjx8@ruwKltii90vzfQzyJo;3#S6+L z&u7%n*;n8D<hJUA@Lu*n{3HSh2;~j76L%RQAF?DPDsV5AG>$n{KIlS1M_)@lPuEf_ zRyA4lTV-B`U{qqzWA<dnWkF_TW-(@`WyfTZV+LX=VEJ8oTdi1?RWwqLPNYhFMi)YR zJ*qgVGkh*6DX}9P9&8w?64ea$1`+`-`%Lw8@2ctZ<5b?!*l^P{&Lhb{#E`!hyV$nZ zvKX(Ot7@o%rRJiVpq`%foS>Van)jKcnW&iqnzWj{n;4zRp3I;iqr#=KsOzh2uQ9VY zw|u+%zpuoX$*j)n(@@#f-go3M>iqB3^|$+*0e=Tw4KEY&7@i(6B&I3$E*~@;Ip{rr zLf=LLOXW_6Qs7nbShrg*URPi)VzFc2WVdBHW@TnNX18VEWU*r|Vpm`<UbkEESm0HL zQsqtpOW#I-Lg+mlIUh9kE~Y6lB%U7f7%vlD4Sxrl0k`|r_5ANJ>UZST-cZ@=)2z;y z$*;uwzkItmw=uJ9uj{L_sKTWnqs*Ymo*13Ho3xq(ny8tinfIBXnxLEYoSvSVpyr~2 zrD~|1s~E4>ve>p3yO6&?#3RWx&T!Mw*i_#0<ErU&?@aYB`w{{62GtCy5^NY79<d`R zDSR%eGpaayJr_cJMx;uPPBc=LRjpWhTlrlnU<P85W5;BtWie)DW<h4hW%gvyV^m^> iU}awPTQylLR@YKJPhU$yN9aOKNmEn=0000<PDW1*?f;Je
literal 0 HcmV?d00001
On 11/8/21 5:08 PM, Rémi Bernon wrote:
- for (i = 0; i < count; i++)
- {
PropVariantInit(&value);
hr = IMFMediaType_GetItemByIndex(media_type, i, &key, &value);
ok(hr == S_OK, "GetItemByIndex returned hr %#x\n", hr);
for (j = 0; expect->items[j].key; j++) if (IsEqualGUID(expect->items[j].key, &key)) break;
if (!expect->items[j].key)
{
todo_wine_if(expect->todo_spurious > spurious_count)
ok(0, "spurious attribute %s\n", debugstr_guid(&key));
spurious_count++;
continue;
}
So this basically ignores "extra" attributes a type might have, that are not accounted for in "expect"? A rather arbitrary number of attributes we don't know about will be ignored.
Will it work if you checked for expected attributes only, doing a loop over "expect" array, and simply checking with CompareItem(expect.key, expect.value) ? This way you don't know secondary search, and we'll know that all of expected attributes matched.
ok(!found[j], "duplicate attribute %s\n", debugstr_guid(&key));
found[j] = TRUE;
I don't understand this duplicate detection. If you're iterating once through all attributes with zeroed "found[]", how is it possible to get duplicated keys?
if (!strcmp(winetest_platform, "wine"))
ok(!expect->items[j].todo_missing, "attribute not missing %s\n", debugstr_guid(&key));
ok(!PropVariantCompareEx(&value, &expect->items[j].value, 0, 0), "got %s, expected %s.\n",
debugstr_propvariant(&value), debugstr_propvariant(&expect->items[j].value));
PropVariantClear(&value);
- }
Like I meantioned CompareItem() should probably work?
On 11/9/21 21:50, Nikolay Sivov wrote:
On 11/8/21 5:08 PM, Rémi Bernon wrote:
- for (i = 0; i < count; i++)
- {
PropVariantInit(&value);
hr = IMFMediaType_GetItemByIndex(media_type, i, &key, &value);
ok(hr == S_OK, "GetItemByIndex returned hr %#x\n", hr);
for (j = 0; expect->items[j].key; j++) if (IsEqualGUID(expect->items[j].key, &key)) break;
if (!expect->items[j].key)
{
todo_wine_if(expect->todo_spurious > spurious_count)
ok(0, "spurious attribute %s\n", debugstr_guid(&key));
spurious_count++;
continue;
}
So this basically ignores "extra" attributes a type might have, that are not accounted for in "expect"? A rather arbitrary number of attributes we don't know about will be ignored.
No, "expect" should contain the exact list of attributes native MF type has, anything extra will cause a test failure.
On Wine, there's some types with attributes they should not have (either for instance channel mask, or because we report uncompressed native types where native report compressed). In order to keep things simpler we just leave a given number of spurious attrs, marked as todo.
The todo and spurious_count can be removed once Wine stops reporting additional attributes.
Will it work if you checked for expected attributes only, doing a loop over "expect" array, and simply checking with CompareItem(expect.key, expect.value) ? This way you don't know secondary search, and we'll know that all of expected attributes matched.
This would only check the attributes we expect to be present, and not attributes that native MF reports but that we aren't looking for yet.
If native starts reporting more attributes, and games start using them, they may slip through the tests if we only check the ones we expect.
ok(!found[j], "duplicate attribute %s\n", debugstr_guid(&key));
found[j] = TRUE;
I don't understand this duplicate detection. If you're iterating once through all attributes with zeroed "found[]", how is it possible to get duplicated keys?
Well, we're only enumerating items by index, it's just making sure an expected item isn't matched twice. Of course it's probably never going to happen if the keys are unique.
if (!strcmp(winetest_platform, "wine"))
ok(!expect->items[j].todo_missing, "attribute not missing %s\n", debugstr_guid(&key));
ok(!PropVariantCompareEx(&value, &expect->items[j].value, 0, 0), "got %s, expected %s.\n",
debugstr_propvariant(&value), debugstr_propvariant(&expect->items[j].value));
PropVariantClear(&value);
- }
Like I meantioned CompareItem() should probably work?
I guess, but then we would ignore anything we don't expect.
I'm actually trying to add these tests to validate that some attributes we don't have yet should be present. More specifically, average bytes per sec and block alignment, which are actually pretty useless as they can be deduced from the other attributes.
As I see it it's the kind of situation where there would be little reason to have them in an "expected" list as they aren't really useful, but where checking the whole attribute list would have shown that they should be present nonetheless.
On 11/8/21 5:08 PM, Rémi Bernon wrote:
- static const struct media_type_desc audio_44100_s8_desc =
- {
.items =
{
{.key = &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 44100}, .todo_missing = TRUE},
{.key = &MF_MT_AUDIO_BLOCK_ALIGNMENT, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE},
{.key = &MF_MT_AUDIO_NUM_CHANNELS, .value = {.vt = VT_UI4, .ulVal = 1}},
{.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Audio}},
{.key = &MF_MT_AUDIO_SAMPLES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 44100}},
{.key = &MF_MT_AUDIO_PREFER_WAVEFORMATEX, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE},
{.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}},
{.key = &MF_MT_AUDIO_BITS_PER_SAMPLE, .value = {.vt = VT_UI4, .ulVal = 8}},
{.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFAudioFormat_PCM}},
},
.todo_spurious = 1,
- };
When you explicitly checking audio types, you can drop MAJOR_TYPE, PREFER_WAVEFORMATEX, ALL_SAMPLES_INDEPENDENT, or maybe even subtype from static data, because it will always be the same. You can check for these still right in the loop, for all data entries.
On 11/9/21 21:53, Nikolay Sivov wrote:
On 11/8/21 5:08 PM, Rémi Bernon wrote:
- static const struct media_type_desc audio_44100_s8_desc =
- {
.items =
{
{.key = &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 44100}, .todo_missing = TRUE},
{.key = &MF_MT_AUDIO_BLOCK_ALIGNMENT, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE},
{.key = &MF_MT_AUDIO_NUM_CHANNELS, .value = {.vt = VT_UI4, .ulVal = 1}},
{.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Audio}},
{.key = &MF_MT_AUDIO_SAMPLES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 44100}},
{.key = &MF_MT_AUDIO_PREFER_WAVEFORMATEX, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE},
{.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}},
{.key = &MF_MT_AUDIO_BITS_PER_SAMPLE, .value = {.vt = VT_UI4, .ulVal = 8}},
{.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFAudioFormat_PCM}},
},
.todo_spurious = 1,
- };
When you explicitly checking audio types, you can drop MAJOR_TYPE, PREFER_WAVEFORMATEX, ALL_SAMPLES_INDEPENDENT, or maybe even subtype from static data, because it will always be the same. You can check for these still right in the loop, for all data entries.
Sure but that would be a specific code path in the generic comparison method. I feel like it's just simpler to treat them the same way as the other items and not add any special case.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mfreadwrite/tests/mfplat.c | 195 ++++++++++++++++++++- dlls/mfreadwrite/tests/resource.rc | 2 + dlls/mfreadwrite/tests/test-40x36-h264.mp4 | Bin 0 -> 11151 bytes 3 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 dlls/mfreadwrite/tests/test-40x36-h264.mp4
diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 5a7d021ef84..051c7206e96 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -28,6 +28,7 @@
#include "initguid.h" #include "ole2.h" +#include "uuids.h"
DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
@@ -1261,7 +1262,9 @@ struct media_type_item { const GUID *key; const PROPVARIANT value; + BOOL optional; BOOL todo_missing; + BOOL todo_value; };
struct media_type_desc @@ -1287,7 +1290,13 @@ static void check_media_type_items(IMFMediaType *media_type, const struct media_ hr = IMFMediaType_GetItemByIndex(media_type, i, &key, &value); ok(hr == S_OK, "GetItemByIndex returned hr %#x\n", hr);
- for (j = 0; expect->items[j].key; j++) if (IsEqualGUID(expect->items[j].key, &key)) break; + for (j = 0; expect->items[j].key; j++) + { + if (!IsEqualGUID(expect->items[j].key, &key)) + continue; + if (!expect->items[j].optional || !PropVariantCompareEx(&value, &expect->items[j].value, 0, 0)) + break; + } if (!expect->items[j].key) { todo_wine_if(expect->todo_spurious > spurious_count) @@ -1301,6 +1310,7 @@ static void check_media_type_items(IMFMediaType *media_type, const struct media_
if (!strcmp(winetest_platform, "wine")) ok(!expect->items[j].todo_missing, "attribute not missing %s\n", debugstr_guid(&key)); + todo_wine_if(expect->items[j].todo_value) ok(!PropVariantCompareEx(&value, &expect->items[j].value, 0, 0), "got %s, expected %s.\n", debugstr_propvariant(&value), debugstr_propvariant(&expect->items[j].value)); PropVariantClear(&value); @@ -1312,6 +1322,7 @@ static void check_media_type_items(IMFMediaType *media_type, const struct media_ for (j = 0; expect->items[j].key; j++) { if (found[j]) continue; + if (expect->items[j].optional) continue; todo_wine_if(expect->items[j].todo_missing) ok(0, "missing attribute %s\n", debugstr_guid(expect->items[j].key)); } @@ -1400,6 +1411,118 @@ static void test_media_types(void) .todo_spurious = 1, };
+ static const BYTE mpeg_sequence_header[] = + { + 0x00,0x00,0x01,0x67,0x64,0x00,0x14,0xac,0xd9,0x4d,0xf9,0x67,0xc0,0x5a,0x83,0x03, + 0x03,0x52,0x80,0x00,0x00,0x03,0x00,0x80,0x00,0x00,0x1e,0x47,0x8a,0x14,0xcb,0x00, + 0x00,0x01,0x68,0xeb,0xec,0xb2,0x2c, + }; + static const BYTE mpeg4_sample_description[] = + { + 0x00,0x00,0x00,0xd1,0x73,0x74,0x73,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0xc1,0x61,0x76,0x63,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x28,0x00,0x24,0x00,0x48,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x18,0xff,0xff,0x00,0x00,0x00,0x34,0x61,0x76,0x63,0x43,0x01,0x64, + 0x00,0x14,0xff,0xe1,0x00,0x1c,0x67,0x64,0x00,0x14,0xac,0xd9,0x4d,0xf9,0x67,0xc0, + 0x5a,0x83,0x03,0x03,0x52,0x80,0x00,0x00,0x03,0x00,0x80,0x00,0x00,0x1e,0x47,0x8a, + 0x14,0xcb,0x01,0x00,0x05,0x68,0xeb,0xec,0xb2,0x2c,0x00,0x00,0x00,0x14,0x62,0x74, + 0x72,0x74,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x34,0x38,0x00,0x00, + 0x00,0x13,0x63,0x6f,0x6c,0x72,0x6e,0x63,0x6c,0x78,0x00,0x06,0x00,0x06,0x00,0x06, + 0x00,0x00,0x00,0x00,0x10,0x70,0x61,0x73,0x70,0x00,0x00,0x00,0x01,0x00,0x00,0x00, + 0x01, + }; + static const struct media_type_desc video_40x36_h264_desc = + { + .items = + { + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Video}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFVideoFormat_H264}, .todo_value = TRUE}, + {.key = &MF_MT_AM_FORMAT_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&FORMAT_MPEG2Video}, .todo_missing = TRUE}, + {.key = &MF_MT_SAMPLE_SIZE, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_AVG_BITRATE, .value = {.vt = VT_UI4, .ulVal = 78904}, .todo_missing = TRUE}, + {.key = &MF_MT_FRAME_RATE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (30ull << 32) | 1ull}}}, + {.key = &MF_MT_FRAME_SIZE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (40ull << 32) | 36ull}}}, + {.key = &MF_MT_INTERLACE_MODE, .value = {.vt = VT_UI4, .ulVal = MFVideoInterlace_MixedInterlaceOrProgressive}, .todo_missing = TRUE}, + { + .key = &MF_MT_MPEG_SEQUENCE_HEADER, + .value = + { + .vt = VT_VECTOR|VT_UI1, + .caub = + { + .pElems = (BYTE *)mpeg_sequence_header, + .cElems = ARRAY_SIZE(mpeg_sequence_header) + } + }, + .todo_missing = TRUE + }, + {.key = &MF_MT_MPEG2_LEVEL, .value = {.vt = VT_UI4, .ulVal = 20}, .todo_missing = TRUE}, + {.key = &MF_MT_MPEG2_PROFILE, .value = {.vt = VT_UI4, .ulVal = 100}, .todo_missing = TRUE}, + {.key = &MF_MT_PIXEL_ASPECT_RATIO, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (1ull << 32) | 1ull}}, .todo_missing = TRUE}, + { + .key = &MF_MT_MPEG4_SAMPLE_DESCRIPTION, + .value = + { + .vt = VT_VECTOR|VT_UI1, + .caub = + { + .pElems = (BYTE *)mpeg4_sample_description, + .cElems = ARRAY_SIZE(mpeg4_sample_description) + } + }, + .todo_missing = TRUE + }, + {.key = &MF_MT_MPEG4_CURRENT_SAMPLE_ENTRY, .value = {.vt = VT_UI4}, .todo_missing = TRUE}, + {.key = &MF_MT_VIDEO_ROTATION, .value = {.vt = VT_UI4, .ulVal = 0}, .optional = TRUE /* <= win7 */}, + {.key = &MF_PROGRESSIVE_CODING_CONTENT, .value = {.vt = VT_UI4, .ulVal = 1}, .optional = TRUE /* <= win7 */, .todo_missing = TRUE}, + {.key = &MF_NALU_LENGTH_SET, .value = {.vt = VT_UI4, .ulVal = 1}, .optional = TRUE /* <= win7 */, .todo_missing = TRUE}, + }, + .todo_spurious = 2, + }; + static const struct media_type_desc video_40x36_h264_nv12_desc = + { + .items = + { + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Video}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFVideoFormat_NV12}}, + {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_COMPRESSED, .value = {.vt = VT_UI4, .ulVal = 0}}, + {.key = &MF_MT_FIXED_SIZE_SAMPLES, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_SAMPLE_SIZE, .value = {.vt = VT_UI4, .ulVal = 40 * 36 * 3 / 2}, .todo_missing = TRUE}, + {.key = &MF_MT_AVG_BIT_ERROR_RATE, .value = {.vt = VT_UI4, .ulVal = 0}, .todo_missing = TRUE}, + {.key = &MF_MT_AVG_BITRATE, .value = {.vt = VT_UI4, .ulVal = 78904}, .todo_missing = TRUE}, + {.key = &MF_MT_DEFAULT_STRIDE, .value = {.vt = VT_UI4, .ulVal = 40}, .todo_missing = TRUE}, + {.key = &MF_MT_FRAME_RATE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (30ull << 32) | 1ull}}}, + {.key = &MF_MT_FRAME_SIZE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (40ull << 32) | 36ull}}}, + {.key = &MF_MT_INTERLACE_MODE, .value = {.vt = VT_UI4, .ulVal = MFVideoInterlace_MixedInterlaceOrProgressive}, .todo_missing = TRUE}, + {.key = &MF_MT_PIXEL_ASPECT_RATIO, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (1ull << 32) | 1ull}}, .todo_missing = TRUE}, + {.key = &MF_MT_VIDEO_ROTATION, .value = {.vt = VT_UI4, .ulVal = 0}, .optional = TRUE /* <= win7 */}, + }, + }; + static const struct media_type_desc video_40x36_h264_i420_desc = + { + .items = + { + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Video}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFVideoFormat_I420}}, + {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_COMPRESSED, .value = {.vt = VT_UI4, .ulVal = 0}}, + {.key = &MF_MT_FIXED_SIZE_SAMPLES, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_SAMPLE_SIZE, .value = {.vt = VT_UI4, .ulVal = 40 * 36 * 3 / 2}, .todo_missing = TRUE}, + {.key = &MF_MT_AVG_BIT_ERROR_RATE, .value = {.vt = VT_UI4, .ulVal = 0}, .todo_missing = TRUE}, + {.key = &MF_MT_AVG_BITRATE, .value = {.vt = VT_UI4, .ulVal = 78904}, .todo_missing = TRUE}, + {.key = &MF_MT_DEFAULT_STRIDE, .value = {.vt = VT_UI4, .ulVal = 40}, .todo_missing = TRUE}, + {.key = &MF_MT_FRAME_RATE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (30ull << 32) | 1ull}}}, + {.key = &MF_MT_FRAME_SIZE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (40ull << 32) | 36ull}}}, + {.key = &MF_MT_INTERLACE_MODE, .value = {.vt = VT_UI4, .ulVal = MFVideoInterlace_MixedInterlaceOrProgressive}, .todo_missing = TRUE}, + {.key = &MF_MT_PIXEL_ASPECT_RATIO, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (1ull << 32) | 1ull}}, .todo_missing = TRUE}, + {.key = &MF_MT_VIDEO_ROTATION, .value = {.vt = VT_UI4, .ulVal = 0}, .optional = TRUE /* <= win7 */}, + }, + }; + struct test_audio_format { GUID subtype; @@ -1408,12 +1531,20 @@ static void test_media_types(void) const struct media_type_desc *current; };
+ struct test_video_format + { + GUID subtype; + const struct media_type_desc *current; + }; + struct test_media_type { const char *resource; const struct media_type_desc *native; struct test_audio_format *audio_formats; UINT audio_format_count; + struct test_video_format *video_formats; + UINT video_format_count; };
struct test_audio_format test_audio_formats[] = @@ -1424,6 +1555,12 @@ static void test_media_types(void) {.subtype = MFAudioFormat_Float, .bits = 32, .rate = 48000, .current = &audio_48000_f32_desc}, };
+ struct test_video_format test_h264_formats[] = + { + {.subtype = MFVideoFormat_NV12, .current = &video_40x36_h264_nv12_desc}, + {.subtype = MFVideoFormat_I420, .current = &video_40x36_h264_i420_desc}, + }; + struct test_media_type tests[] = { { @@ -1438,9 +1575,16 @@ static void test_media_types(void) .audio_formats = test_audio_formats, .audio_format_count = ARRAY_SIZE(test_audio_formats), }, + { + .resource = "test-40x36-h264.mp4", + .native = &video_40x36_h264_desc, + .video_formats = test_h264_formats, + .video_format_count = ARRAY_SIZE(test_h264_formats), + }, };
struct test_audio_format audio_format; + struct test_video_format video_format; IMFMediaType *media_type; IMFSourceReader *reader; IMFByteStream *stream; @@ -1518,6 +1662,55 @@ static void test_media_types(void) IMFByteStream_Release(stream); }
+ for (j = 0; j < tests[i].video_format_count; ++j) + { + video_format = tests[i].video_formats[j]; + stream = get_resource_stream(tests[i].resource); + if (FAILED(hr = MFCreateSourceReaderFromByteStream(stream, NULL, &reader))) + { + todo_wine + win_skip("MFCreateSourceReaderFromByteStream() failed\n"); + IMFByteStream_Release(stream); + continue; + } + ok(hr == S_OK, "Failed to create source reader, hr %#x.\n", hr); + + hr = IMFSourceReader_GetNativeMediaType(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, &media_type); + ok(hr == S_OK, "Failed to get native mediatype, hr %#x.\n", hr); + winetest_push_context("native video"); + check_media_type_items(media_type, tests[i].native); + IMFMediaType_Release(media_type); + winetest_pop_context(); + + hr = IMFSourceReader_GetNativeMediaType(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, 1, &media_type); + todo_wine + ok(hr == MF_E_NO_MORE_TYPES, "Expected only one native mediatype, hr %#x.\n", hr); + if (hr == S_OK) IMFMediaType_Release(media_type); + + hr = IMFSourceReader_SetStreamSelection(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, TRUE); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &video_format.subtype); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFSourceReader_SetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, NULL, media_type); + ok(hr == S_OK, "Failed setting current media type %u, hr %#x.\n", j, hr); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, &media_type); + ok(hr == S_OK, "Failed to get current mediatype, hr %#x.\n", hr); + winetest_push_context("current video %u", j); + check_media_type_items(media_type, video_format.current); + winetest_pop_context(); + IMFMediaType_Release(media_type); + + IMFSourceReader_Release(reader); + IMFByteStream_Release(stream); + } + winetest_pop_context(); } } diff --git a/dlls/mfreadwrite/tests/resource.rc b/dlls/mfreadwrite/tests/resource.rc index 5b3269fef1d..5ae9636d671 100644 --- a/dlls/mfreadwrite/tests/resource.rc +++ b/dlls/mfreadwrite/tests/resource.rc @@ -24,3 +24,5 @@ test.wav RCDATA test.wav /* @makedep: test-48000.wav */ test-48000.wav RCDATA test-48000.wav
+/* @makedep: test-40x36-h264.mp4 */ +test-40x36-h264.mp4 RCDATA test-40x36-h264.mp4 diff --git a/dlls/mfreadwrite/tests/test-40x36-h264.mp4 b/dlls/mfreadwrite/tests/test-40x36-h264.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..3b3771a7c67322ed99721a026b9f17d8c7829856 GIT binary patch literal 11151 zcmb7q1z40%@GwUUNQ0DcAdPgFbc523aKMpAAB}Vif^<kI4N4=D0s;~uU4k@7w@Ar- z@99r}|N8#V_w7BiGdnXoyE{7@FDwcQ3fKnj>+0kxz=r}PBnE)j-owQS03;9F#vKYp zL19jCvWCEcGU_ctAg8glMj?GYt8ro5VH}2rrX7ref`$TQv`Vq0gMb{vZfCdlKA?Su ziGe^I&ns-TZOke+rrn<b&)(ZV@Zl2@0CR$^T->2xULhW^J3kLEFWAZ&Dhd(h2L#Go zfC9IMrh*cu09Zy}4$!oQS^)w%7gt{x)CLab<Kf}w<m2Jv0ho4hxT_d9x3{-9mz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Y%R}lT<#B+_?;jZw0ennJK!kM8 z4*=5vKn2jp07h<ldH^T_zyJUf0L*|4I8H$V0FVN3>mMuwU^D>!@CgB$`?m}QaMdq8 zG61sxfb7c^0Ebrpj)?{+Bm39)8-svXo4?A)F#>$h=|AOv<Ur{^$^WnQ5&=D6)%^0+ z|AU?X*6#mr{r|0>z+73mAUh5u<XCwCF!Hp9LjbJh1pS2p5{3THigB`oxdW^0@9IGc pk%`g%_p+oZgS#LNk^+xnkw%b4QIPLV0VMg4VZr|&!`Mi}{|7xJ&h7vJ
literal 0 HcmV?d00001
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mfreadwrite/tests/mfplat.c | 157 +++++++++++++++++++++++++++++++- 1 file changed, 155 insertions(+), 2 deletions(-)
diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 051c7206e96..9d2e17de4f1 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -1523,6 +1523,134 @@ static void test_media_types(void) }, };
+ static const UINT32 actual_40x36_aperture[] = {0, 0, 40, 36}; + static const struct media_type_desc video_48x48_h264_nv12_desc = + { + .items = + { + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Video}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFVideoFormat_NV12}}, + {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_COMPRESSED, .value = {.vt = VT_UI4, .ulVal = 0}}, + {.key = &MF_MT_FIXED_SIZE_SAMPLES, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_SAMPLE_SIZE, .value = {.vt = VT_UI4, .ulVal = 48 * 48 * 3 / 2}, .todo_missing = TRUE}, + {.key = &MF_MT_AVG_BIT_ERROR_RATE, .value = {.vt = VT_UI4, .ulVal = 0}, .todo_missing = TRUE}, + {.key = &MF_MT_AVG_BITRATE, .value = {.vt = VT_UI4, .ulVal = 78904}, .todo_missing = TRUE}, + {.key = &MF_MT_DEFAULT_STRIDE, .value = {.vt = VT_UI4, .ulVal = 48}, .todo_missing = TRUE}, + {.key = &MF_MT_FRAME_RATE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (30ull << 32) | 1ull}}}, + {.key = &MF_MT_FRAME_SIZE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (48ull << 32) | 48ull}}, .todo_value = TRUE}, + {.key = &MF_MT_INTERLACE_MODE, .value = {.vt = VT_UI4, .ulVal = MFVideoInterlace_MixedInterlaceOrProgressive}, .todo_missing = TRUE}, + {.key = &MF_MT_PIXEL_ASPECT_RATIO, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (1ull << 32) | 1ull}}, .todo_missing = TRUE}, + {.key = &MF_MT_VIDEO_ROTATION, .value = {.vt = VT_UI4, .ulVal = 0}, .optional = TRUE /* <= win7 */}, + {.key = &MF_MT_YUV_MATRIX, .value = {.vt = VT_UI4, .ulVal = MFVideoTransferMatrix_BT601}, .todo_missing = TRUE}, + {.key = &MF_MT_TRANSFER_FUNCTION, .value = {.vt = VT_UI4, .ulVal = MFVideoTransFunc_709}, .todo_missing = TRUE}, + {.key = &MF_MT_VIDEO_NOMINAL_RANGE, .value = {.vt = VT_UI4, .ulVal = MFNominalRange_Wide}, .todo_missing = TRUE}, + {.key = &MF_MT_VIDEO_PRIMARIES, .value = {.vt = VT_UI4, .ulVal = MFVideoPrimaries_SMPTE170M}, .todo_missing = TRUE}, + { + .key = &MF_MT_GEOMETRIC_APERTURE, + .value = + { + .vt = VT_VECTOR|VT_UI1, + .caub = + { + .pElems = (BYTE *)actual_40x36_aperture, + .cElems = sizeof(actual_40x36_aperture), + } + }, + .todo_missing = TRUE, + }, + { + .key = &MF_MT_PAN_SCAN_APERTURE, + .value = + { + .vt = VT_VECTOR|VT_UI1, + .caub = + { + .pElems = (BYTE *)actual_40x36_aperture, + .cElems = sizeof(actual_40x36_aperture), + } + }, + .todo_missing = TRUE, + }, + { + .key = &MF_MT_MINIMUM_DISPLAY_APERTURE, + .value = + { + .vt = VT_VECTOR|VT_UI1, + .caub = + { + .pElems = (BYTE *)actual_40x36_aperture, + .cElems = sizeof(actual_40x36_aperture), + } + }, + .todo_missing = TRUE, + }, + }, + }; + static const struct media_type_desc video_48x48_h264_i420_desc = + { + .items = + { + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Video}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFVideoFormat_I420}}, + {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_COMPRESSED, .value = {.vt = VT_UI4, .ulVal = 0}}, + {.key = &MF_MT_FIXED_SIZE_SAMPLES, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_SAMPLE_SIZE, .value = {.vt = VT_UI4, .ulVal = 48 * 48 * 3 / 2}, .todo_missing = TRUE}, + {.key = &MF_MT_AVG_BIT_ERROR_RATE, .value = {.vt = VT_UI4, .ulVal = 0}, .todo_missing = TRUE}, + {.key = &MF_MT_AVG_BITRATE, .value = {.vt = VT_UI4, .ulVal = 78904}, .todo_missing = TRUE}, + {.key = &MF_MT_DEFAULT_STRIDE, .value = {.vt = VT_UI4, .ulVal = 48}, .todo_missing = TRUE}, + {.key = &MF_MT_FRAME_RATE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (30ull << 32) | 1ull}}}, + {.key = &MF_MT_FRAME_SIZE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (48ull << 32) | 48ull}}, .todo_value = TRUE}, + {.key = &MF_MT_INTERLACE_MODE, .value = {.vt = VT_UI4, .ulVal = MFVideoInterlace_MixedInterlaceOrProgressive}, .todo_missing = TRUE}, + {.key = &MF_MT_PIXEL_ASPECT_RATIO, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (1ull << 32) | 1ull}}, .todo_missing = TRUE}, + {.key = &MF_MT_VIDEO_ROTATION, .value = {.vt = VT_UI4, .ulVal = 0}, .optional = TRUE /* <= win7 */}, + {.key = &MF_MT_YUV_MATRIX, .value = {.vt = VT_UI4, .ulVal = MFVideoTransferMatrix_BT601}, .todo_missing = TRUE}, + {.key = &MF_MT_TRANSFER_FUNCTION, .value = {.vt = VT_UI4, .ulVal = MFVideoTransFunc_709}, .todo_missing = TRUE}, + {.key = &MF_MT_VIDEO_NOMINAL_RANGE, .value = {.vt = VT_UI4, .ulVal = MFNominalRange_Wide}, .todo_missing = TRUE}, + {.key = &MF_MT_VIDEO_PRIMARIES, .value = {.vt = VT_UI4, .ulVal = MFVideoPrimaries_SMPTE170M}, .todo_missing = TRUE}, + { + .key = &MF_MT_GEOMETRIC_APERTURE, + .value = + { + .vt = VT_VECTOR|VT_UI1, + .caub = + { + .pElems = (BYTE *)actual_40x36_aperture, + .cElems = sizeof(actual_40x36_aperture), + } + }, + .todo_missing = TRUE, + }, + { + .key = &MF_MT_PAN_SCAN_APERTURE, + .value = + { + .vt = VT_VECTOR|VT_UI1, + .caub = + { + .pElems = (BYTE *)actual_40x36_aperture, + .cElems = sizeof(actual_40x36_aperture), + } + }, + .todo_missing = TRUE, + }, + { + .key = &MF_MT_MINIMUM_DISPLAY_APERTURE, + .value = + { + .vt = VT_VECTOR|VT_UI1, + .caub = + { + .pElems = (BYTE *)actual_40x36_aperture, + .cElems = sizeof(actual_40x36_aperture), + } + }, + .todo_missing = TRUE, + }, + }, + }; + struct test_audio_format { GUID subtype; @@ -1535,6 +1663,7 @@ static void test_media_types(void) { GUID subtype; const struct media_type_desc *current; + const struct media_type_desc *actual; };
struct test_media_type @@ -1557,8 +1686,8 @@ static void test_media_types(void)
struct test_video_format test_h264_formats[] = { - {.subtype = MFVideoFormat_NV12, .current = &video_40x36_h264_nv12_desc}, - {.subtype = MFVideoFormat_I420, .current = &video_40x36_h264_i420_desc}, + {.subtype = MFVideoFormat_NV12, .current = &video_40x36_h264_nv12_desc, .actual = &video_48x48_h264_nv12_desc}, + {.subtype = MFVideoFormat_I420, .current = &video_40x36_h264_i420_desc, .actual = &video_48x48_h264_i420_desc}, };
struct test_media_type tests[] = @@ -1588,6 +1717,8 @@ static void test_media_types(void) IMFMediaType *media_type; IMFSourceReader *reader; IMFByteStream *stream; + IMFSample *sample; + DWORD flags; HRESULT hr; int i, j;
@@ -1658,6 +1789,17 @@ static void test_media_types(void) winetest_pop_context(); IMFMediaType_Release(media_type);
+ hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, NULL, &flags, NULL, &sample); + ok(hr == S_OK, "Failed to read sample, hr %#x\n", hr); + IMFSample_Release(sample); + + hr = IMFSourceReader_GetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, &media_type); + ok(hr == S_OK, "Failed to get current mediatype, hr %#x.\n", hr); + winetest_push_context("actual audio %u", j); + check_media_type_items(media_type, audio_format.current); + winetest_pop_context(); + IMFMediaType_Release(media_type); + IMFSourceReader_Release(reader); IMFByteStream_Release(stream); } @@ -1707,6 +1849,17 @@ static void test_media_types(void) winetest_pop_context(); IMFMediaType_Release(media_type);
+ hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, NULL, &flags, NULL, &sample); + ok(hr == S_OK, "Failed to read sample, hr %#x\n", hr); + IMFSample_Release(sample); + + hr = IMFSourceReader_GetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, &media_type); + ok(hr == S_OK, "Failed to get current mediatype, hr %#x.\n", hr); + winetest_push_context("actual video %u", j); + check_media_type_items(media_type, video_format.actual); + winetest_pop_context(); + IMFMediaType_Release(media_type); + IMFSourceReader_Release(reader); IMFByteStream_Release(stream); }
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mfreadwrite/tests/mfplat.c | 36 ++++++++++++++++++++- dlls/mfreadwrite/tests/resource.rc | 3 ++ dlls/mfreadwrite/tests/test-40x36-i420.avi | Bin 0 -> 66320 bytes 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 dlls/mfreadwrite/tests/test-40x36-i420.avi
diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 9d2e17de4f1..a219eecce36 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -1651,6 +1651,27 @@ static void test_media_types(void) }, };
+ static const GUID unknown_attribute = {0xc496f370,0x2f8b,0x4f51,{0xae,0x46,0x9c,0xfc,0x1b,0xc8,0x2a,0x47}}; + static const struct media_type_desc video_40x36_i420_desc = + { + .items = + { + {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Video}}, + {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFVideoFormat_I420}}, + {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}}, + {.key = &MF_MT_FIXED_SIZE_SAMPLES, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE}, + {.key = &MF_MT_SAMPLE_SIZE, .value = {.vt = VT_UI4, .ulVal = 40 * 36}, .todo_missing = TRUE}, + {.key = &MF_MT_DEFAULT_STRIDE, .value = {.vt = VT_UI4, .ulVal = 40}, .todo_missing = TRUE}, + {.key = &MF_MT_FRAME_RATE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (30ull << 32) | 1ull}}}, + {.key = &MF_MT_FRAME_SIZE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (40ull << 32) | 36ull}}}, + {.key = &MF_MT_INTERLACE_MODE, .value = {.vt = VT_UI4, .ulVal = MFVideoInterlace_MixedInterlaceOrProgressive}, .optional = TRUE /* > win7 */, .todo_missing = TRUE}, + {.key = &MF_MT_INTERLACE_MODE, .value = {.vt = VT_UI4, .ulVal = MFVideoInterlace_Progressive}, .optional = TRUE /* <= win7 */, .todo_missing = TRUE}, + {.key = &MF_MT_PIXEL_ASPECT_RATIO, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (1ull << 32) | 1ull}}, .todo_missing = TRUE}, + {.key = &MF_MT_TIMESTAMP_CAN_BE_DTS, .value = {.vt = VT_UI4, .ulVal = 1}, .optional = TRUE /* <= win7 */}, + {.key = &unknown_attribute, .value = {.vt = VT_UI4, .ulVal = 12}}, + }, + }; + struct test_audio_format { GUID subtype; @@ -1689,6 +1710,11 @@ static void test_media_types(void) {.subtype = MFVideoFormat_NV12, .current = &video_40x36_h264_nv12_desc, .actual = &video_48x48_h264_nv12_desc}, {.subtype = MFVideoFormat_I420, .current = &video_40x36_h264_i420_desc, .actual = &video_48x48_h264_i420_desc}, }; + struct test_video_format test_i420_formats[] = + { + {.subtype = MFVideoFormat_NV12}, + {.subtype = MFVideoFormat_I420, .current = &video_40x36_i420_desc, .actual = &video_40x36_i420_desc}, + };
struct test_media_type tests[] = { @@ -1710,6 +1736,12 @@ static void test_media_types(void) .video_formats = test_h264_formats, .video_format_count = ARRAY_SIZE(test_h264_formats), }, + { + .resource = "test-40x36-i420.avi", + .native = &video_40x36_i420_desc, + .video_formats = test_i420_formats, + .video_format_count = ARRAY_SIZE(test_i420_formats), + }, };
struct test_audio_format audio_format; @@ -1839,8 +1871,10 @@ static void test_media_types(void) hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &video_format.subtype); ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); hr = IMFSourceReader_SetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, NULL, media_type); - ok(hr == S_OK, "Failed setting current media type %u, hr %#x.\n", j, hr); + if (video_format.current) ok(hr == S_OK, "Failed setting current media type %u, hr %#x.\n", j, hr); + else ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Succeeded setting current media type %u, hr %#x.\n", j, hr); IMFMediaType_Release(media_type); + if (hr != S_OK) continue;
hr = IMFSourceReader_GetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, &media_type); ok(hr == S_OK, "Failed to get current mediatype, hr %#x.\n", hr); diff --git a/dlls/mfreadwrite/tests/resource.rc b/dlls/mfreadwrite/tests/resource.rc index 5ae9636d671..3f32c2abc30 100644 --- a/dlls/mfreadwrite/tests/resource.rc +++ b/dlls/mfreadwrite/tests/resource.rc @@ -26,3 +26,6 @@ test-48000.wav RCDATA test-48000.wav
/* @makedep: test-40x36-h264.mp4 */ test-40x36-h264.mp4 RCDATA test-40x36-h264.mp4 + +/* @makedep: test-40x36-i420.avi */ +test-40x36-i420.avi RCDATA test-40x36-i420.avi diff --git a/dlls/mfreadwrite/tests/test-40x36-i420.avi b/dlls/mfreadwrite/tests/test-40x36-i420.avi new file mode 100644 index 0000000000000000000000000000000000000000..fde02cb07c7fffe8c4fadcd69addbb066a67e86f GIT binary patch literal 66320 zcmeI5c~Dc?m&eodo2lxmnLi>3iXvfG76oLHZZIH53}G>#fDOnJBZe)q35XyMltp9_ z0tl!qvZw?k5d>_(Ey@xahzLOi0tOY7fBdumnwkW<tITxjJoz;><1gM@Ebkn?ocHd_ z4d=so_uc2?=IZ+6KYk$W^K;Yna65eD_kSZ0Sj_n7u%rl<J%K>5%_0ym?;m7a1Oid^ zsk5?0Agp=_gdH;5@DJaY-{i5%WU&$w<D+GtE3uLym<et+yDh)e$>aPPQ~o{n$1i`n zx-I+taQS}z{FLwS2f}|5<gx1h<F9&}ub2B~*}nh%j~`iDG8unWA<y@E2ION?K9)~0 zW1?jrEcrN*k3G46<9`zfF{hFu<YPuY7MJC1e5JLlv=VuXTxs4b&19t^9Xc=afq=%r zw>1t{-kijhw)&=B*<5`quew)WvE}vFeHnXs)sX+mk!|V98gWGZ<PEb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