ReactOS 0.4.17-dev-966-gf06eace
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 "ole2.h"
25#include "vfwmsgs.h"
26#include "uuids.h"
27#include "wine/strmbase.h"
28#include "wine/test.h"
29#include "qedit.h"
30#include "control.h"
31#include "rc.h"
32
33static ULONG get_refcount(void *iface)
34{
35 IUnknown *unknown = iface;
36 IUnknown_AddRef(unknown);
37 return IUnknown_Release(unknown);
38}
39
40static const GUID test_iid = {0x33333333};
41static LONG outer_ref = 1;
42
44{
45 if (IsEqualGUID(iid, &IID_IUnknown)
46 || IsEqualGUID(iid, &IID_IMediaDet)
47 || IsEqualGUID(iid, &test_iid))
48 {
49 *out = (IUnknown *)0xdeadbeef;
50 return S_OK;
51 }
52 ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid));
53 return E_NOINTERFACE;
54}
55
57{
59}
60
62{
64}
65
66static const IUnknownVtbl outer_vtbl =
67{
71};
72
74
75static void test_aggregation(void)
76{
77 IMediaDet *detector, *detector2;
78 IUnknown *unk, *unk2;
79 HRESULT hr;
80 ULONG ref;
81
82 detector = (IMediaDet *)0xdeadbeef;
83 hr = CoCreateInstance(&CLSID_MediaDet, &test_outer, CLSCTX_INPROC_SERVER,
84 &IID_IMediaDet, (void **)&detector);
85 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
86 ok(!detector, "Got interface %p.\n", detector);
87
88 hr = CoCreateInstance(&CLSID_MediaDet, &test_outer, CLSCTX_INPROC_SERVER,
89 &IID_IUnknown, (void **)&unk);
90 ok(hr == S_OK, "Got hr %#lx.\n", hr);
91 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
92 ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
93 ref = get_refcount(unk);
94 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
95
96 ref = IUnknown_AddRef(unk);
97 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
98 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
99
100 ref = IUnknown_Release(unk);
101 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
102 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
103
104 hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
105 ok(hr == S_OK, "Got hr %#lx.\n", hr);
106 ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
107 IUnknown_Release(unk2);
108
109 hr = IUnknown_QueryInterface(unk, &IID_IMediaDet, (void **)&detector);
110 ok(hr == S_OK, "Got hr %#lx.\n", hr);
111
112 hr = IMediaDet_QueryInterface(detector, &IID_IUnknown, (void **)&unk2);
113 ok(hr == S_OK, "Got hr %#lx.\n", hr);
114 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
115
116 hr = IMediaDet_QueryInterface(detector, &IID_IMediaDet, (void **)&detector2);
117 ok(hr == S_OK, "Got hr %#lx.\n", hr);
118 ok(detector2 == (IMediaDet *)0xdeadbeef, "Got unexpected IMediaDet %p.\n", detector2);
119
120 hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
121 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
122 ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
123
124 hr = IMediaDet_QueryInterface(detector, &test_iid, (void **)&unk2);
125 ok(hr == S_OK, "Got hr %#lx.\n", hr);
126 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
127
128 IMediaDet_Release(detector);
129 ref = IUnknown_Release(unk);
130 ok(!ref, "Got unexpected refcount %ld.\n", ref);
131 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
132}
133
134struct testfilter
135{
136 struct strmbase_filter filter;
137 struct strmbase_source source;
139};
140
141static inline struct testfilter *impl_from_strmbase_filter(struct strmbase_filter *iface)
142{
143 return CONTAINING_RECORD(iface, struct testfilter, filter);
144}
145
146static struct strmbase_pin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
147{
149
150 return index ? NULL : &filter->source.pin;
151}
152
153static void testfilter_destroy(struct strmbase_filter *iface)
154{
156
159}
160
162{
163 .filter_get_pin = testfilter_get_pin,
164 .filter_destroy = testfilter_destroy,
165};
166
167static inline struct testfilter *impl_from_strmbase_pin(struct strmbase_pin *iface)
168{
169 return CONTAINING_RECORD(iface, struct testfilter, source.pin);
170}
171
173{
174 static const VIDEOINFOHEADER source_format =
175 {
177 .bmiHeader.biWidth = 640,
178 .bmiHeader.biHeight = 480,
179 .bmiHeader.biPlanes = 1,
180 .bmiHeader.biBitCount = 24,
181 .bmiHeader.biCompression = BI_RGB,
182 .bmiHeader.biSizeImage = 640 * 480 * 3
183 };
184
185 if (index)
186 return S_FALSE;
187
188 mt->majortype = MEDIATYPE_Video;
189 mt->subtype = MEDIASUBTYPE_RGB24;
190 mt->bFixedSizeSamples = TRUE;
191 mt->bTemporalCompression = FALSE;
192 mt->lSampleSize = source_format.bmiHeader.biSizeImage;
193 mt->formattype = FORMAT_VideoInfo;
194 mt->pUnk = NULL;
195 mt->cbFormat = sizeof(source_format);
196 mt->pbFormat = CoTaskMemAlloc(mt->cbFormat);
197 memcpy(mt->pbFormat, &source_format, mt->cbFormat);
198 return S_OK;
199}
200
201static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
202{
204
205 if (IsEqualGUID(iid, &IID_IMediaSeeking))
207 else
208 return E_NOINTERFACE;
209
210 IUnknown_AddRef((IUnknown*)*out);
211 return S_OK;
212}
213
216{
217 return S_OK;
218}
219
221{
222 .base.pin_get_media_type = testsource_get_media_type,
223 .base.pin_query_interface = testsource_query_interface,
224 .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection,
225 .pfnDecideAllocator = testsource_DecideAllocator,
226};
227
229{
230 return CONTAINING_RECORD(iface, struct testfilter, IMediaSeeking_iface);
231}
232
234{
236 return IPin_QueryInterface(&filter->source.pin.IPin_iface, iid, out);
237}
238
240{
242 return IPin_AddRef(&filter->source.pin.IPin_iface);
243}
244
246{
248 return IPin_Release(&filter->source.pin.IPin_iface);
249}
250
252{
253 ok(0, "Unexpected call.\n");
254 return E_NOTIMPL;
255}
256
258{
259 ok(0, "Unexpected call.\n");
260 return E_NOTIMPL;
261}
262
264{
265 ok(0, "Unexpected call.\n");
266 return E_NOTIMPL;
267}
268
270{
271 ok(0, "Unexpected call.\n");
272 return E_NOTIMPL;
273}
274
276{
277 ok(0, "Unexpected call.\n");
278 return E_NOTIMPL;
279}
280
282{
283 ok(0, "Unexpected call.\n");
284 return E_NOTIMPL;
285}
286
288{
289 ok(0, "Unexpected call.\n");
290 return E_NOTIMPL;
291}
292
294{
295 if (winetest_debug > 1) trace("IMediaSeeking_GetDuration()\n");
296
297 *duration = 42000000;
298 return S_OK;
299}
300
302{
303 ok(0, "Unexpected call.\n");
304 return E_NOTIMPL;
305}
306
308{
309 ok(0, "Unexpected call.\n");
310 return E_NOTIMPL;
311}
312
314 const GUID *target_format, LONGLONG source, const GUID *source_format)
315{
316 ok(0, "Unexpected call.\n");
317 return E_NOTIMPL;
318}
319
321 DWORD current_flags, LONGLONG *stop, DWORD stop_flags)
322{
323 ok(0, "Unexpected call.\n");
324 return E_NOTIMPL;
325}
326
328{
329 ok(0, "Unexpected call.\n");
330 return E_NOTIMPL;
331}
332
334{
335 ok(0, "Unexpected call.\n");
336 return E_NOTIMPL;
337}
338
340{
341 ok(0, "Unexpected call.\n");
342 return E_NOTIMPL;
343}
344
346{
347 ok(0, "Unexpected call.\n");
348 return E_NOTIMPL;
349}
350
352{
353 ok(0, "Unexpected call.\n");
354 return E_NOTIMPL;
355}
356
357static const IMediaSeekingVtbl testseek_vtbl =
358{
379};
380
382{
383 static const GUID clsid = {0xabacab};
384
385 memset(filter, 0, sizeof(*filter));
389}
390
393
395{
396 static WCHAR temp_path[MAX_PATH];
397 HRSRC res;
399 char *mem;
400 DWORD size, written;
401 HANDLE fh;
402 BOOL ret;
403
405 if (!res)
406 return FALSE;
407
409 if (!data)
410 return FALSE;
411
413 if (!mem)
414 return FALSE;
415
417 if (size == 0)
418 return FALSE;
419
421 return FALSE;
422
423 /* We might end up relying on the extension here, so .TMP is no good. */
424 if (!GetTempFileNameW(temp_path, L"DES", 0, name))
425 return FALSE;
426
428 wcscpy(name + wcslen(name) - 3, L"avi");
429
432 if (fh == INVALID_HANDLE_VALUE)
433 return FALSE;
434
435 ret = WriteFile(fh, mem, size, &written, NULL);
436 CloseHandle(fh);
437 return ret && written == size;
438}
439
440static BOOL init_tests(void)
441{
444}
445
446static void test_mediadet(void)
447{
448 HRESULT hr;
449 FILTER_INFO filter_info;
450 AM_MEDIA_TYPE mt, *pmt;
453 IMediaDet *pM = NULL;
456 IEnumPins *enumpins;
457 IUnknown *unk;
458 IPin *pin;
459 GUID guid;
460 BSTR bstr;
461 double fps;
462 int flags;
463 int i;
464
465 /* test.avi has one video stream. */
466 hr = CoCreateInstance(&CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER,
467 &IID_IMediaDet, (LPVOID*)&pM);
468 ok(hr == S_OK, "Got hr %#lx.\n", hr);
469 ok(pM != NULL, "pM is NULL\n");
470
471 filename = NULL;
472 hr = IMediaDet_get_Filename(pM, &filename);
473 /* Despite what MSDN claims, this returns S_OK. */
474 ok(hr == S_OK, "Got hr %#lx.\n", hr);
475 ok(filename == NULL, "IMediaDet_get_Filename\n");
476
477 filename = (BSTR) -1;
478 hr = IMediaDet_get_Filename(pM, &filename);
479 /* Despite what MSDN claims, this returns S_OK. */
480 ok(hr == S_OK, "Got hr %#lx.\n", hr);
481 ok(filename == NULL, "IMediaDet_get_Filename\n");
482
483 count = -1;
484 hr = IMediaDet_get_OutputStreams(pM, &count);
485 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
486 ok(count == -1, "Got %ld streams.\n", count);
487
488 index = -1;
489 /* The stream defaults to 0, even without a file! */
490 hr = IMediaDet_get_CurrentStream(pM, &index);
491 ok(hr == S_OK, "Got hr %#lx.\n", hr);
492 ok(index == 0, "Got stream index %ld.\n", index);
493
494 hr = IMediaDet_get_CurrentStream(pM, NULL);
495 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
496
497 /* But put_CurrentStream doesn't. */
498 hr = IMediaDet_put_CurrentStream(pM, 0);
499 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
500
501 hr = IMediaDet_put_CurrentStream(pM, -1);
502 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
503
504 hr = IMediaDet_get_StreamMediaType(pM, &mt);
505 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
506
507 hr = IMediaDet_get_StreamMediaType(pM, NULL);
508 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
509
510 hr = IMediaDet_get_StreamType(pM, &guid);
511 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
512
513 hr = IMediaDet_get_StreamType(pM, NULL);
514 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
515
516 hr = IMediaDet_get_StreamTypeB(pM, &bstr);
517 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
518
519 hr = IMediaDet_get_StreamTypeB(pM, NULL);
520 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
521
522 hr = IMediaDet_get_Filter(pM, NULL);
523 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
524
525 unk = (IUnknown*)0xdeadbeef;
526 hr = IMediaDet_get_Filter(pM, &unk);
527 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
528 ok(!unk, "Got filter %p.\n", unk);
529
531 hr = IMediaDet_put_Filename(pM, filename);
532 ok(hr == S_OK, "Got hr %#lx.\n", hr);
534#ifdef __REACTOS__
535 if (FAILED(hr))
536 {
537 skip("Failed to open file, hr %#lx.\n", hr);
538 IMediaDet_Release(pM);
539 return;
540 }
541#endif
542
543 index = -1;
544 /* The stream defaults to 0. */
545 hr = IMediaDet_get_CurrentStream(pM, &index);
546 ok(hr == S_OK, "Got hr %#lx.\n", hr);
547 ok(index == 0, "Got stream index %ld.\n", index);
548
549 ZeroMemory(&mt, sizeof mt);
550 hr = IMediaDet_get_StreamMediaType(pM, &mt);
551 ok(hr == S_OK, "Got hr %#lx.\n", hr);
552 CoTaskMemFree(mt.pbFormat);
553
554 hr = IMediaDet_get_StreamType(pM, &guid);
555 ok(hr == S_OK, "Got hr %#lx.\n", hr);
556 ok(IsEqualGUID(&guid, &MEDIATYPE_Video), "Got major type %s.\n", debugstr_guid(&guid));
557
558 hr = IMediaDet_get_StreamTypeB(pM, &bstr);
559 ok(hr == S_OK, "Got hr %#lx.\n", hr);
560 ok(!wcscmp(bstr, L"{73646976-0000-0010-8000-00AA00389B71}"),
561 "Got major type %s.\n", debugstr_w(bstr));
562 SysFreeString(bstr);
563
564 /* Even before get_OutputStreams. */
565 hr = IMediaDet_put_CurrentStream(pM, 1);
566 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
567
568 hr = IMediaDet_get_OutputStreams(pM, &count);
569 ok(hr == S_OK, "Got hr %#lx.\n", hr);
570 ok(count == 1, "Got %ld streams.\n", count);
571
572 filename = NULL;
573 hr = IMediaDet_get_Filename(pM, &filename);
574 ok(hr == S_OK, "Got hr %#lx.\n", hr);
575 ok(!wcscmp(filename, test_avi_filename), "Expected filename %s, got %s.\n",
578
579 hr = IMediaDet_get_Filename(pM, NULL);
580 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
581
582 index = -1;
583 hr = IMediaDet_get_CurrentStream(pM, &index);
584 ok(hr == S_OK, "Got hr %#lx.\n", hr);
585 ok(index == 0, "Got stream index %ld.\n", index);
586
587 hr = IMediaDet_get_CurrentStream(pM, NULL);
588 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
589
590 hr = IMediaDet_put_CurrentStream(pM, -1);
591 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
592
593 hr = IMediaDet_put_CurrentStream(pM, 1);
594 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
595
596 /* Try again. */
597 index = -1;
598 hr = IMediaDet_get_CurrentStream(pM, &index);
599 ok(hr == S_OK, "Got hr %#lx.\n", hr);
600 ok(index == 0, "Got stream index %ld.\n", index);
601
602 hr = IMediaDet_put_CurrentStream(pM, 0);
603 ok(hr == S_OK, "Got hr %#lx.\n", hr);
604
605 index = -1;
606 hr = IMediaDet_get_CurrentStream(pM, &index);
607 ok(hr == S_OK, "Got hr %#lx.\n", hr);
608 ok(index == 0, "Got stream index %ld.\n", index);
609
610 ZeroMemory(&mt, sizeof mt);
611 hr = IMediaDet_get_StreamMediaType(pM, &mt);
612 ok(hr == S_OK, "Got hr %#lx.\n", hr);
613 ok(IsEqualGUID(&mt.majortype, &MEDIATYPE_Video),
614 "IMediaDet_get_StreamMediaType\n");
615 CoTaskMemFree(mt.pbFormat);
616
617 hr = IMediaDet_get_StreamType(pM, &guid);
618 ok(hr == S_OK, "Got hr %#lx.\n", hr);
619 ok(IsEqualGUID(&guid, &MEDIATYPE_Video), "Got major type %s.\n", debugstr_guid(&guid));
620
621 hr = IMediaDet_get_StreamTypeB(pM, &bstr);
622 ok(hr == S_OK, "Got hr %#lx.\n", hr);
623 ok(!wcscmp(bstr, L"{73646976-0000-0010-8000-00AA00389B71}"),
624 "Got major type %s.\n", debugstr_w(bstr));
625 SysFreeString(bstr);
626
627 hr = IMediaDet_get_FrameRate(pM, NULL);
628 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
629
630 hr = IMediaDet_get_FrameRate(pM, &fps);
631 ok(hr == S_OK, "Got hr %#lx.\n", hr);
632 ok(fps == 10.0, "IMediaDet_get_FrameRate: fps is %f\n", fps);
633
634 ref = IMediaDet_Release(pM);
635 ok(!ref, "Got outstanding refcount %ld.\n", ref);
636
637 /* test_sound.avi has one video stream and one audio stream. */
638 hr = CoCreateInstance(&CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER,
639 &IID_IMediaDet, (LPVOID*)&pM);
640 ok(hr == S_OK, "Got hr %#lx.\n", hr);
641 ok(pM != NULL, "pM is NULL\n");
642
644 hr = IMediaDet_put_Filename(pM, filename);
645 ok(hr == S_OK, "Got hr %#lx.\n", hr);
647#ifdef __REACTOS__
648 if (FAILED(hr))
649 {
650 skip("Failed to open file, hr %#lx.\n", hr);
651 IMediaDet_Release(pM);
652 return;
653 }
654#endif
655
656 hr = IMediaDet_get_OutputStreams(pM, &count);
657 ok(hr == S_OK, "Got hr %#lx.\n", hr);
658 ok(count == 2, "Got %ld streams.\n", count);
659
660 filename = NULL;
661 hr = IMediaDet_get_Filename(pM, &filename);
662 ok(hr == S_OK, "Got hr %#lx.\n", hr);
663 ok(!wcscmp(filename, test_sound_avi_filename), "Expected filename %s, got %s.\n",
666
667 /* I don't know if the stream order is deterministic. Just check
668 for both an audio and video stream. */
669 flags = 0;
670
671 for (i = 0; i < 2; ++i)
672 {
673 hr = IMediaDet_put_CurrentStream(pM, i);
674 ok(hr == S_OK, "Got hr %#lx.\n", hr);
675
676 index = -1;
677 hr = IMediaDet_get_CurrentStream(pM, &index);
678 ok(hr == S_OK, "Got hr %#lx.\n", hr);
679 ok(index == i, "Got stream index %ld.\n", index);
680
681 ZeroMemory(&mt, sizeof mt);
682 hr = IMediaDet_get_StreamMediaType(pM, &mt);
683 ok(hr == S_OK, "Got hr %#lx.\n", hr);
684 flags += (IsEqualGUID(&mt.majortype, &MEDIATYPE_Video)
685 ? 1
686 : (IsEqualGUID(&mt.majortype, &MEDIATYPE_Audio)
687 ? 2
688 : 0));
689
690 if (IsEqualGUID(&mt.majortype, &MEDIATYPE_Audio))
691 {
692 hr = IMediaDet_get_StreamType(pM, &guid);
693 ok(hr == S_OK, "Got hr %#lx.\n", hr);
694 ok(IsEqualGUID(&guid, &MEDIATYPE_Audio), "Got major type %s.\n", debugstr_guid(&guid));
695
696 hr = IMediaDet_get_StreamTypeB(pM, &bstr);
697 ok(hr == S_OK, "Got hr %#lx.\n", hr);
698 ok(!wcscmp(bstr, L"{73647561-0000-0010-8000-00AA00389B71}"),
699 "Got major type %s.\n", debugstr_w(bstr));
700 SysFreeString(bstr);
701
702 hr = IMediaDet_get_FrameRate(pM, &fps);
703 ok(hr == VFW_E_INVALIDMEDIATYPE, "Got hr %#lx.\n", hr);
704 }
705
706 CoTaskMemFree(mt.pbFormat);
707 }
708 ok(flags == 3, "IMediaDet_get_StreamMediaType: flags are %i\n", flags);
709
710 hr = IMediaDet_put_CurrentStream(pM, 2);
711 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
712
713 index = -1;
714 hr = IMediaDet_get_CurrentStream(pM, &index);
715 ok(hr == S_OK, "Got hr %#lx.\n", hr);
716 ok(index == 1, "Got stream index %ld.\n", index);
717
718 unk = NULL;
719 hr = IMediaDet_get_Filter(pM, &unk);
720 ok(hr == S_OK, "Got hr %#lx.\n", hr);
721 ok(!!unk, "Expected a non-NULL filter.\n");
722 hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void**)&filter);
723 ok(hr == S_OK, "Got hr %#lx.\n", hr);
724 IUnknown_Release(unk);
725
726 hr = IBaseFilter_EnumPins(filter, &enumpins);
727 ok(hr == S_OK, "Got hr %#lx.\n", hr);
728 hr = IEnumPins_Next(enumpins, 1, &pin, NULL);
729 ok(hr == S_OK, "Got hr %#lx.\n", hr);
730 hr = IPin_EnumMediaTypes(pin, &type);
731 ok(hr == S_OK, "Got hr %#lx.\n", hr);
732 hr = IEnumMediaTypes_Next(type, 1, &pmt, NULL);
733 ok(hr == S_OK, "Got hr %#lx.\n", hr);
734 ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Stream), "Got major type %s.\n",
735 debugstr_guid(&pmt->majortype));
736 IEnumMediaTypes_Release(type);
737 CoTaskMemFree(pmt->pbFormat);
738 CoTaskMemFree(pmt);
739 IPin_Release(pin);
740
741 hr = IEnumPins_Next(enumpins, 1, &pin, NULL);
742 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
743 IEnumPins_Release(enumpins);
744
745 hr = IBaseFilter_QueryFilterInfo(filter, &filter_info);
746 ok(hr == S_OK, "Got hr %#lx.\n", hr);
747 ok(!wcscmp(filter_info.achName, L"Source"), "Got name %s.\n", debugstr_w(filter_info.achName));
748 IFilterGraph_Release(filter_info.pGraph);
749 IBaseFilter_Release(filter);
750
751 ref = IMediaDet_Release(pM);
752 ok(!ref, "Got outstanding refcount %ld.\n", ref);
753}
754
755static void test_put_filter(void)
756{
757 struct testfilter testfilter, testfilter2;
760 IMediaDet *detector;
763 double duration;
764 IUnknown *unk;
766 HRESULT hr;
767 ULONG ref;
768
769 hr = CoCreateInstance(&CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER,
770 &IID_IMediaDet, (void **)&detector);
771 ok(hr == S_OK, "Got hr %#lx.\n", hr);
772
773 hr = IMediaDet_put_Filter(detector, NULL);
774 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
775
776 hr = IMediaDet_get_Filter(detector, NULL);
777 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
778
779 hr = IMediaDet_get_StreamLength(detector, NULL);
780 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
781
782 hr = IMediaDet_get_StreamLength(detector, &duration);
783 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
784
786 hr = IMediaDet_put_Filter(detector, &testfilter.filter.IUnknown_inner);
787 ok(hr == S_OK, "Got hr %#lx.\n", hr);
788
789 hr = IMediaDet_get_Filter(detector, &unk);
790 ok(hr == S_OK, "Got hr %#lx.\n", hr);
791 ok(!!unk, "Expected a non-NULL interface.\n");
792 hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
793 ok(hr == S_OK, "Got hr %#lx.\n", hr);
794 ok(filter == &testfilter.filter.IBaseFilter_iface, "Expected the same filter.\n");
795 IBaseFilter_Release(filter);
796 IUnknown_Release(unk);
797
798 ok(!wcscmp(testfilter.filter.name, L"Source"), "Got name %s.\n",
800 graph = testfilter.filter.graph;
801 IFilterGraph_AddRef(graph);
802
803 testfilter_init(&testfilter2);
804 hr = IMediaDet_put_Filter(detector, &testfilter2.filter.IUnknown_inner);
805 ok(hr == S_OK, "Got hr %#lx.\n", hr);
806
807 hr = IMediaDet_get_Filter(detector, &unk);
808 ok(hr == S_OK, "Got hr %#lx.\n", hr);
809 ok(!!unk, "Expected a non-NULL interface.\n");
810 hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
811 ok(hr == S_OK, "Got hr %#lx.\n", hr);
812 ok(filter == &testfilter2.filter.IBaseFilter_iface, "Expected the same filter.\n");
813 IBaseFilter_Release(filter);
814 IUnknown_Release(unk);
815
816 ok(testfilter2.filter.graph != graph, "Expected a different graph.\n");
817
818 ref = IFilterGraph_Release(graph);
819 ok(!ref, "Got outstanding refcount %ld.\n", ref);
820 ref = IBaseFilter_Release(&testfilter.filter.IBaseFilter_iface);
821 ok(!ref, "Got outstanding refcount %ld.\n", ref);
822
823 count = 0xdeadbeef;
824 hr = IMediaDet_get_OutputStreams(detector, &count);
825 ok(hr == S_OK, "Got hr %#lx.\n", hr);
826 ok(count == 1, "Got %ld streams.\n", count);
827
828 index = 0xdeadbeef;
829 hr = IMediaDet_get_CurrentStream(detector, &index);
830 ok(hr == S_OK, "Got hr %#lx.\n", hr);
831 ok(index == 0, "Got stream %ld.\n", index);
832
833 filename = (BSTR)0xdeadbeef;
834 hr = IMediaDet_get_Filename(detector, &filename);
835 ok(hr == S_OK, "Got hr %#lx.\n", hr);
836 ok(!filename, "Got filename %s.\n", debugstr_w(filename));
837
838 hr = IMediaDet_get_StreamLength(detector, &duration);
839 ok(hr == S_OK, "Got hr %#lx.\n", hr);
840 ok(duration == 4.2, "Got duration %.16e.\n", duration);
841
842 ref = IMediaDet_Release(detector);
843 ok(!ref, "Got outstanding refcount %ld.\n", ref);
844 ref = IBaseFilter_Release(&testfilter2.filter.IBaseFilter_iface);
845 ok(!ref, "Got outstanding refcount %ld.\n", ref);
846
847 hr = CoCreateInstance(&CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER,
848 &IID_IMediaDet, (void **)&detector);
849 ok(hr == S_OK, "Got hr %#lx.\n", hr);
850
852 hr = IMediaDet_put_Filename(detector, filename);
853 ok(hr == S_OK, "Got hr %#lx.\n", hr);
855#ifdef __REACTOS__
856 if (FAILED(hr))
857 {
858 skip("Failed to open file, hr %#lx.\n", hr);
859 IMediaDet_Release(detector);
860 return;
861 }
862#endif
863
864 hr = IMediaDet_get_StreamMediaType(detector, &mt);
865 ok(hr == S_OK, "Got hr %#lx.\n", hr);
867
868 hr = IMediaDet_get_Filter(detector, &unk);
869 ok(hr == S_OK, "Got hr %#lx.\n", hr);
870 hr = IMediaDet_put_Filter(detector, unk);
871 ok(hr == S_OK, "Got hr %#lx.\n", hr);
872 IUnknown_Release(unk);
873
874 filename = (BSTR)0xdeadbeef;
875 hr = IMediaDet_get_Filename(detector, &filename);
876 ok(hr == S_OK, "Got hr %#lx.\n", hr);
877 ok(!filename, "Got filename %s.\n", debugstr_w(filename));
878
879 count = 0xdeadbeef;
880 hr = IMediaDet_get_OutputStreams(detector, &count);
881 ok(hr == S_OK, "Got hr %#lx.\n", hr);
882 ok(count == 2, "Got %ld streams.\n", count);
883
884 index = 0xdeadbeef;
885 hr = IMediaDet_get_CurrentStream(detector, &index);
886 ok(hr == S_OK, "Got hr %#lx.\n", hr);
887 ok(index == 0, "Got stream %ld.\n", index);
888
889 ref = IMediaDet_Release(detector);
890 ok(!ref, "Got outstanding refcount %ld.\n", ref);
891}
892
894{
897};
898
900{
901 return CONTAINING_RECORD(iface, struct test_sample, sample);
902}
903
905 void **ppvObject)
906{
907 return E_NOTIMPL;
908}
909
911{
913 return InterlockedIncrement(&sample->refcount);
914}
915
917{
919 return InterlockedDecrement(&sample->refcount);
920}
921
922static HRESULT WINAPI ms_GetPointer(IMediaSample *iface, BYTE **ppBuffer)
923{
924 return E_NOTIMPL;
925}
926
928{
929 return E_NOTIMPL;
930}
931
933 REFERENCE_TIME *pTimeEnd)
934{
935 return E_NOTIMPL;
936}
937
939 REFERENCE_TIME *pTimeEnd)
940{
941 return E_NOTIMPL;
942}
943
945{
946 return E_NOTIMPL;
947}
948
949static HRESULT WINAPI ms_SetSyncPoint(IMediaSample *iface, BOOL bIsSyncPoint)
950{
951 return E_NOTIMPL;
952}
953
955{
956 return E_NOTIMPL;
957}
958
959static HRESULT WINAPI ms_SetPreroll(IMediaSample *iface, BOOL bIsPreroll)
960{
961 return E_NOTIMPL;
962}
963
965{
966 return E_NOTIMPL;
967}
968
970{
971 return E_NOTIMPL;
972}
973
975 **ppMediaType)
976{
977 return E_NOTIMPL;
978}
979
981{
982 return E_NOTIMPL;
983}
984
986{
987 return E_NOTIMPL;
988}
989
990static HRESULT WINAPI ms_SetDiscontinuity(IMediaSample *iface, BOOL bDiscontinuity)
991{
992 return E_NOTIMPL;
993}
994
996 LONGLONG *pTimeEnd)
997{
998 return E_NOTIMPL;
999}
1000
1002 LONGLONG *pTimeEnd)
1003{
1004 return E_NOTIMPL;
1005}
1006
1007static const IMediaSampleVtbl my_sample_vt = {
1009 ms_AddRef,
1010 ms_Release,
1012 ms_GetSize,
1013 ms_GetTime,
1014 ms_SetTime,
1027};
1028
1029static struct test_sample my_sample = { {&my_sample_vt}, 0 };
1030
1032
1034 void **ppvObject)
1035{
1036 return E_NOTIMPL;
1037}
1038
1040{
1041 return E_NOTIMPL;
1042}
1043
1045{
1046 return E_NOTIMPL;
1047}
1048
1049static HRESULT WINAPI sgcb_SampleCB(ISampleGrabberCB *iface, double SampleTime,
1050 IMediaSample *pSample)
1051{
1052 ok(pSample == &my_sample.sample, "Got wrong IMediaSample: %p, expected %p\n", pSample, &my_sample);
1054 IMediaSample_AddRef(pSample);
1055 return E_NOTIMPL;
1056}
1057
1058static HRESULT WINAPI sgcb_BufferCB(ISampleGrabberCB *iface, double SampleTime,
1059 BYTE *pBuffer, LONG BufferLen)
1060{
1061 ok(0, "BufferCB should not have been called\n");
1062 return E_NOTIMPL;
1063}
1064
1065static const ISampleGrabberCBVtbl sgcb_vt = {
1071};
1072
1074
1075static void test_samplegrabber(void)
1076{
1077 ISampleGrabber *sg;
1078 IBaseFilter *bf;
1079 IPin *pin;
1080 IMemInputPin *inpin;
1081 IEnumPins *pins;
1082 HRESULT hr;
1083 FILTER_STATE fstate;
1085
1086 /* Invalid RIID */
1087 hr = CoCreateInstance(&CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, &IID_IClassFactory,
1088 (void**)&sg);
1089 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
1090
1091 hr = CoCreateInstance(&CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, &IID_ISampleGrabber,
1092 (void**)&sg);
1093 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1094
1095 hr = ISampleGrabber_QueryInterface(sg, &IID_IBaseFilter, (void**)&bf);
1096 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1097
1098 hr = ISampleGrabber_SetCallback(sg, &my_sg_cb, 0);
1099 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1100
1101 hr = IBaseFilter_GetState(bf, 100, &fstate);
1102 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1103 ok(fstate == State_Stopped, "Got wrong filter state: %u\n", fstate);
1104
1105 hr = IBaseFilter_EnumPins(bf, &pins);
1106 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1107
1108 hr = IEnumPins_Next(pins, 1, &pin, NULL);
1109 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1110
1111 IEnumPins_Release(pins);
1112
1113 hr = IPin_QueryInterface(pin, &IID_IMemInputPin, (void**)&inpin);
1114 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1115
1116 hr = IMemInputPin_Receive(inpin, &my_sample.sample);
1117 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1118 ok(samplecb_called == TRUE, "SampleCB should have been called\n");
1119
1120 refcount = IUnknown_Release(&my_sample.sample);
1121 ok(!refcount, "Got unexpected refcount %ld.\n", refcount);
1122
1123 IMemInputPin_Release(inpin);
1124 IPin_Release(pin);
1125
1126 while (ISampleGrabber_Release(sg));
1127}
1128
1129static void test_COM_sg_enumpins(void)
1130{
1131 IBaseFilter *bf;
1132 IEnumPins *pins, *pins2;
1133 IUnknown *unk;
1135 HRESULT hr;
1136
1137 hr = CoCreateInstance(&CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter,
1138 (void**)&bf);
1139 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1140 hr = IBaseFilter_EnumPins(bf, &pins);
1141 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1142
1143 /* Same refcount for all EnumPins interfaces */
1144 refcount = IEnumPins_AddRef(pins);
1145 ok(refcount == 2, "refcount == %lu, expected 2\n", refcount);
1146 hr = IEnumPins_QueryInterface(pins, &IID_IEnumPins, (void**)&pins2);
1147 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1148 ok(pins == pins2, "QueryInterface for self failed (%p != %p)\n", pins, pins2);
1149 IEnumPins_Release(pins2);
1150
1151 hr = IEnumPins_QueryInterface(pins, &IID_IUnknown, (void**)&unk);
1152 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1153 refcount = IUnknown_AddRef(unk);
1154 ok(refcount == 4, "refcount == %lu, expected 4\n", refcount);
1155 refcount = IUnknown_Release(unk);
1156
1157 while (IEnumPins_Release(pins));
1158 IBaseFilter_Release(bf);
1159}
1160
1161START_TEST(mediadet)
1162{
1163 IMediaDet *detector;
1164 HRESULT hr;
1165 BOOL ret;
1166
1167 if (!init_tests())
1168 {
1169 skip("Couldn't initialize tests!\n");
1170 return;
1171 }
1172
1174
1175 if (FAILED(hr = CoCreateInstance(&CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER,
1176 &IID_IMediaDet, (void **)&detector)))
1177 {
1178 /* qedit.dll does not exist on 2003. */
1179 win_skip("Failed to create media detector object, hr %#lx.\n", hr);
1180 return;
1181 }
1182 IMediaDet_Release(detector);
1183
1185 test_mediadet();
1189
1191 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
1193 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
1194
1196}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
unsigned int rate
Definition: audiorecord.c:87
#define index(s, c)
Definition: various.h:29
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT hr
Definition: delayimp.cpp:582
const GUID IID_IBaseFilter
#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 CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1674
#define CloseHandle
Definition: compat.h:739
#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
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2098
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
GUID guid
Definition: version.c:147
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
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
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
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
REFIID riid
Definition: atlbase.h:39
Definition: axcore.idl:92
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
int winetest_debug
#define win_skip
Definition: minitest.h:67
#define ZeroMemory
Definition: minwinbase.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct task_struct * current
Definition: linux.c:32
#define CREATE_NEW
Definition: disk.h:69
static HRESULT WINAPI ms_GetMediaTime(IMediaSample *iface, LONGLONG *pTimeStart, LONGLONG *pTimeEnd)
Definition: mediadet.c:995
static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IMemInputPin *peer, IMemAllocator **allocator)
Definition: mediadet.c:214
static ULONG WINAPI sgcb_AddRef(ISampleGrabberCB *iface)
Definition: mediadet.c:1039
static HRESULT WINAPI testseek_CheckCapabilities(IMediaSeeking *iface, DWORD *caps)
Definition: mediadet.c:257
static HRESULT WINAPI ms_GetPointer(IMediaSample *iface, BYTE **ppBuffer)
Definition: mediadet.c:922
static void testfilter_destroy(struct strmbase_filter *iface)
Definition: mediadet.c:153
static const IUnknownVtbl outer_vtbl
Definition: mediadet.c:66
static ULONG WINAPI testseek_Release(IMediaSeeking *iface)
Definition: mediadet.c:245
static WCHAR test_sound_avi_filename[MAX_PATH]
Definition: mediadet.c:392
static ULONG WINAPI testseek_AddRef(IMediaSeeking *iface)
Definition: mediadet.c:239
static HRESULT WINAPI testseek_QueryInterface(IMediaSeeking *iface, REFIID iid, void **out)
Definition: mediadet.c:233
static HRESULT WINAPI testseek_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop)
Definition: mediadet.c:301
static void test_aggregation(void)
Definition: mediadet.c:75
static HRESULT WINAPI ms_SetPreroll(IMediaSample *iface, BOOL bIsPreroll)
Definition: mediadet.c:959
static ULONG WINAPI outer_AddRef(IUnknown *iface)
Definition: mediadet.c:56
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out)
Definition: mediadet.c:43
static const IMediaSampleVtbl my_sample_vt
Definition: mediadet.c:1007
static struct test_sample my_sample
Definition: mediadet.c:1029
static HRESULT WINAPI ms_IsPreroll(IMediaSample *iface)
Definition: mediadet.c:954
static HRESULT WINAPI testseek_IsFormatSupported(IMediaSeeking *iface, const GUID *format)
Definition: mediadet.c:263
static struct testfilter * impl_from_strmbase_filter(struct strmbase_filter *iface)
Definition: mediadet.c:141
static ULONG WINAPI sgcb_Release(ISampleGrabberCB *iface)
Definition: mediadet.c:1044
static ULONG get_refcount(void *iface)
Definition: mediadet.c:33
static HRESULT WINAPI testseek_SetRate(IMediaSeeking *iface, double rate)
Definition: mediadet.c:339
static const IMediaSeekingVtbl testseek_vtbl
Definition: mediadet.c:357
static struct testfilter * impl_from_IMediaSeeking(IMediaSeeking *iface)
Definition: mediadet.c:228
static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: mediadet.c:201
static IUnknown test_outer
Definition: mediadet.c:73
static LONG WINAPI ms_GetActualDataLength(IMediaSample *iface)
Definition: mediadet.c:964
static HRESULT WINAPI sgcb_QueryInterface(ISampleGrabberCB *iface, REFIID riid, void **ppvObject)
Definition: mediadet.c:1033
static HRESULT WINAPI ms_SetMediaTime(IMediaSample *iface, LONGLONG *pTimeStart, LONGLONG *pTimeEnd)
Definition: mediadet.c:1001
static HRESULT WINAPI sgcb_BufferCB(ISampleGrabberCB *iface, double SampleTime, BYTE *pBuffer, LONG BufferLen)
Definition: mediadet.c:1058
static const struct strmbase_source_ops testsource_ops
Definition: mediadet.c:220
static HRESULT WINAPI testseek_GetDuration(IMediaSeeking *iface, LONGLONG *duration)
Definition: mediadet.c:293
static void test_samplegrabber(void)
Definition: mediadet.c:1075
static HRESULT testsource_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
Definition: mediadet.c:172
static HRESULT WINAPI sgcb_SampleCB(ISampleGrabberCB *iface, double SampleTime, IMediaSample *pSample)
Definition: mediadet.c:1049
static ULONG WINAPI ms_AddRef(IMediaSample *iface)
Definition: mediadet.c:910
static struct test_sample * impl_from_IMediaSample(IMediaSample *iface)
Definition: mediadet.c:899
static HRESULT WINAPI ms_SetTime(IMediaSample *iface, REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd)
Definition: mediadet.c:938
static HRESULT WINAPI ms_QueryInterface(IMediaSample *iface, REFIID riid, void **ppvObject)
Definition: mediadet.c:904
static HRESULT WINAPI ms_SetMediaType(IMediaSample *iface, AM_MEDIA_TYPE *pMediaType)
Definition: mediadet.c:980
static HRESULT WINAPI testseek_SetPositions(IMediaSeeking *iface, LONGLONG *current, DWORD current_flags, LONGLONG *stop, DWORD stop_flags)
Definition: mediadet.c:320
static HRESULT WINAPI testseek_ConvertTimeFormat(IMediaSeeking *iface, LONGLONG *target, const GUID *target_format, LONGLONG source, const GUID *source_format)
Definition: mediadet.c:313
static WCHAR test_avi_filename[MAX_PATH]
Definition: mediadet.c:391
static HRESULT WINAPI testseek_IsUsingTimeFormat(IMediaSeeking *iface, const GUID *format)
Definition: mediadet.c:281
static struct strmbase_pin * testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
Definition: mediadet.c:146
static HRESULT WINAPI ms_IsDiscontinuity(IMediaSample *iface)
Definition: mediadet.c:985
static const ISampleGrabberCBVtbl sgcb_vt
Definition: mediadet.c:1065
static ISampleGrabberCB my_sg_cb
Definition: mediadet.c:1073
static void test_mediadet(void)
Definition: mediadet.c:446
static HRESULT WINAPI testseek_QueryPreferredFormat(IMediaSeeking *iface, GUID *format)
Definition: mediadet.c:269
static HRESULT WINAPI testseek_GetCapabilities(IMediaSeeking *iface, DWORD *caps)
Definition: mediadet.c:251
static HRESULT WINAPI ms_IsSyncPoint(IMediaSample *iface)
Definition: mediadet.c:944
static BOOL samplecb_called
Definition: mediadet.c:1031
static BOOL unpack_avi_file(int id, WCHAR name[MAX_PATH])
Definition: mediadet.c:394
static HRESULT WINAPI testseek_GetAvailable(IMediaSeeking *iface, LONGLONG *earliest, LONGLONG *latest)
Definition: mediadet.c:333
static HRESULT WINAPI testseek_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current)
Definition: mediadet.c:307
static HRESULT WINAPI testseek_SetTimeFormat(IMediaSeeking *iface, const GUID *format)
Definition: mediadet.c:287
static void test_COM_sg_enumpins(void)
Definition: mediadet.c:1129
static HRESULT WINAPI testseek_GetTimeFormat(IMediaSeeking *iface, GUID *format)
Definition: mediadet.c:275
static BOOL init_tests(void)
Definition: mediadet.c:440
static HRESULT WINAPI ms_GetTime(IMediaSample *iface, REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd)
Definition: mediadet.c:932
static HRESULT WINAPI ms_SetSyncPoint(IMediaSample *iface, BOOL bIsSyncPoint)
Definition: mediadet.c:949
static HRESULT WINAPI testseek_GetPreroll(IMediaSeeking *iface, LONGLONG *preroll)
Definition: mediadet.c:351
static LONG outer_ref
Definition: mediadet.c:41
static HRESULT WINAPI ms_SetActualDataLength(IMediaSample *iface, LONG length)
Definition: mediadet.c:969
static struct testfilter * impl_from_strmbase_pin(struct strmbase_pin *iface)
Definition: mediadet.c:167
static HRESULT WINAPI testseek_GetRate(IMediaSeeking *iface, double *rate)
Definition: mediadet.c:345
static HRESULT WINAPI ms_GetMediaType(IMediaSample *iface, AM_MEDIA_TYPE **ppMediaType)
Definition: mediadet.c:974
static const struct strmbase_filter_ops testfilter_ops
Definition: mediadet.c:161
static HRESULT WINAPI ms_SetDiscontinuity(IMediaSample *iface, BOOL bDiscontinuity)
Definition: mediadet.c:990
static ULONG WINAPI ms_Release(IMediaSample *iface)
Definition: mediadet.c:916
static HRESULT WINAPI testseek_GetPositions(IMediaSeeking *iface, LONGLONG *current, LONGLONG *stop)
Definition: mediadet.c:327
static const GUID test_iid
Definition: mediadet.c:40
static LONG WINAPI ms_GetSize(IMediaSample *iface)
Definition: mediadet.c:927
static void test_put_filter(void)
Definition: mediadet.c:755
static void testfilter_init(struct testfilter *filter)
Definition: mediadet.c:381
static ULONG WINAPI outer_Release(IUnknown *iface)
Definition: mediadet.c:61
fstate
Definition: ms2ps.cpp:80
const CLSID * clsid
Definition: msctf.cpp:50
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:240
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:273
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#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
wcscpy
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181
#define memset(x, y, z)
Definition: compat.h:39
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_filter_cleanup(struct strmbase_filter *filter)
Definition: filter.c:540
void strmbase_source_cleanup(struct strmbase_source *pin)
Definition: pin.c:778
void strmbase_filter_init(struct strmbase_filter *filter, IUnknown *outer, const CLSID *clsid, const struct strmbase_filter_ops *func_table)
Definition: filter.c:517
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(struct strmbase_source *pin, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: pin.c:710
DWORD biSizeImage
Definition: amvideo.idl:36
Definition: filter.c:165
IBaseFilter * filter
Definition: filtergraph.c:75
IMediaSeeking IMediaSeeking_iface
Definition: filter.c:167
Definition: graph.c:32
Definition: mem.c:349
Definition: name.c:39
Definition: send.c:48
Definition: wave.c:25
BITMAPINFOHEADER bmiHeader
Definition: amvideo.idl:189
Definition: tools.h:99
LONG refcount
Definition: mediadet.c:896
IMediaSample sample
Definition: mediadet.c:895
IMediaSeeking IMediaSeeking_iface
Definition: amstream.c:1021
const AM_MEDIA_TYPE * mt
Definition: avidec.c:799
IFilterGraph * graph
Definition: filtergraph.c:850
struct strmbase_filter filter
Definition: amstream.c:1019
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 BI_RGB
Definition: uefivid.c:46
#define VFW_E_INVALIDMEDIATYPE
Definition: vfwmsgs.h:39
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#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