ReactOS 0.4.17-dev-966-gf06eace
dsoundrender.c
Go to the documentation of this file.
1/*
2 * DirectSound renderer filter unit tests
3 *
4 * Copyright (C) 2010 Maarten Lankhorst for CodeWeavers
5 * Copyright (C) 2007 Google (Lei Zhang)
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#define COBJMACROS
23#include <math.h>
24#include "dshow.h"
25#include "initguid.h"
26#include "dsound.h"
27#include "amaudio.h"
28#include "mmreg.h"
29#include "wine/strmbase.h"
30#include "wine/test.h"
31
32static const WCHAR sink_id[] = L"Audio Input pin (rendered)";
33
35{
37 HRESULT hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER,
38 &IID_IBaseFilter, (void **)&filter);
39 ok(hr == S_OK, "Got hr %#lx.\n", hr);
40 return filter;
41}
42
44{
46 HRESULT hr;
47 hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&ret);
48 ok(hr == S_OK, "Got hr %#lx.\n", hr);
49 return ret;
50}
51
53{
54 return !memcmp(a, b, offsetof(AM_MEDIA_TYPE, pbFormat))
55 && !memcmp(a->pbFormat, b->pbFormat, a->cbFormat);
56}
57
58static ULONG get_refcount(void *iface)
59{
60 IUnknown *unknown = iface;
61 IUnknown_AddRef(unknown);
62 return IUnknown_Release(unknown);
63}
64
66{
67 ok(0, "Unexpected call (iid %s).\n", wine_dbgstr_guid(iid));
68 return E_NOINTERFACE;
69}
70
72{
73 ok(0, "Unexpected call.\n");
74 return 2;
75}
76
78{
79 ok(0, "Unexpected call.\n");
80 return 1;
81}
82
84{
85 WCHAR guidstr[39];
86
87 ok(!wcscmp(name, L"DSGuid"), "Got unexpected name %s.\n", wine_dbgstr_w(name));
88 ok(V_VT(var) == VT_BSTR, "Got unexpected type %u.\n", V_VT(var));
89 StringFromGUID2(&DSDEVID_DefaultPlayback, guidstr, ARRAY_SIZE(guidstr));
90 V_BSTR(var) = SysAllocString(guidstr);
91 return S_OK;
92}
93
95{
96 ok(0, "Unexpected call (name %s).\n", wine_dbgstr_w(name));
97 return E_FAIL;
98}
99
100static const IPropertyBagVtbl property_bag_vtbl =
101{
107};
108
109static void test_property_bag(void)
110{
111 IPropertyBag property_bag = {&property_bag_vtbl};
113 HRESULT hr;
114 ULONG ref;
115
116 hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER,
117 &IID_IPersistPropertyBag, (void **)&ppb);
118 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
119 if (hr != S_OK) return;
120
121 hr = IPersistPropertyBag_InitNew(ppb);
122 ok(hr == S_OK, "Got hr %#lx.\n", hr);
123
124 hr = IPersistPropertyBag_Load(ppb, &property_bag, NULL);
125 ok(hr == S_OK, "Got hr %#lx.\n", hr);
126
127 ref = IPersistPropertyBag_Release(ppb);
128 ok(!ref, "Got unexpected refcount %ld.\n", ref);
129}
130
131#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
132static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
133{
134 IUnknown *iface = iface_ptr;
136 IUnknown *unk;
137
138 expected_hr = supported ? S_OK : E_NOINTERFACE;
139
140 hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
141 ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
142 if (SUCCEEDED(hr))
143 IUnknown_Release(unk);
144}
145
146static void test_interfaces(void)
147{
149 IPin *pin;
150
151 check_interface(filter, &IID_IAMDirectSound, TRUE);
153 check_interface(filter, &IID_IBasicAudio, TRUE);
154 todo_wine check_interface(filter, &IID_IDirectSound3DBuffer, TRUE);
155 check_interface(filter, &IID_IMediaFilter, TRUE);
156 check_interface(filter, &IID_IMediaPosition, TRUE);
157 check_interface(filter, &IID_IMediaSeeking, TRUE);
160 check_interface(filter, &IID_IQualityControl, TRUE);
161 check_interface(filter, &IID_IReferenceClock, TRUE);
163
164 check_interface(filter, &IID_IAMFilterMiscFlags, FALSE);
165 check_interface(filter, &IID_IBasicVideo, FALSE);
169 check_interface(filter, &IID_IQualProp, FALSE);
170 check_interface(filter, &IID_IVideoWindow, FALSE);
171
172 IBaseFilter_FindPin(filter, sink_id, &pin);
173
175 check_interface(pin, &IID_IMemInputPin, TRUE);
176 todo_wine check_interface(pin, &IID_IQualityControl, TRUE);
178
180 check_interface(pin, &IID_IMediaPosition, FALSE);
181 check_interface(pin, &IID_IMediaSeeking, FALSE);
182
183 IPin_Release(pin);
184 IBaseFilter_Release(filter);
185}
186
187static const GUID test_iid = {0x33333333};
188static LONG outer_ref = 1;
189
191{
192 if (IsEqualGUID(iid, &IID_IUnknown)
194 || IsEqualGUID(iid, &test_iid))
195 {
196 *out = (IUnknown *)0xdeadbeef;
197 return S_OK;
198 }
199 ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid));
200 return E_NOINTERFACE;
201}
202
204{
206}
207
209{
211}
212
213static const IUnknownVtbl outer_vtbl =
214{
218};
219
221
222static void test_aggregation(void)
223{
224 IBaseFilter *filter, *filter2;
225 IUnknown *unk, *unk2;
226 HRESULT hr;
227 ULONG ref;
228
229 filter = (IBaseFilter *)0xdeadbeef;
230 hr = CoCreateInstance(&CLSID_DSoundRender, &test_outer, CLSCTX_INPROC_SERVER,
231 &IID_IBaseFilter, (void **)&filter);
232 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
233 ok(!filter, "Got interface %p.\n", filter);
234
235 hr = CoCreateInstance(&CLSID_DSoundRender, &test_outer, CLSCTX_INPROC_SERVER,
236 &IID_IUnknown, (void **)&unk);
237 ok(hr == S_OK, "Got hr %#lx.\n", hr);
238 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
239 ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
240 ref = get_refcount(unk);
241 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
242
243 ref = IUnknown_AddRef(unk);
244 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
245 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
246
247 ref = IUnknown_Release(unk);
248 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
249 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
250
251 hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
252 ok(hr == S_OK, "Got hr %#lx.\n", hr);
253 ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
254 IUnknown_Release(unk2);
255
256 hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
257 ok(hr == S_OK, "Got hr %#lx.\n", hr);
258
259 hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
260 ok(hr == S_OK, "Got hr %#lx.\n", hr);
261 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
262
263 hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
264 ok(hr == S_OK, "Got hr %#lx.\n", hr);
265 ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
266
267 hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
268 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
269 ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
270
271 hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
272 ok(hr == S_OK, "Got hr %#lx.\n", hr);
273 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
274
275 IBaseFilter_Release(filter);
276 ref = IUnknown_Release(unk);
277 ok(!ref, "Got unexpected refcount %ld.\n", ref);
278 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
279}
280
281static void test_enum_pins(void)
282{
284 IEnumPins *enum1, *enum2;
285 ULONG count, ref;
286 IPin *pins[2];
287 HRESULT hr;
288
290 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
291
292 hr = IBaseFilter_EnumPins(filter, NULL);
293 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
294
295 hr = IBaseFilter_EnumPins(filter, &enum1);
296 ok(hr == S_OK, "Got hr %#lx.\n", hr);
298 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
299 ref = get_refcount(enum1);
300 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
301
302 hr = IEnumPins_Next(enum1, 1, NULL, NULL);
303 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
304
305 hr = IEnumPins_Next(enum1, 1, pins, NULL);
306 ok(hr == S_OK, "Got hr %#lx.\n", hr);
308 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
309 ref = get_refcount(pins[0]);
310 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
311 ref = get_refcount(enum1);
312 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
313 IPin_Release(pins[0]);
315 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
316
317 hr = IEnumPins_Next(enum1, 1, pins, NULL);
318 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
319
320 hr = IEnumPins_Reset(enum1);
321 ok(hr == S_OK, "Got hr %#lx.\n", hr);
322
323 hr = IEnumPins_Next(enum1, 1, pins, &count);
324 ok(hr == S_OK, "Got hr %#lx.\n", hr);
325 ok(count == 1, "Got count %lu.\n", count);
326 IPin_Release(pins[0]);
327
328 hr = IEnumPins_Next(enum1, 1, pins, &count);
329 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
330 ok(!count, "Got count %lu.\n", count);
331
332 hr = IEnumPins_Reset(enum1);
333 ok(hr == S_OK, "Got hr %#lx.\n", hr);
334
335 hr = IEnumPins_Next(enum1, 2, pins, NULL);
336 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
337
338 hr = IEnumPins_Next(enum1, 2, pins, &count);
339 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
340 ok(count == 1, "Got count %lu.\n", count);
341 IPin_Release(pins[0]);
342
343 hr = IEnumPins_Reset(enum1);
344 ok(hr == S_OK, "Got hr %#lx.\n", hr);
345
346 hr = IEnumPins_Clone(enum1, &enum2);
347 ok(hr == S_OK, "Got hr %#lx.\n", hr);
348
349 hr = IEnumPins_Skip(enum1, 2);
350 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
351
352 hr = IEnumPins_Skip(enum1, 1);
353 ok(hr == S_OK, "Got hr %#lx.\n", hr);
354
355 hr = IEnumPins_Skip(enum1, 1);
356 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
357
358 hr = IEnumPins_Next(enum1, 1, pins, NULL);
359 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
360
361 hr = IEnumPins_Next(enum2, 1, pins, NULL);
362 ok(hr == S_OK, "Got hr %#lx.\n", hr);
363 IPin_Release(pins[0]);
364
365 IEnumPins_Release(enum2);
366 IEnumPins_Release(enum1);
367 ref = IBaseFilter_Release(filter);
368 ok(!ref, "Got outstanding refcount %ld.\n", ref);
369}
370
371static void test_find_pin(void)
372{
375 IPin *pin, *pin2;
376 HRESULT hr;
377 ULONG ref;
378
379 hr = IBaseFilter_FindPin(filter, L"In", &pin);
380 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
381
382 hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
383 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
384
385 hr = IBaseFilter_FindPin(filter, sink_id, &pin);
386 ok(hr == S_OK, "Got hr %#lx.\n", hr);
387
388 hr = IBaseFilter_EnumPins(filter, &enum_pins);
389 ok(hr == S_OK, "Got hr %#lx.\n", hr);
390
391 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
392 ok(hr == S_OK, "Got hr %#lx.\n", hr);
393 ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
394 IPin_Release(pin);
395 IPin_Release(pin2);
396
397 IEnumPins_Release(enum_pins);
398 ref = IBaseFilter_Release(filter);
399 ok(!ref, "Got outstanding refcount %ld.\n", ref);
400}
401
402static void test_pin_info(void)
403{
407 HRESULT hr;
408 WCHAR *id;
409 ULONG ref;
410 IPin *pin;
411
412 hr = IBaseFilter_FindPin(filter, sink_id, &pin);
413 ok(hr == S_OK, "Got hr %#lx.\n", hr);
415 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
416 ref = get_refcount(pin);
417 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
418
419 hr = IPin_QueryPinInfo(pin, &info);
420 ok(hr == S_OK, "Got hr %#lx.\n", hr);
421 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
422 ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
423 ok(!wcscmp(info.achName, sink_id), "Got name %s.\n", wine_dbgstr_w(info.achName));
425 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
426 ref = get_refcount(pin);
427 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
428 IBaseFilter_Release(info.pFilter);
429
430 hr = IPin_QueryDirection(pin, &dir);
431 ok(hr == S_OK, "Got hr %#lx.\n", hr);
432 ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
433
434 hr = IPin_QueryId(pin, &id);
435 ok(hr == S_OK, "Got hr %#lx.\n", hr);
436 ok(!wcscmp(id, sink_id), "Got id %s.\n", wine_dbgstr_w(id));
437 CoTaskMemFree(id);
438
439 hr = IPin_QueryInternalConnections(pin, NULL, NULL);
440 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
441
442 IPin_Release(pin);
443 ref = IBaseFilter_Release(filter);
444 ok(!ref, "Got outstanding refcount %ld.\n", ref);
445}
446
447static void test_basic_audio(void)
448{
450 LONG balance, volume;
452 unsigned int count;
453 IBasicAudio *audio;
454 TYPEATTR *typeattr;
455 HRESULT hr;
456 ULONG ref;
457
458 hr = IBaseFilter_QueryInterface(filter, &IID_IBasicAudio, (void **)&audio);
459 ok(hr == S_OK, "Got hr %#lx.\n", hr);
460
461 hr = IBasicAudio_get_Balance(audio, NULL);
462 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
463
464 hr = IBasicAudio_get_Balance(audio, &balance);
465 if (hr != VFW_E_MONO_AUDIO_HW)
466 {
467 ok(hr == S_OK, "Got hr %#lx.\n", hr);
468 ok(balance == 0, "Got balance %ld.\n", balance);
469
470 hr = IBasicAudio_put_Balance(audio, DSBPAN_LEFT - 1);
471 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
472
473 hr = IBasicAudio_put_Balance(audio, DSBPAN_LEFT);
474 ok(hr == S_OK, "Got hr %#lx.\n", hr);
475
476 hr = IBasicAudio_get_Balance(audio, &balance);
477 ok(hr == S_OK, "Got hr %#lx.\n", hr);
478 ok(balance == DSBPAN_LEFT, "Got balance %ld.\n", balance);
479 }
480
481 hr = IBasicAudio_get_Volume(audio, &volume);
482 ok(hr == S_OK, "Got hr %#lx.\n", hr);
483 ok(volume == 0, "Got volume %ld.\n", volume);
484
485 hr = IBasicAudio_put_Volume(audio, DSBVOLUME_MIN - 1);
486 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
487
488 hr = IBasicAudio_put_Volume(audio, DSBVOLUME_MIN);
489 ok(hr == S_OK, "Got hr %#lx.\n", hr);
490
491 hr = IBasicAudio_get_Volume(audio, &volume);
492 ok(hr == S_OK, "Got hr %#lx.\n", hr);
493 ok(volume == DSBVOLUME_MIN, "Got volume %ld.\n", volume);
494
495 hr = IBasicAudio_GetTypeInfoCount(audio, &count);
496 ok(hr == S_OK, "Got hr %#lx.\n", hr);
497 ok(count == 1, "Got count %u.\n", count);
498
499 hr = IBasicAudio_GetTypeInfo(audio, 0, 0, &typeinfo);
500 ok(hr == S_OK, "Got hr %#lx.\n", hr);
501 hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
502 ok(hr == S_OK, "Got hr %#lx.\n", hr);
503 ok(typeattr->typekind == TKIND_DISPATCH, "Got kind %u.\n", typeattr->typekind);
504 ok(IsEqualGUID(&typeattr->guid, &IID_IBasicAudio), "Got IID %s.\n", wine_dbgstr_guid(&typeattr->guid));
505 ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
506 ITypeInfo_Release(typeinfo);
507
508 IBasicAudio_Release(audio);
509 ref = IBaseFilter_Release(filter);
510 ok(!ref, "Got outstanding refcount %ld.\n", ref);
511}
512
513static void test_enum_media_types(void)
514{
516 IEnumMediaTypes *enum1, *enum2;
517 AM_MEDIA_TYPE *mts[2];
518 ULONG ref, count;
519 HRESULT hr;
520 IPin *pin;
521
522 IBaseFilter_FindPin(filter, sink_id, &pin);
523
524 hr = IPin_EnumMediaTypes(pin, &enum1);
525 ok(hr == S_OK, "Got hr %#lx.\n", hr);
526
527 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
528 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
529 if (hr == S_OK) CoTaskMemFree(mts[0]->pbFormat);
530 if (hr == S_OK) CoTaskMemFree(mts[0]);
531
532 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
533 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
534
535 hr = IEnumMediaTypes_Reset(enum1);
536 ok(hr == S_OK, "Got hr %#lx.\n", hr);
537
538 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
539 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
540 todo_wine ok(count == 1, "Got count %lu.\n", count);
541 if (hr == S_OK) CoTaskMemFree(mts[0]->pbFormat);
542 if (hr == S_OK) CoTaskMemFree(mts[0]);
543
544 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
545 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
546 ok(!count, "Got count %lu.\n", count);
547
548 hr = IEnumMediaTypes_Reset(enum1);
549 ok(hr == S_OK, "Got hr %#lx.\n", hr);
550
551 hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
552 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
553 todo_wine ok(count == 1, "Got count %lu.\n", count);
554 if (count > 0) CoTaskMemFree(mts[0]->pbFormat);
555 if (count > 0) CoTaskMemFree(mts[0]);
556
557 hr = IEnumMediaTypes_Reset(enum1);
558 ok(hr == S_OK, "Got hr %#lx.\n", hr);
559
560 hr = IEnumMediaTypes_Clone(enum1, &enum2);
561 ok(hr == S_OK, "Got hr %#lx.\n", hr);
562
563 hr = IEnumMediaTypes_Skip(enum1, 2);
564 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
565
566 hr = IEnumMediaTypes_Skip(enum1, 1);
567 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
568
569 hr = IEnumMediaTypes_Reset(enum1);
570 ok(hr == S_OK, "Got hr %#lx.\n", hr);
571
572 hr = IEnumMediaTypes_Skip(enum1, 1);
573 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
574
575 hr = IEnumMediaTypes_Skip(enum1, 1);
576 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
577
578 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
579 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
580
581 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
582 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
583 if (hr == S_OK) CoTaskMemFree(mts[0]->pbFormat);
584 if (hr == S_OK) CoTaskMemFree(mts[0]);
585
586 IEnumMediaTypes_Release(enum1);
587 IEnumMediaTypes_Release(enum2);
588 IPin_Release(pin);
589
590 ref = IBaseFilter_Release(filter);
591 ok(!ref, "Got outstanding refcount %ld.\n", ref);
592}
593
594struct testfilter
595{
596 struct strmbase_filter filter;
597 struct strmbase_source source;
599};
600
601static inline struct testfilter *impl_from_strmbase_filter(struct strmbase_filter *iface)
602{
603 return CONTAINING_RECORD(iface, struct testfilter, filter);
604}
605
606static struct strmbase_pin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
607{
609 if (!index)
610 return &filter->source.pin;
611 return NULL;
612}
613
614static void testfilter_destroy(struct strmbase_filter *iface)
615{
619}
620
622{
623 .filter_get_pin = testfilter_get_pin,
624 .filter_destroy = testfilter_destroy,
625};
626
627static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
628{
630
631 ok(!IsEqualGUID(iid, &IID_IQualityControl), "Unexpected query for IQualityControl.\n");
632
633 if (IsEqualGUID(iid, &IID_IMediaSeeking))
635 else
636 return E_NOINTERFACE;
637
638 IUnknown_AddRef((IUnknown *)*out);
639 return S_OK;
640}
641
644{
645 return S_OK;
646}
647
649{
650 .base.pin_query_interface = testsource_query_interface,
651 .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection,
652 .pfnDecideAllocator = testsource_DecideAllocator,
653};
654
656{
657 return CONTAINING_RECORD(iface, struct testfilter, IMediaSeeking_iface);
658}
659
661{
663 return IUnknown_QueryInterface(filter->filter.outer_unk, iid, out);
664}
665
667{
669 return IUnknown_AddRef(filter->filter.outer_unk);
670}
671
673{
675 return IUnknown_Release(filter->filter.outer_unk);
676}
677
679{
680 ok(0, "Unexpected call.\n");
681 return E_NOTIMPL;
682}
683
685{
686 ok(0, "Unexpected call.\n");
687 return E_NOTIMPL;
688}
689
691{
692 if (winetest_debug > 1) trace("IsFormatSupported(%s)\n", debugstr_guid(format));
693 return E_NOTIMPL;
694}
695
697{
698 ok(0, "Unexpected call.\n");
699 return E_NOTIMPL;
700}
701
703{
704 if (winetest_debug > 1) trace("GetTimeFormat()\n");
705 return E_NOTIMPL;
706}
707
709{
710 ok(0, "Unexpected call.\n");
711 return E_NOTIMPL;
712}
713
715{
716 ok(0, "Unexpected call.\n");
717 return E_NOTIMPL;
718}
719
721{
722 ok(0, "Unexpected call.\n");
723 return E_NOTIMPL;
724}
725
727{
728 if (winetest_debug > 1) trace("GetStopPosition()\n");
729 return E_NOTIMPL;
730}
731
733{
734 if (winetest_debug > 1) trace("GetCurrentPosition()\n");
735 return 0xdeadbeef;
736}
737
739 const GUID *target_format, LONGLONG source, const GUID *source_format)
740{
741 ok(0, "Unexpected call.\n");
742 return E_NOTIMPL;
743}
744
746 DWORD current_flags, LONGLONG *stop, DWORD stop_flags)
747{
748 ok(0, "Unexpected call.\n");
749 return E_NOTIMPL;
750}
751
753{
754 ok(0, "Unexpected call.\n");
755 return E_NOTIMPL;
756}
757
759{
760 ok(0, "Unexpected call.\n");
761 return E_NOTIMPL;
762}
763
765{
766 ok(0, "Unexpected call.\n");
767 return E_NOTIMPL;
768}
769
771{
772 if (winetest_debug > 1) trace("GetRate()\n");
773 return E_NOTIMPL;
774}
775
777{
778 ok(0, "Unexpected call.\n");
779 return E_NOTIMPL;
780}
781
782static const IMediaSeekingVtbl testseek_vtbl =
783{
804};
805
807{
808 static const GUID clsid = {0xabacab};
812}
813
815{
816 IMemAllocator *req_allocator, *ret_allocator;
818 HRESULT hr;
819
820 hr = IMemInputPin_GetAllocatorRequirements(input, &props);
821 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
822
823 hr = IMemInputPin_GetAllocator(input, &ret_allocator);
824 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
825
826 if (hr == S_OK)
827 {
828 hr = IMemAllocator_GetProperties(ret_allocator, &props);
829 ok(hr == S_OK, "Got hr %#lx.\n", hr);
830 ok(!props.cBuffers, "Got %ld buffers.\n", props.cBuffers);
831 ok(!props.cbBuffer, "Got size %ld.\n", props.cbBuffer);
832 ok(!props.cbAlign, "Got alignment %ld.\n", props.cbAlign);
833 ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
834
835 hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
836 ok(hr == S_OK, "Got hr %#lx.\n", hr);
837 IMemAllocator_Release(ret_allocator);
838 }
839
840 hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
841 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
842
843 CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
844 &IID_IMemAllocator, (void **)&req_allocator);
845
846 hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
847 ok(hr == S_OK, "Got hr %#lx.\n", hr);
848
849 hr = IMemInputPin_GetAllocator(input, &ret_allocator);
850 ok(hr == S_OK, "Got hr %#lx.\n", hr);
851 ok(ret_allocator == req_allocator, "Allocators didn't match.\n");
852
853 IMemAllocator_Release(req_allocator);
854 IMemAllocator_Release(ret_allocator);
855}
856
858{
861};
862
864{
866 HRESULT hr;
867
868 if (winetest_debug > 1) trace("%04lx: Sending frame.\n", GetCurrentThreadId());
869 hr = IMemInputPin_Receive(params->sink, params->sample);
870 if (winetest_debug > 1) trace("%04lx: Returned %#lx.\n", GetCurrentThreadId(), hr);
871 IMediaSample_Release(params->sample);
872 free(params);
873 return hr;
874}
875
877{
878 struct frame_thread_params *params = malloc(sizeof(*params));
879 REFERENCE_TIME start_time, end_time;
881 unsigned short *words;
883 unsigned int i;
885 HRESULT hr;
886 BYTE *data;
887 DWORD ret;
888
889 hr = IMemInputPin_GetAllocator(sink, &allocator);
890 ok(hr == S_OK, "Got hr %#lx.\n", hr);
891
892 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
893 ok(hr == S_OK, "Got hr %#lx.\n", hr);
894
895 hr = IMediaSample_GetPointer(sample, &data);
896 ok(hr == S_OK, "Got hr %#lx.\n", hr);
897 words = (unsigned short *)data;
898 for (i = 0; i < 44100 * 2; i += 2)
899 words[i] = words[i+1] = sinf(i / 20.0f) * 0x7fff;
900
901 hr = IMediaSample_SetActualDataLength(sample, 44100 * 4);
902 ok(hr == S_OK, "Got hr %#lx.\n", hr);
903
904 start_time = 0;
905 end_time = start_time + 10000000;
906 hr = IMediaSample_SetTime(sample, &start_time, &end_time);
907 ok(hr == S_OK, "Got hr %#lx.\n", hr);
908
909 hr = IMediaSample_SetPreroll(sample, TRUE);
910 ok(hr == S_OK, "Got hr %#lx.\n", hr);
911
912 params->sink = sink;
913 params->sample = sample;
916 todo_wine_if (ret) ok(!ret, "Wait failed.\n");
919
920 IMemAllocator_Release(allocator);
921 return ret;
922}
923
924static void test_filter_state(IMemInputPin *input, IMediaSeeking *seeking, IMediaControl *control)
925{
926 OAFilterState state;
928 HRESULT hr;
929
931 ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
932
933 /* The renderer is not fully paused until it receives a sample. The
934 * DirectSound renderer never blocks in Receive(), despite returning S_OK
935 * from ReceiveCanBlock(). Instead it holds on to each sample until its
936 * presentation time, then writes it into the buffer. This is more work
937 * than it's worth to emulate, so for now, we'll ignore this behaviour. */
938
939 hr = IMediaControl_Pause(control);
940 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
941
942 /* It's possible to queue multiple samples while paused. The number of
943 * samples that can be queued depends on the length of each sample, but
944 * it's not particularly clear how. */
945
946 hr = IMediaControl_GetState(control, 0, &state);
947 ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
948
950 ok(hr == S_OK, "Got hr %#lx.\n", hr);
951
952 hr = IMediaControl_GetState(control, 1000, &state);
953 ok(hr == S_OK, "Got hr %#lx.\n", hr);
954
955 hr = IMediaControl_Stop(control);
956 ok(hr == S_OK, "Got hr %#lx.\n", hr);
957
959 ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
960
961 hr = IMediaControl_Pause(control);
962 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
963
964 hr = IMediaControl_GetState(control, 0, &state);
965 ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
966
968 ok(hr == S_OK, "Got hr %#lx.\n", hr);
969
970 hr = IMediaControl_GetState(control, 1000, &state);
971 ok(hr == S_OK, "Got hr %#lx.\n", hr);
972
973 hr = IMediaControl_Run(control);
974 ok(hr == S_OK, "Got hr %#lx.\n", hr);
975
976 hr = IMediaControl_GetState(control, 0, &state);
977 ok(hr == S_OK, "Got hr %#lx.\n", hr);
978
980 ok(hr == S_OK, "Got hr %#lx.\n", hr);
981
983 ok(hr == S_OK, "Got hr %#lx.\n", hr);
984
985 hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
986 ok(hr == 0xdeadbeef, "Got hr %#lx.\n", hr);
987
988 hr = IMediaControl_GetState(control, 0, &state);
989 ok(hr == S_OK, "Got hr %#lx.\n", hr);
990
991 hr = IMediaControl_Run(control);
992 ok(hr == S_OK, "Got hr %#lx.\n", hr);
993
994 hr = IMediaControl_GetState(control, 0, &state);
995 ok(hr == S_OK, "Got hr %#lx.\n", hr);
996
997 hr = IMediaControl_Pause(control);
998 ok(hr == S_OK, "Got hr %#lx.\n", hr);
999
1000 hr = IMediaControl_GetState(control, 0, &state);
1001 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1002
1003 hr = IMediaControl_Stop(control);
1004 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1005
1006 hr = IMediaControl_GetState(control, 0, &state);
1007 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1008
1009 /* The DirectSound renderer will silently refuse to transition to running
1010 * if it hasn't finished pausing yet. Once it does it reports itself as
1011 * completely paused. */
1012}
1013
1014static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control)
1015{
1016 OAFilterState state;
1017 HRESULT hr;
1018
1019 hr = IMediaControl_Pause(control);
1020 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1021
1022 hr = send_frame(input);
1023 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1024
1025 hr = IMediaControl_GetState(control, 0, &state);
1026 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1027
1028 hr = IPin_BeginFlush(pin);
1029 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1030
1031 hr = send_frame(input);
1032 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1033
1034 hr = IPin_EndFlush(pin);
1035 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1036
1037 hr = IMediaControl_GetState(control, 0, &state);
1038 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1039
1040 hr = IMediaControl_Run(control);
1041 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1042
1043 hr = IPin_BeginFlush(pin);
1044 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1045
1046 hr = send_frame(input);
1047 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1048
1049 hr = IPin_EndFlush(pin);
1050 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1051
1052 hr = send_frame(input);
1053 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1054
1055 hr = IMediaControl_Stop(control);
1056 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1057}
1058
1059static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
1060{
1061 LONG_PTR param1, param2;
1062 unsigned int ret = 0;
1063 HRESULT hr;
1064 LONG code;
1065
1066 while ((hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, timeout)) == S_OK)
1067 {
1068 if (code == EC_COMPLETE)
1069 {
1070 ok(param1 == S_OK, "Got param1 %#Ix.\n", param1);
1071 ok(!param2, "Got param2 %#Ix.\n", param2);
1072 ret++;
1073 }
1074 IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
1075 timeout = 0;
1076 }
1077 ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
1078
1079 return ret;
1080}
1081
1082static void test_eos(IPin *pin, IMemInputPin *input, IMediaSeeking *seeking, IMediaControl *control)
1083{
1084 IMediaEvent *eventsrc;
1085 OAFilterState state;
1086 LONGLONG time;
1087 HRESULT hr;
1088 BOOL ret;
1089
1090 IMediaControl_QueryInterface(control, &IID_IMediaEvent, (void **)&eventsrc);
1091
1092 hr = IMediaControl_Pause(control);
1093 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1094 ret = check_ec_complete(eventsrc, 0);
1095 ok(!ret, "Got unexpected EC_COMPLETE.\n");
1096
1097 hr = IPin_EndOfStream(pin);
1098 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1099
1100 hr = IMediaControl_GetState(control, 1000, &state);
1101 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1102 ret = check_ec_complete(eventsrc, 0);
1103 ok(!ret, "Got unexpected EC_COMPLETE.\n");
1104
1105 hr = send_frame(input);
1106 todo_wine ok(hr == VFW_E_SAMPLE_REJECTED_EOS, "Got hr %#lx.\n", hr);
1107
1108 hr = IMediaControl_Run(control);
1109 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1110 ret = check_ec_complete(eventsrc, 0);
1111 ok(ret == 1, "Expected EC_COMPLETE.\n");
1112
1113 hr = IMediaControl_Stop(control);
1114 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1115 ret = check_ec_complete(eventsrc, 0);
1116 ok(!ret, "Got unexpected EC_COMPLETE.\n");
1117
1118 /* We do not receive an EC_COMPLETE notification until the last sample is
1119 * done rendering. */
1120
1121 hr = IMediaControl_Pause(control);
1122 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1123 hr = send_frame(input);
1124 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1125 hr = IMediaControl_GetState(control, 1000, &state);
1126 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1127 hr = IMediaControl_Run(control);
1128 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1129 ret = check_ec_complete(eventsrc, 0);
1130 ok(!ret, "Got unexpected EC_COMPLETE.\n");
1131
1132 hr = IPin_EndOfStream(pin);
1133 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1134 ret = check_ec_complete(eventsrc, 0);
1135 todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
1136 ret = check_ec_complete(eventsrc, 2000);
1137 todo_wine ok(ret == 1, "Expected EC_COMPLETE.\n");
1138
1139 hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
1140 ok(hr == 0xdeadbeef, "Got hr %#lx.\n", hr);
1141
1142 hr = IMediaControl_Stop(control);
1143 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1144 ret = check_ec_complete(eventsrc, 0);
1145 ok(!ret, "Got unexpected EC_COMPLETE.\n");
1146
1147 /* Test sending EOS while flushing. */
1148
1149 hr = IMediaControl_Run(control);
1150 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1151 hr = send_frame(input);
1152 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1153
1154 hr = IPin_BeginFlush(pin);
1155 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1156 hr = IPin_EndOfStream(pin);
1157 todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1158 hr = IPin_EndFlush(pin);
1159 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1160
1161 hr = IMediaControl_Stop(control);
1162 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1163 ret = check_ec_complete(eventsrc, 0);
1164 todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
1165
1166 /* Test sending EOS and then flushing or stopping. */
1167
1168 hr = IMediaControl_Pause(control);
1169 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1170 hr = send_frame(input);
1171 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1172 hr = IMediaControl_GetState(control, 1000, &state);
1173 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1174 hr = IMediaControl_Run(control);
1175 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1176 ret = check_ec_complete(eventsrc, 0);
1177 ok(!ret, "Got unexpected EC_COMPLETE.\n");
1178
1179 hr = IPin_EndOfStream(pin);
1180 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1181 ret = check_ec_complete(eventsrc, 0);
1182 todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
1183
1184 hr = IPin_BeginFlush(pin);
1185 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1186 hr = IPin_EndFlush(pin);
1187 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1188
1189 hr = send_frame(input);
1190 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1191 hr = IPin_EndOfStream(pin);
1192 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1193 ret = check_ec_complete(eventsrc, 0);
1194 ok(!ret, "Got unexpected EC_COMPLETE.\n");
1195
1196 hr = IMediaControl_Stop(control);
1197 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1198 ret = check_ec_complete(eventsrc, 0);
1199 ok(!ret, "Got unexpected EC_COMPLETE.\n");
1200
1201 IMediaEvent_Release(eventsrc);
1202}
1203
1204static void test_connect_pin(void)
1205{
1206 ALLOCATOR_PROPERTIES req_props = {1, 4 * 44100, 1, 0}, ret_props;
1207 WAVEFORMATEX wfx =
1208 {
1210 .nChannels = 2,
1211 .nSamplesPerSec = 44100,
1212 .nAvgBytesPerSec = 44100 * 4,
1213 .nBlockAlign = 4,
1214 .wBitsPerSample = 16,
1215 };
1216 AM_MEDIA_TYPE req_mt =
1217 {
1218 .majortype = MEDIATYPE_Audio,
1219 .subtype = MEDIASUBTYPE_PCM,
1220 .formattype = FORMAT_WaveFormatEx,
1221 .cbFormat = sizeof(wfx),
1222 .pbFormat = (BYTE *)&wfx,
1223 };
1225 struct testfilter source;
1227 IMediaSeeking *seeking;
1228 IMediaControl *control;
1232 IPin *pin, *peer;
1233 HRESULT hr;
1234 ULONG ref;
1235
1237
1238 CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&graph);
1239 IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, L"source");
1240 IFilterGraph2_AddFilter(graph, filter, L"sink");
1241 IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
1242
1243 IBaseFilter_FindPin(filter, sink_id, &pin);
1244 IBaseFilter_QueryInterface(filter, &IID_IMediaSeeking, (void **)&seeking);
1245
1246 peer = (IPin *)0xdeadbeef;
1247 hr = IPin_ConnectedTo(pin, &peer);
1248 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1249 ok(!peer, "Got peer %p.\n", peer);
1250
1251 hr = IPin_ConnectionMediaType(pin, &mt);
1252 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1253
1254 hr = IMediaControl_Pause(control);
1255 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1256 hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
1257 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1258 hr = IMediaControl_Stop(control);
1259 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1260
1261 hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
1262 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1263
1264 hr = IPin_ConnectedTo(pin, &peer);
1265 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1266 ok(peer == &source.source.pin.IPin_iface, "Got peer %p.\n", peer);
1267 IPin_Release(peer);
1268
1269 hr = IPin_ConnectionMediaType(pin, &mt);
1270 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1271 ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
1272
1273 hr = IMediaControl_Pause(control);
1274 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1275 hr = IFilterGraph2_Disconnect(graph, pin);
1276 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1277 hr = IMediaControl_Stop(control);
1278 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1279
1280 IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
1281
1283
1284 hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
1285 &IID_IMemAllocator, (void **)&allocator);
1286 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1287 hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
1288 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1289 ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
1290 hr = IMemInputPin_NotifyAllocator(input, allocator, TRUE);
1291 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1292 hr = IMemAllocator_Commit(allocator);
1293 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1294
1295 hr = IMemInputPin_ReceiveCanBlock(input);
1296 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1297
1298 test_filter_state(input, seeking, control);
1300 test_eos(pin, input, seeking, control);
1301
1302 hr = IFilterGraph2_Disconnect(graph, pin);
1303 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1304 hr = IFilterGraph2_Disconnect(graph, pin);
1305 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1306 ok(source.source.pin.peer == pin, "Got peer %p.\n", source.source.pin.peer);
1307 IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
1308
1309 peer = (IPin *)0xdeadbeef;
1310 hr = IPin_ConnectedTo(pin, &peer);
1311 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1312 ok(!peer, "Got peer %p.\n", peer);
1313
1314 hr = IPin_ConnectionMediaType(pin, &mt);
1315 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1316
1317 ref = IMemAllocator_Release(allocator);
1318 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1319 IMemInputPin_Release(input);
1320 IPin_Release(pin);
1321 IMediaControl_Release(control);
1322 ref = IFilterGraph2_Release(graph);
1323 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1324 IMediaSeeking_Release(seeking);
1325 ref = IBaseFilter_Release(filter);
1326 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1327 ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
1328 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1329}
1330
1332{
1334 FILTER_STATE state;
1335 HRESULT hr;
1336 ULONG ref;
1337
1338 hr = IBaseFilter_GetState(filter, 0, &state);
1339 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1340 ok(state == State_Stopped, "Got state %u.\n", state);
1341
1342 hr = IBaseFilter_Pause(filter);
1343 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1344
1345 hr = IBaseFilter_GetState(filter, 0, &state);
1346 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1347 ok(state == State_Paused, "Got state %u.\n", state);
1348
1349 hr = IBaseFilter_Run(filter, 0);
1350 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1351
1352 hr = IBaseFilter_GetState(filter, 0, &state);
1353 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1354 ok(state == State_Running, "Got state %u.\n", state);
1355
1356 hr = IBaseFilter_Pause(filter);
1357 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1358
1359 hr = IBaseFilter_GetState(filter, 0, &state);
1360 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1361 ok(state == State_Paused, "Got state %u.\n", state);
1362
1363 hr = IBaseFilter_Stop(filter);
1364 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1365
1366 hr = IBaseFilter_GetState(filter, 0, &state);
1367 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1368 ok(state == State_Stopped, "Got state %u.\n", state);
1369
1370 hr = IBaseFilter_Run(filter, 0);
1371 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1372
1373 hr = IBaseFilter_GetState(filter, 0, &state);
1374 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1375 ok(state == State_Running, "Got state %u.\n", state);
1376
1377 hr = IBaseFilter_Stop(filter);
1378 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1379
1380 hr = IBaseFilter_GetState(filter, 0, &state);
1381 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1382 ok(state == State_Stopped, "Got state %u.\n", state);
1383
1384 ref = IBaseFilter_Release(filter);
1385 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1386}
1387
1389{
1390 const DSBUFFERDESC desc =
1391 {
1392 .dwSize = sizeof(DSBUFFERDESC),
1393 .dwBufferBytes = format->nAvgBytesPerSec,
1394 .lpwfxFormat = format,
1395 };
1396 IDirectSoundBuffer *buffer;
1397 IDirectSound *dsound;
1398 HRESULT hr;
1399
1400 hr = DirectSoundCreate(NULL, &dsound, NULL);
1401 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1402
1404 if (hr == S_OK)
1406 IDirectSound_Release(dsound);
1407
1408 return hr == S_OK ? S_OK : S_FALSE;
1409}
1410
1411static void test_media_types(void)
1412{
1414 AM_MEDIA_TYPE *mt, req_mt = {{0}};
1415 IEnumMediaTypes *enummt;
1416 WAVEFORMATEX wfx = {0};
1418 unsigned int i, j;
1419 WORD channels;
1420 ULONG ref;
1421 IPin *pin;
1422
1423 static const DWORD sample_rates[] = {8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 96000};
1424
1425 static const struct
1426 {
1427 WORD tag;
1428 WORD depth;
1429 } formats[] =
1430 {
1431 {WAVE_FORMAT_PCM, 8},
1432 {WAVE_FORMAT_PCM, 16},
1433 {WAVE_FORMAT_PCM, 24},
1434 {WAVE_FORMAT_PCM, 32},
1437 };
1438
1439 IBaseFilter_FindPin(filter, sink_id, &pin);
1440
1441 hr = IPin_EnumMediaTypes(pin, &enummt);
1442 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1443
1444 hr = IEnumMediaTypes_Next(enummt, 1, &mt, NULL);
1445 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
1446 if (hr == S_OK)
1447 {
1448 ok(IsEqualGUID(&mt->majortype, &MEDIATYPE_Audio), "Got major type %s.\n", wine_dbgstr_guid(&mt->majortype));
1449 ok(IsEqualGUID(&mt->subtype, &GUID_NULL), "Got subtype %s.\n", wine_dbgstr_guid(&mt->subtype));
1450 ok(mt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", mt->bFixedSizeSamples);
1451 ok(!mt->bTemporalCompression, "Got temporal compression %d.\n", mt->bTemporalCompression);
1452 ok(mt->lSampleSize == 1, "Got sample size %lu.\n", mt->lSampleSize);
1453 ok(IsEqualGUID(&mt->formattype, &GUID_NULL), "Got format type %s.\n", wine_dbgstr_guid(&mt->formattype));
1454 ok(!mt->pUnk, "Got pUnk %p.\n", mt->pUnk);
1455 ok(!mt->cbFormat, "Got format size %lu.\n", mt->cbFormat);
1456 ok(!mt->pbFormat, "Got unexpected format block.\n");
1457
1458 hr = IPin_QueryAccept(pin, mt);
1459 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1460
1462 }
1463
1464 hr = IEnumMediaTypes_Next(enummt, 1, &mt, NULL);
1465 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1466
1467 req_mt.majortype = MEDIATYPE_Audio;
1468 req_mt.formattype = FORMAT_WaveFormatEx;
1469 req_mt.cbFormat = sizeof(WAVEFORMATEX);
1470 req_mt.pbFormat = (BYTE *)&wfx;
1471
1472 IEnumMediaTypes_Release(enummt);
1473
1474 for (channels = 1; channels <= 2; ++channels)
1475 {
1476 wfx.nChannels = channels;
1477
1478 for (i = 0; i < ARRAY_SIZE(formats); ++i)
1479 {
1480 wfx.wFormatTag = formats[i].tag;
1481 wfx.wBitsPerSample = formats[i].depth;
1482 wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8;
1483 for (j = 0; j < ARRAY_SIZE(sample_rates); ++j)
1484 {
1485 wfx.nSamplesPerSec = sample_rates[j];
1487
1489
1490 hr = IPin_QueryAccept(pin, &req_mt);
1491 ok(hr == expect_hr, "Expected hr %#lx, got %#lx, for %d channels, %d-bit %s, %ld Hz.\n",
1493 formats[i].tag == WAVE_FORMAT_PCM ? "integer" : "float", sample_rates[j]);
1494 }
1495 }
1496 }
1497
1498 IPin_Release(pin);
1499 ref = IBaseFilter_Release(filter);
1500 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1501}
1502
1503static void test_unconnected_eos(void)
1504{
1507 IMediaControl *control;
1508 IMediaEvent *eventsrc;
1509 unsigned int ret;
1510 HRESULT hr;
1511 ULONG ref;
1512
1513 hr = IFilterGraph2_AddFilter(graph, filter, L"renderer");
1514 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1515
1516 hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
1517 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1518
1519 hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
1520 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1521
1522 ret = check_ec_complete(eventsrc, 0);
1523 ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
1524
1525 hr = IMediaControl_Pause(control);
1526 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1527
1528 ret = check_ec_complete(eventsrc, 0);
1529 ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
1530
1531 hr = IMediaControl_Run(control);
1532 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1533
1534 ret = check_ec_complete(eventsrc, 0);
1535 ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
1536
1537 hr = IMediaControl_Pause(control);
1538 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1539
1540 ret = check_ec_complete(eventsrc, 0);
1541 ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
1542
1543 hr = IMediaControl_Run(control);
1544 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1545
1546 ret = check_ec_complete(eventsrc, 0);
1547 ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
1548
1549 hr = IMediaControl_Stop(control);
1550 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1551
1552 ret = check_ec_complete(eventsrc, 0);
1553 ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
1554
1555 hr = IMediaControl_Run(control);
1556 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1557
1558 ret = check_ec_complete(eventsrc, 0);
1559 ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
1560
1561 IMediaControl_Release(control);
1562 IMediaEvent_Release(eventsrc);
1563 ref = IFilterGraph2_Release(graph);
1564 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1565 ref = IBaseFilter_Release(filter);
1566 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1567}
1568
1569START_TEST(dsoundrender)
1570{
1572 HRESULT hr;
1573
1575
1576 hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER,
1577 &IID_IBaseFilter, (void **)&filter);
1579 {
1580 skip("No audio hardware.\n");
1582 return;
1583 }
1584 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1585 IBaseFilter_Release(filter);
1586
1591 test_find_pin();
1592 test_pin_info();
1599
1601}
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 skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
unsigned int channels
Definition: audiorecord.c:89
unsigned int rate
Definition: audiorecord.c:87
enum _PinDirection PIN_DIRECTION
@ PINDIR_INPUT
Definition: axcore.idl:41
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define ARRAY_SIZE(A)
Definition: main.h:20
static HANDLE thread
Definition: service.c:33
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
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
const GUID IID_IBaseFilter
const GUID IID_IAsyncReader
HRESULT WINAPI DirectSoundCreate(LPCGUID lpcGUID, LPDIRECTSOUND *ppDS, IUnknown *pUnkOuter)
Definition: directsound.c:494
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const struct pixel_format_desc formats[]
Definition: util.c:31
static struct dsound_render * impl_from_strmbase_filter(struct strmbase_filter *iface)
Definition: dsoundrender.c:83
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
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
@ VT_BSTR
Definition: compat.h:2303
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
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
_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
_ACRTIMP float __cdecl sinf(float)
Definition: sinf.c:13
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 _DSBUFFERDESC DSBUFFERDESC
#define DSBPAN_LEFT
Definition: dsound.h:226
#define DSBVOLUME_MIN
Definition: dsound.h:230
#define IDirectSound_Release(p)
Definition: dsound.h:453
#define IDirectSound_CreateSoundBuffer(p, a, b, c)
Definition: dsound.h:455
#define IDirectSoundBuffer_Release(p)
Definition: dsound.h:574
#define EC_COMPLETE
Definition: evcode.h:17
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint buffer
Definition: glext.h:5915
GLuint index
Definition: glext.h:6031
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum const GLfloat * params
Definition: glext.h:5645
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
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 GLint GLint j
Definition: glfuncs.h:250
Definition: axcore.idl:92
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_guid
Definition: kernel32.h:35
#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
__u16 time
Definition: mkdosfs.c:8
#define WAVE_FORMAT_IEEE_FLOAT
Definition: mmreg.h:97
struct task_struct * current
Definition: linux.c:32
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
const char * var
Definition: shader.c:5879
static void test_property_bag(void)
Definition: dsoundrender.c:109
static IBaseFilter * create_dsound_render(void)
Definition: dsoundrender.c:34
static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IMemInputPin *peer, IMemAllocator **allocator)
Definition: dsoundrender.c:642
static HRESULT WINAPI testseek_CheckCapabilities(IMediaSeeking *iface, DWORD *caps)
Definition: dsoundrender.c:684
static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b)
Definition: dsoundrender.c:52
static void testfilter_destroy(struct strmbase_filter *iface)
Definition: dsoundrender.c:614
static const IUnknownVtbl outer_vtbl
Definition: dsoundrender.c:213
static ULONG WINAPI testseek_Release(IMediaSeeking *iface)
Definition: dsoundrender.c:672
static HRESULT send_frame(IMemInputPin *sink)
Definition: dsoundrender.c:876
static ULONG WINAPI testseek_AddRef(IMediaSeeking *iface)
Definition: dsoundrender.c:666
static HRESULT WINAPI testseek_QueryInterface(IMediaSeeking *iface, REFIID iid, void **out)
Definition: dsoundrender.c:660
static HRESULT WINAPI testseek_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop)
Definition: dsoundrender.c:726
static void test_aggregation(void)
Definition: dsoundrender.c:222
static void test_eos(IPin *pin, IMemInputPin *input, IMediaSeeking *seeking, IMediaControl *control)
static void test_basic_audio(void)
Definition: dsoundrender.c:447
static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
Definition: dsoundrender.c:132
static ULONG WINAPI outer_AddRef(IUnknown *iface)
Definition: dsoundrender.c:203
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out)
Definition: dsoundrender.c:190
static HRESULT WINAPI testseek_IsFormatSupported(IMediaSeeking *iface, const GUID *format)
Definition: dsoundrender.c:690
static ULONG get_refcount(void *iface)
Definition: dsoundrender.c:58
static HRESULT WINAPI testseek_SetRate(IMediaSeeking *iface, double rate)
Definition: dsoundrender.c:764
static ULONG WINAPI property_bag_Release(IPropertyBag *iface)
Definition: dsoundrender.c:77
static void test_pin_info(void)
Definition: dsoundrender.c:402
static const IMediaSeekingVtbl testseek_vtbl
Definition: dsoundrender.c:782
static struct testfilter * impl_from_IMediaSeeking(IMediaSeeking *iface)
Definition: dsoundrender.c:655
static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: dsoundrender.c:627
static IUnknown test_outer
Definition: dsoundrender.c:220
static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, const WCHAR *name, VARIANT *var, IErrorLog *log)
Definition: dsoundrender.c:83
static void test_find_pin(void)
Definition: dsoundrender.c:371
static ULONG WINAPI property_bag_AddRef(IPropertyBag *iface)
Definition: dsoundrender.c:71
static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control)
static const struct strmbase_source_ops testsource_ops
Definition: dsoundrender.c:648
static HRESULT WINAPI testseek_GetDuration(IMediaSeeking *iface, LONGLONG *duration)
Definition: dsoundrender.c:720
static void test_enum_media_types(void)
Definition: dsoundrender.c:513
static void test_interfaces(void)
Definition: dsoundrender.c:146
static void test_connect_pin(void)
static DWORD WINAPI frame_thread(void *arg)
Definition: dsoundrender.c:863
static void test_media_types(void)
static HRESULT WINAPI testseek_SetPositions(IMediaSeeking *iface, LONGLONG *current, DWORD current_flags, LONGLONG *stop, DWORD stop_flags)
Definition: dsoundrender.c:745
static HRESULT WINAPI testseek_ConvertTimeFormat(IMediaSeeking *iface, LONGLONG *target, const GUID *target_format, LONGLONG source, const GUID *source_format)
Definition: dsoundrender.c:738
static HRESULT WINAPI testseek_IsUsingTimeFormat(IMediaSeeking *iface, const GUID *format)
Definition: dsoundrender.c:708
static struct strmbase_pin * testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
Definition: dsoundrender.c:606
static void test_allocator(IMemInputPin *input)
Definition: dsoundrender.c:814
static void test_enum_pins(void)
Definition: dsoundrender.c:281
static IFilterGraph2 * create_graph(void)
Definition: dsoundrender.c:43
static HRESULT WINAPI property_bag_QueryInterface(IPropertyBag *iface, REFIID iid, void **out)
Definition: dsoundrender.c:65
static HRESULT WINAPI testseek_QueryPreferredFormat(IMediaSeeking *iface, GUID *format)
Definition: dsoundrender.c:696
static HRESULT WINAPI testseek_GetCapabilities(IMediaSeeking *iface, DWORD *caps)
Definition: dsoundrender.c:678
static HRESULT WINAPI property_bag_Write(IPropertyBag *iface, const WCHAR *name, VARIANT *var)
Definition: dsoundrender.c:94
static HRESULT WINAPI testseek_GetAvailable(IMediaSeeking *iface, LONGLONG *earliest, LONGLONG *latest)
Definition: dsoundrender.c:758
static void test_unconnected_eos(void)
static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
#define check_interface(a, b, c)
Definition: dsoundrender.c:131
static HRESULT WINAPI testseek_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current)
Definition: dsoundrender.c:732
static HRESULT WINAPI testseek_SetTimeFormat(IMediaSeeking *iface, const GUID *format)
Definition: dsoundrender.c:714
static HRESULT WINAPI testseek_GetTimeFormat(IMediaSeeking *iface, GUID *format)
Definition: dsoundrender.c:702
static HRESULT does_dsound_support_format(WAVEFORMATEX *format)
static HRESULT WINAPI testseek_GetPreroll(IMediaSeeking *iface, LONGLONG *preroll)
Definition: dsoundrender.c:776
static LONG outer_ref
Definition: dsoundrender.c:188
static const WCHAR sink_id[]
Definition: dsoundrender.c:32
static HRESULT WINAPI testseek_GetRate(IMediaSeeking *iface, double *rate)
Definition: dsoundrender.c:770
static const IPropertyBagVtbl property_bag_vtbl
Definition: dsoundrender.c:100
static const struct strmbase_filter_ops testfilter_ops
Definition: dsoundrender.c:621
static void test_unconnected_filter_state(void)
static HRESULT WINAPI testseek_GetPositions(IMediaSeeking *iface, LONGLONG *current, LONGLONG *stop)
Definition: dsoundrender.c:752
static const GUID test_iid
Definition: dsoundrender.c:187
static void testfilter_init(struct testfilter *filter)
Definition: dsoundrender.c:806
static ULONG WINAPI outer_Release(IUnknown *iface)
Definition: dsoundrender.c:208
static void test_filter_state(void)
Definition: filtergraph.c:3441
#define expect_hr(expected, got)
Definition: assoc.c:27
const CLSID * clsid
Definition: msctf.cpp:50
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:240
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
const GUID IID_IDispatch
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 log(outFile, fmt,...)
Definition: util.h:15
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_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
DWORD nAvgBytesPerSec
Definition: audioclient.idl:43
WORD wBitsPerSample
Definition: audioclient.idl:45
DWORD nSamplesPerSec
Definition: audioclient.idl:42
Definition: inflate.c:139
Definition: dialog.c:52
Definition: filter.c:165
IBaseFilter * filter
Definition: filtergraph.c:75
IMediaSeeking IMediaSeeking_iface
Definition: filter.c:167
IMemInputPin * sink
Definition: nullrenderer.c:529
IMediaSample * sample
Definition: nullrenderer.c:530
Definition: graph.c:32
Definition: parser.c:49
Definition: name.c:39
Definition: send.c:48
Definition: wave.c:25
struct strmbase_filter * filter
Definition: strmbase.h:58
Definition: ecma_167.h:138
Definition: tools.h:99
IMediaSeeking IMediaSeeking_iface
Definition: amstream.c:1021
const AM_MEDIA_TYPE * mt
Definition: avidec.c:799
IFilterGraph * graph
Definition: filtergraph.c:850
struct strmbase_filter filter
Definition: amstream.c:1019
Definition: dhcpd.h:248
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
int64_t LONGLONG
Definition: typedefs.h:68
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define VFW_E_MONO_AUDIO_HW
Definition: vfwmsgs.h:107
#define VFW_E_SAMPLE_REJECTED_EOS
Definition: vfwmsgs.h:83
#define VFW_E_NOT_STOPPED
Definition: vfwmsgs.h:75
#define VFW_E_WRONG_STATE
Definition: vfwmsgs.h:78
#define VFW_S_STATE_INTERMEDIATE
Definition: vfwmsgs.h:21
#define VFW_E_NO_AUDIO_HARDWARE
Definition: vfwmsgs.h:109
#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
@ TKIND_DISPATCH
Definition: widltypes.h:238
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
void * arg
Definition: msvc.h:10
#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
#define E_ABORT
Definition: winerror.h:3481
unsigned char BYTE
Definition: xxhash.c:193