Zebediah Figura : quartz/tests: Add some tests for allocator negotiation on the video renderer filter.
Alexandre Julliard
julliard at winehq.org
Mon Sep 30 16:19:06 CDT 2019
Module: wine
Branch: master
Commit: 23bd22a80b7c198fb573e865200cbc03c3485d3c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=23bd22a80b7c198fb573e865200cbc03c3485d3c
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sun Sep 29 19:03:26 2019 -0500
quartz/tests: Add some tests for allocator negotiation on the video renderer filter.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/quartz/tests/videorenderer.c | 50 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
index 24cf0cc828..bce42c4b8b 100644
--- a/dlls/quartz/tests/videorenderer.c
+++ b/dlls/quartz/tests/videorenderer.c
@@ -600,6 +600,49 @@ static void testfilter_init(struct testfilter *filter)
strmbase_source_init(&filter->source, &testsource_vtbl, &filter->filter, L"", &testsource_ops);
}
+static void test_allocator(IMemInputPin *input)
+{
+ IMemAllocator *req_allocator, *ret_allocator;
+ ALLOCATOR_PROPERTIES props;
+ HRESULT hr;
+
+ hr = IMemInputPin_GetAllocatorRequirements(input, &props);
+ ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+
+ hr = IMemInputPin_GetAllocator(input, &ret_allocator);
+ todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ if (hr == S_OK)
+ {
+ hr = IMemAllocator_GetProperties(ret_allocator, &props);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(!props.cBuffers, "Got %d buffers.\n", props.cBuffers);
+ ok(!props.cbBuffer, "Got size %d.\n", props.cbBuffer);
+ ok(!props.cbAlign, "Got alignment %d.\n", props.cbAlign);
+ ok(!props.cbPrefix, "Got prefix %d.\n", props.cbPrefix);
+
+ hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ IMemAllocator_Release(ret_allocator);
+ }
+
+ hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
+ ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+
+ CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IMemAllocator, (void **)&req_allocator);
+
+ hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IMemInputPin_GetAllocator(input, &ret_allocator);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(ret_allocator == req_allocator, "Allocators didn't match.\n");
+
+ IMemAllocator_Release(req_allocator);
+ IMemAllocator_Release(ret_allocator);
+}
+
static void test_connect_pin(void)
{
VIDEOINFOHEADER vih =
@@ -621,6 +664,7 @@ static void test_connect_pin(void)
IBaseFilter *filter = create_video_renderer();
IFilterGraph2 *graph = create_graph();
struct testfilter source;
+ IMemInputPin *input;
AM_MEDIA_TYPE mt;
IPin *pin, *peer;
unsigned int i;
@@ -682,6 +726,10 @@ static void test_connect_pin(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
+ IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
+
+ test_allocator(input);
+
hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IFilterGraph2_Disconnect(graph, pin);
@@ -697,6 +745,7 @@ static void test_connect_pin(void)
hr = IPin_ConnectionMediaType(pin, &mt);
ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+ IMemInputPin_Release(input);
IPin_Release(pin);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
@@ -716,7 +765,6 @@ static void test_pin(IPin *pin)
if (mpin)
{
ok(IMemInputPin_ReceiveCanBlock(mpin) == S_OK, "Receive can't block for pin!\n");
- ok(IMemInputPin_NotifyAllocator(mpin, NULL, 0) == E_POINTER, "NotifyAllocator likes a NULL pointer argument\n");
IMemInputPin_Release(mpin);
}
/* TODO */
More information about the wine-cvs
mailing list