ReactOS 0.4.17-dev-923-g4c9a150
avidec.c
Go to the documentation of this file.
1/*
2 * AVI decompressor 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 "vfw.h"
24#include "wmcodecdsp.h"
25#include "wine/strmbase.h"
26#include "wine/test.h"
27
28static const DWORD test_handler = mmioFOURCC('w','t','s','t');
29static const GUID test_subtype = {mmioFOURCC('w','t','s','t'),0x0000,0x0010,{0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71}};
30
31static int testmode;
32
34{
36 HRESULT hr = CoCreateInstance(&CLSID_AVIDec, NULL, CLSCTX_INPROC_SERVER,
37 &IID_IBaseFilter, (void **)&filter);
38 ok(hr == S_OK, "Got hr %#lx.\n", hr);
39 return filter;
40}
41
43{
44 return !memcmp(a, b, offsetof(AM_MEDIA_TYPE, pbFormat))
45 && !memcmp(a->pbFormat, b->pbFormat, a->cbFormat);
46}
47
48static ULONG get_refcount(void *iface)
49{
50 IUnknown *unknown = iface;
51 IUnknown_AddRef(unknown);
52 return IUnknown_Release(unknown);
53}
54
56
58 LPARAM lparam1, LPARAM lparam2)
59{
60 static int in_begin;
61
62 if (winetest_debug > 1)
63 trace("id %#Ix, driver %p, msg %#x, lparam1 %#Ix, lparam2 %#Ix.\n",
64 id, driver, msg, lparam1, lparam2);
65
66 switch (msg)
67 {
68 case DRV_LOAD:
69 case DRV_ENABLE:
70 case DRV_OPEN:
71 case DRV_CLOSE:
72 case DRV_DISABLE:
73 case DRV_FREE:
74 return 1;
75
77 {
80
81 if (!out)
82 return sizeof(BITMAPINFOHEADER);
83
84 ok(!memcmp(in, &sink_bitmap_info, sizeof(BITMAPINFOHEADER)), "Input types didn't match.\n");
85
86 out->biSize = sizeof(BITMAPINFOHEADER);
87 out->biCompression = mmioFOURCC('I','4','2','0');
88 out->biWidth = 29;
89 out->biHeight = 24;
90 out->biBitCount = 12;
91 out->biSizeImage = 24 * (((29 * 12 + 31) / 8) & ~3);
92
93 return ICERR_OK;
94 }
95
97 {
100
101 if (in->biCompression != test_handler || in->biBitCount != 16)
102 return ICERR_BADFORMAT;
103
104 if (out && out->biCompression != mmioFOURCC('I','4','2','0'))
105 return ICERR_BADFORMAT;
106
107 return ICERR_OK;
108 }
109
112 return ICERR_UNSUPPORTED;
113
115 {
118
121 "Input types didn't match.\n");
123 "Output types didn't match.\n");
124 ok(!in_begin, "Got multiple ICM_DECOMPRESS_BEGIN messages.\n");
125 in_begin = 1;
126 return ICERR_OK;
127 }
128
130 ok(in_begin, "Got unmatched ICM_DECOMPRESS_END message.\n");
131 in_begin = 0;
132 return ICERR_OK;
133
134 case ICM_DECOMPRESS:
135 {
136 BITMAPINFOHEADER expect_sink_format = sink_bitmap_info;
137 ICDECOMPRESS *params = (ICDECOMPRESS *)lparam1;
138 BYTE *output = params->lpOutput, expect[200];
139 unsigned int i;
140
141 ok(in_begin, "Got ICM_DECOMPRESS without ICM_DECOMPRESS_BEGIN.\n");
142
143 ok(lparam2 == sizeof(ICDECOMPRESS), "Got size %Iu.\n", lparam2);
144
145 if (testmode == 5 || testmode == 6)
146 ok(params->dwFlags == ICDECOMPRESS_NOTKEYFRAME, "Got flags %#lx.\n", params->dwFlags);
147 else if (testmode == 3)
148 ok(params->dwFlags == ICDECOMPRESS_PREROLL, "Got flags %#lx.\n", params->dwFlags);
149 else
150 ok(params->dwFlags == 0, "Got flags %#lx.\n", params->dwFlags);
151
152 expect_sink_format.biSizeImage = 200;
153 ok(!memcmp(params->lpbiInput, &expect_sink_format, sizeof(BITMAPINFOHEADER)),
154 "Input types didn't match.\n");
155 ok(!memcmp(params->lpbiOutput, &source_bitmap_info, sizeof(BITMAPINFOHEADER)),
156 "Output types didn't match.\n");
157 ok(!params->ckid, "Got chunk id %#lx.\n", params->ckid);
158
159 for (i = 0; i < 200; ++i)
160 expect[i] = i;
161 ok(!memcmp(params->lpInput, expect, 200), "Data didn't match.\n");
162 for (i = 0; i < 24 * (((29 * 12 + 31) / 8) & ~3); ++i)
163 output[i] = 111 - i;
164
165 return ICERR_OK;
166 }
167
168 case ICM_GETINFO:
169 {
170 ICINFO *info = (ICINFO *)lparam1;
171 info->fccType = ICTYPE_VIDEO;
172 info->fccHandler = test_handler;
173 return sizeof(ICINFO);
174 }
175
176 default:
177 ok(0, "Got unexpected message %#x.\n", msg);
178 return ICERR_UNSUPPORTED;
179 }
180}
181
182#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
183static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
184{
185 IUnknown *iface = iface_ptr;
187 IUnknown *unk;
188
189 expected_hr = supported ? S_OK : E_NOINTERFACE;
190
191 hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
192 ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
193 if (SUCCEEDED(hr))
194 IUnknown_Release(unk);
195}
196
197static void test_interfaces(void)
198{
200 IPin *pin;
201
203 check_interface(filter, &IID_IMediaFilter, TRUE);
206
207 check_interface(filter, &IID_IAMFilterMiscFlags, FALSE);
208 check_interface(filter, &IID_IBasicAudio, FALSE);
209 check_interface(filter, &IID_IBasicVideo, FALSE);
211 check_interface(filter, &IID_IMediaPosition, FALSE);
212 check_interface(filter, &IID_IMediaSeeking, FALSE);
215 check_interface(filter, &IID_IQualityControl, FALSE);
216 check_interface(filter, &IID_IQualProp, FALSE);
217 check_interface(filter, &IID_IReferenceClock, FALSE);
218 check_interface(filter, &IID_IVideoWindow, FALSE);
219
220 IBaseFilter_FindPin(filter, L"In", &pin);
221
222 check_interface(pin, &IID_IMemInputPin, TRUE);
224 todo_wine check_interface(pin, &IID_IQualityControl, TRUE);
226
227 check_interface(pin, &IID_IMediaPosition, FALSE);
228 check_interface(pin, &IID_IMediaSeeking, FALSE);
229
230 IPin_Release(pin);
231
232 IBaseFilter_FindPin(filter, L"Out", &pin);
233
235 todo_wine check_interface(pin, &IID_IMediaPosition, TRUE);
236 check_interface(pin, &IID_IMediaSeeking, TRUE);
237 check_interface(pin, &IID_IQualityControl, TRUE);
239
241
242 IPin_Release(pin);
243
244 IBaseFilter_Release(filter);
245}
246
247static const GUID test_iid = {0x33333333};
248static LONG outer_ref = 1;
249
251{
252 if (IsEqualGUID(iid, &IID_IUnknown)
254 || IsEqualGUID(iid, &test_iid))
255 {
256 *out = (IUnknown *)0xdeadbeef;
257 return S_OK;
258 }
259 ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid));
260 return E_NOINTERFACE;
261}
262
264{
266}
267
269{
271}
272
273static const IUnknownVtbl outer_vtbl =
274{
278};
279
281
282static void test_aggregation(void)
283{
284 IBaseFilter *filter, *filter2;
285 IUnknown *unk, *unk2;
286 HRESULT hr;
287 ULONG ref;
288
289 filter = (IBaseFilter *)0xdeadbeef;
290 hr = CoCreateInstance(&CLSID_AVIDec, &test_outer, CLSCTX_INPROC_SERVER,
291 &IID_IBaseFilter, (void **)&filter);
292 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
293 ok(!filter, "Got interface %p.\n", filter);
294
295 hr = CoCreateInstance(&CLSID_AVIDec, &test_outer, CLSCTX_INPROC_SERVER,
296 &IID_IUnknown, (void **)&unk);
297 ok(hr == S_OK, "Got hr %#lx.\n", hr);
298 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
299 ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
300 ref = get_refcount(unk);
301 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
302
303 ref = IUnknown_AddRef(unk);
304 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
305 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
306
307 ref = IUnknown_Release(unk);
308 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
309 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
310
311 hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
312 ok(hr == S_OK, "Got hr %#lx.\n", hr);
313 ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
314 IUnknown_Release(unk2);
315
316 hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
317 ok(hr == S_OK, "Got hr %#lx.\n", hr);
318
319 hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
320 ok(hr == S_OK, "Got hr %#lx.\n", hr);
321 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
322
323 hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
324 ok(hr == S_OK, "Got hr %#lx.\n", hr);
325 ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
326
327 hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
328 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
329 ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
330
331 hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
332 ok(hr == S_OK, "Got hr %#lx.\n", hr);
333 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
334
335 IBaseFilter_Release(filter);
336 ref = IUnknown_Release(unk);
337 ok(!ref, "Got unexpected refcount %ld.\n", ref);
338 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
339}
340
341static void test_enum_pins(void)
342{
344 IEnumPins *enum1, *enum2;
345 ULONG count, ref;
346 IPin *pins[3];
347 HRESULT hr;
348
350 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
351
352 hr = IBaseFilter_EnumPins(filter, NULL);
353 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
354
355 hr = IBaseFilter_EnumPins(filter, &enum1);
356 ok(hr == S_OK, "Got hr %#lx.\n", hr);
358 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
359 ref = get_refcount(enum1);
360 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
361
362 hr = IEnumPins_Next(enum1, 1, NULL, NULL);
363 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
364
365 hr = IEnumPins_Next(enum1, 1, pins, NULL);
366 ok(hr == S_OK, "Got hr %#lx.\n", hr);
368 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
369 ref = get_refcount(pins[0]);
370 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
371 ref = get_refcount(enum1);
372 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
373 IPin_Release(pins[0]);
375 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
376
377 hr = IEnumPins_Next(enum1, 1, pins, NULL);
378 ok(hr == S_OK, "Got hr %#lx.\n", hr);
380 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
381 ref = get_refcount(pins[0]);
382 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
383 ref = get_refcount(enum1);
384 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
385 IPin_Release(pins[0]);
387 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
388
389 hr = IEnumPins_Next(enum1, 1, pins, NULL);
390 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
391
392 hr = IEnumPins_Reset(enum1);
393 ok(hr == S_OK, "Got hr %#lx.\n", hr);
394
395 hr = IEnumPins_Next(enum1, 1, pins, &count);
396 ok(hr == S_OK, "Got hr %#lx.\n", hr);
397 ok(count == 1, "Got count %lu.\n", count);
398 IPin_Release(pins[0]);
399
400 hr = IEnumPins_Next(enum1, 1, pins, &count);
401 ok(hr == S_OK, "Got hr %#lx.\n", hr);
402 ok(count == 1, "Got count %lu.\n", count);
403 IPin_Release(pins[0]);
404
405 hr = IEnumPins_Next(enum1, 1, pins, &count);
406 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
407 ok(!count, "Got count %lu.\n", count);
408
409 hr = IEnumPins_Reset(enum1);
410 ok(hr == S_OK, "Got hr %#lx.\n", hr);
411
412 hr = IEnumPins_Next(enum1, 2, pins, NULL);
413 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
414
415 hr = IEnumPins_Next(enum1, 2, pins, &count);
416 ok(hr == S_OK, "Got hr %#lx.\n", hr);
417 ok(count == 2, "Got count %lu.\n", count);
418 IPin_Release(pins[0]);
419 IPin_Release(pins[1]);
420
421 hr = IEnumPins_Next(enum1, 2, pins, &count);
422 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
423 ok(!count, "Got count %lu.\n", count);
424
425 hr = IEnumPins_Reset(enum1);
426 ok(hr == S_OK, "Got hr %#lx.\n", hr);
427
428 hr = IEnumPins_Next(enum1, 3, pins, &count);
429 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
430 ok(count == 2, "Got count %lu.\n", count);
431 IPin_Release(pins[0]);
432 IPin_Release(pins[1]);
433
434 hr = IEnumPins_Reset(enum1);
435 ok(hr == S_OK, "Got hr %#lx.\n", hr);
436
437 hr = IEnumPins_Clone(enum1, &enum2);
438 ok(hr == S_OK, "Got hr %#lx.\n", hr);
439
440 hr = IEnumPins_Skip(enum1, 3);
441 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
442
443 hr = IEnumPins_Skip(enum1, 2);
444 ok(hr == S_OK, "Got hr %#lx.\n", hr);
445
446 hr = IEnumPins_Skip(enum1, 1);
447 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
448
449 hr = IEnumPins_Next(enum1, 1, pins, NULL);
450 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
451
452 hr = IEnumPins_Next(enum2, 1, pins, NULL);
453 ok(hr == S_OK, "Got hr %#lx.\n", hr);
454 IPin_Release(pins[0]);
455
456 IEnumPins_Release(enum2);
457 IEnumPins_Release(enum1);
458 ref = IBaseFilter_Release(filter);
459 ok(!ref, "Got outstanding refcount %ld.\n", ref);
460}
461
462static void test_find_pin(void)
463{
466 IPin *pin, *pin2;
467 HRESULT hr;
468 ULONG ref;
469
470 hr = IBaseFilter_EnumPins(filter, &enum_pins);
471 ok(hr == S_OK, "Got hr %#lx.\n", hr);
472
473 hr = IBaseFilter_FindPin(filter, L"In", &pin);
474 ok(hr == S_OK, "Got hr %#lx.\n", hr);
475 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
476 ok(hr == S_OK, "Got hr %#lx.\n", hr);
477 ok(pin == pin2, "Pins didn't match.\n");
478 IPin_Release(pin);
479 IPin_Release(pin2);
480
481 hr = IBaseFilter_FindPin(filter, L"Out", &pin);
482 ok(hr == S_OK, "Got hr %#lx.\n", hr);
483 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
484 ok(hr == S_OK, "Got hr %#lx.\n", hr);
485 ok(pin == pin2, "Pins didn't match.\n");
486 IPin_Release(pin);
487 IPin_Release(pin2);
488
489 hr = IBaseFilter_FindPin(filter, L"XForm In", &pin);
490 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
491 hr = IBaseFilter_FindPin(filter, L"XForm Out", &pin);
492 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
493 hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
494 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
495 hr = IBaseFilter_FindPin(filter, L"output pin", &pin);
496 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
497
498 IEnumPins_Release(enum_pins);
499 ref = IBaseFilter_Release(filter);
500 ok(!ref, "Got outstanding refcount %ld.\n", ref);
501}
502
503static void test_pin_info(void)
504{
508 HRESULT hr;
509 WCHAR *id;
510 ULONG ref;
511 IPin *pin;
512
513 hr = IBaseFilter_FindPin(filter, L"In", &pin);
514 ok(hr == S_OK, "Got hr %#lx.\n", hr);
516 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
517 ref = get_refcount(pin);
518 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
519
520 hr = IPin_QueryPinInfo(pin, &info);
521 ok(hr == S_OK, "Got hr %#lx.\n", hr);
522 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
523 ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
524 ok(!wcscmp(info.achName, L"XForm In"), "Got name %s.\n", wine_dbgstr_w(info.achName));
526 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
527 ref = get_refcount(pin);
528 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
529 IBaseFilter_Release(info.pFilter);
530
531 hr = IPin_QueryDirection(pin, &dir);
532 ok(hr == S_OK, "Got hr %#lx.\n", hr);
533 ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
534
535 hr = IPin_QueryId(pin, &id);
536 ok(hr == S_OK, "Got hr %#lx.\n", hr);
537 ok(!wcscmp(id, L"In"), "Got id %s.\n", wine_dbgstr_w(id));
538 CoTaskMemFree(id);
539
540 hr = IPin_QueryInternalConnections(pin, NULL, NULL);
541 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
542
543 IPin_Release(pin);
544
545 hr = IBaseFilter_FindPin(filter, L"Out", &pin);
546 ok(hr == S_OK, "Got hr %#lx.\n", hr);
547
549 check_interface(pin, &IID_IMediaSeeking, TRUE);
550
551 hr = IPin_QueryPinInfo(pin, &info);
552 ok(hr == S_OK, "Got hr %#lx.\n", hr);
553 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
554 ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
555 ok(!wcscmp(info.achName, L"XForm Out"), "Got name %s.\n", wine_dbgstr_w(info.achName));
556 IBaseFilter_Release(info.pFilter);
557
558 hr = IPin_QueryDirection(pin, &dir);
559 ok(hr == S_OK, "Got hr %#lx.\n", hr);
560 ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
561
562 hr = IPin_QueryId(pin, &id);
563 ok(hr == S_OK, "Got hr %#lx.\n", hr);
564 ok(!wcscmp(id, L"Out"), "Got id %s.\n", wine_dbgstr_w(id));
565 CoTaskMemFree(id);
566
567 hr = IPin_QueryInternalConnections(pin, NULL, NULL);
568 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
569
570 IPin_Release(pin);
571
572 ref = IBaseFilter_Release(filter);
573 ok(!ref, "Got outstanding refcount %ld.\n", ref);
574}
575
576static void test_media_types(void)
577{
579 AM_MEDIA_TYPE mt = {{0}}, *pmt;
580 VIDEOINFOHEADER vih = {{0}};
581 IEnumMediaTypes *enummt;
582 HRESULT hr;
583 ULONG ref;
584 IPin *pin;
585
586 IBaseFilter_FindPin(filter, L"In", &pin);
587
588 hr = IPin_EnumMediaTypes(pin, &enummt);
589 ok(hr == S_OK, "Got hr %#lx.\n", hr);
590
591 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
592 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
593
594 IEnumMediaTypes_Release(enummt);
595
596 mt.majortype = MEDIATYPE_Video;
597 mt.subtype = test_subtype;
598 mt.formattype = FORMAT_VideoInfo;
599 mt.cbFormat = sizeof(VIDEOINFOHEADER);
600 mt.pbFormat = (BYTE *)&vih;
601 vih.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
603 vih.bmiHeader.biWidth = 32;
604 vih.bmiHeader.biHeight = 24;
605 vih.bmiHeader.biBitCount = 16;
606 hr = IPin_QueryAccept(pin, &mt);
607 ok(hr == S_OK, "Got hr %#lx.\n", hr);
608
609 vih.bmiHeader.biBitCount = 32;
610 hr = IPin_QueryAccept(pin, &mt);
611 todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
612 vih.bmiHeader.biBitCount = 16;
613
614 mt.bFixedSizeSamples = TRUE;
615 mt.bTemporalCompression = TRUE;
616 mt.lSampleSize = 123;
617 hr = IPin_QueryAccept(pin, &mt);
618 ok(hr == S_OK, "Got hr %#lx.\n", hr);
619
620 /* Some versions of quartz check the major type; some do not. */
621
622 mt.subtype = MEDIASUBTYPE_NULL;
623 hr = IPin_QueryAccept(pin, &mt);
624 todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
625 mt.subtype = MEDIASUBTYPE_RGB24;
626 hr = IPin_QueryAccept(pin, &mt);
627 todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
628 mt.subtype = test_subtype;
629
630 mt.formattype = GUID_NULL;
631 hr = IPin_QueryAccept(pin, &mt);
632 todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
633 mt.formattype = FORMAT_None;
634 hr = IPin_QueryAccept(pin, &mt);
635 todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
636 mt.formattype = FORMAT_VideoInfo;
637
638 IPin_Release(pin);
639
640 IBaseFilter_FindPin(filter, L"Out", &pin);
641
642 hr = IPin_EnumMediaTypes(pin, &enummt);
643 ok(hr == S_OK, "Got hr %#lx.\n", hr);
644
645 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
646 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
647
648 mt.subtype = MEDIASUBTYPE_RGB24;
650 vih.bmiHeader.biBitCount = 24;
651 vih.bmiHeader.biSizeImage= 32 * 24 * 3;
652 hr = IPin_QueryAccept(pin, &mt);
653 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
654
655 IEnumMediaTypes_Release(enummt);
656 IPin_Release(pin);
657
658 ref = IBaseFilter_Release(filter);
659 ok(!ref, "Got outstanding refcount %ld.\n", ref);
660}
661
662static void test_enum_media_types(void)
663{
665 IEnumMediaTypes *enum1, *enum2;
666 AM_MEDIA_TYPE *mts[1];
667 ULONG ref, count;
668 HRESULT hr;
669 IPin *pin;
670
671 IBaseFilter_FindPin(filter, L"In", &pin);
672
673 hr = IPin_EnumMediaTypes(pin, &enum1);
674 ok(hr == S_OK, "Got hr %#lx.\n", hr);
675
676 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
677 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
678
679 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
680 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
681 ok(!count, "Got count %lu.\n", count);
682
683 hr = IEnumMediaTypes_Reset(enum1);
684 ok(hr == S_OK, "Got hr %#lx.\n", hr);
685
686 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
687 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
688
689 hr = IEnumMediaTypes_Clone(enum1, &enum2);
690 ok(hr == S_OK, "Got hr %#lx.\n", hr);
691
692 hr = IEnumMediaTypes_Skip(enum1, 1);
693 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
694
695 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
696 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
697
698 IEnumMediaTypes_Release(enum1);
699 IEnumMediaTypes_Release(enum2);
700 IPin_Release(pin);
701
702 IBaseFilter_FindPin(filter, L"Out", &pin);
703
704 hr = IPin_EnumMediaTypes(pin, &enum1);
705 ok(hr == S_OK, "Got hr %#lx.\n", hr);
706
707 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
708 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
709
710 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
711 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
712 ok(!count, "Got count %lu.\n", count);
713
714 hr = IEnumMediaTypes_Reset(enum1);
715 ok(hr == S_OK, "Got hr %#lx.\n", hr);
716
717 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
718 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
719
720 hr = IEnumMediaTypes_Clone(enum1, &enum2);
721 ok(hr == S_OK, "Got hr %#lx.\n", hr);
722
723 hr = IEnumMediaTypes_Skip(enum1, 1);
724 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
725
726 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
727 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
728
729 IEnumMediaTypes_Release(enum1);
730 IEnumMediaTypes_Release(enum2);
731 IPin_Release(pin);
732
733 ref = IBaseFilter_Release(filter);
734 ok(!ref, "Got outstanding refcount %ld.\n", ref);
735}
736
738{
740 FILTER_STATE state;
741 HRESULT hr;
742 ULONG ref;
743
744 hr = IBaseFilter_GetState(filter, 0, &state);
745 ok(hr == S_OK, "Got hr %#lx.\n", hr);
746 ok(state == State_Stopped, "Got state %u.\n", state);
747
748 hr = IBaseFilter_Pause(filter);
749 ok(hr == S_OK, "Got hr %#lx.\n", hr);
750
751 hr = IBaseFilter_GetState(filter, 0, &state);
752 ok(hr == S_OK, "Got hr %#lx.\n", hr);
753 ok(state == State_Paused, "Got state %u.\n", state);
754
755 hr = IBaseFilter_Run(filter, 0);
756 ok(hr == S_OK, "Got hr %#lx.\n", hr);
757
758 hr = IBaseFilter_GetState(filter, 0, &state);
759 ok(hr == S_OK, "Got hr %#lx.\n", hr);
760 ok(state == State_Running, "Got state %u.\n", state);
761
762 hr = IBaseFilter_Pause(filter);
763 ok(hr == S_OK, "Got hr %#lx.\n", hr);
764
765 hr = IBaseFilter_GetState(filter, 0, &state);
766 ok(hr == S_OK, "Got hr %#lx.\n", hr);
767 ok(state == State_Paused, "Got state %u.\n", state);
768
769 hr = IBaseFilter_Stop(filter);
770 ok(hr == S_OK, "Got hr %#lx.\n", hr);
771
772 hr = IBaseFilter_GetState(filter, 0, &state);
773 ok(hr == S_OK, "Got hr %#lx.\n", hr);
774 ok(state == State_Stopped, "Got state %u.\n", state);
775
776 hr = IBaseFilter_Run(filter, 0);
777 ok(hr == S_OK, "Got hr %#lx.\n", hr);
778
779 hr = IBaseFilter_GetState(filter, 0, &state);
780 ok(hr == S_OK, "Got hr %#lx.\n", hr);
781 ok(state == State_Running, "Got state %u.\n", state);
782
783 hr = IBaseFilter_Stop(filter);
784 ok(hr == S_OK, "Got hr %#lx.\n", hr);
785
786 hr = IBaseFilter_GetState(filter, 0, &state);
787 ok(hr == S_OK, "Got hr %#lx.\n", hr);
788 ok(state == State_Stopped, "Got state %u.\n", state);
789
790 ref = IBaseFilter_Release(filter);
791 ok(!ref, "Got outstanding refcount %ld.\n", ref);
792}
793
794struct testfilter
795{
796 struct strmbase_filter filter;
797 struct strmbase_source source;
798 struct strmbase_sink sink;
801};
802
803static inline struct testfilter *impl_from_strmbase_filter(struct strmbase_filter *iface)
804{
805 return CONTAINING_RECORD(iface, struct testfilter, filter);
806}
807
808static struct strmbase_pin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
809{
811 if (!index)
812 return &filter->source.pin;
813 else if (index == 1)
814 return &filter->sink.pin;
815 return NULL;
816}
817
818static void testfilter_destroy(struct strmbase_filter *iface)
819{
824}
825
827{
828 .filter_get_pin = testfilter_get_pin,
829 .filter_destroy = testfilter_destroy,
830};
831
834{
835 return S_OK;
836}
837
839{
840 .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection,
841 .pfnDecideAllocator = testsource_DecideAllocator,
842};
843
844static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
845{
847
848 if (IsEqualGUID(iid, &IID_IMemInputPin))
849 *out = &filter->sink.IMemInputPin_iface;
850 else
851 return E_NOINTERFACE;
852
853 IUnknown_AddRef((IUnknown *)*out);
854 return S_OK;
855}
856
858{
860 if (!index && filter->mt)
861 {
862 CopyMediaType(mt, filter->mt);
863 return S_OK;
864 }
865 return VFW_S_NO_MORE_ITEMS;
866}
867
868static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
869{
870 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
871 if (filter->mt && !IsEqualGUID(&mt->majortype, &filter->mt->majortype))
873 return S_OK;
874}
875
877{
878 struct testfilter *filter = ptr;
880 Quality q = { Famine, 2000, -10000000, 10000000 };
881
882 IPin_QueryInterface(filter->sink.pin.peer, &IID_IQualityControl, (void**)&qc);
883 /* don't worry too much about what it returns, just check that it doesn't deadlock */
884 IQualityControl_Notify(qc, &filter->filter.IBaseFilter_iface, q);
885 IQualityControl_Release(qc);
886
887 return 0;
888}
889
891{
892 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
893 BYTE *data, expect[24 * (((29 * 12 + 31) / 8) & ~3)];
894 REFERENCE_TIME start, stop;
895 LONG size, i;
896 HRESULT hr;
897
898 ++filter->got_sample;
899
900 size = IMediaSample_GetSize(sample);
901 ok(size == 24 * (((29 * 12 + 31) / 8) & ~3), "Got size %lu.\n", size);
902 size = IMediaSample_GetActualDataLength(sample);
903 ok(size == 24 * (((29 * 12 + 31) / 8) & ~3), "Got valid size %lu.\n", size);
904
905 hr = IMediaSample_GetPointer(sample, &data);
906 ok(hr == S_OK, "Got hr %#lx.\n", hr);
907 for (i = 0; i < size; ++i)
908 expect[i] = 111 - i;
909 ok(!memcmp(data, expect, size), "Data didn't match.\n");
910
911 hr = IMediaSample_GetTime(sample, &start, &stop);
912 if (testmode == 0)
913 {
914 ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#lx.\n", hr);
915 }
916 else if (testmode == 1)
917 {
918 ok(hr == VFW_S_NO_STOP_TIME, "Got hr %#lx.\n", hr);
919 ok(start == 20000, "Got start time %s.\n", wine_dbgstr_longlong(start));
920 }
921 else
922 {
923 ok(hr == S_OK, "Got hr %#lx.\n", hr);
924 ok(start == 20000, "Got start time %s.\n", wine_dbgstr_longlong(start));
925 ok(stop == 30000, "Got stop time %s.\n", wine_dbgstr_longlong(stop));
926 }
927
928 hr = IMediaSample_GetMediaTime(sample, &start, &stop);
929 ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#lx.\n", hr);
930 hr = IMediaSample_IsDiscontinuity(sample);
931 todo_wine_if (testmode == 5) ok(hr == (testmode == 4) ? S_OK : S_FALSE, "Got hr %#lx.\n", hr);
932 hr = IMediaSample_IsPreroll(sample);
933 todo_wine_if (testmode == 3) ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
934 hr = IMediaSample_IsSyncPoint(sample);
935 todo_wine_if (testmode == 5 || testmode == 6) ok(hr == S_OK, "Got hr %#lx.\n", hr);
936
937 if (testmode == 7)
938 {
940 ok(WaitForSingleObject(h, 1000) == WAIT_OBJECT_0, "Didn't expect deadlock.\n");
941 CloseHandle(h);
942 }
943
944 return S_OK;
945}
946
949{
950 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
951 ++filter->got_new_segment;
952 ok(start == 10000, "Got start %s.\n", wine_dbgstr_longlong(start));
953 ok(stop == 20000, "Got stop %s.\n", wine_dbgstr_longlong(stop));
954 ok(rate == 1.0, "Got rate %.16e.\n", rate);
955 return S_OK;
956}
957
958static HRESULT testsink_eos(struct strmbase_sink *iface)
959{
960 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
961 ++filter->got_eos;
962 return S_OK;
963}
964
966{
967 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
968 ++filter->got_begin_flush;
969 return S_OK;
970}
971
973{
974 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
975 ++filter->got_end_flush;
976 return S_OK;
977}
978
979static const struct strmbase_sink_ops testsink_ops =
980{
981 .base.pin_query_interface = testsink_query_interface,
982 .base.pin_get_media_type = testsink_get_media_type,
983 .sink_connect = testsink_connect,
984 .pfnReceive = testsink_Receive,
985 .sink_new_segment = testsink_new_segment,
986 .sink_eos = testsink_eos,
987 .sink_begin_flush = testsink_begin_flush,
988 .sink_end_flush = testsink_end_flush,
989};
990
992{
993 static const GUID clsid = {0xabacab};
994 memset(filter, 0, sizeof(*filter));
998}
999
1001{
1002 IMemAllocator *req_allocator, *ret_allocator;
1003 ALLOCATOR_PROPERTIES props, ret_props;
1004 HRESULT hr;
1005
1006 hr = IMemInputPin_GetAllocatorRequirements(input, &props);
1007 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
1008
1009 hr = IMemInputPin_GetAllocator(input, &ret_allocator);
1010 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
1011
1012 if (hr == S_OK)
1013 {
1014 hr = IMemAllocator_GetProperties(ret_allocator, &props);
1015 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1016 ok(!props.cBuffers, "Got %ld buffers.\n", props.cBuffers);
1017 ok(!props.cbBuffer, "Got size %ld.\n", props.cbBuffer);
1018 ok(!props.cbAlign, "Got alignment %ld.\n", props.cbAlign);
1019 ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
1020
1021 hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
1022 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1023 IMemAllocator_Release(ret_allocator);
1024 }
1025
1026 hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
1027 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
1028
1029 CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
1030 &IID_IMemAllocator, (void **)&req_allocator);
1031
1032 props.cBuffers = 1;
1033 props.cbBuffer = 256;
1034 props.cbAlign = 1;
1035 props.cbPrefix = 0;
1036 hr = IMemAllocator_SetProperties(req_allocator, &props, &ret_props);
1037 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1038
1039 hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
1040 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1041
1042 hr = IMemInputPin_GetAllocator(input, &ret_allocator);
1043 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1044 ok(ret_allocator == req_allocator, "Allocators didn't match.\n");
1045
1046 IMemAllocator_Release(req_allocator);
1047 IMemAllocator_Release(ret_allocator);
1048}
1049
1050static void test_sample_processing(IMediaControl *control, IMemInputPin *input, struct testfilter *sink)
1051{
1052 REFERENCE_TIME start, stop;
1055 LONG size, i;
1056 HRESULT hr;
1057 BYTE *data;
1058
1059 hr = IMemInputPin_ReceiveCanBlock(input);
1060 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1061
1062 hr = IMemInputPin_GetAllocator(input, &allocator);
1063 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1064
1065 hr = IMediaControl_Pause(control);
1066 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1067
1068 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
1069 ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
1070
1071 hr = IMemAllocator_Commit(allocator);
1072 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1073 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
1074 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1075
1076 hr = IMediaSample_GetPointer(sample, &data);
1077 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1078 size = IMediaSample_GetSize(sample);
1079 ok(size == 256, "Got size %ld.\n", size);
1080 for (i = 0; i < 200; ++i)
1081 data[i] = i;
1082 hr = IMediaSample_SetActualDataLength(sample, 200);
1083 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1084
1085 start = 10000;
1086 stop = 20000;
1087 hr = IMediaSample_SetMediaTime(sample, &start, &stop);
1088 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1089 hr = IMediaSample_SetSyncPoint(sample, TRUE);
1090 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1091
1092 testmode = 0;
1093 hr = IMemInputPin_Receive(input, sample);
1094 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1095 ok(sink->got_sample == 1, "Got %u calls to Receive().\n", sink->got_sample);
1096 sink->got_sample = 0;
1097
1098 start = 20000;
1099 hr = IMediaSample_SetTime(sample, &start, NULL);
1100 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1101
1102 testmode = 1;
1103 hr = IMemInputPin_Receive(input, sample);
1104 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1105 ok(sink->got_sample == 1, "Got %u calls to Receive().\n", sink->got_sample);
1106 sink->got_sample = 0;
1107
1108 stop = 30000;
1109 hr = IMediaSample_SetTime(sample, &start, &stop);
1110 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1111
1112 testmode = 2;
1113 hr = IMemInputPin_Receive(input, sample);
1114 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1115 ok(sink->got_sample == 1, "Got %u calls to Receive().\n", sink->got_sample);
1116 sink->got_sample = 0;
1117
1118 hr = IMediaSample_SetPreroll(sample, TRUE);
1119 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1120
1121 testmode = 3;
1122 hr = IMemInputPin_Receive(input, sample);
1123 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1124 todo_wine ok(!sink->got_sample, "Got %u calls to Receive().\n", sink->got_sample);
1125
1126 hr = IMediaSample_SetPreroll(sample, FALSE);
1127 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1128 hr = IMediaSample_SetDiscontinuity(sample, TRUE);
1129 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1130
1131 testmode = 4;
1132 hr = IMemInputPin_Receive(input, sample);
1133 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1134 todo_wine ok(sink->got_sample == 1, "Got %u calls to Receive().\n", sink->got_sample);
1135 sink->got_sample = 0;
1136
1137 hr = IMediaSample_SetSyncPoint(sample, FALSE);
1138 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1139
1140 testmode = 5;
1141 hr = IMemInputPin_Receive(input, sample);
1142 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1143 todo_wine ok(!sink->got_sample, "Got %u calls to Receive().\n", sink->got_sample);
1144
1145 hr = IMediaSample_SetDiscontinuity(sample, FALSE);
1146 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1147
1148 testmode = 6;
1149 hr = IMemInputPin_Receive(input, sample);
1150 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1151 todo_wine ok(!sink->got_sample, "Got %u calls to Receive().\n", sink->got_sample);
1152
1153 testmode = 7;
1154 hr = IMediaSample_SetSyncPoint(sample, TRUE);
1155 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1156 sink->got_sample = 0;
1157 hr = IMemInputPin_Receive(input, sample);
1158 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1159 ok(sink->got_sample == 1, "Got %u calls to Receive().\n", sink->got_sample);
1160 sink->got_sample = 0;
1161
1162 hr = IMediaControl_Stop(control);
1163 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1164
1165 hr = IMemInputPin_Receive(input, sample);
1166 ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
1167
1168 IMediaSample_Release(sample);
1169 IMemAllocator_Release(allocator);
1170}
1171
1172static void test_streaming_events(IMediaControl *control, IPin *sink,
1174{
1177 HRESULT hr;
1178 BYTE *data;
1179 LONG i;
1180
1181 hr = IMediaControl_Pause(control);
1182 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1183
1184 hr = IMemInputPin_GetAllocator(input, &allocator);
1185 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1186 hr = IMemAllocator_Commit(allocator);
1187 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1188 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
1189 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1190 hr = IMediaSample_GetPointer(sample, &data);
1191 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1192 for (i = 0; i < 200; ++i)
1193 data[i] = i;
1194 hr = IMediaSample_SetActualDataLength(sample, 200);
1195 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1196 hr = IMediaSample_SetSyncPoint(sample, TRUE);
1197 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1198
1199 ok(!testsink->got_new_segment, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment);
1200 hr = IPin_NewSegment(sink, 10000, 20000, 1.0);
1201 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1202 ok(testsink->got_new_segment == 1, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment);
1203
1204 ok(!testsink->got_eos, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
1205 hr = IPin_EndOfStream(sink);
1206 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1207 ok(!testsink->got_sample, "Got %u calls to Receive().\n", testsink->got_sample);
1208 ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
1209 testsink->got_eos = 0;
1210
1211 hr = IPin_EndOfStream(sink);
1212 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1213 ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
1214
1215 testmode = 0;
1216 hr = IMemInputPin_Receive(input, sample);
1217 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1218 ok(testsink->got_sample == 1, "Got %u calls to Receive().\n", testsink->got_sample);
1219 testsink->got_sample = 0;
1220
1221 ok(!testsink->got_begin_flush, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush);
1222 hr = IPin_BeginFlush(sink);
1223 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1224 ok(testsink->got_begin_flush == 1, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush);
1225
1226 hr = IMemInputPin_Receive(input, sample);
1227 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1228
1229 hr = IPin_EndOfStream(sink);
1230 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1231
1232 ok(!testsink->got_end_flush, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush);
1233 hr = IPin_EndFlush(sink);
1234 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1235 ok(testsink->got_end_flush == 1, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush);
1236
1237 hr = IMemInputPin_Receive(input, sample);
1238 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1239 ok(testsink->got_sample == 1, "Got %u calls to Receive().\n", testsink->got_sample);
1240 testsink->got_sample = 0;
1241
1242 hr = IMediaControl_Stop(control);
1243 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1244 IMediaSample_Release(sample);
1245 IMemAllocator_Release(allocator);
1246}
1247
1248static void test_connect_pin(void)
1249{
1250 VIDEOINFOHEADER req_format =
1251 {
1253 .bmiHeader.biCompression = test_handler,
1254 .bmiHeader.biWidth = 29,
1255 .bmiHeader.biHeight = 24,
1256 .bmiHeader.biBitCount = 16,
1257 };
1258 AM_MEDIA_TYPE req_mt =
1259 {
1260 .majortype = MEDIATYPE_Video,
1261 .subtype = test_subtype,
1262 .formattype = FORMAT_VideoInfo,
1263 .lSampleSize = 888,
1264 .cbFormat = sizeof(req_format),
1265 .pbFormat = (BYTE *)&req_format,
1266 };
1267 struct testfilter testsource, testsink;
1269 AM_MEDIA_TYPE mt, source_mt, *pmt;
1270 IPin *sink, *source, *peer;
1271 IEnumMediaTypes *enummt;
1272 IMediaControl *control;
1273 IMemInputPin *meminput;
1275 unsigned int i;
1276 HRESULT hr;
1277 ULONG ref;
1278
1279 CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
1280 &IID_IFilterGraph2, (void **)&graph);
1281 testfilter_init(&testsource);
1283 IFilterGraph2_AddFilter(graph, &testsink.filter.IBaseFilter_iface, L"sink");
1284 IFilterGraph2_AddFilter(graph, &testsource.filter.IBaseFilter_iface, L"source");
1285 IFilterGraph2_AddFilter(graph, filter, L"AVI decoder");
1286 IBaseFilter_FindPin(filter, L"In", &sink);
1287 IBaseFilter_FindPin(filter, L"Out", &source);
1288 IPin_QueryInterface(sink, &IID_IMemInputPin, (void **)&meminput);
1289 IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
1290
1291 /* Test sink connection. */
1292
1293 peer = (IPin *)0xdeadbeef;
1294 hr = IPin_ConnectedTo(sink, &peer);
1295 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1296 ok(!peer, "Got peer %p.\n", peer);
1297
1298 hr = IPin_ConnectionMediaType(sink, &mt);
1299 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1300
1301 hr = IMediaControl_Pause(control);
1302 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1303 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1304 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1305 hr = IMediaControl_Stop(control);
1306 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1307
1308 req_mt.subtype = MEDIASUBTYPE_RGB24;
1309 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1310 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1311 req_mt.subtype = test_subtype;
1312
1313 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1314 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1315
1316 hr = IPin_ConnectedTo(sink, &peer);
1317 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1318 ok(peer == &testsource.source.pin.IPin_iface, "Got peer %p.\n", peer);
1319 IPin_Release(peer);
1320
1321 hr = IPin_ConnectionMediaType(sink, &mt);
1322 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1323 ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
1324 ok(compare_media_types(&testsource.source.pin.mt, &req_mt), "Media types didn't match.\n");
1325 FreeMediaType(&mt);
1326
1327 hr = IMediaControl_Pause(control);
1328 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1329 hr = IFilterGraph2_Disconnect(graph, sink);
1330 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1331 hr = IMediaControl_Stop(control);
1332 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1333
1334 sink_bitmap_info = req_format.bmiHeader;
1335
1336 hr = IPin_EnumMediaTypes(source, &enummt);
1337 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1338
1339 for (i = 0; i < 9; ++i)
1340 {
1341 static const struct
1342 {
1343 const GUID *subtype;
1345 WORD bpp;
1346 }
1347 expect[9] =
1348 {
1349 {&MEDIASUBTYPE_CLJR, mmioFOURCC('C','L','J','R'), 8},
1350 {&MEDIASUBTYPE_UYVY, mmioFOURCC('U','Y','V','Y'), 16},
1351 {&MEDIASUBTYPE_YUY2, mmioFOURCC('Y','U','Y','2'), 16},
1352 {&MEDIASUBTYPE_RGB32, BI_RGB, 32},
1353 {&MEDIASUBTYPE_RGB24, BI_RGB, 24},
1354 {&MEDIASUBTYPE_RGB565, BI_BITFIELDS, 16},
1355 {&MEDIASUBTYPE_RGB555, BI_RGB, 16},
1356 {&MEDIASUBTYPE_RGB8, BI_RGB, 8},
1357 {&MEDIASUBTYPE_I420, mmioFOURCC('I','4','2','0'), 12},
1358 };
1359
1360 VIDEOINFOHEADER expect_format =
1361 {
1363 .bmiHeader.biWidth = 29,
1364 .bmiHeader.biHeight = 24,
1365 .bmiHeader.biBitCount = expect[i].bpp,
1366 .bmiHeader.biCompression = expect[i].compression,
1367 .bmiHeader.biSizeImage = 24 * (((29 * expect[i].bpp + 31) / 8) & ~3),
1368 };
1369
1370 AM_MEDIA_TYPE expect_mt =
1371 {
1372 .majortype = MEDIATYPE_Video,
1373 .subtype = *expect[i].subtype,
1374 .bFixedSizeSamples = TRUE,
1375 .lSampleSize = 24 * (((29 * expect[i].bpp + 31) / 8) & ~3),
1376 .formattype = FORMAT_VideoInfo,
1377 .cbFormat = sizeof(VIDEOINFOHEADER),
1378 .pbFormat = (BYTE *)&expect_format,
1379 };
1380
1381 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
1382 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1383 ok(!memcmp(pmt, &expect_mt, offsetof(AM_MEDIA_TYPE, cbFormat)),
1384 "%u: Media types didn't match.\n", i);
1385 ok(!memcmp(pmt->pbFormat, &expect_format, sizeof(VIDEOINFOHEADER)),
1386 "%u: Format blocks didn't match.\n", i);
1387 if (i == 5)
1388 {
1389 const VIDEOINFO *format = (VIDEOINFO *)pmt->pbFormat;
1390
1391 ok(pmt->cbFormat == offsetof(VIDEOINFO, dwBitMasks[3]), "Got format size %lu.\n", pmt->cbFormat);
1392 ok(format->dwBitMasks[iRED] == 0xf800, "Got red bit mask %#lx.\n", format->dwBitMasks[iRED]);
1393 ok(format->dwBitMasks[iGREEN] == 0x07e0, "Got green bit mask %#lx.\n", format->dwBitMasks[iGREEN]);
1394 ok(format->dwBitMasks[iBLUE] == 0x001f, "Got blue bit mask %#lx.\n", format->dwBitMasks[iBLUE]);
1395 }
1396
1397 hr = IPin_QueryAccept(source, pmt);
1398 ok(hr == (i == 8 ? S_OK : S_FALSE), "Got hr %#lx.\n", hr);
1399
1400 if (i == 8)
1401 CopyMediaType(&source_mt, pmt);
1402
1403 DeleteMediaType(pmt);
1404 }
1405
1406 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
1407 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1408
1409 IEnumMediaTypes_Release(enummt);
1410
1411 test_sink_allocator(meminput);
1412
1413 /* Test source connection. */
1414
1415 peer = (IPin *)0xdeadbeef;
1416 hr = IPin_ConnectedTo(source, &peer);
1417 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1418 ok(!peer, "Got peer %p.\n", peer);
1419
1420 hr = IPin_ConnectionMediaType(source, &mt);
1421 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1422
1423 /* Exact connection. */
1424
1425 CopyMediaType(&req_mt, &source_mt);
1426
1427 hr = IMediaControl_Pause(control);
1428 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1429 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1430 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1431 hr = IMediaControl_Stop(control);
1432 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1433
1434 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1435 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1436
1437 hr = IPin_ConnectedTo(source, &peer);
1438 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1439 ok(peer == &testsink.sink.pin.IPin_iface, "Got peer %p.\n", peer);
1440 IPin_Release(peer);
1441
1442 hr = IPin_ConnectionMediaType(source, &mt);
1443 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1444 ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
1445 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1446 FreeMediaType(&mt);
1447
1448 source_bitmap_info = ((VIDEOINFOHEADER *)req_mt.pbFormat)->bmiHeader;
1449
1450 hr = IMediaControl_Pause(control);
1451 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1452 hr = IFilterGraph2_Disconnect(graph, source);
1453 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1454 hr = IMediaControl_Stop(control);
1455 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1456
1459
1460 hr = IFilterGraph2_Disconnect(graph, source);
1461 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1462 hr = IFilterGraph2_Disconnect(graph, source);
1463 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1464 ok(testsink.sink.pin.peer == source, "Got peer %p.\n", testsink.sink.pin.peer);
1465 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1466
1467 req_mt.lSampleSize = 999;
1468 req_mt.bTemporalCompression = req_mt.bFixedSizeSamples = TRUE;
1469 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1470 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1471 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1472 IFilterGraph2_Disconnect(graph, source);
1473 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1474
1475 req_mt.formattype = FORMAT_None;
1476 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1477 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1478 req_mt.formattype = FORMAT_VideoInfo;
1479
1480 /* Connection with wildcards. */
1481
1482 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1483 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1484 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1485 IFilterGraph2_Disconnect(graph, source);
1486 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1487
1488 req_mt.majortype = GUID_NULL;
1489 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1490 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1491 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1492 IFilterGraph2_Disconnect(graph, source);
1493 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1494
1495 req_mt.subtype = MEDIASUBTYPE_RGB32;
1496 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1497 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1498
1499 req_mt.subtype = GUID_NULL;
1500 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1501 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1502 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1503 IFilterGraph2_Disconnect(graph, source);
1504 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1505
1506 req_mt.formattype = FORMAT_None;
1507 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1508 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1509
1510 req_mt.majortype = MEDIATYPE_Video;
1511 req_mt.subtype = MEDIASUBTYPE_I420;
1512 req_mt.formattype = GUID_NULL;
1513 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1514 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1515 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1516 IFilterGraph2_Disconnect(graph, source);
1517 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1518
1519 req_mt.subtype = MEDIASUBTYPE_RGB32;
1520 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1521 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1522
1523 req_mt.subtype = GUID_NULL;
1524 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1525 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1526 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1527 IFilterGraph2_Disconnect(graph, source);
1528 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1529
1530 req_mt.majortype = MEDIATYPE_Audio;
1531 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1532 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1533
1534 /* Test enumeration of sink media types. */
1535
1536 /* Our sink's proposed media type is sort of broken, but Windows 8+ returns
1537 * VFW_E_INVALIDMEDIATYPE for even perfectly reasonable ones. */
1538 testsink.mt = &req_mt;
1539 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1541 || broken(hr == VFW_E_INVALIDMEDIATYPE) /* Win8+ */, "Got hr %#lx.\n", hr);
1542
1543 req_mt.majortype = MEDIATYPE_Video;
1544 req_mt.subtype = MEDIASUBTYPE_I420;
1545 req_mt.formattype = FORMAT_VideoInfo;
1546 req_mt.lSampleSize = 444;
1547 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1548 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1549 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1550
1551 hr = IFilterGraph2_Disconnect(graph, sink);
1552 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1553 hr = IFilterGraph2_Disconnect(graph, sink);
1554 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1555 ok(testsource.source.pin.peer == sink, "Got peer %p.\n", testsource.source.pin.peer);
1556 IFilterGraph2_Disconnect(graph, &testsource.source.pin.IPin_iface);
1557
1559 FreeMediaType(&req_mt);
1560 IMemInputPin_Release(meminput);
1561 IPin_Release(sink);
1562 IPin_Release(source);
1563 IMediaControl_Release(control);
1564 ref = IFilterGraph2_Release(graph);
1565 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1566 ref = IBaseFilter_Release(filter);
1567 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1568 ref = IBaseFilter_Release(&testsource.filter.IBaseFilter_iface);
1569 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1570 ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
1571 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1572}
1573
1575{
1576 BOOL ret;
1577
1579 ok(ret, "Failed to install driver.\n");
1580
1582
1586 test_find_pin();
1587 test_pin_info();
1592
1594
1596 ok(ret, "Failed to remove driver.\n");
1597}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
static int state
Definition: maze.c:121
unsigned int dir
Definition: maze.c:112
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
unsigned int rate
Definition: audiorecord.c:87
#define msg(x)
Definition: auth_time.c:54
enum _PinDirection PIN_DIRECTION
@ PINDIR_OUTPUT
Definition: axcore.idl:42
@ PINDIR_INPUT
Definition: axcore.idl:41
const GUID IID_IUnknown
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t compression
Definition: btrfs_drv.h:1365
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 struct avi_decompressor * impl_from_strmbase_filter(struct strmbase_filter *iface)
Definition: avidec.c:56
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
#define CloseHandle
Definition: compat.h:739
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define CALLBACK
Definition: compat.h:35
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)
Definition: thread.c:137
_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
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
struct tagVIDEOINFOHEADER VIDEOINFOHEADER
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
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
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum const GLfloat * params
Definition: glext.h:5645
GLuint in
Definition: glext.h:9616
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
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
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
unsigned int UINT
Definition: sysinfo.c:13
#define DRV_LOAD(x)
Definition: axcore.idl:92
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define wine_dbgstr_w
Definition: kernel32.h:34
#define GUID_NULL
Definition: ks.h:106
int winetest_debug
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
#define BI_BITFIELDS
Definition: mmreg.h:507
#define ICTYPE_VIDEO
Definition: mmreg.h:531
#define DRV_CLOSE
Definition: mmsystem.h:122
#define DRV_ENABLE
Definition: mmsystem.h:120
#define DRV_OPEN
Definition: mmsystem.h:121
#define mmioFOURCC(c0, c1, c2, c3)
Definition: mmsystem.h:38
#define DRV_FREE
Definition: mmsystem.h:124
#define DRV_DISABLE
Definition: mmsystem.h:123
static PVOID ptr
Definition: dispmode.c:27
static BITMAPINFOHEADER source_bitmap_info
Definition: avidec.c:55
static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IMemInputPin *peer, IMemAllocator **allocator)
Definition: avidec.c:832
static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b)
Definition: avidec.c:42
static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: avidec.c:844
static void testfilter_destroy(struct strmbase_filter *iface)
Definition: avidec.c:818
static const IUnknownVtbl outer_vtbl
Definition: avidec.c:273
static const struct strmbase_sink_ops testsink_ops
Definition: avidec.c:979
static IBaseFilter * create_avi_dec(void)
Definition: avidec.c:33
static HRESULT testsink_begin_flush(struct strmbase_sink *iface)
Definition: avidec.c:965
static void test_aggregation(void)
Definition: avidec.c:282
static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: avidec.c:868
static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
Definition: avidec.c:183
static BITMAPINFOHEADER sink_bitmap_info
Definition: avidec.c:55
static ULONG WINAPI outer_AddRef(IUnknown *iface)
Definition: avidec.c:263
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out)
Definition: avidec.c:250
static ULONG get_refcount(void *iface)
Definition: avidec.c:48
static DWORD WINAPI call_qc_notify(void *ptr)
Definition: avidec.c:876
static void test_pin_info(void)
Definition: avidec.c:503
static IUnknown test_outer
Definition: avidec.c:280
static const GUID test_subtype
Definition: avidec.c:29
static void test_find_pin(void)
Definition: avidec.c:462
static HRESULT testsink_eos(struct strmbase_sink *iface)
Definition: avidec.c:958
static const struct strmbase_source_ops testsource_ops
Definition: avidec.c:838
static void test_enum_media_types(void)
Definition: avidec.c:662
static void test_interfaces(void)
Definition: avidec.c:197
static void test_streaming_events(IMediaControl *control, IPin *sink, IMemInputPin *input, struct testfilter *testsink)
Definition: avidec.c:1172
static void test_connect_pin(void)
Definition: avidec.c:1248
static void test_media_types(void)
Definition: avidec.c:576
static struct strmbase_pin * testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
Definition: avidec.c:808
static LRESULT CALLBACK vfw_driver_proc(DWORD_PTR id, HDRVR driver, UINT msg, LPARAM lparam1, LPARAM lparam2)
Definition: avidec.c:57
static void test_enum_pins(void)
Definition: avidec.c:341
static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample)
Definition: avidec.c:890
static void test_sink_allocator(IMemInputPin *input)
Definition: avidec.c:1000
static const DWORD test_handler
Definition: avidec.c:28
#define check_interface(a, b, c)
Definition: avidec.c:182
static LONG outer_ref
Definition: avidec.c:248
static int testmode
Definition: avidec.c:31
static const struct strmbase_filter_ops testfilter_ops
Definition: avidec.c:826
static HRESULT testsink_new_segment(struct strmbase_sink *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
Definition: avidec.c:947
static void test_unconnected_filter_state(void)
Definition: avidec.c:737
static const GUID test_iid
Definition: avidec.c:247
static void test_sample_processing(IMediaControl *control, IMemInputPin *input, struct testfilter *sink)
Definition: avidec.c:1050
static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
Definition: avidec.c:857
static HRESULT testsink_end_flush(struct strmbase_sink *iface)
Definition: avidec.c:972
static void testfilter_init(struct testfilter *filter)
Definition: avidec.c:991
static ULONG WINAPI outer_Release(IUnknown *iface)
Definition: avidec.c:268
const GUID * subtype
Definition: mpegvideo.c:120
const CLSID * clsid
Definition: msctf.cpp:50
BOOL VFWAPI ICInstall(DWORD type, DWORD handler, LPARAM lparam, char *desc, UINT flags)
Definition: msvideo_main.c:336
BOOL VFWAPI ICRemove(DWORD type, DWORD handler, UINT flags)
Definition: msvideo_main.c:388
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
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(struct strmbase_source *pin, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: pin.c:710
void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: mediatype.c:193
DWORD biCompression
Definition: amvideo.idl:35
DWORD biSizeImage
Definition: amvideo.idl:36
Definition: vfw.h:280
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
BITMAPINFOHEADER bmiHeader
Definition: amvideo.idl:189
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 testqc * qc
Definition: mpegaudio.c:903
struct strmbase_source source
Definition: amstream.c:1020
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
const AM_MEDIA_TYPE * mt
Definition: filesource.c:1214
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define BI_RGB
Definition: uefivid.c:46
#define MEDIASUBTYPE_NULL
Definition: uuids.h:25
#define ICERR_OK
Definition: vfw.h:50
#define ICM_DECOMPRESS_GET_PALETTE
Definition: vfw.h:112
#define ICM_DECOMPRESS_QUERY
Definition: vfw.h:107
#define ICERR_UNSUPPORTED
Definition: vfw.h:56
#define ICM_GETINFO
Definition: vfw.h:82
#define ICERR_BADFORMAT
Definition: vfw.h:57
#define ICM_DECOMPRESS_GET_FORMAT
Definition: vfw.h:106
#define ICM_DECOMPRESS_END
Definition: vfw.h:110
#define ICM_DECOMPRESS_BEGIN
Definition: vfw.h:108
#define ICDECOMPRESS_NOTKEYFRAME
Definition: vfw.h:331
#define ICINSTALL_FUNCTION
Definition: vfw.h:625
#define ICDECOMPRESS_PREROLL
Definition: vfw.h:329
#define ICM_DECOMPRESS
Definition: vfw.h:109
#define ICM_DECOMPRESS_SET_PALETTE
Definition: vfw.h:111
#define VFW_E_SAMPLE_TIME_NOT_SET
Definition: vfwmsgs.h:104
#define VFW_E_MEDIA_TIME_NOT_SET
Definition: vfwmsgs.h:105
#define VFW_E_INVALIDMEDIATYPE
Definition: vfwmsgs.h:39
#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_S_NO_STOP_TIME
Definition: vfwmsgs.h:34
#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
static const WCHAR props[]
Definition: wbemdisp.c:288
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
static WORD const char * driver
Definition: odbccp32.c:56
#define WAIT_OBJECT_0
Definition: winbase.h: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
ULONG bpp[]
Definition: xlate.c:19
unsigned char BYTE
Definition: xxhash.c:193