ReactOS 0.4.15-dev-7906-g1b85a5f
mediadet.c
Go to the documentation of this file.
1/*
2 * Unit tests for Media Detector
3 *
4 * Copyright (C) 2008 Google (Lei Zhang, Dan Hipschman)
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#define COBJMACROS
22#define CONST_VTABLE
23
24#include "initguid.h"
25#include "ole2.h"
26#include "vfwmsgs.h"
27#include "uuids.h"
28#include "wine/test.h"
29#include "qedit.h"
30#include "control.h"
31#include "rc.h"
32
33/* Outer IUnknown for COM aggregation tests */
34struct unk_impl {
36 LONG ref;
38};
39
40static inline struct unk_impl *impl_from_IUnknown(IUnknown *iface)
41{
42 return CONTAINING_RECORD(iface, struct unk_impl, IUnknown_iface);
43}
44
46{
47 struct unk_impl *This = impl_from_IUnknown(iface);
48
49 return IUnknown_QueryInterface(This->inner_unk, riid, ppv);
50}
51
53{
54 struct unk_impl *This = impl_from_IUnknown(iface);
55
56 return InterlockedIncrement(&This->ref);
57}
58
60{
61 struct unk_impl *This = impl_from_IUnknown(iface);
62
63 return InterlockedDecrement(&This->ref);
64}
65
66static const IUnknownVtbl unk_vtbl =
67{
71};
72
73
76
78{
79 static WCHAR temp_path[MAX_PATH];
80 static const WCHAR prefix[] = {'D','E','S',0};
81 static const WCHAR avi[] = {'a','v','i',0};
82 HRSRC res;
84 char *mem;
85 DWORD size, written;
86 HANDLE fh;
87 BOOL ret;
88
90 if (!res)
91 return FALSE;
92
94 if (!data)
95 return FALSE;
96
98 if (!mem)
99 return FALSE;
100
102 if (size == 0)
103 return FALSE;
104
106 return FALSE;
107
108 /* We might end up relying on the extension here, so .TMP is no good. */
109 if (!GetTempFileNameW(temp_path, prefix, 0, name))
110 return FALSE;
111
113 lstrcpyW(name + lstrlenW(name) - 3, avi);
114
117 if (fh == INVALID_HANDLE_VALUE)
118 return FALSE;
119
120 ret = WriteFile(fh, mem, size, &written, NULL);
121 CloseHandle(fh);
122 return ret && written == size;
123}
124
125static BOOL init_tests(void)
126{
129}
130
131static void test_mediadet(void)
132{
133 HRESULT hr;
134 struct unk_impl unk_obj = {{&unk_vtbl}, 19, NULL};
135 IMediaDet *pM = NULL;
136 ULONG refcount;
138 LONG nstrms = 0;
139 LONG strm;
140 AM_MEDIA_TYPE mt;
141 double fps;
142 int flags;
143 int i;
144
145 /* COM aggregation */
146 hr = CoCreateInstance(&CLSID_MediaDet, &unk_obj.IUnknown_iface, CLSCTX_INPROC_SERVER,
147 &IID_IUnknown, (void**)&unk_obj.inner_unk);
148 ok(hr == S_OK, "CoCreateInstance failed: %08x\n", hr);
149
150 hr = IUnknown_QueryInterface(unk_obj.inner_unk, &IID_IMediaDet, (void**)&pM);
151 ok(hr == S_OK, "QueryInterface for IID_IMediaDet failed: %08x\n", hr);
152 refcount = IMediaDet_AddRef(pM);
153 ok(refcount == unk_obj.ref, "MediaDet just pretends to support COM aggregation\n");
154 refcount = IMediaDet_Release(pM);
155 ok(refcount == unk_obj.ref, "MediaDet just pretends to support COM aggregation\n");
156 refcount = IMediaDet_Release(pM);
157 ok(refcount == 19, "Refcount should be back at 19 but is %u\n", refcount);
158
159 IUnknown_Release(unk_obj.inner_unk);
160
161 /* test.avi has one video stream. */
162 hr = CoCreateInstance(&CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER,
163 &IID_IMediaDet, (LPVOID*)&pM);
164 ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
165 ok(pM != NULL, "pM is NULL\n");
166
167 filename = NULL;
168 hr = IMediaDet_get_Filename(pM, &filename);
169 /* Despite what MSDN claims, this returns S_OK. */
170 ok(hr == S_OK, "IMediaDet_get_Filename failed: %08x\n", hr);
171 ok(filename == NULL, "IMediaDet_get_Filename\n");
172
173 filename = (BSTR) -1;
174 hr = IMediaDet_get_Filename(pM, &filename);
175 /* Despite what MSDN claims, this returns S_OK. */
176 ok(hr == S_OK, "IMediaDet_get_Filename failed: %08x\n", hr);
177 ok(filename == NULL, "IMediaDet_get_Filename\n");
178
179 nstrms = -1;
180 hr = IMediaDet_get_OutputStreams(pM, &nstrms);
181 ok(hr == E_INVALIDARG, "IMediaDet_get_OutputStreams failed: %08x\n", hr);
182 ok(nstrms == -1, "IMediaDet_get_OutputStreams: nstrms is %i\n", nstrms);
183
184 strm = -1;
185 /* The stream defaults to 0, even without a file! */
186 hr = IMediaDet_get_CurrentStream(pM, &strm);
187 ok(hr == S_OK, "IMediaDet_get_CurrentStream failed: %08x\n", hr);
188 ok(strm == 0, "IMediaDet_get_CurrentStream: strm is %i\n", strm);
189
190 hr = IMediaDet_get_CurrentStream(pM, NULL);
191 ok(hr == E_POINTER, "IMediaDet_get_CurrentStream failed: %08x\n", hr);
192
193 /* But put_CurrentStream doesn't. */
194 hr = IMediaDet_put_CurrentStream(pM, 0);
195 ok(hr == E_INVALIDARG, "IMediaDet_put_CurrentStream failed: %08x\n", hr);
196
197 hr = IMediaDet_put_CurrentStream(pM, -1);
198 ok(hr == E_INVALIDARG, "IMediaDet_put_CurrentStream failed: %08x\n", hr);
199
200 hr = IMediaDet_get_StreamMediaType(pM, &mt);
201 ok(hr == E_INVALIDARG, "IMediaDet_get_StreamMediaType failed: %08x\n", hr);
202
203 hr = IMediaDet_get_StreamMediaType(pM, NULL);
204 ok(hr == E_POINTER, "IMediaDet_get_StreamMediaType failed: %08x\n", hr);
205
207 hr = IMediaDet_put_Filename(pM, filename);
208 ok(hr == S_OK, "IMediaDet_put_Filename failed: %08x\n", hr);
210
211 strm = -1;
212 /* The stream defaults to 0. */
213 hr = IMediaDet_get_CurrentStream(pM, &strm);
214 ok(hr == S_OK, "IMediaDet_get_CurrentStream failed: %08x\n", hr);
215 ok(strm == 0, "IMediaDet_get_CurrentStream: strm is %i\n", strm);
216
217 ZeroMemory(&mt, sizeof mt);
218 hr = IMediaDet_get_StreamMediaType(pM, &mt);
219 ok(hr == S_OK, "IMediaDet_get_StreamMediaType failed: %08x\n", hr);
220 CoTaskMemFree(mt.pbFormat);
221
222 /* Even before get_OutputStreams. */
223 hr = IMediaDet_put_CurrentStream(pM, 1);
224 ok(hr == E_INVALIDARG, "IMediaDet_put_CurrentStream failed: %08x\n", hr);
225
226 hr = IMediaDet_get_OutputStreams(pM, &nstrms);
227 ok(hr == S_OK, "IMediaDet_get_OutputStreams failed: %08x\n", hr);
228 ok(nstrms == 1, "IMediaDet_get_OutputStreams: nstrms is %i\n", nstrms);
229
230 filename = NULL;
231 hr = IMediaDet_get_Filename(pM, &filename);
232 ok(hr == S_OK, "IMediaDet_get_Filename failed: %08x\n", hr);
234 "IMediaDet_get_Filename\n");
236
237 hr = IMediaDet_get_Filename(pM, NULL);
238 ok(hr == E_POINTER, "IMediaDet_get_Filename failed: %08x\n", hr);
239
240 strm = -1;
241 hr = IMediaDet_get_CurrentStream(pM, &strm);
242 ok(hr == S_OK, "IMediaDet_get_CurrentStream failed: %08x\n", hr);
243 ok(strm == 0, "IMediaDet_get_CurrentStream: strm is %i\n", strm);
244
245 hr = IMediaDet_get_CurrentStream(pM, NULL);
246 ok(hr == E_POINTER, "IMediaDet_get_CurrentStream failed: %08x\n", hr);
247
248 hr = IMediaDet_put_CurrentStream(pM, -1);
249 ok(hr == E_INVALIDARG, "IMediaDet_put_CurrentStream failed: %08x\n", hr);
250
251 hr = IMediaDet_put_CurrentStream(pM, 1);
252 ok(hr == E_INVALIDARG, "IMediaDet_put_CurrentStream failed: %08x\n", hr);
253
254 /* Try again. */
255 strm = -1;
256 hr = IMediaDet_get_CurrentStream(pM, &strm);
257 ok(hr == S_OK, "IMediaDet_get_CurrentStream failed: %08x\n", hr);
258 ok(strm == 0, "IMediaDet_get_CurrentStream: strm is %i\n", strm);
259
260 hr = IMediaDet_put_CurrentStream(pM, 0);
261 ok(hr == S_OK, "IMediaDet_put_CurrentStream failed: %08x\n", hr);
262
263 strm = -1;
264 hr = IMediaDet_get_CurrentStream(pM, &strm);
265 ok(hr == S_OK, "IMediaDet_get_CurrentStream failed: %08x\n", hr);
266 ok(strm == 0, "IMediaDet_get_CurrentStream: strm is %i\n", strm);
267
268 ZeroMemory(&mt, sizeof mt);
269 hr = IMediaDet_get_StreamMediaType(pM, &mt);
270 ok(hr == S_OK, "IMediaDet_get_StreamMediaType failed: %08x\n", hr);
271 ok(IsEqualGUID(&mt.majortype, &MEDIATYPE_Video),
272 "IMediaDet_get_StreamMediaType\n");
273 CoTaskMemFree(mt.pbFormat);
274
275 hr = IMediaDet_get_FrameRate(pM, NULL);
276 ok(hr == E_POINTER, "IMediaDet_get_FrameRate failed: %08x\n", hr);
277
278 hr = IMediaDet_get_FrameRate(pM, &fps);
279 ok(hr == S_OK, "IMediaDet_get_FrameRate failed: %08x\n", hr);
280 ok(fps == 10.0, "IMediaDet_get_FrameRate: fps is %f\n", fps);
281
282 hr = IMediaDet_Release(pM);
283 ok(hr == 0, "IMediaDet_Release returned: %x\n", hr);
284
286
287 /* test_sound.avi has one video stream and one audio stream. */
288 hr = CoCreateInstance(&CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER,
289 &IID_IMediaDet, (LPVOID*)&pM);
290 ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
291 ok(pM != NULL, "pM is NULL\n");
292
294 hr = IMediaDet_put_Filename(pM, filename);
295 ok(hr == S_OK, "IMediaDet_put_Filename failed: %08x\n", hr);
297
298 hr = IMediaDet_get_OutputStreams(pM, &nstrms);
299 ok(hr == S_OK, "IMediaDet_get_OutputStreams failed: %08x\n", hr);
300 ok(nstrms == 2, "IMediaDet_get_OutputStreams: nstrms is %i\n", nstrms);
301
302 filename = NULL;
303 hr = IMediaDet_get_Filename(pM, &filename);
304 ok(hr == S_OK, "IMediaDet_get_Filename failed: %08x\n", hr);
306 "IMediaDet_get_Filename\n");
308
309 /* I don't know if the stream order is deterministic. Just check
310 for both an audio and video stream. */
311 flags = 0;
312
313 for (i = 0; i < 2; ++i)
314 {
315 hr = IMediaDet_put_CurrentStream(pM, i);
316 ok(hr == S_OK, "IMediaDet_put_CurrentStream failed: %08x\n", hr);
317
318 strm = -1;
319 hr = IMediaDet_get_CurrentStream(pM, &strm);
320 ok(hr == S_OK, "IMediaDet_get_CurrentStream failed: %08x\n", hr);
321 ok(strm == i, "IMediaDet_get_CurrentStream: strm is %i\n", strm);
322
323 ZeroMemory(&mt, sizeof mt);
324 hr = IMediaDet_get_StreamMediaType(pM, &mt);
325 ok(hr == S_OK, "IMediaDet_get_StreamMediaType failed: %08x\n", hr);
326 flags += (IsEqualGUID(&mt.majortype, &MEDIATYPE_Video)
327 ? 1
328 : (IsEqualGUID(&mt.majortype, &MEDIATYPE_Audio)
329 ? 2
330 : 0));
331
332 if (IsEqualGUID(&mt.majortype, &MEDIATYPE_Audio))
333 {
334 hr = IMediaDet_get_FrameRate(pM, &fps);
335 ok(hr == VFW_E_INVALIDMEDIATYPE, "IMediaDet_get_FrameRate failed: %08x\n", hr);
336 }
337
338 CoTaskMemFree(mt.pbFormat);
339 }
340 ok(flags == 3, "IMediaDet_get_StreamMediaType: flags are %i\n", flags);
341
342 hr = IMediaDet_put_CurrentStream(pM, 2);
343 ok(hr == E_INVALIDARG, "IMediaDet_put_CurrentStream failed: %08x\n", hr);
344
345 strm = -1;
346 hr = IMediaDet_get_CurrentStream(pM, &strm);
347 ok(hr == S_OK, "IMediaDet_get_CurrentStream failed: %08x\n", hr);
348 ok(strm == 1, "IMediaDet_get_CurrentStream: strm is %i\n", strm);
349
350 hr = IMediaDet_Release(pM);
351 ok(hr == 0, "IMediaDet_Release returned: %x\n", hr);
352
354}
355
357 void **ppvObject)
358{
359 return E_NOTIMPL;
360}
361
363{
364 return 2;
365}
366
368{
369 return 1;
370}
371
372static HRESULT WINAPI ms_GetPointer(IMediaSample *iface, BYTE **ppBuffer)
373{
374 return E_NOTIMPL;
375}
376
378{
379 return E_NOTIMPL;
380}
381
383 REFERENCE_TIME *pTimeEnd)
384{
385 return E_NOTIMPL;
386}
387
389 REFERENCE_TIME *pTimeEnd)
390{
391 return E_NOTIMPL;
392}
393
395{
396 return E_NOTIMPL;
397}
398
399static HRESULT WINAPI ms_SetSyncPoint(IMediaSample *iface, BOOL bIsSyncPoint)
400{
401 return E_NOTIMPL;
402}
403
405{
406 return E_NOTIMPL;
407}
408
409static HRESULT WINAPI ms_SetPreroll(IMediaSample *iface, BOOL bIsPreroll)
410{
411 return E_NOTIMPL;
412}
413
415{
416 return E_NOTIMPL;
417}
418
420{
421 return E_NOTIMPL;
422}
423
425 **ppMediaType)
426{
427 return E_NOTIMPL;
428}
429
431{
432 return E_NOTIMPL;
433}
434
436{
437 return E_NOTIMPL;
438}
439
440static HRESULT WINAPI ms_SetDiscontinuity(IMediaSample *iface, BOOL bDiscontinuity)
441{
442 return E_NOTIMPL;
443}
444
446 LONGLONG *pTimeEnd)
447{
448 return E_NOTIMPL;
449}
450
452 LONGLONG *pTimeEnd)
453{
454 return E_NOTIMPL;
455}
456
457static const IMediaSampleVtbl my_sample_vt = {
459 ms_AddRef,
477};
478
480
482
484 void **ppvObject)
485{
486 return E_NOTIMPL;
487}
488
490{
491 return E_NOTIMPL;
492}
493
495{
496 return E_NOTIMPL;
497}
498
499static HRESULT WINAPI sgcb_SampleCB(ISampleGrabberCB *iface, double SampleTime,
500 IMediaSample *pSample)
501{
502 ok(pSample == &my_sample, "Got wrong IMediaSample: %p, expected %p\n", pSample, &my_sample);
504 return E_NOTIMPL;
505}
506
507static HRESULT WINAPI sgcb_BufferCB(ISampleGrabberCB *iface, double SampleTime,
508 BYTE *pBuffer, LONG BufferLen)
509{
510 ok(0, "BufferCB should not have been called\n");
511 return E_NOTIMPL;
512}
513
514static const ISampleGrabberCBVtbl sgcb_vt = {
520};
521
523
524static void test_samplegrabber(void)
525{
526 struct unk_impl unk_obj = {{&unk_vtbl}, 19, NULL};
527 ISampleGrabber *sg;
528 IBaseFilter *bf;
529 IMediaFilter *mf;
530 IPersist *persist;
531 IUnknown *unk;
532 IPin *pin;
533 IMemInputPin *inpin;
534 IEnumPins *pins;
535 ULONG refcount;
536 HRESULT hr;
537 FILTER_STATE fstate;
538
539 /* COM aggregation */
540 hr = CoCreateInstance(&CLSID_SampleGrabber, &unk_obj.IUnknown_iface, CLSCTX_INPROC_SERVER,
541 &IID_IUnknown, (void**)&unk_obj.inner_unk);
542 ok(hr == S_OK, "CoCreateInstance failed: %08x\n", hr);
543
544 hr = IUnknown_QueryInterface(unk_obj.inner_unk, &IID_ISampleGrabber, (void**)&sg);
545 ok(hr == S_OK, "QueryInterface for IID_ISampleGrabber failed: %08x\n", hr);
546 refcount = ISampleGrabber_AddRef(sg);
547 ok(refcount == unk_obj.ref, "SampleGrabber just pretends to support COM aggregation\n");
548 refcount = ISampleGrabber_Release(sg);
549 ok(refcount == unk_obj.ref, "SampleGrabber just pretends to support COM aggregation\n");
550 refcount = ISampleGrabber_Release(sg);
551 ok(refcount == 19, "Refcount should be back at 19 but is %u\n", refcount);
552 IUnknown_Release(unk_obj.inner_unk);
553
554 /* Invalid RIID */
555 hr = CoCreateInstance(&CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, &IID_IClassFactory,
556 (void**)&sg);
557 ok(hr == E_NOINTERFACE, "SampleGrabber create failed: %08x, expected E_NOINTERFACE\n", hr);
558
559 /* Same refcount for all SampleGrabber interfaces */
560 hr = CoCreateInstance(&CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, &IID_ISampleGrabber,
561 (void**)&sg);
562 ok(hr == S_OK, "SampleGrabber create failed: %08x, expected S_OK\n", hr);
563 refcount = ISampleGrabber_AddRef(sg);
564 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
565
566 hr = ISampleGrabber_QueryInterface(sg, &IID_IBaseFilter, (void**)&bf);
567 ok(hr == S_OK, "QueryInterface for IID_IBaseFilter failed: %08x\n", hr);
568 refcount = IBaseFilter_AddRef(bf);
569 ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
570 refcount = IBaseFilter_Release(bf);
571
572 hr = ISampleGrabber_QueryInterface(sg, &IID_IMediaFilter, (void**)&mf);
573 ok(hr == S_OK, "QueryInterface for IID_IMediaFilter failed: %08x\n", hr);
574 refcount = IMediaFilter_AddRef(mf);
575 ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
576 refcount = IMediaFilter_Release(mf);
577
578 hr = ISampleGrabber_QueryInterface(sg, &IID_IPersist, (void**)&persist);
579 ok(hr == S_OK, "QueryInterface for IID_IPersist failed: %08x\n", hr);
580 refcount = IPersist_AddRef(persist);
581 ok(refcount == 6, "refcount == %u, expected 6\n", refcount);
582 refcount = IPersist_Release(persist);
583
584 hr = ISampleGrabber_QueryInterface(sg, &IID_IUnknown, (void**)&unk);
585 ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
586 refcount = IUnknown_AddRef(unk);
587 ok(refcount == 7, "refcount == %u, expected 7\n", refcount);
588 refcount = IUnknown_Release(unk);
589
590 hr = ISampleGrabber_SetCallback(sg, &my_sg_cb, 0);
591 ok(hr == S_OK, "SetCallback failed: %08x\n", hr);
592
593 hr = IBaseFilter_GetState(bf, 100, &fstate);
594 ok(hr == S_OK, "Failed to get filter state: %08x\n", hr);
595 ok(fstate == State_Stopped, "Got wrong filter state: %u\n", fstate);
596
597 hr = IBaseFilter_EnumPins(bf, &pins);
598 ok(hr == S_OK, "EnumPins create failed: %08x, expected S_OK\n", hr);
599
600 hr = IEnumPins_Next(pins, 1, &pin, NULL);
601 ok(hr == S_OK, "Next failed: %08x\n", hr);
602
603 IEnumPins_Release(pins);
604
605 hr = IPin_QueryInterface(pin, &IID_IMemInputPin, (void**)&inpin);
606 ok(hr == S_OK, "QueryInterface(IMemInputPin) failed: %08x\n", hr);
607
608 hr = IMemInputPin_Receive(inpin, &my_sample);
609 ok(hr == S_OK, "Receive failed: %08x\n", hr);
610 ok(samplecb_called == TRUE, "SampleCB should have been called\n");
611
612 IMemInputPin_Release(inpin);
613 IPin_Release(pin);
614
615 /* Interfaces that native does not support */
616 hr = ISampleGrabber_QueryInterface(sg, &IID_IMediaPosition, (void**)&unk);
617 todo_wine ok(hr == E_NOINTERFACE, "QueryInterface for IID_IMediaPosition failed: %08x\n", hr);
618 hr = ISampleGrabber_QueryInterface(sg, &IID_IMediaSeeking, (void**)&unk);
619 todo_wine ok(hr == E_NOINTERFACE, "QueryInterface for IID_IMediaSeeking failed: %08x\n", hr);
620 hr = ISampleGrabber_QueryInterface(sg, &IID_IMemInputPin, (void**)&unk);
621 ok(hr == E_NOINTERFACE, "QueryInterface for IID_IMemInputPin failed: %08x\n", hr);
622 hr = ISampleGrabber_QueryInterface(sg, &IID_IQualityControl, (void**)&unk);
623 ok(hr == E_NOINTERFACE, "QueryInterface for IID_IQualityControl failed: %08x\n", hr);
624 hr = ISampleGrabber_QueryInterface(sg, &IID_ISeekingPassThru, (void**)&unk);
625 ok(hr == E_NOINTERFACE, "QueryInterface for IID_ISeekingPassThru failed: %08x\n", hr);
626
627 while (ISampleGrabber_Release(sg));
628}
629
630static void test_COM_sg_enumpins(void)
631{
632 IBaseFilter *bf;
633 IEnumPins *pins, *pins2;
634 IUnknown *unk;
635 ULONG refcount;
636 HRESULT hr;
637
638 hr = CoCreateInstance(&CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter,
639 (void**)&bf);
640 ok(hr == S_OK, "SampleGrabber create failed: %08x, expected S_OK\n", hr);
641 hr = IBaseFilter_EnumPins(bf, &pins);
642 ok(hr == S_OK, "EnumPins create failed: %08x, expected S_OK\n", hr);
643
644 /* Same refcount for all EnumPins interfaces */
645 refcount = IEnumPins_AddRef(pins);
646 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
647 hr = IEnumPins_QueryInterface(pins, &IID_IEnumPins, (void**)&pins2);
648 ok(hr == S_OK, "QueryInterface for IID_IEnumPins failed: %08x\n", hr);
649 ok(pins == pins2, "QueryInterface for self failed (%p != %p)\n", pins, pins2);
650 IEnumPins_Release(pins2);
651
652 hr = IEnumPins_QueryInterface(pins, &IID_IUnknown, (void**)&unk);
653 ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
654 refcount = IUnknown_AddRef(unk);
655 ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
656 refcount = IUnknown_Release(unk);
657
658 while (IEnumPins_Release(pins));
659 IBaseFilter_Release(bf);
660}
661
662START_TEST(mediadet)
663{
664 if (!init_tests())
665 {
666 skip("Couldn't initialize tests!\n");
667 return;
668 }
669
675}
#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
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
const GUID IID_IBaseFilter
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static MediaDetImpl * impl_from_IUnknown(IUnknown *iface)
Definition: mediadet.c:48
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
OLECHAR * BSTR
Definition: compat.h:2293
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLuint res
Definition: glext.h:9613
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
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
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
Definition: axcore.idl:92
#define S_OK
Definition: intsafe.h:52
const char * filename
Definition: ioapi.h:137
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define CREATE_NEW
Definition: disk.h:69
#define todo_wine
Definition: custom.c:79
static HRESULT WINAPI ms_GetMediaTime(IMediaSample *iface, LONGLONG *pTimeStart, LONGLONG *pTimeEnd)
Definition: mediadet.c:445
static ULONG WINAPI sgcb_AddRef(ISampleGrabberCB *iface)
Definition: mediadet.c:489
static HRESULT WINAPI ms_GetPointer(IMediaSample *iface, BYTE **ppBuffer)
Definition: mediadet.c:372
static WCHAR test_sound_avi_filename[MAX_PATH]
Definition: mediadet.c:75
static HRESULT WINAPI ms_SetPreroll(IMediaSample *iface, BOOL bIsPreroll)
Definition: mediadet.c:409
static const IMediaSampleVtbl my_sample_vt
Definition: mediadet.c:457
static HRESULT WINAPI ms_IsPreroll(IMediaSample *iface)
Definition: mediadet.c:404
static ULONG WINAPI sgcb_Release(ISampleGrabberCB *iface)
Definition: mediadet.c:494
static ULONG WINAPI unk_Release(IUnknown *iface)
Definition: mediadet.c:59
static LONG WINAPI ms_GetActualDataLength(IMediaSample *iface)
Definition: mediadet.c:414
static HRESULT WINAPI sgcb_QueryInterface(ISampleGrabberCB *iface, REFIID riid, void **ppvObject)
Definition: mediadet.c:483
static HRESULT WINAPI ms_SetMediaTime(IMediaSample *iface, LONGLONG *pTimeStart, LONGLONG *pTimeEnd)
Definition: mediadet.c:451
static HRESULT WINAPI sgcb_BufferCB(ISampleGrabberCB *iface, double SampleTime, BYTE *pBuffer, LONG BufferLen)
Definition: mediadet.c:507
static HRESULT WINAPI unk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: mediadet.c:45
static void test_samplegrabber(void)
Definition: mediadet.c:524
static HRESULT WINAPI sgcb_SampleCB(ISampleGrabberCB *iface, double SampleTime, IMediaSample *pSample)
Definition: mediadet.c:499
static ULONG WINAPI ms_AddRef(IMediaSample *iface)
Definition: mediadet.c:362
static HRESULT WINAPI ms_SetTime(IMediaSample *iface, REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd)
Definition: mediadet.c:388
static HRESULT WINAPI ms_QueryInterface(IMediaSample *iface, REFIID riid, void **ppvObject)
Definition: mediadet.c:356
static HRESULT WINAPI ms_SetMediaType(IMediaSample *iface, AM_MEDIA_TYPE *pMediaType)
Definition: mediadet.c:430
static ULONG WINAPI unk_AddRef(IUnknown *iface)
Definition: mediadet.c:52
static WCHAR test_avi_filename[MAX_PATH]
Definition: mediadet.c:74
static HRESULT WINAPI ms_IsDiscontinuity(IMediaSample *iface)
Definition: mediadet.c:435
static const ISampleGrabberCBVtbl sgcb_vt
Definition: mediadet.c:514
static ISampleGrabberCB my_sg_cb
Definition: mediadet.c:522
static void test_mediadet(void)
Definition: mediadet.c:131
static IMediaSample my_sample
Definition: mediadet.c:479
static const IUnknownVtbl unk_vtbl
Definition: mediadet.c:66
static HRESULT WINAPI ms_IsSyncPoint(IMediaSample *iface)
Definition: mediadet.c:394
static BOOL samplecb_called
Definition: mediadet.c:481
static BOOL unpack_avi_file(int id, WCHAR name[MAX_PATH])
Definition: mediadet.c:77
static void test_COM_sg_enumpins(void)
Definition: mediadet.c:630
static BOOL init_tests(void)
Definition: mediadet.c:125
static HRESULT WINAPI ms_GetTime(IMediaSample *iface, REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd)
Definition: mediadet.c:382
static HRESULT WINAPI ms_SetSyncPoint(IMediaSample *iface, BOOL bIsSyncPoint)
Definition: mediadet.c:399
static HRESULT WINAPI ms_SetActualDataLength(IMediaSample *iface, LONG length)
Definition: mediadet.c:419
static HRESULT WINAPI ms_GetMediaType(IMediaSample *iface, AM_MEDIA_TYPE **ppMediaType)
Definition: mediadet.c:424
static HRESULT WINAPI ms_SetDiscontinuity(IMediaSample *iface, BOOL bDiscontinuity)
Definition: mediadet.c:440
static ULONG WINAPI ms_Release(IMediaSample *iface)
Definition: mediadet.c:367
static LONG WINAPI ms_GetSize(IMediaSample *iface)
Definition: mediadet.c:377
fstate
Definition: ms2ps.cpp:80
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
#define GENERIC_WRITE
Definition: nt_native.h:90
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
long LONG
Definition: pedump.c:60
const GUID IID_IPersist
Definition: proxy.cpp:14
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define TEST_AVI_RES
Definition: rc.h:24
#define TEST_SOUND_AVI_RES
Definition: rc.h:25
#define AVI_RES_TYPE
Definition: rc.h:27
PVOID pBuffer
HRESULT hr
Definition: shlfolder.c:183
Definition: mem.c:156
Definition: name.c:39
Definition: regsvr.c:104
Definition: api.c:544
IUnknown IUnknown_iface
Definition: api.c:545
IUnknown * inner_unk
Definition: api.c:547
LONG ref
Definition: api.c:546
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_INVALIDMEDIATYPE
Definition: vfwmsgs.h:39
int ret
#define ZeroMemory
Definition: winbase.h:1712
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193