Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
November 2021
- 83 participants
- 2620 messages
Re: [PATCH 5/5] winegstreamer: Implement IWMReader::GetOutputProps().
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=101210
Your paranoid android.
=== w864 (64 bit report) ===
wmvcore:
wmvcore.c:1425: Test failed: Output 0: Media types didn't match.
=== w1064v1507 (64 bit report) ===
wmvcore:
wmvcore.c:1425: Test failed: Output 0: Media types didn't match.
=== w1064 (64 bit report) ===
wmvcore:
wmvcore.c:1425: Test failed: Output 0: Media types didn't match.
=== w1064_tsign (64 bit report) ===
wmvcore:
wmvcore.c:1425: Test failed: Output 0: Media types didn't match.
=== w10pro64_ja (64 bit report) ===
wmvcore:
wmvcore.c:1425: Test failed: Output 0: Media types didn't match.
Nov. 3, 2021
Re: [PATCH 4/5] winegstreamer: Implement IWMReader::GetOutputCount().
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=101209
Your paranoid android.
=== w1064_2qxl (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
=== w10pro64_he (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
=== w10pro64_zh_CN (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
Nov. 3, 2021
Re: [PATCH 3/5] winegstreamer: Implement IWMReaderAdvanced2::OpenStream().
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=101208
Your paranoid android.
=== w864 (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
=== w10pro64 (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
=== w10pro64_he (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
Nov. 3, 2021
Re: [PATCH 2/5] wmvcore/tests: Add tests for asynchronous reader media types.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=101207
Your paranoid android.
=== w864 (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
=== w1064v1507 (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
=== w1064v1809 (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
=== w1064_tsign (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
=== w10pro64_ja (64 bit report) ===
wmvcore:
wmvcore.c:1430: Test failed: Output 0: Media types didn't match.
Nov. 3, 2021
Re: [PATCH 2/2] dmime: Skip Segment header only if too much data
by Michael Stefaniuc
Hello Alistair,
I have submitted a different patch that accepts DMUS_IO_SEGMENT_HEADER without
rtPlayStart field but warns about it.
Really puzzling what was used to create those .sgt files included in Sound.rez.
bye
michael
On 11/1/21 07:30, Alistair Leslie-Hughes wrote:
> Tron 2.0 has a segment header of 56, so is missing the rtPlayStart field.
>
> Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
> ---
> dlls/dmime/segment.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
> index f5dbf4b9959..67522c0edb6 100644
> --- a/dlls/dmime/segment.c
> +++ b/dlls/dmime/segment.c
> @@ -743,9 +743,7 @@ static HRESULT parse_segment_form(IDirectMusicSegment8Impl *This, IStream *strea
> switch (chunk.id) {
> case DMUS_FOURCC_SEGMENT_CHUNK:
> /* DX7, DX8 and DX9 structure sizes */
> - if (chunk.size != offsetof(DMUS_IO_SEGMENT_HEADER, rtLength) &&
> - chunk.size != offsetof(DMUS_IO_SEGMENT_HEADER, rtLoopStart) &&
> - chunk.size != sizeof(DMUS_IO_SEGMENT_HEADER)) {
> + if (chunk.size > sizeof(DMUS_IO_SEGMENT_HEADER)) {
> WARN("Invalid size of %s\n", debugstr_chunk(&chunk));
> break;
> }
>
Nov. 3, 2021
[PATCH 5/5] winegstreamer: Implement IWMReader::GetOutputProps().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/winegstreamer/wm_asyncreader.c | 10 +++++----
dlls/wmvcore/tests/wmvcore.c | 32 +++++++++++------------------
2 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c
index 8caf21a2de0..6771b590a71 100644
--- a/dlls/winegstreamer/wm_asyncreader.c
+++ b/dlls/winegstreamer/wm_asyncreader.c
@@ -114,11 +114,13 @@ static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *count)
return S_OK;
}
-static HRESULT WINAPI WMReader_GetOutputProps(IWMReader *iface, DWORD output_num, IWMOutputMediaProps **output)
+static HRESULT WINAPI WMReader_GetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps **props)
{
- struct async_reader *This = impl_from_IWMReader(iface);
- FIXME("(%p)->(%u %p)\n", This, output_num, output);
- return E_NOTIMPL;
+ struct async_reader *reader = impl_from_IWMReader(iface);
+
+ TRACE("reader %p, output %u, props %p.\n", reader, output, props);
+
+ return wm_reader_get_output_props(&reader->reader, output, props);
}
static HRESULT WINAPI WMReader_SetOutputProps(IWMReader *iface, DWORD output_num, IWMOutputMediaProps *output)
diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c
index 786160ec756..4b36392e570 100644
--- a/dlls/wmvcore/tests/wmvcore.c
+++ b/dlls/wmvcore/tests/wmvcore.c
@@ -1387,12 +1387,7 @@ static void test_async_reader_types(void)
output_number = i;
hr = IWMReader_GetOutputProps(reader, output_number, &output_props);
- todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
- if (hr != S_OK)
- {
- winetest_pop_context();
- continue;
- }
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
ret_size = sizeof(mt_buffer);
hr = IWMOutputMediaProps_GetMediaType(output_props, mt, &ret_size);
@@ -1519,25 +1514,22 @@ static void test_async_reader_types(void)
todo_wine ok(hr == NS_E_INVALID_OUTPUT_FORMAT, "Got hr %#x.\n", hr);
hr = IWMReader_GetOutputProps(reader, output_number, &output_props);
- todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
- if (hr == S_OK)
- {
- hr = IWMReader_GetOutputProps(reader, output_number, &output_props2);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(output_props2 != output_props, "Expected different objects.\n");
+ hr = IWMReader_GetOutputProps(reader, output_number, &output_props2);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(output_props2 != output_props, "Expected different objects.\n");
- ref = IWMOutputMediaProps_Release(output_props2);
- ok(!ref, "Got outstanding refcount %d.\n", ref);
- ref = IWMOutputMediaProps_Release(output_props);
- ok(!ref, "Got outstanding refcount %d.\n", ref);
- }
+ ref = IWMOutputMediaProps_Release(output_props2);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ ref = IWMOutputMediaProps_Release(output_props);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
winetest_pop_context();
}
- todo_wine ok(got_audio, "No audio stream was enumerated.\n");
- todo_wine ok(got_video, "No video stream was enumerated.\n");
+ ok(got_audio, "No audio stream was enumerated.\n");
+ ok(got_video, "No video stream was enumerated.\n");
count = 0xdeadbeef;
hr = IWMReader_GetOutputFormatCount(reader, 2, &count);
@@ -1546,7 +1538,7 @@ static void test_async_reader_types(void)
output_props = (void *)0xdeadbeef;
hr = IWMReader_GetOutputProps(reader, 2, &output_props);
- todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(output_props == (void *)0xdeadbeef, "Got output props %p.\n", output_props);
output_props = (void *)0xdeadbeef;
--
2.33.0
Nov. 3, 2021
[PATCH 4/5] winegstreamer: Implement IWMReader::GetOutputCount().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/winegstreamer/wm_asyncreader.c | 12 ++++++------
dlls/wmvcore/tests/wmvcore.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c
index 3448e156fa0..8caf21a2de0 100644
--- a/dlls/winegstreamer/wm_asyncreader.c
+++ b/dlls/winegstreamer/wm_asyncreader.c
@@ -102,15 +102,15 @@ static HRESULT WINAPI WMReader_Close(IWMReader *iface)
return hr;
}
-static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *outputs)
+static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *count)
{
- struct async_reader *This = impl_from_IWMReader(iface);
- FIXME("(%p)->(%p)\n", This, outputs);
+ struct async_reader *reader = impl_from_IWMReader(iface);
- if(!outputs)
- return E_INVALIDARG;
+ TRACE("reader %p, count %p.\n", reader, count);
- *outputs = 0;
+ EnterCriticalSection(&reader->reader.cs);
+ *count = reader->reader.stream_count;
+ LeaveCriticalSection(&reader->reader.cs);
return S_OK;
}
diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c
index 4e40aa53dfe..786160ec756 100644
--- a/dlls/wmvcore/tests/wmvcore.c
+++ b/dlls/wmvcore/tests/wmvcore.c
@@ -1254,7 +1254,7 @@ static void test_async_reader_streaming(void)
count = 0xdeadbeef;
hr = IWMReader_GetOutputCount(reader, &count);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(count == 2, "Got count %u.\n", count);
+ ok(count == 2, "Got count %u.\n", count);
for (i = 0; i < 2; ++i)
{
--
2.33.0
Nov. 3, 2021
[PATCH 3/5] winegstreamer: Implement IWMReaderAdvanced2::OpenStream().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/winegstreamer/wm_asyncreader.c | 58 +++++++++++++++++++++++++----
dlls/wmvcore/tests/wmvcore.c | 21 +++++------
2 files changed, 60 insertions(+), 19 deletions(-)
diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c
index 4fec89a2100..3448e156fa0 100644
--- a/dlls/winegstreamer/wm_asyncreader.c
+++ b/dlls/winegstreamer/wm_asyncreader.c
@@ -31,8 +31,20 @@ struct async_reader
IWMReaderStreamClock IWMReaderStreamClock_iface;
IWMReaderTypeNegotiation IWMReaderTypeNegotiation_iface;
IReferenceClock IReferenceClock_iface;
+
+ IWMReaderCallback *callback;
+ void *context;
};
+static void open_stream(struct async_reader *reader, IWMReaderCallback *callback, void *context)
+{
+ static const DWORD zero;
+
+ IWMReaderCallback_AddRef(reader->callback = callback);
+ reader->context = context;
+ IWMReaderCallback_OnStatus(callback, WMT_OPENED, S_OK, WMT_TYPE_DWORD, (BYTE *)&zero, context);
+}
+
static struct async_reader *impl_from_IWMReader(IWMReader *iface)
{
return CONTAINING_RECORD(iface, struct async_reader, IWMReader_iface);
@@ -68,9 +80,26 @@ static HRESULT WINAPI WMReader_Open(IWMReader *iface, const WCHAR *url, IWMReade
static HRESULT WINAPI WMReader_Close(IWMReader *iface)
{
- struct async_reader *This = impl_from_IWMReader(iface);
- FIXME("(%p)\n", This);
- return E_NOTIMPL;
+ struct async_reader *reader = impl_from_IWMReader(iface);
+ static const DWORD zero;
+ HRESULT hr;
+
+ TRACE("reader %p.\n", reader);
+
+ EnterCriticalSection(&reader->reader.cs);
+
+ hr = wm_reader_close(&reader->reader);
+ if (reader->callback)
+ {
+ IWMReaderCallback_OnStatus(reader->callback, WMT_CLOSED, S_OK,
+ WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
+ IWMReaderCallback_Release(reader->callback);
+ }
+ reader->callback = NULL;
+
+ LeaveCriticalSection(&reader->reader.cs);
+
+ return hr;
}
static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *outputs)
@@ -427,12 +456,21 @@ static HRESULT WINAPI WMReaderAdvanced2_StopBuffering(IWMReaderAdvanced6 *iface)
return E_NOTIMPL;
}
-static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface, IStream *stream,
- IWMReaderCallback *callback, void *context)
+static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface,
+ IStream *stream, IWMReaderCallback *callback, void *context)
{
- struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
- FIXME("(%p)->(%p %p %p)\n", This, stream, callback, context);
- return E_NOTIMPL;
+ struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
+ HRESULT hr;
+
+ TRACE("reader %p, stream %p, callback %p, context %p.\n", reader, stream, callback, context);
+
+ EnterCriticalSection(&reader->reader.cs);
+
+ if (SUCCEEDED(hr = wm_reader_open_stream(&reader->reader, stream)))
+ open_stream(reader, callback, context);
+
+ LeaveCriticalSection(&reader->reader.cs);
+ return hr;
}
static HRESULT WINAPI WMReaderAdvanced3_StopNetStreaming(IWMReaderAdvanced6 *iface)
@@ -1256,6 +1294,10 @@ static void async_reader_destroy(struct wm_reader *iface)
TRACE("reader %p.\n", reader);
wm_reader_close(&reader->reader);
+
+ if (reader->callback)
+ IWMReaderCallback_Release(reader->callback);
+
wm_reader_cleanup(&reader->reader);
free(reader);
}
diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c
index ef6aa294c48..4e40aa53dfe 100644
--- a/dlls/wmvcore/tests/wmvcore.c
+++ b/dlls/wmvcore/tests/wmvcore.c
@@ -1245,9 +1245,7 @@ static void test_async_reader_streaming(void)
IWMReader_QueryInterface(reader, &IID_IWMReaderAdvanced2, (void **)&advanced);
hr = IWMReaderAdvanced2_OpenStream(advanced, &stream.IStream_iface, &callback.IWMReaderCallback_iface, (void **)0xdeadbeef);
- todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
- if (hr != S_OK)
- goto out;
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(stream.refcount > 1, "Got refcount %d.\n", stream.refcount);
ok(callback.refcount > 1, "Got refcount %d.\n", callback.refcount);
ret = WaitForSingleObject(callback.got_opened, 1000);
@@ -1305,19 +1303,18 @@ static void test_async_reader_streaming(void)
test_reader_attributes(profile);
hr = IWMReader_Close(reader);
- todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(callback.got_closed == 1, "Got %u WMT_CLOSED callbacks.\n", callback.got_closed);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(callback.got_closed == 1, "Got %u WMT_CLOSED callbacks.\n", callback.got_closed);
ok(callback.refcount == 1, "Got outstanding refcount %d.\n", callback.refcount);
callback_cleanup(&callback);
-out:
ok(stream.refcount == 1, "Got outstanding refcount %d.\n", stream.refcount);
CloseHandle(stream.file);
ret = DeleteFileW(filename);
ok(ret, "Failed to delete %s, error %u.\n", debugstr_w(filename), GetLastError());
hr = IWMReader_Close(reader);
- todo_wine ok(hr == NS_E_INVALID_REQUEST, "Got hr %#x.\n", hr);
+ ok(hr == NS_E_INVALID_REQUEST, "Got hr %#x.\n", hr);
IWMReaderAdvanced2_Release(advanced);
IWMProfile_Release(profile);
@@ -1358,9 +1355,7 @@ static void test_async_reader_types(void)
IWMReader_QueryInterface(reader, &IID_IWMReaderAdvanced2, (void **)&advanced);
hr = IWMReaderAdvanced2_OpenStream(advanced, &stream.IStream_iface, &callback.IWMReaderCallback_iface, (void **)0xdeadbeef);
- todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
- if (hr != S_OK)
- goto out;
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(stream.refcount > 1, "Got refcount %d.\n", stream.refcount);
ok(callback.refcount > 1, "Got refcount %d.\n", callback.refcount);
ret = WaitForSingleObject(callback.got_opened, 1000);
@@ -1393,6 +1388,11 @@ static void test_async_reader_types(void)
hr = IWMReader_GetOutputProps(reader, output_number, &output_props);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+ if (hr != S_OK)
+ {
+ winetest_pop_context();
+ continue;
+ }
ret_size = sizeof(mt_buffer);
hr = IWMOutputMediaProps_GetMediaType(output_props, mt, &ret_size);
@@ -1554,7 +1554,6 @@ static void test_async_reader_types(void)
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(output_props == (void *)0xdeadbeef, "Got output props %p.\n", output_props);
-out:
IWMReaderAdvanced2_Release(advanced);
IWMProfile_Release(profile);
ref = IWMReader_Release(reader);
--
2.33.0
Nov. 3, 2021
[PATCH 2/5] wmvcore/tests: Add tests for asynchronous reader media types.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/wmvcore/tests/wmvcore.c | 242 +++++++++++++++++++++++++++++++++++
1 file changed, 242 insertions(+)
diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c
index ac4239f1d24..ef6aa294c48 100644
--- a/dlls/wmvcore/tests/wmvcore.c
+++ b/dlls/wmvcore/tests/wmvcore.c
@@ -1325,6 +1325,247 @@ out:
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
+static void test_async_reader_types(void)
+{
+ char mt_buffer[2000], mt2_buffer[2000];
+ const WCHAR *filename = load_resource(L"test.wmv");
+ IWMOutputMediaProps *output_props, *output_props2;
+ WM_MEDIA_TYPE *mt2 = (WM_MEDIA_TYPE *)mt2_buffer;
+ WM_MEDIA_TYPE *mt = (WM_MEDIA_TYPE *)mt_buffer;
+ bool got_video = false, got_audio = false;
+ DWORD size, ret_size, output_number;
+ IWMReaderAdvanced2 *advanced;
+ struct teststream stream;
+ struct callback callback;
+ IWMStreamConfig *config;
+ ULONG count, ref, i, j;
+ IWMProfile *profile;
+ IWMReader *reader;
+ GUID majortype;
+ HANDLE file;
+ HRESULT hr;
+ BOOL ret;
+
+ file = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
+ ok(file != INVALID_HANDLE_VALUE, "Failed to open %s, error %u.\n", debugstr_w(file), GetLastError());
+
+ teststream_init(&stream, file);
+ callback_init(&callback);
+
+ hr = WMCreateReader(NULL, 0, &reader);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ IWMReader_QueryInterface(reader, &IID_IWMProfile, (void **)&profile);
+ IWMReader_QueryInterface(reader, &IID_IWMReaderAdvanced2, (void **)&advanced);
+
+ hr = IWMReaderAdvanced2_OpenStream(advanced, &stream.IStream_iface, &callback.IWMReaderCallback_iface, (void **)0xdeadbeef);
+ todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+ if (hr != S_OK)
+ goto out;
+ ok(stream.refcount > 1, "Got refcount %d.\n", stream.refcount);
+ ok(callback.refcount > 1, "Got refcount %d.\n", callback.refcount);
+ ret = WaitForSingleObject(callback.got_opened, 1000);
+ ok(!ret, "Wait timed out.\n");
+
+ for (i = 0; i < 2; ++i)
+ {
+ winetest_push_context("Stream %u", i);
+
+ hr = IWMProfile_GetStream(profile, i, &config);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IWMStreamConfig_GetStreamType(config, &majortype);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ if (!i)
+ ok(IsEqualGUID(&majortype, &MEDIATYPE_Video), "Got major type %s.\n", debugstr_guid(&majortype));
+ else
+ ok(IsEqualGUID(&majortype, &MEDIATYPE_Audio), "Got major type %s.\n", debugstr_guid(&majortype));
+
+ ref = IWMStreamConfig_Release(config);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ winetest_pop_context();
+ }
+
+ for (i = 0; i < 2; ++i)
+ {
+ winetest_push_context("Output %u", i);
+ output_number = i;
+
+ hr = IWMReader_GetOutputProps(reader, output_number, &output_props);
+ todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ ret_size = sizeof(mt_buffer);
+ hr = IWMOutputMediaProps_GetMediaType(output_props, mt, &ret_size);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ ref = IWMOutputMediaProps_Release(output_props);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ majortype = mt->majortype;
+ if (IsEqualGUID(&majortype, &MEDIATYPE_Audio))
+ {
+ got_audio = true;
+ check_audio_type(mt);
+
+ /* R.U.S.E. enumerates all audio formats, picks the first one it
+ * likes, and then sets the wrong stream to that format.
+ * Accordingly we need the first audio format to be the default
+ * format, and we need it to be a format that the game is happy
+ * with. In particular it has to be PCM. */
+
+ hr = IWMReader_GetOutputFormat(reader, output_number, 0, &output_props);
+ todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ if (hr == S_OK)
+ {
+ ret_size = sizeof(mt2_buffer);
+ hr = IWMOutputMediaProps_GetMediaType(output_props, mt2, &ret_size);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ ref = IWMOutputMediaProps_Release(output_props);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ /* The sample size might differ. */
+ mt2->lSampleSize = mt->lSampleSize;
+ ok(compare_media_types(mt, mt2), "Media types didn't match.\n");
+ }
+ }
+ else
+ {
+ ok(IsEqualGUID(&majortype, &MEDIATYPE_Video), "Got major type %s.\n", debugstr_guid(&majortype));
+ got_video = true;
+ check_video_type(mt);
+ }
+
+ count = 0;
+ hr = IWMReader_GetOutputFormatCount(reader, output_number, &count);
+ todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+ todo_wine ok(count > 0, "Got count %u.\n", count);
+
+ for (j = 0; j < count; ++j)
+ {
+ winetest_push_context("Format %u", j);
+
+ hr = IWMReader_GetOutputFormat(reader, output_number, j, &output_props);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IWMReader_GetOutputFormat(reader, output_number, j, &output_props2);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(output_props2 != output_props, "Expected different objects.\n");
+ ref = IWMOutputMediaProps_Release(output_props2);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ size = 0xdeadbeef;
+ hr = IWMOutputMediaProps_GetMediaType(output_props, NULL, &size);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(size != 0xdeadbeef && size >= sizeof(WM_MEDIA_TYPE), "Got size %u.\n", size);
+
+ ret_size = size - 1;
+ hr = IWMOutputMediaProps_GetMediaType(output_props, mt, &ret_size);
+ ok(hr == ASF_E_BUFFERTOOSMALL, "Got hr %#x.\n", hr);
+ ok(ret_size == size, "Expected size %u, got %u.\n", size, ret_size);
+
+ ret_size = sizeof(mt_buffer);
+ memset(mt_buffer, 0xcc, sizeof(mt_buffer));
+ hr = IWMOutputMediaProps_GetMediaType(output_props, mt, &ret_size);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(ret_size == size, "Expected size %u, got %u.\n", size, ret_size);
+ ok(size == sizeof(WM_MEDIA_TYPE) + mt->cbFormat, "Expected size %u, got %u.\n",
+ sizeof(WM_MEDIA_TYPE) + mt->cbFormat, size);
+
+ ok(IsEqualGUID(&mt->majortype, &majortype), "Got major type %s.\n", debugstr_guid(&mt->majortype));
+
+ if (IsEqualGUID(&mt->majortype, &MEDIATYPE_Audio))
+ check_audio_type(mt);
+ else
+ check_video_type(mt);
+
+ hr = IWMReader_SetOutputProps(reader, output_number, output_props);
+ todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+ if (hr != S_OK)
+ {
+ ref = IWMOutputMediaProps_Release(output_props);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ winetest_pop_context();
+ continue;
+ }
+ hr = IWMReader_SetOutputProps(reader, 1 - output_number, output_props);
+ if (!i)
+ ok(hr == NS_E_INCOMPATIBLE_FORMAT /* win < 8, win10 1507-1809 */
+ || hr == ASF_E_BADMEDIATYPE /* win8, win10 1909+ */, "Got hr %#x.\n", hr);
+ else
+ todo_wine ok(hr == NS_E_INVALID_REQUEST, "Got hr %#x.\n", hr);
+ hr = IWMReader_SetOutputProps(reader, 2, output_props);
+ todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+
+ hr = IWMReader_GetOutputProps(reader, output_number, &output_props2);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(output_props2 != output_props, "Expected different objects.\n");
+
+ ret_size = sizeof(mt2_buffer);
+ hr = IWMOutputMediaProps_GetMediaType(output_props2, mt2, &ret_size);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(compare_media_types(mt, mt2), "Media types didn't match.\n");
+
+ ref = IWMOutputMediaProps_Release(output_props2);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ ref = IWMOutputMediaProps_Release(output_props);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ winetest_pop_context();
+ }
+
+ hr = IWMReader_GetOutputFormat(reader, output_number, count, &output_props);
+ todo_wine ok(hr == NS_E_INVALID_OUTPUT_FORMAT, "Got hr %#x.\n", hr);
+
+ hr = IWMReader_GetOutputProps(reader, output_number, &output_props);
+ todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ if (hr == S_OK)
+ {
+ hr = IWMReader_GetOutputProps(reader, output_number, &output_props2);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(output_props2 != output_props, "Expected different objects.\n");
+
+ ref = IWMOutputMediaProps_Release(output_props2);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ ref = IWMOutputMediaProps_Release(output_props);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ }
+
+ winetest_pop_context();
+ }
+
+ todo_wine ok(got_audio, "No audio stream was enumerated.\n");
+ todo_wine ok(got_video, "No video stream was enumerated.\n");
+
+ count = 0xdeadbeef;
+ hr = IWMReader_GetOutputFormatCount(reader, 2, &count);
+ todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(count == 0xdeadbeef, "Got count %#x.\n", count);
+
+ output_props = (void *)0xdeadbeef;
+ hr = IWMReader_GetOutputProps(reader, 2, &output_props);
+ todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(output_props == (void *)0xdeadbeef, "Got output props %p.\n", output_props);
+
+ output_props = (void *)0xdeadbeef;
+ hr = IWMReader_GetOutputFormat(reader, 2, 0, &output_props);
+ todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(output_props == (void *)0xdeadbeef, "Got output props %p.\n", output_props);
+
+out:
+ IWMReaderAdvanced2_Release(advanced);
+ IWMProfile_Release(profile);
+ ref = IWMReader_Release(reader);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ ok(stream.refcount == 1, "Got outstanding refcount %d.\n", stream.refcount);
+ CloseHandle(stream.file);
+ ret = DeleteFileW(filename);
+ ok(ret, "Failed to delete %s, error %u.\n", debugstr_w(filename), GetLastError());
+}
+
START_TEST(wmvcore)
{
HRESULT hr;
@@ -1345,6 +1586,7 @@ START_TEST(wmvcore)
test_sync_reader_types();
test_sync_reader_file();
test_async_reader_streaming();
+ test_async_reader_types();
CoUninitialize();
}
--
2.33.0
Nov. 3, 2021