48 return IUnknown_Release(
unknown);
51#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
60 hr = IUnknown_QueryInterface(iface, iid, (
void **)&unk);
63 IUnknown_Release(unk);
90 IBaseFilter_FindPin(
filter,
L"In", &pin);
103 ok(!
ref,
"Got unexpected refcount %ld.\n",
ref);
115 ok(
ref == 1,
"Got unexpected refcount %ld.\n",
ref);
120 hr = IBaseFilter_EnumPins(
filter, &enum1);
123 ok(
ref == 2,
"Got unexpected refcount %ld.\n",
ref);
125 ok(
ref == 1,
"Got unexpected refcount %ld.\n",
ref);
130 hr = IEnumPins_Next(enum1, 1, pins,
NULL);
133 ok(
ref == 3,
"Got unexpected refcount %ld.\n",
ref);
135 ok(
ref == 3,
"Got unexpected refcount %ld.\n",
ref);
137 ok(
ref == 1,
"Got unexpected refcount %ld.\n",
ref);
138 IPin_Release(pins[0]);
140 ok(
ref == 2,
"Got unexpected refcount %ld.\n",
ref);
142 hr = IEnumPins_Next(enum1, 1, pins,
NULL);
145 hr = IEnumPins_Reset(enum1);
148 hr = IEnumPins_Next(enum1, 1, pins, &
count);
151 IPin_Release(pins[0]);
153 hr = IEnumPins_Next(enum1, 1, pins, &
count);
157 hr = IEnumPins_Reset(enum1);
160 hr = IEnumPins_Next(enum1, 2, pins,
NULL);
163 hr = IEnumPins_Next(enum1, 2, pins, &
count);
166 IPin_Release(pins[0]);
168 hr = IEnumPins_Reset(enum1);
171 hr = IEnumPins_Clone(enum1, &enum2);
174 hr = IEnumPins_Skip(enum1, 2);
177 hr = IEnumPins_Skip(enum1, 1);
180 hr = IEnumPins_Skip(enum1, 1);
183 hr = IEnumPins_Next(enum1, 1, pins,
NULL);
186 hr = IEnumPins_Next(enum2, 1, pins,
NULL);
188 IPin_Release(pins[0]);
190 IEnumPins_Release(enum2);
191 IEnumPins_Release(enum1);
193 ok(!
ref,
"Got outstanding refcount %ld.\n",
ref);
204 hr = IBaseFilter_FindPin(
filter,
L"input pin", &pin);
210 hr = IBaseFilter_FindPin(
filter,
L"In", &pin);
214 ok(pin2 == pin,
"Expected pin %p, got %p.\n", pin, pin2);
220 ok(!
ref,
"Got outstanding refcount %ld.\n",
ref);
233 hr = IBaseFilter_FindPin(
filter,
L"In", &pin);
236 ok(
ref == 2,
"Got unexpected refcount %ld.\n",
ref);
238 ok(
ref == 2,
"Got unexpected refcount %ld.\n",
ref);
240 hr = IPin_QueryPinInfo(pin, &
info);
246 ok(
ref == 3,
"Got unexpected refcount %ld.\n",
ref);
248 ok(
ref == 3,
"Got unexpected refcount %ld.\n",
ref);
249 IBaseFilter_Release(
info.pFilter);
251 hr = IPin_QueryDirection(pin, &
dir);
255 hr = IPin_QueryId(pin, &
id);
260 hr = IPin_QueryInternalConnections(pin,
NULL,
NULL);
265 ok(!
ref,
"Got outstanding refcount %ld.\n",
ref);
320 ok(unk != &
test_outer,
"Returned IUnknown should not be outer IUnknown.\n");
322 ok(
ref == 1,
"Got unexpected refcount %ld.\n",
ref);
324 ref = IUnknown_AddRef(unk);
325 ok(
ref == 2,
"Got unexpected refcount %ld.\n",
ref);
328 ref = IUnknown_Release(unk);
329 ok(
ref == 1,
"Got unexpected refcount %ld.\n",
ref);
334 ok(unk2 == unk,
"Got unexpected IUnknown %p.\n", unk2);
335 IUnknown_Release(unk2);
342 ok(unk2 == (
IUnknown *)0xdeadbeef,
"Got unexpected IUnknown %p.\n", unk2);
346 ok(filter2 == (
IBaseFilter *)0xdeadbeef,
"Got unexpected IBaseFilter %p.\n", filter2);
348 hr = IUnknown_QueryInterface(unk, &
test_iid, (
void **)&unk2);
350 ok(!unk2,
"Got unexpected IUnknown %p.\n", unk2);
354 ok(unk2 == (
IUnknown *)0xdeadbeef,
"Got unexpected IUnknown %p.\n", unk2);
356 IBaseFilter_Release(
filter);
357 ref = IUnknown_Release(unk);
358 ok(!
ref,
"Got unexpected refcount %ld.\n",
ref);
371 IBaseFilter_FindPin(
filter,
L"In", &pin);
373 hr = IPin_EnumMediaTypes(pin, &enummt);
376 hr = IEnumMediaTypes_Next(enummt, 1, &pmt,
NULL);
379 IEnumMediaTypes_Release(enummt);
381 hr = IPin_QueryAccept(pin, &mt);
386 ok(!
ref,
"Got outstanding refcount %ld.\n",
ref);
398 IBaseFilter_FindPin(
filter,
L"In", &pin);
400 hr = IPin_EnumMediaTypes(pin, &enum1);
403 hr = IEnumMediaTypes_Next(enum1, 1, mts,
NULL);
406 hr = IEnumMediaTypes_Next(enum1, 1, mts, &
count);
410 hr = IEnumMediaTypes_Reset(enum1);
413 hr = IEnumMediaTypes_Next(enum1, 1, mts,
NULL);
416 hr = IEnumMediaTypes_Clone(enum1, &enum2);
419 hr = IEnumMediaTypes_Skip(enum1, 1);
422 hr = IEnumMediaTypes_Next(enum2, 1, mts,
NULL);
425 IEnumMediaTypes_Release(enum1);
426 IEnumMediaTypes_Release(enum2);
430 ok(!
ref,
"Got outstanding refcount %ld.\n",
ref);
448 return &
filter->source.pin;
490 hr = IMemInputPin_GetAllocatorRequirements(
input, &
props);
493 hr = IMemInputPin_GetAllocator(
input, &ret_allocator);
498 hr = IMemAllocator_GetProperties(ret_allocator, &
props);
500 ok(!
props.cBuffers,
"Got %ld buffers.\n",
props.cBuffers);
502 ok(!
props.cbAlign,
"Got alignment %ld.\n",
props.cbAlign);
503 ok(!
props.cbPrefix,
"Got prefix %ld.\n",
props.cbPrefix);
505 hr = IMemInputPin_NotifyAllocator(
input, ret_allocator,
TRUE);
507 IMemAllocator_Release(ret_allocator);
514 &IID_IMemAllocator, (
void **)&req_allocator);
516 hr = IMemInputPin_NotifyAllocator(
input, req_allocator,
TRUE);
519 hr = IMemInputPin_GetAllocator(
input, &ret_allocator);
521 ok(ret_allocator == req_allocator,
"Allocators didn't match.\n");
523 IMemAllocator_Release(req_allocator);
524 IMemAllocator_Release(ret_allocator);
541 IMediaSample_Release(
params->sample);
566 hr = IMediaSample_SetActualDataLength(
sample, 32 * 16 * 2);
569 start_time *= 10000000;
570 end_time = start_time + 10000000;
571 hr = IMediaSample_SetTime(
sample, &start_time, &end_time);
595#define join_thread(a) join_thread_(__LINE__, a)
606 IFilterGraph2_QueryInterface(
graph, &IID_IMediaControl, (
void **)&
control);
738 IMediaControl_Release(
control);
748 IFilterGraph2_QueryInterface(
graph, &IID_IMediaControl, (
void **)&
control);
759 hr = IPin_BeginFlush(pin);
769 hr = IPin_EndFlush(pin);
785 hr = IPin_BeginFlush(pin);
791 hr = IPin_EndFlush(pin);
800 IMediaControl_Release(
control);
806 unsigned int ret = 0;
810 while ((
hr = IMediaEvent_GetEvent(eventsrc, &
code, ¶m1, ¶m2,
timeout)) ==
S_OK)
812 if (
code == expected_code)
814 ok(param1 == expected1,
"Got param1 %#Ix.\n", param1);
815 ok(param2 == expected2,
"Got param2 %#Ix.\n", param2);
818 IMediaEvent_FreeEventParams(eventsrc,
code, param1, param2);
835 .majortype = {0x111},
837 .formattype = {0x333},
854 &IID_IFilterGraph2, (
void **)&
graph);
855 IFilterGraph2_AddFilter(
graph, &
source.filter.IBaseFilter_iface,
L"source");
857 IFilterGraph2_QueryInterface(
graph, &IID_IMediaControl, (
void **)&
control);
859 IBaseFilter_FindPin(
filter,
L"In", &pin);
861 peer = (
IPin *)0xdeadbeef;
862 hr = IPin_ConnectedTo(pin, &peer);
864 ok(!peer,
"Got peer %p.\n", peer);
866 hr = IPin_ConnectionMediaType(pin, &
mt);
871 hr = IFilterGraph2_ConnectDirect(
graph, &
source.source.pin.IPin_iface, pin, &req_mt);
876 hr = IFilterGraph2_ConnectDirect(
graph, &
source.source.pin.IPin_iface, pin, &req_mt);
879 hr = IPin_ConnectedTo(pin, &peer);
881 ok(peer == &
source.source.pin.IPin_iface,
"Got peer %p.\n", peer);
884 hr = IPin_ConnectionMediaType(pin, &
mt);
890 hr = IFilterGraph2_Disconnect(
graph, pin);
895 IPin_QueryInterface(pin, &IID_IMemInputPin, (
void **)&
input);
901 hr = IMemAllocator_SetProperties(
allocator, &req_props, &ret_props);
903 ok(!
memcmp(&ret_props, &req_props,
sizeof(req_props)),
"Properties did not match.\n");
908 hr = IMemInputPin_ReceiveCanBlock(
input);
914 hr = IFilterGraph2_Disconnect(
graph, pin);
916 hr = IFilterGraph2_Disconnect(
graph, pin);
918 ok(
source.source.pin.peer == pin,
"Got peer %p.\n", peer);
919 IFilterGraph2_Disconnect(
graph, &
source.source.pin.IPin_iface);
921 peer = (
IPin *)0xdeadbeef;
922 hr = IPin_ConnectedTo(pin, &peer);
924 ok(!peer,
"Got peer %p.\n", peer);
926 hr = IPin_ConnectionMediaType(pin, &
mt);
929 IMemInputPin_Release(
input);
931 IMediaControl_Release(
control);
933 ok(!
ref,
"Got outstanding refcount %ld.\n",
ref);
935 ok(!
ref,
"Got outstanding refcount %ld.\n",
ref);
936 ref = IBaseFilter_Release(&
source.filter.IBaseFilter_iface);
937 ok(!
ref,
"Got outstanding refcount %ld.\n",
ref);
945 IMediaEvent *eventsrc;
953 hr = IFilterGraph2_QueryInterface(
graph, &IID_IMediaControl, (
void **)&
control);
956 hr = IFilterGraph2_QueryInterface(
graph, &IID_IMediaEvent, (
void **)&eventsrc);
960 ok(!
ret,
"Got %u EC_COMPLETE events.\n",
ret);
966 ok(!
ret,
"Got %u EC_COMPLETE events.\n",
ret);
972 ok(
ret == 1,
"Got %u EC_COMPLETE events.\n",
ret);
978 ok(!
ret,
"Got %u EC_COMPLETE events.\n",
ret);
984 ok(
ret == 1,
"Got %u EC_COMPLETE events.\n",
ret);
990 ok(!
ret,
"Got %u EC_COMPLETE events.\n",
ret);
996 ok(
ret == 1,
"Got %u EC_COMPLETE events.\n",
ret);
998 IMediaControl_Release(
control);
999 IMediaEvent_Release(eventsrc);
1000 ref = IFilterGraph2_Release(
graph);
1001 ok(!
ref,
"Got outstanding refcount %ld.\n",
ref);
1003 ok(!
ref,
"Got outstanding refcount %ld.\n",
ref);
1017 win_skip(
"Failed to create null renderer filter, hr %#lx.\n",
hr);
1020 IBaseFilter_Release(
filter);
#define InterlockedIncrement
#define InterlockedDecrement
enum _PinDirection PIN_DIRECTION
const GUID IID_IKsPropertySet
const GUID IID_IBaseFilter
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
void WINAPI CoTaskMemFree(void *ptr)
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum const GLfloat * params
GLsizei GLenum GLboolean sink
GLenum GLenum GLenum input
static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IMemInputPin *peer, IMemAllocator **allocator)
static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
static void testfilter_destroy(struct strmbase_filter *iface)
static HRESULT join_thread_(int line, HANDLE thread)
static const IUnknownVtbl outer_vtbl
static HANDLE send_frame_time(IMemInputPin *sink, REFERENCE_TIME start_time, unsigned char color)
static void test_aggregation(void)
static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
static IBaseFilter * create_null_renderer(void)
static ULONG WINAPI outer_AddRef(IUnknown *iface)
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out)
static struct testfilter * impl_from_strmbase_filter(struct strmbase_filter *iface)
static ULONG get_refcount(void *iface)
static void test_pin_info(void)
static IUnknown test_outer
static void test_find_pin(void)
static const struct strmbase_source_ops testsource_ops
static void test_enum_media_types(void)
static void test_interfaces(void)
static void test_connect_pin(void)
static DWORD WINAPI frame_thread(void *arg)
static void test_media_types(void)
static struct strmbase_pin * testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
static void test_allocator(IMemInputPin *input)
static void test_enum_pins(void)
static IFilterGraph2 * create_graph(void)
static HANDLE send_frame(IMemInputPin *sink)
static void test_unconnected_eos(void)
static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
#define check_interface(a, b, c)
static unsigned int check_event_code(IMediaEvent *eventsrc, DWORD timeout, LONG expected_code, LONG_PTR expected1, LONG_PTR expected2)
static const struct strmbase_filter_ops testfilter_ops
static const GUID test_iid
static void testfilter_init(struct testfilter *filter)
static ULONG WINAPI outer_Release(IUnknown *iface)
static void test_filter_state(void)
const GUID IID_IPersistPropertyBag
#define IsEqualGUID(rguid1, rguid2)
static __inline const char * wine_dbgstr_guid(const GUID *id)
void strmbase_source_init(struct strmbase_source *pin, struct strmbase_filter *filter, const WCHAR *name, const struct strmbase_source_ops *func_table)
void strmbase_filter_cleanup(struct strmbase_filter *filter)
void strmbase_source_cleanup(struct strmbase_source *pin)
void strmbase_filter_init(struct strmbase_filter *filter, IUnknown *outer, const CLSID *clsid, const struct strmbase_filter_ops *func_table)
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(struct strmbase_source *pin, IPin *peer, const AM_MEDIA_TYPE *mt)
struct strmbase_filter filter
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
#define CONTAINING_RECORD(address, type, field)
#define VFW_E_NOT_COMMITTED
#define VFW_E_NOT_STOPPED
#define VFW_S_STATE_INTERMEDIATE
#define VFW_E_NOT_CONNECTED
static const WCHAR props[]
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
DWORD WINAPI GetCurrentThreadId(void)