ReactOS 0.4.17-dev-923-g4c9a150
samplegrabber.c
Go to the documentation of this file.
1/*
2 * Sample grabber filter unit tests
3 *
4 * Copyright 2018 Zebediah Figura
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#define COBJMACROS
22#include "dshow.h"
23#include "qedit.h"
24#include "wine/strmbase.h"
25#include "wine/test.h"
26
28{
30 HRESULT hr = CoCreateInstance(&CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,
31 &IID_IBaseFilter, (void **)&filter);
32 ok(hr == S_OK, "Got hr %#lx.\n", hr);
33 return filter;
34}
35
36static ULONG get_refcount(void *iface)
37{
38 IUnknown *unknown = iface;
39 IUnknown_AddRef(unknown);
40 return IUnknown_Release(unknown);
41}
42
44{
45 return !memcmp(a, b, offsetof(AM_MEDIA_TYPE, pbFormat))
46 && !memcmp(a->pbFormat, b->pbFormat, a->cbFormat);
47}
48
49#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
50static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
51{
52 IUnknown *iface = iface_ptr;
55 IUnknown *unk;
56
57 expected_hr = supported ? S_OK : E_NOINTERFACE;
58
59 expect_ref = get_refcount(iface);
60
61 hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
62 ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
63 if (SUCCEEDED(hr))
64 {
65 ref = get_refcount(iface);
66 ok_(__FILE__, line)(ref == expect_ref + 1, "Expected %lu references, got %lu.\n", expect_ref + 1, ref);
67 ref = get_refcount(unk);
68 ok_(__FILE__, line)(ref == expect_ref + 1, "Expected %lu references, got %lu.\n", expect_ref + 1, ref);
69 IUnknown_Release(unk);
70 }
71}
72
73static void test_interfaces(void)
74{
76 IUnknown *unk;
77 HRESULT hr;
78 ULONG ref;
79 IPin *pin;
80
82 check_interface(filter, &IID_IMediaFilter, TRUE);
84 check_interface(filter, &IID_ISampleGrabber, TRUE);
86
87 check_interface(filter, &IID_IAMFilterMiscFlags, FALSE);
88 check_interface(filter, &IID_IBasicAudio, FALSE);
89 check_interface(filter, &IID_IBasicVideo, FALSE);
91 check_interface(filter, &IID_IMediaPosition, FALSE);
92 check_interface(filter, &IID_IMediaSeeking, FALSE);
93 check_interface(filter, &IID_IMemInputPin, FALSE);
96 check_interface(filter, &IID_IQualityControl, FALSE);
97 check_interface(filter, &IID_IQualProp, FALSE);
98 check_interface(filter, &IID_IReferenceClock, FALSE);
99 check_interface(filter, &IID_ISeekingPassThru, FALSE);
100 check_interface(filter, &IID_IVideoWindow, FALSE);
101
102 IBaseFilter_FindPin(filter, L"In", &pin);
103
104 check_interface(pin, &IID_IMemInputPin, TRUE);
106 todo_wine check_interface(pin, &IID_IQualityControl, TRUE);
108
110 check_interface(pin, &IID_IMediaPosition, FALSE);
111 check_interface(pin, &IID_IMediaSeeking, FALSE);
112
113 IPin_Release(pin);
114
115 IBaseFilter_FindPin(filter, L"Out", &pin);
116
117 /* Queries for IMediaPosition or IMediaSeeking do not seem to increase the
118 * reference count. */
119 hr = IPin_QueryInterface(pin, &IID_IMediaPosition, (void **)&unk);
120 ok(hr == S_OK, "Got hr %#lx.\n", hr);
121 IUnknown_Release(unk);
122 hr = IPin_QueryInterface(pin, &IID_IMediaSeeking, (void **)&unk);
123 ok(hr == S_OK, "Got hr %#lx.\n", hr);
124 IUnknown_Release(unk);
126 todo_wine check_interface(pin, &IID_IQualityControl, TRUE);
128
131 check_interface(pin, &IID_IMemInputPin, FALSE);
132
133 IPin_Release(pin);
134
135 ref = IBaseFilter_Release(filter);
136 ok(!ref, "Got unexpected refcount %ld.\n", ref);
137}
138
139static void test_enum_pins(void)
140{
142 IEnumPins *enum1, *enum2;
143 ULONG count, ref;
144 IPin *pins[3];
145 HRESULT hr;
146
148 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
149
150 hr = IBaseFilter_EnumPins(filter, NULL);
151 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
152
153 hr = IBaseFilter_EnumPins(filter, &enum1);
154 ok(hr == S_OK, "Got hr %#lx.\n", hr);
156 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
157 ref = get_refcount(enum1);
158 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
159
160 hr = IEnumPins_Next(enum1, 1, NULL, NULL);
161 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
162
163 hr = IEnumPins_Next(enum1, 1, pins, NULL);
164 ok(hr == S_OK, "Got hr %#lx.\n", hr);
166 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
167 ref = get_refcount(pins[0]);
168 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
169 ref = get_refcount(enum1);
170 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
171 IPin_Release(pins[0]);
173 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
174
175 hr = IEnumPins_Next(enum1, 1, pins, NULL);
176 ok(hr == S_OK, "Got hr %#lx.\n", hr);
178 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
179 ref = get_refcount(pins[0]);
180 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
181 ref = get_refcount(enum1);
182 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
183 IPin_Release(pins[0]);
185 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
186
187 hr = IEnumPins_Next(enum1, 1, pins, NULL);
188 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
189
190 hr = IEnumPins_Reset(enum1);
191 ok(hr == S_OK, "Got hr %#lx.\n", hr);
192
193 hr = IEnumPins_Next(enum1, 1, pins, &count);
194 ok(hr == S_OK, "Got hr %#lx.\n", hr);
195 ok(count == 1, "Got count %lu.\n", count);
196 IPin_Release(pins[0]);
197
198 hr = IEnumPins_Next(enum1, 1, pins, &count);
199 ok(hr == S_OK, "Got hr %#lx.\n", hr);
200 ok(count == 1, "Got count %lu.\n", count);
201 IPin_Release(pins[0]);
202
203 hr = IEnumPins_Next(enum1, 1, pins, &count);
204 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
205 ok(!count, "Got count %lu.\n", count);
206
207 hr = IEnumPins_Reset(enum1);
208 ok(hr == S_OK, "Got hr %#lx.\n", hr);
209
210 hr = IEnumPins_Next(enum1, 2, pins, NULL);
211 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
212
213 hr = IEnumPins_Next(enum1, 2, pins, &count);
214 ok(hr == S_OK, "Got hr %#lx.\n", hr);
215 ok(count == 2, "Got count %lu.\n", count);
216 IPin_Release(pins[0]);
217 IPin_Release(pins[1]);
218
219 hr = IEnumPins_Next(enum1, 2, pins, &count);
220 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
221 ok(!count, "Got count %lu.\n", count);
222
223 hr = IEnumPins_Reset(enum1);
224 ok(hr == S_OK, "Got hr %#lx.\n", hr);
225
226 hr = IEnumPins_Next(enum1, 3, pins, &count);
227 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
228 ok(count == 2, "Got count %lu.\n", count);
229 IPin_Release(pins[0]);
230 IPin_Release(pins[1]);
231
232 hr = IEnumPins_Reset(enum1);
233 ok(hr == S_OK, "Got hr %#lx.\n", hr);
234
235 hr = IEnumPins_Clone(enum1, &enum2);
236 ok(hr == S_OK, "Got hr %#lx.\n", hr);
237
238 hr = IEnumPins_Skip(enum1, 3);
239 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
240
241 hr = IEnumPins_Skip(enum1, 2);
242 ok(hr == S_OK, "Got hr %#lx.\n", hr);
243
244 hr = IEnumPins_Skip(enum1, 1);
245 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
246
247 hr = IEnumPins_Next(enum1, 1, pins, NULL);
248 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
249
250 hr = IEnumPins_Next(enum2, 1, pins, NULL);
251 ok(hr == S_OK, "Got hr %#lx.\n", hr);
252 IPin_Release(pins[0]);
253
254 IEnumPins_Release(enum2);
255 IEnumPins_Release(enum1);
256 ref = IBaseFilter_Release(filter);
257 ok(!ref, "Got outstanding refcount %ld.\n", ref);
258}
259
260static void test_find_pin(void)
261{
264 IPin *pin, *pin2;
265 HRESULT hr;
266 ULONG ref;
267
268 hr = IBaseFilter_FindPin(filter, L"Input", &pin);
269 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
270 hr = IBaseFilter_FindPin(filter, L"Output", &pin);
271 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
272
273 hr = IBaseFilter_EnumPins(filter, &enum_pins);
274 ok(hr == S_OK, "Got hr %#lx.\n", hr);
275
276 hr = IBaseFilter_FindPin(filter, L"In", &pin);
277 ok(hr == S_OK, "Got hr %#lx.\n", hr);
278 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
279 ok(hr == S_OK, "Got hr %#lx.\n", hr);
280 ok(pin2 == pin, "Expected pin %p, got %p.\n", pin, pin2);
281 IPin_Release(pin2);
282 IPin_Release(pin);
283
284 hr = IBaseFilter_FindPin(filter, L"Out", &pin);
285 ok(hr == S_OK, "Got hr %#lx.\n", hr);
286 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
287 ok(hr == S_OK, "Got hr %#lx.\n", hr);
288 ok(pin2 == pin, "Expected pin %p, got %p.\n", pin, pin2);
289 IPin_Release(pin2);
290 IPin_Release(pin);
291
292 IEnumPins_Release(enum_pins);
293 ref = IBaseFilter_Release(filter);
294 ok(!ref, "Got outstanding refcount %ld.\n", ref);
295}
296
297static void test_pin_info(void)
298{
302 ULONG count;
303 HRESULT hr;
304 WCHAR *id;
305 ULONG ref;
306 IPin *pin;
307
308 hr = IBaseFilter_FindPin(filter, L"In", &pin);
309 ok(hr == S_OK, "Got hr %#lx.\n", hr);
310
311 hr = IPin_QueryPinInfo(pin, &info);
312 ok(hr == S_OK, "Got hr %#lx.\n", hr);
313 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
314 ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
315 ok(!wcscmp(info.achName, L"Input"), "Got name %s.\n", wine_dbgstr_w(info.achName));
316 IBaseFilter_Release(info.pFilter);
317
318 hr = IPin_QueryDirection(pin, &dir);
319 ok(hr == S_OK, "Got hr %#lx.\n", hr);
320 ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
321
322 hr = IPin_QueryId(pin, &id);
323 ok(hr == S_OK, "Got hr %#lx.\n", hr);
324 ok(!wcscmp(id, L"In"), "Got id %s.\n", wine_dbgstr_w(id));
325 CoTaskMemFree(id);
326
327 hr = IPin_QueryInternalConnections(pin, NULL, &count);
328 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
329
330 IPin_Release(pin);
331
332 hr = IBaseFilter_FindPin(filter, L"Out", &pin);
333 ok(hr == S_OK, "Got hr %#lx.\n", hr);
334
335 hr = IPin_QueryPinInfo(pin, &info);
336 ok(hr == S_OK, "Got hr %#lx.\n", hr);
337 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
338 ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
339 ok(!wcscmp(info.achName, L"Output"), "Got name %s.\n", wine_dbgstr_w(info.achName));
340 IBaseFilter_Release(info.pFilter);
341
342 hr = IPin_QueryDirection(pin, &dir);
343 ok(hr == S_OK, "Got hr %#lx.\n", hr);
344 ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
345
346 hr = IPin_QueryId(pin, &id);
347 ok(hr == S_OK, "Got hr %#lx.\n", hr);
348 ok(!wcscmp(id, L"Out"), "Got id %s.\n", wine_dbgstr_w(id));
349 CoTaskMemFree(id);
350
351 hr = IPin_QueryInternalConnections(pin, NULL, &count);
352 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
353
354 IPin_Release(pin);
355
356 ref = IBaseFilter_Release(filter);
357 ok(!ref, "Got outstanding refcount %ld.\n", ref);
358}
359
360static const GUID test_iid = {0x33333333};
361static LONG outer_ref = 1;
362
364{
365 if (IsEqualGUID(iid, &IID_IUnknown)
367 || IsEqualGUID(iid, &test_iid))
368 {
369 *out = (IUnknown *)0xdeadbeef;
370 return S_OK;
371 }
372 ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid));
373 return E_NOINTERFACE;
374}
375
377{
379}
380
382{
384}
385
386static const IUnknownVtbl outer_vtbl =
387{
391};
392
394
395static void test_aggregation(void)
396{
397 IBaseFilter *filter, *filter2;
398 IUnknown *unk, *unk2;
399 HRESULT hr;
400 ULONG ref;
401
402 filter = (IBaseFilter *)0xdeadbeef;
403 hr = CoCreateInstance(&CLSID_SampleGrabber, &test_outer, CLSCTX_INPROC_SERVER,
404 &IID_IBaseFilter, (void **)&filter);
405 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
406 ok(!filter, "Got interface %p.\n", filter);
407
408 hr = CoCreateInstance(&CLSID_SampleGrabber, &test_outer, CLSCTX_INPROC_SERVER,
409 &IID_IUnknown, (void **)&unk);
410 ok(hr == S_OK, "Got hr %#lx.\n", hr);
411 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
412 ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
413 ref = get_refcount(unk);
414 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
415
416 ref = IUnknown_AddRef(unk);
417 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
418 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
419
420 ref = IUnknown_Release(unk);
421 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
422 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
423
424 hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
425 ok(hr == S_OK, "Got hr %#lx.\n", hr);
426 ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
427 IUnknown_Release(unk2);
428
429 hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
430 ok(hr == S_OK, "Got hr %#lx.\n", hr);
431
432 hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
433 ok(hr == S_OK, "Got hr %#lx.\n", hr);
434 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
435
436 hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
437 ok(hr == S_OK, "Got hr %#lx.\n", hr);
438 ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
439
440 hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
441 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
442 ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
443
444 hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
445 ok(hr == S_OK, "Got hr %#lx.\n", hr);
446 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
447
448 IBaseFilter_Release(filter);
449 ref = IUnknown_Release(unk);
450 ok(!ref, "Got unexpected refcount %ld.\n", ref);
451 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
452}
453
454static void test_media_types(void)
455{
456 BYTE format = 1;
457 AM_MEDIA_TYPE mt =
458 {
459 .majortype = {0x111},
460 .subtype = {0x222},
461 .formattype = {0x333},
462 };
463 AM_MEDIA_TYPE match_mt =
464 {
465 .subtype = {0x123},
466 .bFixedSizeSamples = TRUE,
467 .bTemporalCompression = TRUE,
468 .lSampleSize = 456,
469 .formattype = {0x789},
470 .cbFormat = sizeof(format),
471 .pbFormat = &format,
472 };
474 IEnumMediaTypes *enummt;
475 ISampleGrabber *grabber;
476 IPin *sink, *source;
477 HRESULT hr;
478 ULONG ref;
479
480 IBaseFilter_QueryInterface(filter, &IID_ISampleGrabber, (void **)&grabber);
481 IBaseFilter_FindPin(filter, L"In", &sink);
482 IBaseFilter_FindPin(filter, L"Out", &source);
483
484 hr = IPin_EnumMediaTypes(sink, &enummt);
485 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
486
487 hr = IPin_EnumMediaTypes(source, &enummt);
488 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
489
490 hr = IPin_QueryAccept(sink, &mt);
491 ok(hr == S_OK, "Got hr %#lx.\n", hr);
492 hr = IPin_QueryAccept(source, &mt);
493 ok(hr == S_OK, "Got hr %#lx.\n", hr);
494
495 hr = ISampleGrabber_SetMediaType(grabber, &match_mt);
496 ok(hr == S_OK, "Got hr %#lx.\n", hr);
497
498 hr = IPin_EnumMediaTypes(sink, &enummt);
499 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
500
501 hr = IPin_EnumMediaTypes(source, &enummt);
502 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
503
504 hr = IPin_QueryAccept(sink, &mt);
505 ok(hr == S_OK, "Got hr %#lx.\n", hr);
506 hr = IPin_QueryAccept(source, &mt);
507 ok(hr == S_OK, "Got hr %#lx.\n", hr);
508
509 match_mt.majortype = MEDIATYPE_Video;
510 match_mt.subtype = GUID_NULL;
511 hr = ISampleGrabber_SetMediaType(grabber, &match_mt);
512 ok(hr == S_OK, "Got hr %#lx.\n", hr);
513 hr = IPin_QueryAccept(sink, &mt);
514 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
515 hr = IPin_QueryAccept(source, &mt);
516 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
517
518 mt.majortype = GUID_NULL;
519 hr = IPin_QueryAccept(sink, &mt);
520 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
521 hr = IPin_QueryAccept(source, &mt);
522 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
523 mt.majortype = match_mt.majortype;
524 hr = IPin_QueryAccept(sink, &mt);
525 ok(hr == S_OK, "Got hr %#lx.\n", hr);
526 hr = IPin_QueryAccept(source, &mt);
527 ok(hr == S_OK, "Got hr %#lx.\n", hr);
528
529 match_mt.subtype = MEDIASUBTYPE_RGB8;
530 match_mt.formattype = GUID_NULL;
531 hr = ISampleGrabber_SetMediaType(grabber, &match_mt);
532 ok(hr == S_OK, "Got hr %#lx.\n", hr);
533 hr = IPin_QueryAccept(sink, &mt);
534 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
535 hr = IPin_QueryAccept(source, &mt);
536 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
537
538 mt.subtype = GUID_NULL;
539 hr = IPin_QueryAccept(sink, &mt);
540 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
541 hr = IPin_QueryAccept(source, &mt);
542 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
543 mt.subtype = match_mt.subtype;
544 hr = IPin_QueryAccept(sink, &mt);
545 ok(hr == S_OK, "Got hr %#lx.\n", hr);
546 hr = IPin_QueryAccept(source, &mt);
547 ok(hr == S_OK, "Got hr %#lx.\n", hr);
548
549 match_mt.formattype = FORMAT_None;
550 hr = ISampleGrabber_SetMediaType(grabber, &match_mt);
551 ok(hr == S_OK, "Got hr %#lx.\n", hr);
552 hr = IPin_QueryAccept(sink, &mt);
553 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
554 hr = IPin_QueryAccept(source, &mt);
555 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
556
557 mt.formattype = GUID_NULL;
558 hr = IPin_QueryAccept(sink, &mt);
559 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
560 hr = IPin_QueryAccept(source, &mt);
561 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
562 mt.formattype = match_mt.formattype;
563 hr = IPin_QueryAccept(sink, &mt);
564 ok(hr == S_OK, "Got hr %#lx.\n", hr);
565 hr = IPin_QueryAccept(source, &mt);
566 ok(hr == S_OK, "Got hr %#lx.\n", hr);
567
568 IPin_Release(sink);
569 IPin_Release(source);
570 ISampleGrabber_Release(grabber);
571 ref = IBaseFilter_Release(filter);
572 ok(!ref, "Got outstanding refcount %ld.\n", ref);
573}
574
575struct testfilter
576{
577 struct strmbase_filter filter;
578 struct strmbase_source source;
583};
584
585static inline struct testfilter *impl_from_strmbase_filter(struct strmbase_filter *iface)
586{
587 return CONTAINING_RECORD(iface, struct testfilter, filter);
588}
589
590static struct strmbase_pin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
591{
593 if (!index)
594 return &filter->source.pin;
595 else if (index == 1)
596 return &filter->sink.pin;
597 return NULL;
598}
599
600static void testfilter_destroy(struct strmbase_filter *iface)
601{
606}
607
609{
610 .filter_get_pin = testfilter_get_pin,
611 .filter_destroy = testfilter_destroy,
612};
613
615{
616 return mt->bTemporalCompression ? S_OK : S_FALSE;
617}
618
619static HRESULT testsource_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
620{
622 if (!index)
623 {
624 CopyMediaType(mt, &filter->source_mt);
625 return S_OK;
626 }
627 return VFW_S_NO_MORE_ITEMS;
628}
629
630static void test_sink_allocator(IPin *pin)
631{
632 ALLOCATOR_PROPERTIES req_props = {1, 256, 1, 0}, ret_props;
633 IMemAllocator *req_allocator, *ret_allocator;
635 HRESULT hr;
636
637 IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
638
639 hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
640 todo_wine ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
641
642 hr = IMemInputPin_GetAllocatorRequirements(input, &ret_props);
643 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
644
645 hr = IMemInputPin_GetAllocator(input, &ret_allocator);
646 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
647
648 if (hr == S_OK)
649 {
650 hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
651 ok(hr == S_OK, "Got hr %#lx.\n", hr);
652 IMemAllocator_Release(ret_allocator);
653 }
654
655 CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
656 &IID_IMemAllocator, (void **)&req_allocator);
657
658 hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
659 ok(hr == S_OK, "Got hr %#lx.\n", hr);
660
661 hr = IMemInputPin_GetAllocator(input, &ret_allocator);
662 ok(hr == S_OK, "Got hr %#lx.\n", hr);
663 ok(ret_allocator == req_allocator, "Allocators didn't match.\n");
664 IMemAllocator_Release(ret_allocator);
665
666 hr = IMemAllocator_SetProperties(req_allocator, &req_props, &ret_props);
667 ok(hr == S_OK, "Got hr %#lx.\n", hr);
668
669 IMemAllocator_Release(req_allocator);
670 IMemInputPin_Release(input);
671}
672
674 IPin *peer, const AM_MEDIA_TYPE *mt)
675{
676 HRESULT hr;
677
678 iface->pin.peer = peer;
679 IPin_AddRef(peer);
680 CopyMediaType(&iface->pin.mt, mt);
681
682 if (FAILED(hr = IPin_ReceiveConnection(peer, &iface->pin.IPin_iface, mt)))
683 {
684 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
685 IPin_Release(peer);
686 iface->pin.peer = NULL;
687 FreeMediaType(&iface->pin.mt);
688 }
689
691
692 return hr;
693}
694
696{
697 .base.pin_query_accept = testsource_query_accept,
698 .base.pin_get_media_type = testsource_get_media_type,
699 .pfnAttemptConnection = testsource_AttemptConnection,
700};
701
702static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
703{
705
706 if (IsEqualGUID(iid, &IID_IMemInputPin))
707 *out = &filter->sink.IMemInputPin_iface;
708 else
709 return E_NOINTERFACE;
710
711 IUnknown_AddRef((IUnknown *)*out);
712 return S_OK;
713}
714
716{
718 if (!index && filter->sink_mt)
719 {
720 CopyMediaType(mt, filter->sink_mt);
721 return S_OK;
722 }
723 return VFW_S_NO_MORE_ITEMS;
724}
725
726static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
727{
728 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
729 if (filter->sink_mt && !IsEqualGUID(&mt->majortype, &filter->sink_mt->majortype))
731 return S_OK;
732}
733
735{
736 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
737 REFERENCE_TIME start, stop;
738 BYTE *data, expect[200];
739 LONG size, i;
740 HRESULT hr;
741
742 size = IMediaSample_GetSize(sample);
743 ok(size == 256, "Got size %lu.\n", size);
744 size = IMediaSample_GetActualDataLength(sample);
745 ok(size == 200, "Got valid size %lu.\n", size);
746
747 hr = IMediaSample_GetPointer(sample, &data);
748 ok(hr == S_OK, "Got hr %#lx.\n", hr);
749 for (i = 0; i < size; ++i)
750 expect[i] = i;
751 ok(!memcmp(data, expect, size), "Data didn't match.\n");
752
753 hr = IMediaSample_GetTime(sample, &start, &stop);
754 ok(hr == S_OK, "Got hr %#lx.\n", hr);
755 ok(start == 30000, "Got start time %s.\n", wine_dbgstr_longlong(start));
756 ok(stop == 40000, "Got stop time %s.\n", wine_dbgstr_longlong(stop));
757
758 hr = IMediaSample_GetMediaTime(sample, &start, &stop);
759 ok(hr == S_OK, "Got hr %#lx.\n", hr);
760 ok(start == 10000, "Got start time %s.\n", wine_dbgstr_longlong(start));
761 ok(stop == 20000, "Got stop time %s.\n", wine_dbgstr_longlong(stop));
762
763 hr = IMediaSample_IsDiscontinuity(sample);
764 ok(hr == S_OK, "Got hr %#lx.\n", hr);
765 hr = IMediaSample_IsPreroll(sample);
766 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
767 hr = IMediaSample_IsSyncPoint(sample);
768 ok(hr == S_OK, "Got hr %#lx.\n", hr);
769
770 ++filter->got_sample;
771
772 return S_OK;
773}
774
777{
778 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
779 ++filter->got_new_segment;
780 ok(start == 10000, "Got start %s.\n", wine_dbgstr_longlong(start));
781 ok(stop == 20000, "Got stop %s.\n", wine_dbgstr_longlong(stop));
782 ok(rate == 1.0, "Got rate %.16e.\n", rate);
783 return S_OK;
784}
785
786static HRESULT testsink_eos(struct strmbase_sink *iface)
787{
788 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
789 ++filter->got_eos;
790 return S_OK;
791}
792
794{
795 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
796 ++filter->got_begin_flush;
797 return S_OK;
798}
799
801{
802 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
803 ++filter->got_end_flush;
804 return S_OK;
805}
806
807static const struct strmbase_sink_ops testsink_ops =
808{
809 .base.pin_query_interface = testsink_query_interface,
810 .base.pin_get_media_type = testsink_get_media_type,
811 .sink_connect = testsink_connect,
812 .pfnReceive = testsink_Receive,
813 .sink_new_segment = testsink_new_segment,
814 .sink_eos = testsink_eos,
815 .sink_begin_flush = testsink_begin_flush,
816 .sink_end_flush = testsink_end_flush,
817};
818
820{
821 static const GUID clsid = {0xabacab};
822 memset(filter, 0, sizeof(*filter));
826}
827
828static void test_sample_processing(IMediaControl *control, IMemInputPin *input, struct testfilter *sink)
829{
830 REFERENCE_TIME start, stop;
833 LONG size, i;
834 HRESULT hr;
835 BYTE *data;
836
837 hr = IMemInputPin_ReceiveCanBlock(input);
838 ok(hr == S_OK, "Got hr %#lx.\n", hr);
839
840 hr = IMemInputPin_GetAllocator(input, &allocator);
841 ok(hr == S_OK, "Got hr %#lx.\n", hr);
842
843 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
844 ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
845
846 hr = IMediaControl_Pause(control);
847 ok(hr == S_OK, "Got hr %#lx.\n", hr);
848
849 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
850 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
851 if (hr != S_OK)
852 {
853 IMemAllocator_Commit(allocator);
854 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
855 ok(hr == S_OK, "Got hr %#lx.\n", hr);
856 }
857
858 hr = IMediaSample_GetPointer(sample, &data);
859 ok(hr == S_OK, "Got hr %#lx.\n", hr);
860 size = IMediaSample_GetSize(sample);
861 ok(size == 256, "Got size %ld.\n", size);
862 for (i = 0; i < 200; ++i)
863 data[i] = i;
864 hr = IMediaSample_SetActualDataLength(sample, 200);
865 ok(hr == S_OK, "Got hr %#lx.\n", hr);
866
867 start = 10000;
868 stop = 20000;
869 hr = IMediaSample_SetMediaTime(sample, &start, &stop);
870 ok(hr == S_OK, "Got hr %#lx.\n", hr);
871 start = 30000;
872 stop = 40000;
873 hr = IMediaSample_SetTime(sample, &start, &stop);
874 ok(hr == S_OK, "Got hr %#lx.\n", hr);
875 hr = IMediaSample_SetDiscontinuity(sample, TRUE);
876 ok(hr == S_OK, "Got hr %#lx.\n", hr);
877 hr = IMediaSample_SetSyncPoint(sample, TRUE);
878 ok(hr == S_OK, "Got hr %#lx.\n", hr);
879
880 hr = IMemInputPin_Receive(input, sample);
881 ok(hr == S_OK, "Got hr %#lx.\n", hr);
882 ok(sink->got_sample == 1, "Got %u calls to Receive().\n", sink->got_sample);
883 sink->got_sample = 0;
884
885 hr = IMediaControl_Stop(control);
886 ok(hr == S_OK, "Got hr %#lx.\n", hr);
887
888 hr = IMemInputPin_Receive(input, sample);
889 todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
890
891 IMediaSample_Release(sample);
892 IMemAllocator_Release(allocator);
893}
894
895static void test_streaming_events(IMediaControl *control, IPin *sink,
897{
898 REFERENCE_TIME start, stop;
901 HRESULT hr;
902 BYTE *data;
903 LONG i;
904
905 hr = IMediaControl_Pause(control);
906 ok(hr == S_OK, "Got hr %#lx.\n", hr);
907
908 hr = IMemInputPin_GetAllocator(input, &allocator);
909 ok(hr == S_OK, "Got hr %#lx.\n", hr);
910 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
911 ok(hr == S_OK, "Got hr %#lx.\n", hr);
912 hr = IMediaSample_GetPointer(sample, &data);
913 ok(hr == S_OK, "Got hr %#lx.\n", hr);
914 for (i = 0; i < 200; ++i)
915 data[i] = i;
916 hr = IMediaSample_SetActualDataLength(sample, 200);
917 ok(hr == S_OK, "Got hr %#lx.\n", hr);
918 start = 10000;
919 stop = 20000;
920 hr = IMediaSample_SetMediaTime(sample, &start, &stop);
921 ok(hr == S_OK, "Got hr %#lx.\n", hr);
922 start = 30000;
923 stop = 40000;
924 hr = IMediaSample_SetTime(sample, &start, &stop);
925 ok(hr == S_OK, "Got hr %#lx.\n", hr);
926 hr = IMediaSample_SetDiscontinuity(sample, TRUE);
927 ok(hr == S_OK, "Got hr %#lx.\n", hr);
928 hr = IMediaSample_SetSyncPoint(sample, TRUE);
929 ok(hr == S_OK, "Got hr %#lx.\n", hr);
930
931 ok(!testsink->got_new_segment, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment);
932 hr = IPin_NewSegment(sink, 10000, 20000, 1.0);
933 ok(hr == S_OK, "Got hr %#lx.\n", hr);
934 ok(testsink->got_new_segment == 1, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment);
935
936 ok(!testsink->got_eos, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
937 hr = IPin_EndOfStream(sink);
938 ok(hr == S_OK, "Got hr %#lx.\n", hr);
939 todo_wine ok(!testsink->got_sample, "Got %u calls to Receive().\n", testsink->got_sample);
940 ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
941 testsink->got_eos = 0;
942
943 hr = IPin_EndOfStream(sink);
944 ok(hr == S_OK, "Got hr %#lx.\n", hr);
945 ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
946 testsink->got_eos = 0;
947
948 hr = IMemInputPin_Receive(input, sample);
949 ok(hr == S_OK, "Got hr %#lx.\n", hr);
950 todo_wine ok(testsink->got_sample == 1, "Got %u calls to Receive().\n", testsink->got_sample);
951 testsink->got_sample = 0;
952
953 ok(!testsink->got_begin_flush, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush);
954 hr = IPin_BeginFlush(sink);
955 ok(hr == S_OK, "Got hr %#lx.\n", hr);
956 ok(testsink->got_begin_flush == 1, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush);
957
958 hr = IMemInputPin_Receive(input, sample);
959 ok(hr == S_OK, "Got hr %#lx.\n", hr);
960 ok(testsink->got_sample == 1, "Got %u calls to Receive().\n", testsink->got_sample);
961 testsink->got_sample = 0;
962
963 hr = IPin_EndOfStream(sink);
964 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
965 todo_wine ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
966 testsink->got_eos = 0;
967
968 ok(!testsink->got_end_flush, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush);
969 hr = IPin_EndFlush(sink);
970 ok(hr == S_OK, "Got hr %#lx.\n", hr);
971 ok(testsink->got_end_flush == 1, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush);
972
973 hr = IMemInputPin_Receive(input, sample);
974 ok(hr == S_OK, "Got hr %#lx.\n", hr);
975 ok(testsink->got_sample == 1, "Got %u calls to Receive().\n", testsink->got_sample);
976 testsink->got_sample = 0;
977
978 hr = IMediaControl_Stop(control);
979 ok(hr == S_OK, "Got hr %#lx.\n", hr);
980 IMediaSample_Release(sample);
981 IMemAllocator_Release(allocator);
982}
983
984static void test_connect_pin(void)
985{
986 AM_MEDIA_TYPE req_mt =
987 {
988 .majortype = MEDIATYPE_Stream,
989 .subtype = MEDIASUBTYPE_Avi,
990 .formattype = FORMAT_None,
991 };
993 struct testfilter testsource, testsink;
994 IPin *sink, *source, *peer;
995 IEnumMediaTypes *enummt;
996 ISampleGrabber *grabber;
997 IMediaControl *control;
998 AM_MEDIA_TYPE mt, *pmt;
1001 HRESULT hr;
1002 ULONG ref;
1003
1004 testfilter_init(&testsource);
1006 CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
1007 &IID_IFilterGraph2, (void **)&graph);
1008 IFilterGraph2_AddFilter(graph, &testsource.filter.IBaseFilter_iface, L"source");
1009 IFilterGraph2_AddFilter(graph, &testsink.filter.IBaseFilter_iface, L"sink");
1010 IFilterGraph2_AddFilter(graph, filter, L"sample grabber");
1011 IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
1012 IBaseFilter_FindPin(filter, L"In", &sink);
1013 IPin_QueryInterface(sink, &IID_IMemInputPin, (void **)&input);
1014 IBaseFilter_FindPin(filter, L"Out", &source);
1015 IBaseFilter_QueryInterface(filter, &IID_ISampleGrabber, (void **)&grabber);
1016
1017 testsource.source_mt.majortype = MEDIATYPE_Video;
1018 testsource.source_mt.subtype = MEDIASUBTYPE_RGB8;
1019 testsource.source_mt.formattype = FORMAT_VideoInfo;
1020
1021 hr = ISampleGrabber_GetConnectedMediaType(grabber, &mt);
1022 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1023
1024 /* Test sink connection. */
1025
1026 peer = (IPin *)0xdeadbeef;
1027 hr = IPin_ConnectedTo(sink, &peer);
1028 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1029 ok(!peer, "Got peer %p.\n", peer);
1030
1031 hr = IPin_ConnectionMediaType(sink, &mt);
1032 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1033
1034 hr = IMediaControl_Pause(control);
1035 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1036 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1037 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1038 hr = IMediaControl_Stop(control);
1039 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1040
1041 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1042 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1043
1044 hr = IPin_ConnectedTo(sink, &peer);
1045 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1046 ok(peer == &testsource.source.pin.IPin_iface, "Got peer %p.\n", peer);
1047 IPin_Release(peer);
1048
1049 hr = IPin_ConnectionMediaType(sink, &mt);
1050 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1051 ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
1052
1053 hr = IMediaControl_Pause(control);
1054 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1055 hr = IFilterGraph2_Disconnect(graph, sink);
1056 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1057 hr = IMediaControl_Stop(control);
1058 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1059
1060 hr = ISampleGrabber_GetConnectedMediaType(grabber, NULL);
1061 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
1062
1063 hr = ISampleGrabber_GetConnectedMediaType(grabber, &mt);
1064 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1065 ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
1066
1067 hr = IPin_EnumMediaTypes(sink, &enummt);
1068 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1069 hr = IPin_EnumMediaTypes(source, &enummt);
1070 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1071 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
1072 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1073 ok(compare_media_types(pmt, &testsource.source_mt), "Media types didn't match.\n");
1074 IEnumMediaTypes_Release(enummt);
1075
1076 req_mt.majortype = MEDIATYPE_Video;
1077 req_mt.subtype = MEDIASUBTYPE_RGB8;
1078 req_mt.formattype = FORMAT_VideoInfo;
1079 hr = IPin_QueryAccept(sink, &req_mt);
1080 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1081 hr = IPin_QueryAccept(source, &req_mt);
1082 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1083 req_mt.bTemporalCompression = TRUE;
1084 hr = IPin_QueryAccept(source, &req_mt);
1085 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1086
1087 memset(&mt, 0, sizeof(AM_MEDIA_TYPE));
1088 mt.majortype = MEDIATYPE_Midi;
1089 hr = ISampleGrabber_SetMediaType(grabber, &mt);
1090 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1091
1092 hr = IPin_QueryAccept(source, &req_mt);
1093 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1094
1095 req_mt.majortype = MEDIATYPE_Midi;
1096 req_mt.bTemporalCompression = FALSE;
1097 hr = IPin_QueryAccept(source, &req_mt);
1098 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1099
1100 req_mt.bTemporalCompression = TRUE;
1101 hr = IPin_QueryAccept(source, &req_mt);
1102 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1103
1104 memset(&mt, 0, sizeof(AM_MEDIA_TYPE));
1105 hr = ISampleGrabber_SetMediaType(grabber, &mt);
1106 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1107
1108 /* Test source connection. */
1109
1110 peer = (IPin *)0xdeadbeef;
1111 hr = IPin_ConnectedTo(source, &peer);
1112 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1113 ok(!peer, "Got peer %p.\n", peer);
1114
1115 hr = IPin_ConnectionMediaType(source, &mt);
1116 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1117
1118 /* Exact connection. */
1119
1120 hr = IMediaControl_Pause(control);
1121 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1122 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1123 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1124 hr = IMediaControl_Stop(control);
1125 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1126
1127 req_mt.bTemporalCompression = FALSE;
1128 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1129 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1130
1131 req_mt.bTemporalCompression = TRUE;
1132 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1133 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1134
1135 hr = IPin_ConnectedTo(source, &peer);
1136 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1137 ok(peer == &testsink.sink.pin.IPin_iface, "Got peer %p.\n", peer);
1138 IPin_Release(peer);
1139
1140 hr = IPin_ConnectionMediaType(source, &mt);
1141 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1142 ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
1143 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1144 ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n");
1145
1148
1149 hr = IMediaControl_Pause(control);
1150 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1151 hr = IFilterGraph2_Disconnect(graph, source);
1152 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1153 hr = IMediaControl_Stop(control);
1154 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1155
1156 hr = IFilterGraph2_Disconnect(graph, source);
1157 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1158 hr = IFilterGraph2_Disconnect(graph, source);
1159 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1160 ok(testsink.sink.pin.peer == source, "Got peer %p.\n", testsink.sink.pin.peer);
1161 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1162
1163 /* Connection with wildcards. */
1164
1165 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1166 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1167
1168 testsource.source_mt.bTemporalCompression = TRUE;
1169 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1170 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1171 ok(compare_media_types(&testsink.sink.pin.mt, &testsource.source_mt), "Media types didn't match.\n");
1172 ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n");
1173 IFilterGraph2_Disconnect(graph, source);
1174 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1175
1176 req_mt.majortype = GUID_NULL;
1177 req_mt.bTemporalCompression = FALSE;
1178 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1179 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1180 ok(compare_media_types(&testsink.sink.pin.mt, &testsource.source_mt), "Media types didn't match.\n");
1181 ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n");
1182 IFilterGraph2_Disconnect(graph, source);
1183 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1184
1185 req_mt.subtype = MEDIASUBTYPE_RGB32;
1186 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1187 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1188
1189 req_mt.subtype = GUID_NULL;
1190 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1191 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1192 ok(compare_media_types(&testsink.sink.pin.mt, &testsource.source_mt), "Media types didn't match.\n");
1193 ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n");
1194 IFilterGraph2_Disconnect(graph, source);
1195 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1196
1197 req_mt.formattype = FORMAT_None;
1198 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1199 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1200
1201 req_mt.majortype = MEDIATYPE_Video;
1202 req_mt.subtype = MEDIASUBTYPE_RGB8;
1203 req_mt.formattype = GUID_NULL;
1204 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1205 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1206 ok(compare_media_types(&testsink.sink.pin.mt, &testsource.source_mt), "Media types didn't match.\n");
1207 ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n");
1208 IFilterGraph2_Disconnect(graph, source);
1209 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1210
1211 req_mt.subtype = MEDIASUBTYPE_RGB32;
1212 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1213 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1214
1215 req_mt.subtype = GUID_NULL;
1216 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1217 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1218 ok(compare_media_types(&testsink.sink.pin.mt, &testsource.source_mt), "Media types didn't match.\n");
1219 ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n");
1220 IFilterGraph2_Disconnect(graph, source);
1221 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1222
1223 req_mt.majortype = MEDIATYPE_Audio;
1224 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1225 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1226
1227 testsource.source_mt.majortype = testsource.source_mt.subtype = testsource.source_mt.formattype = GUID_NULL;
1228 req_mt.majortype = req_mt.subtype = req_mt.formattype = GUID_NULL;
1229 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1230 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1231 ok(compare_media_types(&testsink.sink.pin.mt, &testsource.source_mt), "Media types didn't match.\n");
1232 ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n");
1233 IFilterGraph2_Disconnect(graph, source);
1234 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1235
1236 req_mt.majortype = MEDIATYPE_Video;
1237 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1238 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1239 req_mt.majortype = GUID_NULL;
1240
1241 req_mt.subtype = MEDIASUBTYPE_RGB8;
1242 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1243 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1244 req_mt.subtype = GUID_NULL;
1245
1246 req_mt.formattype = FORMAT_None;
1247 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1248 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1249 req_mt.formattype = GUID_NULL;
1250
1251 /* Test enumeration of sink media types. */
1252
1253 testsink.sink_mt = &req_mt;
1254 req_mt.majortype = MEDIATYPE_Audio;
1255 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1256 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1257 req_mt.majortype = GUID_NULL;
1258
1259 req_mt.bTemporalCompression = TRUE;
1260 req_mt.lSampleSize = 444;
1261 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1262 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1263 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1264 ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n");
1265
1266 hr = IPin_EnumMediaTypes(sink, &enummt);
1267 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1268 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
1269 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1270 ok(compare_media_types(pmt, testsink.sink_mt), "Media types didn't match.\n");
1271 IEnumMediaTypes_Release(enummt);
1272
1273 IFilterGraph2_Disconnect(graph, source);
1274 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1275
1276 hr = IFilterGraph2_Disconnect(graph, sink);
1277 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1278 hr = IFilterGraph2_Disconnect(graph, sink);
1279 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1280 ok(testsource.source.pin.peer == sink, "Got peer %p.\n", testsource.source.pin.peer);
1281 IFilterGraph2_Disconnect(graph, &testsource.source.pin.IPin_iface);
1282
1283 peer = (IPin *)0xdeadbeef;
1284 hr = IPin_ConnectedTo(sink, &peer);
1285 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1286 ok(!peer, "Got peer %p.\n", peer);
1287
1288 hr = IPin_ConnectionMediaType(sink, &mt);
1289 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1290
1291 IMemInputPin_Release(input);
1292 IPin_Release(sink);
1293 IPin_Release(source);
1294 IMediaControl_Release(control);
1295 ref = IFilterGraph2_Release(graph);
1296 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1297 ISampleGrabber_Release(grabber);
1298 ref = IBaseFilter_Release(filter);
1299 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1300 ref = IBaseFilter_Release(&testsource.filter.IBaseFilter_iface);
1301 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1302 ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
1303 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1304}
1305
1306START_TEST(samplegrabber)
1307{
1309 HRESULT hr;
1310
1312
1313 if (FAILED(hr = CoCreateInstance(&CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,
1314 &IID_IBaseFilter, (void **)&filter)))
1315 {
1316 /* qedit.dll does not exist on 2003. */
1317 win_skip("Failed to create sample grabber filter, hr %#lx.\n", hr);
1318 return;
1319 }
1320 IBaseFilter_Release(filter);
1321
1324 test_find_pin();
1325 test_pin_info();
1329
1331}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
unsigned int dir
Definition: maze.c:112
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
unsigned int rate
Definition: audiorecord.c:87
enum _PinDirection PIN_DIRECTION
@ PINDIR_OUTPUT
Definition: axcore.idl:42
@ PINDIR_INPUT
Definition: axcore.idl:41
const GUID IID_IUnknown
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
HRESULT expected_hr
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT hr
Definition: delayimp.cpp:582
const GUID IID_IBaseFilter
const GUID IID_IAsyncReader
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b)
static struct sample_grabber * impl_from_strmbase_filter(struct strmbase_filter *iface)
Definition: samplegrabber.c:61
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1674
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLenum GLenum GLenum input
Definition: glext.h:9031
GLuint id
Definition: glext.h:5910
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: axcore.idl:92
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define wine_dbgstr_w
Definition: kernel32.h:34
#define GUID_NULL
Definition: ks.h:106
#define win_skip
Definition: minitest.h:67
#define todo_wine
Definition: minitest.h:80
static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
static void testfilter_destroy(struct strmbase_filter *iface)
static const IUnknownVtbl outer_vtbl
static const struct strmbase_sink_ops testsink_ops
static HRESULT testsink_begin_flush(struct strmbase_sink *iface)
static void test_aggregation(void)
static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
Definition: samplegrabber.c:50
static ULONG WINAPI outer_AddRef(IUnknown *iface)
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out)
static ULONG get_refcount(void *iface)
Definition: samplegrabber.c:36
static void test_pin_info(void)
static HRESULT testsource_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
static IUnknown test_outer
static void test_find_pin(void)
static HRESULT testsink_eos(struct strmbase_sink *iface)
static const struct strmbase_source_ops testsource_ops
static IBaseFilter * create_sample_grabber(void)
Definition: samplegrabber.c:27
static void test_interfaces(void)
Definition: samplegrabber.c:73
static HRESULT testsource_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
static void test_streaming_events(IMediaControl *control, IPin *sink, IMemInputPin *input, struct testfilter *testsink)
static void test_connect_pin(void)
static void test_media_types(void)
static void test_sink_allocator(IPin *pin)
static HRESULT WINAPI testsource_AttemptConnection(struct strmbase_source *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
static struct strmbase_pin * testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
static void test_enum_pins(void)
static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample)
#define check_interface(a, b, c)
Definition: samplegrabber.c:49
static LONG outer_ref
static const struct strmbase_filter_ops testfilter_ops
static HRESULT testsink_new_segment(struct strmbase_sink *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
static const GUID test_iid
static void test_sample_processing(IMediaControl *control, IMemInputPin *input, struct testfilter *sink)
static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
static HRESULT testsink_end_flush(struct strmbase_sink *iface)
static void testfilter_init(struct testfilter *filter)
static ULONG WINAPI outer_Release(IUnknown *iface)
#define expect_ref(obj, ref)
Definition: metadata.c:40
const CLSID * clsid
Definition: msctf.cpp:50
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
const GUID IID_IPin
Definition: pincontrol.cpp:15
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistPropertyBag
Definition: proxy.cpp:11
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define offsetof(TYPE, MEMBER)
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181
#define memset(x, y, z)
Definition: compat.h:39
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
Definition: mediatype.c:150
void WINAPI FreeMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: mediatype.c:165
void strmbase_source_init(struct strmbase_source *pin, struct strmbase_filter *filter, const WCHAR *name, const struct strmbase_source_ops *func_table)
Definition: pin.c:765
void strmbase_sink_cleanup(struct strmbase_sink *pin)
Definition: pin.c:1185
void strmbase_sink_init(struct strmbase_sink *pin, struct strmbase_filter *filter, const WCHAR *name, const struct strmbase_sink_ops *ops, IMemAllocator *allocator)
Definition: pin.c:1168
void strmbase_filter_cleanup(struct strmbase_filter *filter)
Definition: filter.c:540
void strmbase_source_cleanup(struct strmbase_source *pin)
Definition: pin.c:778
void strmbase_filter_init(struct strmbase_filter *filter, IUnknown *outer, const CLSID *clsid, const struct strmbase_filter_ops *func_table)
Definition: filter.c:517
Definition: dialog.c:52
Definition: filter.c:165
IBaseFilter * filter
Definition: filtergraph.c:75
Definition: graph.c:32
Definition: parser.c:49
Definition: send.c:48
Definition: wave.c:25
struct strmbase_filter * filter
Definition: strmbase.h:58
struct strmbase_pin pin
Definition: strmbase.h:106
struct strmbase_pin pin
Definition: strmbase.h:79
unsigned int got_end_flush
unsigned int got_sample
AM_MEDIA_TYPE source_mt
unsigned int got_begin_flush
const AM_MEDIA_TYPE * mt
Definition: avidec.c:799
unsigned int got_eos
IFilterGraph * graph
Definition: filtergraph.c:850
struct strmbase_source source
Definition: amstream.c:1020
const AM_MEDIA_TYPE * sink_mt
struct strmbase_filter filter
Definition: amstream.c:1019
unsigned int got_new_segment
struct strmbase_sink pin
Definition: filesource.c:1211
struct strmbase_filter filter
Definition: filesource.c:1210
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define VFW_E_TYPE_NOT_ACCEPTED
Definition: vfwmsgs.h:81
#define VFW_E_NOT_COMMITTED
Definition: vfwmsgs.h:56
#define VFW_E_NOT_STOPPED
Definition: vfwmsgs.h:75
#define VFW_E_NO_ACCEPTABLE_TYPES
Definition: vfwmsgs.h:46
#define VFW_E_WRONG_STATE
Definition: vfwmsgs.h:78
#define VFW_S_NO_MORE_ITEMS
Definition: vfwmsgs.h:19
#define VFW_E_NOT_FOUND
Definition: vfwmsgs.h:61
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480
unsigned char BYTE
Definition: xxhash.c:193