ReactOS 0.4.17-dev-923-g4c9a150
mpeglayer3.c
Go to the documentation of this file.
1/*
2 * Copyright 2022 Anton Baskanov
3 * Copyright 2018 Zebediah Figura
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#define COBJMACROS
21#include "dshow.h"
22#include "mmreg.h"
23#include "ks.h"
24#include "ksmedia.h"
25#include "wine/strmbase.h"
26#include "wine/test.h"
27
28#include "initguid.h"
29DEFINE_GUID(CLSID_mpeg_layer3_decoder, 0x38be3000, 0xdbf4, 0x11d0, 0x86, 0x0e, 0x00, 0xa0, 0x24, 0xcf, 0xef, 0x6d);
30
32{
34 .wfx.nChannels = 1,
35 .wfx.nSamplesPerSec = 32000,
36 .wfx.nBlockAlign = 48,
37 .wfx.nAvgBytesPerSec = 4000,
38 .wfx.cbSize = sizeof(MPEG1WAVEFORMAT) - sizeof(WAVEFORMATEX),
39 .fwHeadLayer = ACM_MPEG_LAYER1,
40 .dwHeadBitrate = 32000,
41 .fwHeadMode = ACM_MPEG_SINGLECHANNEL,
42 .fwHeadFlags = ACM_MPEG_ID_MPEG1,
43};
44
45static const AM_MEDIA_TYPE mp1_mt =
46{
47 /* MEDIATYPE_Audio, MEDIASUBTYPE_MPEG1AudioPayload, FORMAT_WaveFormatEx */
48 .majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
49 .subtype = {0x00000050, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
50 .bFixedSizeSamples = TRUE,
51 .lSampleSize = 1,
52 .formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
53 .cbFormat = sizeof(MPEG1WAVEFORMAT),
54 .pbFormat = (BYTE *)&mp1_format,
55};
56
58{
60 .wfx.nChannels = 1,
61 .wfx.nSamplesPerSec = 32000,
62 .wfx.nBlockAlign = 144,
63 .wfx.nAvgBytesPerSec = 4000,
64 .wfx.cbSize = sizeof(MPEG1WAVEFORMAT) - sizeof(WAVEFORMATEX),
65 .fwHeadLayer = ACM_MPEG_LAYER2,
66 .dwHeadBitrate = 32000,
67 .fwHeadMode = ACM_MPEG_SINGLECHANNEL,
68 .fwHeadFlags = ACM_MPEG_ID_MPEG1,
69};
70
71static const AM_MEDIA_TYPE mp2_mt =
72{
73 /* MEDIATYPE_Audio, MEDIASUBTYPE_MPEG1AudioPayload, FORMAT_WaveFormatEx */
74 .majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
75 .subtype = {0x00000050, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
76 .bFixedSizeSamples = TRUE,
77 .lSampleSize = 1,
78 .formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
79 .cbFormat = sizeof(MPEG1WAVEFORMAT),
80 .pbFormat = (BYTE *)&mp2_format,
81};
82
84{
86 .wfx.nChannels = 1,
87 .wfx.nSamplesPerSec = 32000,
88 .wfx.nBlockAlign = 144,
89 .wfx.nAvgBytesPerSec = 4000,
90 .wfx.cbSize = sizeof(MPEG1WAVEFORMAT) - sizeof(WAVEFORMATEX),
91 .fwHeadLayer = ACM_MPEG_LAYER3,
92 .dwHeadBitrate = 32000,
93 .fwHeadMode = ACM_MPEG_SINGLECHANNEL,
94 .fwHeadFlags = ACM_MPEG_ID_MPEG1,
95};
96
97static const AM_MEDIA_TYPE mp3_mt0 =
98{
99 /* MEDIATYPE_Audio, MEDIASUBTYPE_MPEG1AudioPayload, FORMAT_WaveFormatEx */
100 .majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
101 .subtype = {0x00000050, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
102 .bFixedSizeSamples = TRUE,
103 .lSampleSize = 1,
104 .formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
105 .cbFormat = sizeof(MPEG1WAVEFORMAT),
106 .pbFormat = (BYTE *)&mp3_format0,
107};
108
110{
112 .wfx.nChannels = 1,
113 .wfx.nSamplesPerSec = 32000,
114 .wfx.nBlockAlign = 144,
115 .wfx.nAvgBytesPerSec = 4000,
116 .wfx.cbSize = sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX),
117 .wID = MPEGLAYER3_ID_MPEG,
118 .nBlockSize = 144,
119 .nFramesPerBlock = 1,
120};
121
122static const AM_MEDIA_TYPE mp3_mt1 =
123{
124 /* MEDIATYPE_Audio, MEDIASUBTYPE_MP3, FORMAT_WaveFormatEx */
125 .majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
126 .subtype = {WAVE_FORMAT_MPEGLAYER3, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
127 .bFixedSizeSamples = TRUE,
128 .lSampleSize = 1,
129 .formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
130 .cbFormat = sizeof(MPEGLAYER3WAVEFORMAT),
131 .pbFormat = (BYTE *)&mp3_format1,
132};
133
135{
137 .Format.nChannels = 1,
138 .Format.nSamplesPerSec = 32000,
139 .Format.wBitsPerSample = 16,
140 .Format.nBlockAlign = 2,
141 .Format.nAvgBytesPerSec = 64000,
142 .Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX),
143 .Samples.wValidBitsPerSample = 16,
144 .dwChannelMask = KSAUDIO_SPEAKER_STEREO,
145 /* KSDATAFORMAT_SUBTYPE_PCM */
146 .SubFormat = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
147};
148
150{
151 /* MEDIATYPE_Audio, MEDIASUBTYPE_PCM, FORMAT_WaveFormatEx */
152 .majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
153 .subtype = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
154 .bFixedSizeSamples = TRUE,
155 .lSampleSize = 2,
156 .formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
157 .cbFormat = sizeof(WAVEFORMATEXTENSIBLE),
158 .pbFormat = (BYTE *)&pcm16ex_format,
159};
160
162{
164 HRESULT hr = CoCreateInstance(&CLSID_mpeg_layer3_decoder, NULL, CLSCTX_INPROC_SERVER,
165 &IID_IBaseFilter, (void **)&filter);
166 ok(hr == S_OK, "Got hr %#lx.\n", hr);
167 return filter;
168}
169
171{
172 return !memcmp(a, b, offsetof(AM_MEDIA_TYPE, pbFormat))
173 && !memcmp(a->pbFormat, b->pbFormat, a->cbFormat);
174}
175
177 WORD channels, DWORD sample_rate, WORD depth)
178{
179 memset(format, 0, sizeof(WAVEFORMATEX));
180 format->wFormatTag = WAVE_FORMAT_PCM;
181 format->nChannels = channels;
182 format->nSamplesPerSec = sample_rate;
183 format->wBitsPerSample = depth;
184 format->nBlockAlign = channels * depth / 8;
185 format->nAvgBytesPerSec = format->nBlockAlign * format->nSamplesPerSec;
186 memset(mt, 0, sizeof(AM_MEDIA_TYPE));
187 mt->majortype = MEDIATYPE_Audio;
188 mt->subtype = MEDIASUBTYPE_PCM;
189 mt->bFixedSizeSamples = TRUE;
190 mt->lSampleSize = format->nBlockAlign;
191 mt->formattype = FORMAT_WaveFormatEx;
192 mt->cbFormat = sizeof(WAVEFORMATEX);
193 mt->pbFormat = (BYTE *)format;
194}
195
196static ULONG get_refcount(void *iface)
197{
198 IUnknown *unknown = iface;
199 IUnknown_AddRef(unknown);
200 return IUnknown_Release(unknown);
201}
202
203#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
204static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
205{
206 IUnknown *iface = iface_ptr;
208 IUnknown *unk;
209
210 expected_hr = supported ? S_OK : E_NOINTERFACE;
211
212 hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
213 ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
214 if (SUCCEEDED(hr))
215 IUnknown_Release(unk);
216}
217
218static void test_interfaces(void)
219{
221 IPin *pin;
222
224 check_interface(filter, &IID_IMediaFilter, TRUE);
227
228 check_interface(filter, &IID_IMpegAudioDecoder, FALSE);
229 check_interface(filter, &IID_IAMFilterMiscFlags, FALSE);
230 check_interface(filter, &IID_IBasicAudio, FALSE);
231 check_interface(filter, &IID_IBasicVideo, FALSE);
233 check_interface(filter, &IID_IMediaPosition, FALSE);
234 check_interface(filter, &IID_IMediaSeeking, FALSE);
236 check_interface(filter, &IID_IQualityControl, FALSE);
237 check_interface(filter, &IID_IQualProp, FALSE);
238 check_interface(filter, &IID_IReferenceClock, FALSE);
239 check_interface(filter, &IID_IVideoWindow, FALSE);
241
242 IBaseFilter_FindPin(filter, L"In", &pin);
243
244 check_interface(pin, &IID_IMemInputPin, TRUE);
246 check_interface(pin, &IID_IQualityControl, TRUE);
248
249 check_interface(pin, &IID_IMediaPosition, FALSE);
250 check_interface(pin, &IID_IMediaSeeking, FALSE);
251
252 IPin_Release(pin);
253
254 IBaseFilter_FindPin(filter, L"Out", &pin);
255
257 check_interface(pin, &IID_IMediaPosition, TRUE);
258 check_interface(pin, &IID_IMediaSeeking, TRUE);
259 check_interface(pin, &IID_IQualityControl, TRUE);
261
263
264 IPin_Release(pin);
265
266 IBaseFilter_Release(filter);
267}
268
269static const GUID test_iid = {0x33333333};
270static LONG outer_ref = 1;
271
273{
274 if (IsEqualGUID(iid, &IID_IUnknown)
276 || IsEqualGUID(iid, &test_iid))
277 {
278 *out = (IUnknown *)0xdeadbeef;
279 return S_OK;
280 }
281 ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid));
282 return E_NOINTERFACE;
283}
284
286{
288}
289
291{
293}
294
295static const IUnknownVtbl outer_vtbl =
296{
300};
301
303
304static void test_aggregation(void)
305{
306 IBaseFilter *filter, *filter2;
307 IUnknown *unk, *unk2;
308 HRESULT hr;
309 ULONG ref;
310
311 filter = (IBaseFilter *)0xdeadbeef;
312 hr = CoCreateInstance(&CLSID_mpeg_layer3_decoder, &test_outer, CLSCTX_INPROC_SERVER,
313 &IID_IBaseFilter, (void **)&filter);
314 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
315 ok(!filter, "Got interface %p.\n", filter);
316
317 hr = CoCreateInstance(&CLSID_mpeg_layer3_decoder, &test_outer, CLSCTX_INPROC_SERVER,
318 &IID_IUnknown, (void **)&unk);
319 ok(hr == S_OK, "Got hr %#lx.\n", hr);
320 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
321 ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
322 ref = get_refcount(unk);
323 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
324
325 ref = IUnknown_AddRef(unk);
326 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
327 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
328
329 ref = IUnknown_Release(unk);
330 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
331 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
332
333 hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
334 ok(hr == S_OK, "Got hr %#lx.\n", hr);
335 ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
336 IUnknown_Release(unk2);
337
338 hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
339 ok(hr == S_OK, "Got hr %#lx.\n", hr);
340
341 hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
342 ok(hr == S_OK, "Got hr %#lx.\n", hr);
343 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
344
345 hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
346 ok(hr == S_OK, "Got hr %#lx.\n", hr);
347 ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
348
349 hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
350 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
351 ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
352
353 hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
354 ok(hr == S_OK, "Got hr %#lx.\n", hr);
355 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
356
357 IBaseFilter_Release(filter);
358 ref = IUnknown_Release(unk);
359 ok(!ref, "Got unexpected refcount %ld.\n", ref);
360 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
361}
362
364{
366 FILTER_STATE state;
367 HRESULT hr;
368 ULONG ref;
369
370 hr = IBaseFilter_GetState(filter, 0, &state);
371 ok(hr == S_OK, "Got hr %#lx.\n", hr);
372 ok(state == State_Stopped, "Got state %u.\n", state);
373
374 hr = IBaseFilter_Pause(filter);
375 ok(hr == S_OK, "Got hr %#lx.\n", hr);
376
377 hr = IBaseFilter_GetState(filter, 0, &state);
378 ok(hr == S_OK, "Got hr %#lx.\n", hr);
379 ok(state == State_Paused, "Got state %u.\n", state);
380
381 hr = IBaseFilter_Run(filter, 0);
382 ok(hr == S_OK, "Got hr %#lx.\n", hr);
383
384 hr = IBaseFilter_GetState(filter, 0, &state);
385 ok(hr == S_OK, "Got hr %#lx.\n", hr);
386 ok(state == State_Running, "Got state %u.\n", state);
387
388 hr = IBaseFilter_Pause(filter);
389 ok(hr == S_OK, "Got hr %#lx.\n", hr);
390
391 hr = IBaseFilter_GetState(filter, 0, &state);
392 ok(hr == S_OK, "Got hr %#lx.\n", hr);
393 ok(state == State_Paused, "Got state %u.\n", state);
394
395 hr = IBaseFilter_Stop(filter);
396 ok(hr == S_OK, "Got hr %#lx.\n", hr);
397
398 hr = IBaseFilter_GetState(filter, 0, &state);
399 ok(hr == S_OK, "Got hr %#lx.\n", hr);
400 ok(state == State_Stopped, "Got state %u.\n", state);
401
402 hr = IBaseFilter_Run(filter, 0);
403 ok(hr == S_OK, "Got hr %#lx.\n", hr);
404
405 hr = IBaseFilter_GetState(filter, 0, &state);
406 ok(hr == S_OK, "Got hr %#lx.\n", hr);
407 ok(state == State_Running, "Got state %u.\n", state);
408
409 hr = IBaseFilter_Stop(filter);
410 ok(hr == S_OK, "Got hr %#lx.\n", hr);
411
412 hr = IBaseFilter_GetState(filter, 0, &state);
413 ok(hr == S_OK, "Got hr %#lx.\n", hr);
414 ok(state == State_Stopped, "Got state %u.\n", state);
415
416 ref = IBaseFilter_Release(filter);
417 ok(!ref, "Got outstanding refcount %ld.\n", ref);
418}
419
420static void test_enum_pins(void)
421{
423 IEnumPins *enum1, *enum2;
424 ULONG count, ref;
425 IPin *pins[3];
426 HRESULT hr;
427
429 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
430
431 hr = IBaseFilter_EnumPins(filter, NULL);
432 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
433
434 hr = IBaseFilter_EnumPins(filter, &enum1);
435 ok(hr == S_OK, "Got hr %#lx.\n", hr);
437 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
438 ref = get_refcount(enum1);
439 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
440
441 hr = IEnumPins_Next(enum1, 1, NULL, NULL);
442 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
443
444 hr = IEnumPins_Next(enum1, 1, pins, NULL);
445 ok(hr == S_OK, "Got hr %#lx.\n", hr);
447 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
448 ref = get_refcount(pins[0]);
449 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
450 ref = get_refcount(enum1);
451 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
452 IPin_Release(pins[0]);
454 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
455
456 hr = IEnumPins_Next(enum1, 1, pins, NULL);
457 ok(hr == S_OK, "Got hr %#lx.\n", hr);
459 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
460 ref = get_refcount(pins[0]);
461 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
462 ref = get_refcount(enum1);
463 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
464 IPin_Release(pins[0]);
466 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
467
468 hr = IEnumPins_Next(enum1, 1, pins, NULL);
469 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
470
471 hr = IEnumPins_Reset(enum1);
472 ok(hr == S_OK, "Got hr %#lx.\n", hr);
473
474 hr = IEnumPins_Next(enum1, 1, pins, &count);
475 ok(hr == S_OK, "Got hr %#lx.\n", hr);
476 ok(count == 1, "Got count %lu.\n", count);
477 IPin_Release(pins[0]);
478
479 hr = IEnumPins_Next(enum1, 1, pins, &count);
480 ok(hr == S_OK, "Got hr %#lx.\n", hr);
481 ok(count == 1, "Got count %lu.\n", count);
482 IPin_Release(pins[0]);
483
484 hr = IEnumPins_Next(enum1, 1, pins, &count);
485 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
486 ok(!count, "Got count %lu.\n", count);
487
488 hr = IEnumPins_Reset(enum1);
489 ok(hr == S_OK, "Got hr %#lx.\n", hr);
490
491 hr = IEnumPins_Next(enum1, 2, pins, NULL);
492 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
493
494 hr = IEnumPins_Next(enum1, 2, pins, &count);
495 ok(hr == S_OK, "Got hr %#lx.\n", hr);
496 ok(count == 2, "Got count %lu.\n", count);
497 IPin_Release(pins[0]);
498 IPin_Release(pins[1]);
499
500 hr = IEnumPins_Next(enum1, 2, pins, &count);
501 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
502 ok(!count, "Got count %lu.\n", count);
503
504 hr = IEnumPins_Reset(enum1);
505 ok(hr == S_OK, "Got hr %#lx.\n", hr);
506
507 hr = IEnumPins_Next(enum1, 3, pins, &count);
508 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
509 ok(count == 2, "Got count %lu.\n", count);
510 IPin_Release(pins[0]);
511 IPin_Release(pins[1]);
512
513 hr = IEnumPins_Reset(enum1);
514 ok(hr == S_OK, "Got hr %#lx.\n", hr);
515
516 hr = IEnumPins_Clone(enum1, &enum2);
517 ok(hr == S_OK, "Got hr %#lx.\n", hr);
518
519 hr = IEnumPins_Skip(enum1, 3);
520 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
521
522 hr = IEnumPins_Skip(enum1, 2);
523 ok(hr == S_OK, "Got hr %#lx.\n", hr);
524
525 hr = IEnumPins_Skip(enum1, 1);
526 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
527
528 hr = IEnumPins_Next(enum1, 1, pins, NULL);
529 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
530
531 hr = IEnumPins_Next(enum2, 1, pins, NULL);
532 ok(hr == S_OK, "Got hr %#lx.\n", hr);
533 IPin_Release(pins[0]);
534
535 IEnumPins_Release(enum2);
536 IEnumPins_Release(enum1);
537 ref = IBaseFilter_Release(filter);
538 ok(!ref, "Got outstanding refcount %ld.\n", ref);
539}
540
541static void test_find_pin(void)
542{
545 IPin *pin, *pin2;
546 HRESULT hr;
547 ULONG ref;
548
549 hr = IBaseFilter_EnumPins(filter, &enum_pins);
550 ok(hr == S_OK, "Got hr %#lx.\n", hr);
551
552 hr = IBaseFilter_FindPin(filter, L"In", &pin);
553 ok(hr == S_OK, "Got hr %#lx.\n", hr);
554 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
555 ok(hr == S_OK, "Got hr %#lx.\n", hr);
556 ok(pin == pin2, "Pins didn't match.\n");
557 IPin_Release(pin);
558 IPin_Release(pin2);
559
560 hr = IBaseFilter_FindPin(filter, L"Out", &pin);
561 ok(hr == S_OK, "Got hr %#lx.\n", hr);
562 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
563 ok(hr == S_OK, "Got hr %#lx.\n", hr);
564 ok(pin == pin2, "Pins didn't match.\n");
565 IPin_Release(pin);
566 IPin_Release(pin2);
567
568 hr = IBaseFilter_FindPin(filter, L"XForm In", &pin);
569 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
570 hr = IBaseFilter_FindPin(filter, L"XForm Out", &pin);
571 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
572 hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
573 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
574 hr = IBaseFilter_FindPin(filter, L"output pin", &pin);
575 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
576
577 IEnumPins_Release(enum_pins);
578 ref = IBaseFilter_Release(filter);
579 ok(!ref, "Got outstanding refcount %ld.\n", ref);
580}
581
582static void test_pin_info(void)
583{
587 HRESULT hr;
588 WCHAR *id;
589 ULONG ref;
590 IPin *pin;
591
592 hr = IBaseFilter_FindPin(filter, L"In", &pin);
593 ok(hr == S_OK, "Got hr %#lx.\n", hr);
595 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
596 ref = get_refcount(pin);
597 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
598
599 hr = IPin_QueryPinInfo(pin, &info);
600 ok(hr == S_OK, "Got hr %#lx.\n", hr);
601 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
602 ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
603 ok(!wcscmp(info.achName, L"XForm In"), "Got name %s.\n", debugstr_w(info.achName));
605 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
606 ref = get_refcount(pin);
607 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
608 IBaseFilter_Release(info.pFilter);
609
610 hr = IPin_QueryDirection(pin, &dir);
611 ok(hr == S_OK, "Got hr %#lx.\n", hr);
612 ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
613
614 hr = IPin_QueryId(pin, &id);
615 ok(hr == S_OK, "Got hr %#lx.\n", hr);
616 ok(!wcscmp(id, L"In"), "Got id %s.\n", wine_dbgstr_w(id));
617 CoTaskMemFree(id);
618
619 hr = IPin_QueryInternalConnections(pin, NULL, NULL);
620 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
621
622 IPin_Release(pin);
623
624 hr = IBaseFilter_FindPin(filter, L"Out", &pin);
625 ok(hr == S_OK, "Got hr %#lx.\n", hr);
626 hr = IPin_QueryPinInfo(pin, &info);
627 ok(hr == S_OK, "Got hr %#lx.\n", hr);
628 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
629 ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
630 ok(!wcscmp(info.achName, L"XForm Out"), "Got name %s.\n", debugstr_w(info.achName));
631 IBaseFilter_Release(info.pFilter);
632
633 hr = IPin_QueryDirection(pin, &dir);
634 ok(hr == S_OK, "Got hr %#lx.\n", hr);
635 ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
636
637 hr = IPin_QueryId(pin, &id);
638 ok(hr == S_OK, "Got hr %#lx.\n", hr);
639 ok(!wcscmp(id, L"Out"), "Got id %s.\n", wine_dbgstr_w(id));
640 CoTaskMemFree(id);
641
642 hr = IPin_QueryInternalConnections(pin, NULL, NULL);
643 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
644
645 IPin_Release(pin);
646
647 ref = IBaseFilter_Release(filter);
648 ok(!ref, "Got outstanding refcount %ld.\n", ref);
649}
650
651static void test_enum_media_types(void)
652{
654 IEnumMediaTypes *enum1, *enum2;
655 AM_MEDIA_TYPE *mts[1];
656 ULONG ref, count;
657 HRESULT hr;
658 IPin *pin;
659
660 IBaseFilter_FindPin(filter, L"In", &pin);
661
662 hr = IPin_EnumMediaTypes(pin, &enum1);
663 ok(hr == S_OK, "Got hr %#lx.\n", hr);
664
665 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
666 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
667
668 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
669 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
670 ok(!count, "Got count %lu.\n", count);
671
672 hr = IEnumMediaTypes_Reset(enum1);
673 ok(hr == S_OK, "Got hr %#lx.\n", hr);
674
675 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
676 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
677
678 hr = IEnumMediaTypes_Clone(enum1, &enum2);
679 ok(hr == S_OK, "Got hr %#lx.\n", hr);
680
681 hr = IEnumMediaTypes_Skip(enum1, 1);
682 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
683
684 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
685 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
686
687 IEnumMediaTypes_Release(enum1);
688 IEnumMediaTypes_Release(enum2);
689 IPin_Release(pin);
690
691 IBaseFilter_FindPin(filter, L"Out", &pin);
692
693 hr = IPin_EnumMediaTypes(pin, &enum1);
694 ok(hr == S_OK, "Got hr %#lx.\n", hr);
695
696 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
697 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
698
699 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
700 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
701 ok(!count, "Got count %lu.\n", count);
702
703 hr = IEnumMediaTypes_Reset(enum1);
704 ok(hr == S_OK, "Got hr %#lx.\n", hr);
705
706 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
707 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
708
709 hr = IEnumMediaTypes_Clone(enum1, &enum2);
710 ok(hr == S_OK, "Got hr %#lx.\n", hr);
711
712 hr = IEnumMediaTypes_Skip(enum1, 1);
713 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
714
715 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
716 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
717
718 IEnumMediaTypes_Release(enum1);
719 IEnumMediaTypes_Release(enum2);
720 IPin_Release(pin);
721
722 ref = IBaseFilter_Release(filter);
723 ok(!ref, "Got outstanding refcount %ld.\n", ref);
724}
725
726static void test_media_types(void)
727{
730 AM_MEDIA_TYPE mt;
731 HRESULT hr;
732 ULONG ref;
733 IPin *pin;
734
735 IBaseFilter_FindPin(filter, L"In", &pin);
736
737 hr = IPin_QueryAccept(pin, &mp3_mt1);
738 ok(hr == S_OK, "Got hr %#lx.\n", hr);
739
740 mt = mp3_mt1;
741 mt.subtype = MEDIASUBTYPE_PCM;
742 hr = IPin_QueryAccept(pin, &mt);
743 ok(hr == S_OK, "Got hr %#lx.\n", hr);
744
745 hr = IPin_QueryAccept(pin, &mp1_mt);
746 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
747
748 hr = IPin_QueryAccept(pin, &mp2_mt);
749 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
750
751 hr = IPin_QueryAccept(pin, &mp3_mt0);
752 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
753
754 mt = mp3_mt1;
755 mt.majortype = GUID_NULL;
756 hr = IPin_QueryAccept(pin, &mt);
757 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
758
759 mt = mp3_mt1;
760 mt.formattype = GUID_NULL;
761 hr = IPin_QueryAccept(pin, &mt);
762 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
763
764 IPin_Release(pin);
765
766 IBaseFilter_FindPin(filter, L"Out", &pin);
767
768 init_pcm_mt(&mt, &format, 1, 32000, 16);
769 hr = IPin_QueryAccept(pin, &mt);
770 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
771
772 IPin_Release(pin);
773
774 ref = IBaseFilter_Release(filter);
775 ok(!ref, "Got outstanding refcount %ld.\n", ref);
776}
777
778struct testqc
779{
787};
788
790{
791 return CONTAINING_RECORD(iface, struct testqc, IQualityControl_iface);
792}
793
795{
796 struct testqc *qc = impl_from_IQualityControl(iface);
797 return IUnknown_QueryInterface(qc->outer_unk, iid, out);
798}
799
801{
802 struct testqc *qc = impl_from_IQualityControl(iface);
803 return IUnknown_AddRef(qc->outer_unk);
804}
805
807{
808 struct testqc *qc = impl_from_IQualityControl(iface);
809 return IUnknown_Release(qc->outer_unk);
810}
811
813{
814 struct testqc *qc = impl_from_IQualityControl(iface);
815
816 qc->notify_sender = sender;
817 qc->notify_quality = q;
818
819 return qc->notify_hr;
820}
821
823{
824 ok(0, "Unexpected call.\n");
825 return E_NOTIMPL;
826}
827
828static const IQualityControlVtbl testqc_vtbl =
829{
835};
836
838{
839 return CONTAINING_RECORD(iface, struct testqc, IUnknown_inner);
840}
841
843{
844 struct testqc *qc = impl_from_qc_IUnknown(iface);
845
846 if (IsEqualIID(iid, &IID_IUnknown))
847 *out = iface;
848 else if (IsEqualIID(iid, &IID_IQualityControl))
850 else
851 return E_NOINTERFACE;
852
853 IUnknown_AddRef((IUnknown *)*out);
854 return S_OK;
855}
856
858{
859 struct testqc *qc = impl_from_qc_IUnknown(iface);
860 return InterlockedIncrement(&qc->refcount);
861}
862
864{
865 struct testqc *qc = impl_from_qc_IUnknown(iface);
866 return InterlockedDecrement(&qc->refcount);
867}
868
869static const IUnknownVtbl testqc_inner_vtbl =
870{
874};
875
876static void testqc_init(struct testqc *qc, IUnknown *outer)
877{
878 memset(qc, 0, sizeof(*qc));
880 qc->IUnknown_inner.lpVtbl = &testqc_inner_vtbl;
881 qc->outer_unk = outer ? outer : &qc->IUnknown_inner;
882}
883
884struct testfilter
885{
886 struct strmbase_filter filter;
887 struct strmbase_source source;
888 struct strmbase_sink sink;
889 struct testqc *qc;
890 const AM_MEDIA_TYPE *mt;
896};
897
898static inline struct testfilter *impl_from_strmbase_filter(struct strmbase_filter *iface)
899{
900 return CONTAINING_RECORD(iface, struct testfilter, filter);
901}
902
903static struct strmbase_pin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
904{
906 if (!index)
907 return &filter->source.pin;
908 return NULL;
909}
910
911static void testfilter_destroy(struct strmbase_filter *iface)
912{
917}
918
920{
921 .filter_get_pin = testfilter_get_pin,
922 .filter_destroy = testfilter_destroy,
923};
924
925static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
926{
928
929 if (IsEqualGUID(iid, &IID_IQualityControl) && filter->qc)
930 *out = &filter->qc->IQualityControl_iface;
931 else
932 return E_NOINTERFACE;
933
934 IUnknown_AddRef((IUnknown *)*out);
935 return S_OK;
936}
937
940{
941 return S_OK;
942}
943
945{
946 .base.pin_query_interface = testsource_query_interface,
947 .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection,
948 .pfnDecideAllocator = testsource_DecideAllocator,
949};
950
951static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
952{
954
955 if (IsEqualGUID(iid, &IID_IMemInputPin))
956 *out = &filter->sink.IMemInputPin_iface;
957 else
958 return E_NOINTERFACE;
959
960 IUnknown_AddRef((IUnknown *)*out);
961 return S_OK;
962}
963
965{
967 if (!index && filter->mt)
968 {
969 CopyMediaType(mt, filter->mt);
970 return S_OK;
971 }
972 return VFW_S_NO_MORE_ITEMS;
973}
974
975static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
976{
977 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
978 if (filter->mt && !IsEqualGUID(&mt->majortype, &filter->mt->majortype))
980 return S_OK;
981}
982
984{
985 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
986 REFERENCE_TIME start, stop;
987 HRESULT hr;
988
989 ++filter->got_sample;
990
991 if (filter->got_sample == 1)
992 {
993 filter->sample_size = IMediaSample_GetSize(sample);
994 filter->sample_actual = IMediaSample_GetActualDataLength(sample);
995 }
996
997 start = 0xdeadbeef;
998 stop = 0xdeadbeef;
999 hr = IMediaSample_GetTime(sample, &start, &stop);
1000 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1001 if (filter->got_sample == 1)
1002 {
1003 filter->sample_start_time = start;
1004 filter->sample_stop_time = stop;
1005 }
1006
1007 return S_OK;
1008}
1009
1012{
1013 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
1014 ++filter->got_new_segment;
1015 ok(start == 10000, "Got start %s.\n", wine_dbgstr_longlong(start));
1016 ok(stop == 20000, "Got stop %s.\n", wine_dbgstr_longlong(stop));
1017 ok(rate == 1.0, "Got rate %.16e.\n", rate);
1018 return S_OK;
1019}
1020
1022{
1023 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
1024 ++filter->got_eos;
1025 return S_OK;
1026}
1027
1029{
1030 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
1031 ++filter->got_begin_flush;
1032 return S_OK;
1033}
1034
1036{
1037 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
1038 ++filter->got_end_flush;
1039 return S_OK;
1040}
1041
1042static const struct strmbase_sink_ops testsink_ops =
1043{
1044 .base.pin_query_interface = testsink_query_interface,
1045 .base.pin_get_media_type = testsink_get_media_type,
1046 .sink_connect = testsink_connect,
1047 .pfnReceive = testsink_Receive,
1048 .sink_new_segment = testsink_new_segment,
1049 .sink_eos = testsink_eos,
1050 .sink_begin_flush = testsink_begin_flush,
1051 .sink_end_flush = testsink_end_flush,
1052};
1053
1055{
1056 static const GUID clsid = {0xabacab};
1057 memset(filter, 0, sizeof(*filter));
1059 strmbase_source_init(&filter->source, &filter->filter, L"source", &testsource_ops);
1061}
1062
1064{
1065 IMemAllocator *req_allocator, *ret_allocator;
1066 ALLOCATOR_PROPERTIES props, ret_props;
1067 HRESULT hr;
1068
1069 hr = IMemInputPin_GetAllocatorRequirements(input, &props);
1070 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
1071
1072 hr = IMemInputPin_GetAllocator(input, &ret_allocator);
1073 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
1074
1075 if (hr == S_OK)
1076 {
1077 hr = IMemAllocator_GetProperties(ret_allocator, &props);
1078 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1079 ok(!props.cBuffers, "Got %ld buffers.\n", props.cBuffers);
1080 ok(!props.cbBuffer, "Got size %ld.\n", props.cbBuffer);
1081 ok(!props.cbAlign, "Got alignment %ld.\n", props.cbAlign);
1082 ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
1083
1084 hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
1085 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1086 IMemAllocator_Release(ret_allocator);
1087 }
1088
1089 hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
1090 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
1091
1092 CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
1093 &IID_IMemAllocator, (void **)&req_allocator);
1094
1095 props.cBuffers = 1;
1096 props.cbBuffer = 256;
1097 props.cbAlign = 1;
1098 props.cbPrefix = 0;
1099 hr = IMemAllocator_SetProperties(req_allocator, &props, &ret_props);
1100 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1101
1102 hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
1103 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1104
1105 hr = IMemInputPin_GetAllocator(input, &ret_allocator);
1106 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1107 ok(ret_allocator == req_allocator, "Allocators didn't match.\n");
1108
1109 IMemAllocator_Release(req_allocator);
1110 IMemAllocator_Release(ret_allocator);
1111}
1112
1114 IPin *sink, IPin *source, struct testfilter *testsource, struct testfilter *testsink)
1115{
1116 ALLOCATOR_PROPERTIES props, req_props = {2, 30000, 32, 0};
1120 AM_MEDIA_TYPE mt;
1121 HRESULT hr;
1122
1123 hr = IFilterGraph2_ConnectDirect(graph, &testsource->source.pin.IPin_iface, sink, &mp3_mt1);
1124 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1125
1126 init_pcm_mt(&mt, &format, 1, 32000, 16);
1127 mt.lSampleSize = 2222;
1128 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &mt);
1129 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1130
1131 ok(!!testsink->sink.pAllocator, "Expected an allocator.\n");
1132 hr = IMemAllocator_GetProperties(testsink->sink.pAllocator, &props);
1133 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1134 /* Earlier versions used 16 buffers of lSampleSize bytes,
1135 * later versions use 8 buffers of lSampleSize * 4 bytes. */
1136 ok(props.cBuffers == 16 || props.cBuffers == 8, "Got %ld buffers.\n", props.cBuffers);
1137 ok(props.cbBuffer == 2222 || props.cbBuffer == 8888, "Got size %ld.\n", props.cbBuffer);
1138 ok(props.cbAlign == 1, "Got alignment %ld.\n", props.cbAlign);
1139 ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
1140
1141 hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0);
1142 ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
1143
1144 hr = IMediaControl_Pause(control);
1145 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1146
1147 hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0);
1148 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1149 if (hr == S_OK)
1150 IMediaSample_Release(sample);
1151
1152 hr = IMediaControl_Stop(control);
1153 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1154
1155 hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0);
1156 ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
1157
1158 IFilterGraph2_Disconnect(graph, source);
1159 IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface);
1160
1161 CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
1162 &IID_IMemAllocator, (void **)&allocator);
1163 testsink->sink.pAllocator = allocator;
1164
1165 hr = IMemAllocator_SetProperties(allocator, &req_props, &props);
1166 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1167
1168 init_pcm_mt(&mt, &format, 1, 32000, 16);
1169 mt.lSampleSize = 2222;
1170 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &mt);
1171 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1172
1173 ok(testsink->sink.pAllocator == allocator, "Expected an allocator.\n");
1174 hr = IMemAllocator_GetProperties(testsink->sink.pAllocator, &props);
1175 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1176 /* Earlier versions used 16 buffers of lSampleSize bytes,
1177 * later versions use 8 buffers of lSampleSize * 4 bytes. */
1178 ok(props.cBuffers == 16 || props.cBuffers == 8, "Got %ld buffers.\n", props.cBuffers);
1179 ok(props.cbBuffer == 2222 || props.cbBuffer == 8888, "Got size %ld.\n", props.cbBuffer);
1180 ok(props.cbAlign == 1, "Got alignment %ld.\n", props.cbAlign);
1181 ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
1182
1183 IFilterGraph2_Disconnect(graph, source);
1184 IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface);
1185
1186 IFilterGraph2_Disconnect(graph, sink);
1187 IFilterGraph2_Disconnect(graph, &testsource->source.pin.IPin_iface);
1188}
1189
1191 IPin *sink, IPin *source, struct testfilter *testsource, struct testfilter *testsink)
1192{
1193 struct testqc testsource_qc;
1194 IQualityControl *source_qc;
1195 IQualityControl *sink_qc;
1196 Quality quality = {0};
1197 struct testqc qc;
1198 HRESULT hr;
1199
1200 testqc_init(&testsource_qc, testsource->filter.outer_unk);
1201 testqc_init(&qc, NULL);
1202
1203 hr = IPin_QueryInterface(sink, &IID_IQualityControl, (void **)&sink_qc);
1204 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1205 hr = IPin_QueryInterface(source, &IID_IQualityControl, (void **)&source_qc);
1206 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1207
1208 hr = IQualityControl_Notify(sink_qc, &testsink->filter.IBaseFilter_iface, quality);
1209 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1210
1211 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1212 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
1213
1214 hr = IQualityControl_SetSink(sink_qc, &qc.IQualityControl_iface);
1215 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1216 qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1217 memset(&qc.notify_quality, 0xaa, sizeof(qc.notify_quality));
1218 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1219 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1220 ok(qc.notify_sender == filter, "Got sender %p.\n", qc.notify_sender);
1221 ok(!memcmp(&qc.notify_quality, &quality, sizeof(quality)), "Quality didn't match.\n");
1222 hr = IQualityControl_SetSink(sink_qc, NULL);
1223 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1224
1225 hr = IQualityControl_SetSink(source_qc, &qc.IQualityControl_iface);
1226 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1227 qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1228 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1229 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
1230 ok(qc.notify_sender == (IBaseFilter *)0xdeadbeef, "Got sender %p.\n", qc.notify_sender);
1231 hr = IQualityControl_SetSink(source_qc, NULL);
1232 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1233
1234 hr = IFilterGraph2_ConnectDirect(graph, &testsource->source.pin.IPin_iface, sink, &mp3_mt1);
1235 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1236
1237 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1238 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
1239
1240 testsource->qc = &testsource_qc;
1241
1242 qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1243 hr = IQualityControl_Notify(sink_qc, &testsink->filter.IBaseFilter_iface, quality);
1244 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1245 ok(qc.notify_sender == (IBaseFilter *)0xdeadbeef, "Got sender %p.\n", qc.notify_sender);
1246
1247 testsource_qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1248 memset(&testsource_qc.notify_quality, 0xaa, sizeof(testsource_qc.notify_quality));
1249 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1250 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1251 ok(testsource_qc.notify_sender == filter, "Got sender %p.\n", testsource_qc.notify_sender);
1252 ok(!memcmp(&testsource_qc.notify_quality, &quality, sizeof(quality)), "Quality didn't match.\n");
1253
1254 testsource_qc.notify_hr = E_FAIL;
1255 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1256 ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
1257 testsource_qc.notify_hr = S_OK;
1258
1259 hr = IQualityControl_SetSink(sink_qc, &qc.IQualityControl_iface);
1260 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1261 qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1262 memset(&qc.notify_quality, 0xaa, sizeof(qc.notify_quality));
1263 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1264 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1265 ok(qc.notify_sender == filter, "Got sender %p.\n", qc.notify_sender);
1266 ok(!memcmp(&qc.notify_quality, &quality, sizeof(quality)), "Quality didn't match.\n");
1267 hr = IQualityControl_SetSink(sink_qc, NULL);
1268 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1269
1270 hr = IQualityControl_SetSink(source_qc, &qc.IQualityControl_iface);
1271 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1272 qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1273 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1274 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1275 ok(qc.notify_sender == (IBaseFilter *)0xdeadbeef, "Got sender %p.\n", qc.notify_sender);
1276 hr = IQualityControl_SetSink(source_qc, NULL);
1277 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1278
1279 IFilterGraph2_Disconnect(graph, sink);
1280 IFilterGraph2_Disconnect(graph, &testsource->source.pin.IPin_iface);
1281
1282 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1283 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
1284
1285 IQualityControl_Release(source_qc);
1286 IQualityControl_Release(sink_qc);
1287
1288 testsource->qc = NULL;
1289}
1290
1291static void test_sample_processing(IMediaControl *control,
1292 IMemInputPin *meminput, struct testfilter *testsink)
1293{
1294 REFERENCE_TIME start, stop;
1297 HRESULT hr;
1298 BYTE *data;
1299 LONG size;
1300
1301 hr = IMemInputPin_ReceiveCanBlock(meminput);
1302 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1303
1304 hr = IMemInputPin_GetAllocator(meminput, &allocator);
1305 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1306
1307 hr = IMediaControl_Pause(control);
1308 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1309
1310 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
1311 ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
1312
1313 hr = IMemAllocator_Commit(allocator);
1314 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1315 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
1316 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1317
1318 hr = IMediaSample_GetPointer(sample, &data);
1319 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1320 size = IMediaSample_GetSize(sample);
1321 ok(size == 256, "Got size %ld.\n", size);
1322 memset(data, 0, 144);
1323 data[0] = 0xff;
1324 data[1] = 0xfb;
1325 data[2] = 0x18;
1326 data[3] = 0xc4;
1327 hr = IMediaSample_SetActualDataLength(sample, 144);
1328 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1329
1330 hr = IMediaSample_SetTime(sample, NULL, NULL);
1331 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1332
1333 hr = IMemInputPin_Receive(meminput, sample);
1334 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1335 hr = IMemInputPin_Receive(meminput, sample);
1336 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1337 hr = IMemInputPin_Receive(meminput, sample);
1338 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1339 ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample);
1340 ok(testsink->sample_size == 2304 || testsink->sample_size == 9216,
1341 "Got size %lu.\n", testsink->sample_size);
1342 ok(testsink->sample_actual == 2304 || testsink->sample_actual == 4608,
1343 "Got valid size %lu.\n", testsink->sample_actual);
1344 ok(testsink->sample_start_time == 0, "Got start time %s.\n",
1345 wine_dbgstr_longlong(testsink->sample_start_time));
1346 ok(testsink->sample_stop_time == (testsink->sample_actual == 2304 ? 360000 : 720000),
1347 "Got stop time %s.\n", wine_dbgstr_longlong(testsink->sample_stop_time));
1348 testsink->got_sample = 0;
1349
1350 hr = IMediaControl_Stop(control);
1351 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1352 hr = IMediaControl_Pause(control);
1353 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1354
1355 start = 22222;
1356 hr = IMediaSample_SetTime(sample, &start, NULL);
1357 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1358
1359 hr = IMemInputPin_Receive(meminput, sample);
1360 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1361 hr = IMemInputPin_Receive(meminput, sample);
1362 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1363 hr = IMemInputPin_Receive(meminput, sample);
1364 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1365 ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample);
1366 ok(testsink->sample_size == 2304 || testsink->sample_size == 9216,
1367 "Got size %lu.\n", testsink->sample_size);
1368 ok(testsink->sample_actual == 2304 || testsink->sample_actual == 4608,
1369 "Got valid size %lu.\n", testsink->sample_actual);
1370 ok(testsink->sample_start_time == 22222, "Got start time %s.\n",
1371 wine_dbgstr_longlong(testsink->sample_start_time));
1372 ok(testsink->sample_stop_time == (testsink->sample_actual == 2304 ? 382222 : 742222),
1373 "Got stop time %s.\n", wine_dbgstr_longlong(testsink->sample_stop_time));
1374 testsink->got_sample = 0;
1375
1376 hr = IMediaControl_Stop(control);
1377 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1378 hr = IMediaControl_Pause(control);
1379 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1380
1381 start = 22222;
1382 stop = 33333;
1383 hr = IMediaSample_SetTime(sample, &start, &stop);
1384 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1385
1386 hr = IMemInputPin_Receive(meminput, sample);
1387 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1388 hr = IMemInputPin_Receive(meminput, sample);
1389 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1390 hr = IMemInputPin_Receive(meminput, sample);
1391 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1392 ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample);
1393 ok(testsink->sample_size == 2304 || testsink->sample_size == 9216,
1394 "Got size %lu.\n", testsink->sample_size);
1395 ok(testsink->sample_actual == 2304 || testsink->sample_actual == 4608,
1396 "Got valid size %lu.\n", testsink->sample_actual);
1397 ok(testsink->sample_start_time == 22222, "Got start time %s.\n",
1398 wine_dbgstr_longlong(testsink->sample_start_time));
1399 ok(testsink->sample_stop_time == (testsink->sample_actual == 2304 ? 382222 : 742222),
1400 "Got stop time %s.\n", wine_dbgstr_longlong(testsink->sample_stop_time));
1401 testsink->got_sample = 0;
1402
1403 hr = IMediaControl_Stop(control);
1404 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1405
1406 hr = IMemInputPin_Receive(meminput, sample);
1407 ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
1408
1409 IMediaSample_Release(sample);
1410 IMemAllocator_Release(allocator);
1411}
1412
1413static void test_streaming_events(IMediaControl *control, IPin *sink,
1414 IMemInputPin *meminput, struct testfilter *testsink)
1415{
1416 REFERENCE_TIME start, stop;
1419 HRESULT hr;
1420 BYTE *data;
1421
1422 hr = IMediaControl_Pause(control);
1423 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1424
1425 hr = IMemInputPin_GetAllocator(meminput, &allocator);
1426 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1427 hr = IMemAllocator_Commit(allocator);
1428 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1429 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
1430 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1431 hr = IMediaSample_GetPointer(sample, &data);
1432 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1433 memset(data, 0, 144);
1434 data[0] = 0xff;
1435 data[1] = 0xfb;
1436 data[2] = 0x18;
1437 data[3] = 0xc4;
1438 hr = IMediaSample_SetActualDataLength(sample, 144);
1439 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1440 start = 0;
1441 stop = 120000;
1442 hr = IMediaSample_SetTime(sample, &start, &stop);
1443 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1444
1445 ok(!testsink->got_new_segment, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment);
1446 hr = IPin_NewSegment(sink, 10000, 20000, 1.0);
1447 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1448 ok(testsink->got_new_segment == 1, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment);
1449 testsink->got_new_segment = 0;
1450
1451 ok(!testsink->got_eos, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
1452 hr = IPin_EndOfStream(sink);
1453 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1454 ok(!testsink->got_sample, "Got %u calls to Receive().\n", testsink->got_sample);
1455 ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
1456 testsink->got_eos = 0;
1457
1458 hr = IPin_EndOfStream(sink);
1459 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1460 ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
1461 testsink->got_eos = 0;
1462
1463 hr = IMemInputPin_Receive(meminput, sample);
1464 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1465 hr = IMemInputPin_Receive(meminput, sample);
1466 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1467 hr = IMemInputPin_Receive(meminput, sample);
1468 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1469 ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample);
1470 testsink->got_sample = 0;
1471
1472 ok(!testsink->got_begin_flush, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush);
1473 hr = IPin_BeginFlush(sink);
1474 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1475 ok(testsink->got_begin_flush == 1, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush);
1476 testsink->got_begin_flush = 1;
1477
1478 hr = IMemInputPin_Receive(meminput, sample);
1479 ok(hr == S_OK || hr == S_FALSE, "Got hr %#lx.\n", hr);
1480
1481 hr = IPin_EndOfStream(sink);
1482 ok(hr == S_OK || hr == S_FALSE, "Got hr %#lx.\n", hr);
1483
1484 ok(!testsink->got_end_flush, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush);
1485 hr = IPin_EndFlush(sink);
1486 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1487 ok(testsink->got_end_flush == 1, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush);
1488 testsink->got_end_flush = 0;
1489
1490 hr = IMemInputPin_Receive(meminput, sample);
1491 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1492 hr = IMemInputPin_Receive(meminput, sample);
1493 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1494 hr = IMemInputPin_Receive(meminput, sample);
1495 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1496 ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample);
1497 testsink->got_sample = 0;
1498
1499 hr = IMediaControl_Stop(control);
1500 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1501 IMediaSample_Release(sample);
1502 IMemAllocator_Release(allocator);
1503}
1504
1505static void test_connect_pin(void)
1506{
1508 struct testfilter testsource, testsink;
1509 AM_MEDIA_TYPE mt, source_mt, *pmt;
1510 WAVEFORMATEX source_format;
1511 WAVEFORMATEX expect_format;
1512 IPin *sink, *source, *peer;
1513 IEnumMediaTypes *enummt;
1514 AM_MEDIA_TYPE expect_mt;
1515 WAVEFORMATEX req_format;
1516 IMediaControl *control;
1517 IMemInputPin *meminput;
1518 AM_MEDIA_TYPE req_mt;
1520 HRESULT hr;
1521 ULONG ref;
1522
1523 CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
1524 &IID_IFilterGraph2, (void **)&graph);
1525 testfilter_init(&testsource);
1527 IFilterGraph2_AddFilter(graph, &testsink.filter.IBaseFilter_iface, L"sink");
1528 IFilterGraph2_AddFilter(graph, &testsource.filter.IBaseFilter_iface, L"source");
1529 IFilterGraph2_AddFilter(graph, filter, L"MPEG layer-3 decoder");
1530 IBaseFilter_FindPin(filter, L"In", &sink);
1531 IBaseFilter_FindPin(filter, L"Out", &source);
1532 IPin_QueryInterface(sink, &IID_IMemInputPin, (void **)&meminput);
1533 IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
1534
1537
1538 /* Test sink connection. */
1539
1540 peer = (IPin *)0xdeadbeef;
1541 hr = IPin_ConnectedTo(sink, &peer);
1542 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1543 ok(!peer, "Got peer %p.\n", peer);
1544
1545 hr = IPin_ConnectionMediaType(sink, &mt);
1546 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1547
1548 hr = IMediaControl_Pause(control);
1549 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1550 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &mp3_mt1);
1551 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1552 hr = IMediaControl_Stop(control);
1553 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1554
1555 req_mt = mp1_mt;
1556 req_mt.subtype = MEDIASUBTYPE_PCM;
1557 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1558 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1559
1560 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &mp3_mt1);
1561 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1562
1563 hr = IPin_ConnectedTo(sink, &peer);
1564 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1565 ok(peer == &testsource.source.pin.IPin_iface, "Got peer %p.\n", peer);
1566 IPin_Release(peer);
1567
1568 hr = IPin_ConnectionMediaType(sink, &mt);
1569 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1570 ok(compare_media_types(&mt, &mp3_mt1), "Media types didn't match.\n");
1571 ok(compare_media_types(&testsource.source.pin.mt, &mp3_mt1), "Media types didn't match.\n");
1572 FreeMediaType(&mt);
1573
1574 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1575 hr = IPin_QueryAccept(source, &req_mt);
1576 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1577
1578 init_pcm_mt(&req_mt, &req_format, 1, 32000, 8);
1579 hr = IPin_QueryAccept(source, &req_mt);
1580 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1581
1582 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1583 req_mt.formattype = GUID_NULL;
1584 hr = IPin_QueryAccept(source, &req_mt);
1585 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1586
1587 init_pcm_mt(&req_mt, &req_format, 2, 32000, 16);
1588 hr = IPin_QueryAccept(source, &req_mt);
1589 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1590
1591 init_pcm_mt(&req_mt, &req_format, 1, 16000, 16);
1592 hr = IPin_QueryAccept(source, &req_mt);
1593 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1594
1595 init_pcm_mt(&req_mt, &req_format, 1, 32000, 24);
1596 hr = IPin_QueryAccept(source, &req_mt);
1597 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1598
1599 hr = IPin_QueryAccept(source, &pcm16ex_mt);
1600 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1601
1602 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1603 req_format.nAvgBytesPerSec = 333;
1604 hr = IPin_QueryAccept(source, &req_mt);
1605 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1606
1607 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1608 req_format.nBlockAlign = 333;
1609 hr = IPin_QueryAccept(source, &req_mt);
1610 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1611
1612 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1613 req_mt.majortype = GUID_NULL;
1614 hr = IPin_QueryAccept(source, &req_mt);
1615 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1616
1617 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1618 req_mt.subtype = GUID_NULL;
1619 hr = IPin_QueryAccept(source, &req_mt);
1620 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1621
1622 hr = IMediaControl_Pause(control);
1623 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1624 hr = IFilterGraph2_Disconnect(graph, sink);
1625 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1626 hr = IMediaControl_Stop(control);
1627 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1628
1629 hr = IPin_EnumMediaTypes(source, &enummt);
1630 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1631
1632 init_pcm_mt(&expect_mt, &expect_format, 1, 32000, 16);
1633 expect_mt.lSampleSize = 2304;
1634
1635 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
1636 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1637 if (hr == S_OK)
1638 {
1639 ok(!memcmp(pmt, &expect_mt, offsetof(AM_MEDIA_TYPE, cbFormat)),
1640 "Media types didn't match.\n");
1641 ok(!memcmp(pmt->pbFormat, &expect_format, sizeof(WAVEFORMATEX)),
1642 "Format blocks didn't match.\n");
1643
1644 DeleteMediaType(pmt);
1645 }
1646
1647 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
1648 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1649
1650 IEnumMediaTypes_Release(enummt);
1651
1652 test_sink_allocator(meminput);
1653
1654 /* Test source connection. */
1655
1656 peer = (IPin *)0xdeadbeef;
1657 hr = IPin_ConnectedTo(source, &peer);
1658 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1659 ok(!peer, "Got peer %p.\n", peer);
1660
1661 hr = IPin_ConnectionMediaType(source, &mt);
1662 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1663
1664 /* Exact connection. */
1665
1666 hr = IMediaControl_Pause(control);
1667 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1668 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1669 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1670 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1671 hr = IMediaControl_Stop(control);
1672 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1673
1674 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1675 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1676 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1677
1678 hr = IPin_ConnectedTo(source, &peer);
1679 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1680 ok(peer == &testsink.sink.pin.IPin_iface, "Got peer %p.\n", peer);
1681 IPin_Release(peer);
1682
1683 hr = IPin_ConnectionMediaType(source, &mt);
1684 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1685 ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
1686 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1687 FreeMediaType(&mt);
1688
1689 hr = IMediaControl_Pause(control);
1690 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1691 hr = IFilterGraph2_Disconnect(graph, source);
1692 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1693 hr = IMediaControl_Stop(control);
1694 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1695
1696 hr = IFilterGraph2_Disconnect(graph, source);
1697 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1698 hr = IFilterGraph2_Disconnect(graph, source);
1699 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1700 ok(testsink.sink.pin.peer == source, "Got peer %p.\n", testsink.sink.pin.peer);
1701 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1702
1703 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1704 req_mt.lSampleSize = 999;
1705 req_mt.bTemporalCompression = TRUE;
1706 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1707 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1708 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1709 IFilterGraph2_Disconnect(graph, source);
1710 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1711
1712 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1713 req_mt.majortype = MEDIATYPE_Video;
1714 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1715 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1716
1717 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1718 req_mt.lSampleSize = 2304;
1719 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1720 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1721
1724
1725 hr = IFilterGraph2_Disconnect(graph, source);
1726 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1727 hr = IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1728 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1729
1730 /* Connection with wildcards. */
1731
1732 init_pcm_mt(&source_mt, &source_format, 1, 32000, 16);
1733 source_mt.lSampleSize = 2304;
1734
1735 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1736 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1737 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1738 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1739 IFilterGraph2_Disconnect(graph, source);
1740 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1741
1742 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1743 req_mt.majortype = GUID_NULL;
1744 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1745 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1746 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1747 IFilterGraph2_Disconnect(graph, source);
1748 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1749
1750 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1751 req_mt.majortype = GUID_NULL;
1752 req_mt.subtype = GUID_NULL;
1753 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1754 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1755 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1756 IFilterGraph2_Disconnect(graph, source);
1757 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1758
1759 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1760 req_mt.majortype = GUID_NULL;
1761 req_mt.subtype = GUID_NULL;
1762 req_mt.formattype = FORMAT_None;
1763 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1764 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1765
1766 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1767 req_mt.formattype = GUID_NULL;
1768 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1769 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1770 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1771 IFilterGraph2_Disconnect(graph, source);
1772 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1773
1774 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1775 req_mt.subtype = GUID_NULL;
1776 req_mt.formattype = GUID_NULL;
1777 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1778 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1779 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1780 IFilterGraph2_Disconnect(graph, source);
1781 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1782
1783 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1784 req_mt.majortype = MEDIATYPE_Video;
1785 req_mt.subtype = GUID_NULL;
1786 req_mt.formattype = GUID_NULL;
1787 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1788 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1789
1790 /* Test enumeration of sink media types. */
1791
1792 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1793 req_mt.majortype = MEDIATYPE_Video;
1794 req_mt.subtype = GUID_NULL;
1795 req_mt.formattype = GUID_NULL;
1796 testsink.mt = &req_mt;
1797 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1798 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1799
1800 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1801 req_mt.lSampleSize = 444;
1802 testsink.mt = &req_mt;
1803 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1804 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1805 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1806
1807 hr = IFilterGraph2_Disconnect(graph, sink);
1808 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1809 hr = IFilterGraph2_Disconnect(graph, sink);
1810 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1811 ok(testsource.source.pin.peer == sink, "Got peer %p.\n", testsource.source.pin.peer);
1812 IFilterGraph2_Disconnect(graph, &testsource.source.pin.IPin_iface);
1813
1814 IMemInputPin_Release(meminput);
1815 IPin_Release(sink);
1816 IPin_Release(source);
1817 IMediaControl_Release(control);
1818 ref = IFilterGraph2_Release(graph);
1819 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1820 ref = IBaseFilter_Release(filter);
1821 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1822 ref = IBaseFilter_Release(&testsource.filter.IBaseFilter_iface);
1823 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1824 ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
1825 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1826}
1827
1828START_TEST(mpeglayer3)
1829{
1831
1833
1834 if (FAILED(CoCreateInstance(&CLSID_mpeg_layer3_decoder, NULL, CLSCTX_INPROC_SERVER,
1835 &IID_IBaseFilter, (void **)&filter)))
1836 {
1837 skip("Failed to create MPEG layer-3 decoder instance.\n");
1838 return;
1839 }
1840 IBaseFilter_Release(filter);
1841
1846 test_find_pin();
1847 test_pin_info();
1851
1853}
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 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_OUTPUT
Definition: axcore.idl:42
@ PINDIR_INPUT
Definition: axcore.idl:41
#define WAVE_FORMAT_PCM
Definition: constants.h:425
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
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
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1674
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
#define L(x)
Definition: resources.c:13
unsigned 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
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
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
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
Definition: axcore.idl:92
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
int quality
Definition: jpeglib.h:994
#define debugstr_w
Definition: kernel32.h:32
#define wine_dbgstr_w
Definition: kernel32.h:34
#define GUID_NULL
Definition: ks.h:106
#define WAVE_FORMAT_EXTENSIBLE
Definition: ksmedia.h:651
#define KSAUDIO_SPEAKER_STEREO
Definition: ksmedia.h:1454
#define todo_wine
Definition: minitest.h:80
#define MPEGLAYER3_ID_MPEG
Definition: mmreg.h:442
#define WAVE_FORMAT_MPEG
Definition: mmreg.h:126
#define WAVE_FORMAT_MPEGLAYER3
Definition: mmreg.h:127
#define ACM_MPEG_SINGLECHANNEL
Definition: mmreg.h:423
#define ACM_MPEG_LAYER3
Definition: mmreg.h:418
struct mpeglayer3waveformat_tag MPEGLAYER3WAVEFORMAT
#define ACM_MPEG_LAYER1
Definition: mmreg.h:416
#define ACM_MPEG_LAYER2
Definition: mmreg.h:417
struct mpeg1waveformat_tag MPEG1WAVEFORMAT
#define ACM_MPEG_ID_MPEG1
Definition: mmreg.h:428
static IUnknown * outer
Definition: compobj.c:82
static void testqc_init(struct testqc *qc, IUnknown *outer)
Definition: mpeglayer3.c:876
static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IMemInputPin *peer, IMemAllocator **allocator)
Definition: mpeglayer3.c:938
static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b)
Definition: mpeglayer3.c:170
static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: mpeglayer3.c:951
static void testfilter_destroy(struct strmbase_filter *iface)
Definition: mpeglayer3.c:911
static ULONG WINAPI testqc_inner_AddRef(IUnknown *iface)
Definition: mpeglayer3.c:857
static const IUnknownVtbl outer_vtbl
Definition: mpeglayer3.c:295
static const struct strmbase_sink_ops testsink_ops
Definition: mpeglayer3.c:1042
static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, IPin *sink, IPin *source, struct testfilter *testsource, struct testfilter *testsink)
Definition: mpeglayer3.c:1113
static HRESULT testsink_begin_flush(struct strmbase_sink *iface)
Definition: mpeglayer3.c:1028
static ULONG WINAPI testqc_Release(IQualityControl *iface)
Definition: mpeglayer3.c:806
static void test_aggregation(void)
Definition: mpeglayer3.c:304
static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: mpeglayer3.c:975
static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
Definition: mpeglayer3.c:204
static void test_streaming_events(IMediaControl *control, IPin *sink, IMemInputPin *meminput, struct testfilter *testsink)
Definition: mpeglayer3.c:1413
static ULONG WINAPI outer_AddRef(IUnknown *iface)
Definition: mpeglayer3.c:285
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out)
Definition: mpeglayer3.c:272
static const AM_MEDIA_TYPE pcm16ex_mt
Definition: mpeglayer3.c:149
static const WAVEFORMATEXTENSIBLE pcm16ex_format
Definition: mpeglayer3.c:134
static struct testfilter * impl_from_strmbase_filter(struct strmbase_filter *iface)
Definition: mpeglayer3.c:898
static ULONG get_refcount(void *iface)
Definition: mpeglayer3.c:196
static void test_pin_info(void)
Definition: mpeglayer3.c:582
static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: mpeglayer3.c:925
static const AM_MEDIA_TYPE mp3_mt1
Definition: mpeglayer3.c:122
static IUnknown test_outer
Definition: mpeglayer3.c:302
static struct testqc * impl_from_qc_IUnknown(IUnknown *iface)
Definition: mpeglayer3.c:837
static const IUnknownVtbl testqc_inner_vtbl
Definition: mpeglayer3.c:869
static void test_find_pin(void)
Definition: mpeglayer3.c:541
static HRESULT testsink_eos(struct strmbase_sink *iface)
Definition: mpeglayer3.c:1021
static const struct strmbase_source_ops testsource_ops
Definition: mpeglayer3.c:944
static const MPEG1WAVEFORMAT mp3_format0
Definition: mpeglayer3.c:83
static const AM_MEDIA_TYPE mp1_mt
Definition: mpeglayer3.c:45
static void test_enum_media_types(void)
Definition: mpeglayer3.c:651
static const MPEG1WAVEFORMAT mp2_format
Definition: mpeglayer3.c:57
static void test_quality_control(IFilterGraph2 *graph, IBaseFilter *filter, IPin *sink, IPin *source, struct testfilter *testsource, struct testfilter *testsink)
Definition: mpeglayer3.c:1190
static void test_interfaces(void)
Definition: mpeglayer3.c:218
static void test_sample_processing(IMediaControl *control, IMemInputPin *meminput, struct testfilter *testsink)
Definition: mpeglayer3.c:1291
static void test_connect_pin(void)
Definition: mpeglayer3.c:1505
static HRESULT WINAPI testqc_SetSink(IQualityControl *iface, IQualityControl *sink)
Definition: mpeglayer3.c:822
static void test_media_types(void)
Definition: mpeglayer3.c:726
static const AM_MEDIA_TYPE mp2_mt
Definition: mpeglayer3.c:71
static struct strmbase_pin * testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
Definition: mpeglayer3.c:903
static void test_enum_pins(void)
Definition: mpeglayer3.c:420
static HRESULT WINAPI testqc_QueryInterface(IQualityControl *iface, REFIID iid, void **out)
Definition: mpeglayer3.c:794
static const MPEGLAYER3WAVEFORMAT mp3_format1
Definition: mpeglayer3.c:109
static void init_pcm_mt(AM_MEDIA_TYPE *mt, WAVEFORMATEX *format, WORD channels, DWORD sample_rate, WORD depth)
Definition: mpeglayer3.c:176
static ULONG WINAPI testqc_inner_Release(IUnknown *iface)
Definition: mpeglayer3.c:863
static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample)
Definition: mpeglayer3.c:983
static HRESULT WINAPI testqc_inner_QueryInterface(IUnknown *iface, REFIID iid, void **out)
Definition: mpeglayer3.c:842
static IBaseFilter * create_mpeg_layer3_decoder(void)
Definition: mpeglayer3.c:161
static const MPEG1WAVEFORMAT mp1_format
Definition: mpeglayer3.c:31
static void test_sink_allocator(IMemInputPin *input)
Definition: mpeglayer3.c:1063
#define check_interface(a, b, c)
Definition: mpeglayer3.c:203
static struct testqc * impl_from_IQualityControl(IQualityControl *iface)
Definition: mpeglayer3.c:789
static ULONG WINAPI testqc_AddRef(IQualityControl *iface)
Definition: mpeglayer3.c:800
static LONG outer_ref
Definition: mpeglayer3.c:270
static const IQualityControlVtbl testqc_vtbl
Definition: mpeglayer3.c:828
static const struct strmbase_filter_ops testfilter_ops
Definition: mpeglayer3.c:919
static HRESULT testsink_new_segment(struct strmbase_sink *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
Definition: mpeglayer3.c:1010
static void test_unconnected_filter_state(void)
Definition: mpeglayer3.c:363
static const GUID test_iid
Definition: mpeglayer3.c:269
static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
Definition: mpeglayer3.c:964
static HRESULT testsink_end_flush(struct strmbase_sink *iface)
Definition: mpeglayer3.c:1035
static const AM_MEDIA_TYPE mp3_mt0
Definition: mpeglayer3.c:97
static void testfilter_init(struct testfilter *filter)
Definition: mpeglayer3.c:1054
static ULONG WINAPI outer_Release(IUnknown *iface)
Definition: mpeglayer3.c:290
static HRESULT WINAPI testqc_Notify(IQualityControl *iface, IBaseFilter *sender, Quality q)
Definition: mpeglayer3.c:812
const CLSID * clsid
Definition: msctf.cpp:50
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
const GUID IID_IPin
Definition: pincontrol.cpp:15
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistPropertyBag
Definition: proxy.cpp:11
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#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
WAVEFORMATEX Format
Definition: ksmedia.h:638
DWORD nAvgBytesPerSec
Definition: audioclient.idl:43
WORD wFormatTag
Definition: mmreg.h:78
Definition: dialog.c:52
Definition: filter.c:165
IBaseFilter * filter
Definition: filtergraph.c:75
Definition: graph.c:32
Definition: parser.c:49
WAVEFORMATEX wfx
Definition: mmreg.h:405
WAVEFORMATEX wfx
Definition: mmreg.h:431
Definition: send.c:48
Definition: wave.c:25
struct strmbase_filter * filter
Definition: strmbase.h:58
struct strmbase_pin pin
Definition: strmbase.h:106
unsigned int got_end_flush
REFERENCE_TIME sample_stop_time
Definition: mpeglayer3.c:895
unsigned int got_sample
AM_MEDIA_TYPE source_mt
unsigned int got_begin_flush
LONG sample_size
Definition: mpeglayer3.c:892
REFERENCE_TIME sample_start_time
Definition: mpeglayer3.c:894
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
LONG sample_actual
Definition: mpeglayer3.c:893
IUnknown IUnknown_inner
Definition: mpegaudio.c:795
IUnknown * outer_unk
Definition: mpegaudio.c:796
LONG refcount
Definition: mpegaudio.c:797
HRESULT notify_hr
Definition: mpegaudio.c:800
Quality notify_quality
Definition: mpegaudio.c:799
IQualityControl IQualityControl_iface
Definition: mpegaudio.c:794
IBaseFilter * notify_sender
Definition: mpegaudio.c:798
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
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define VFW_E_TYPE_NOT_ACCEPTED
Definition: vfwmsgs.h:81
#define VFW_E_NOT_COMMITTED
Definition: vfwmsgs.h:56
#define VFW_E_NOT_STOPPED
Definition: vfwmsgs.h:75
#define VFW_E_NO_ACCEPTABLE_TYPES
Definition: vfwmsgs.h:46
#define VFW_E_WRONG_STATE
Definition: vfwmsgs.h:78
#define VFW_S_NO_MORE_ITEMS
Definition: vfwmsgs.h:19
#define VFW_E_NOT_FOUND
Definition: vfwmsgs.h:61
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
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
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480
unsigned char BYTE
Definition: xxhash.c:193