4 * Copyright 2013 Damjan Jovanovic
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.
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.
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
31 #include "wine/strmbase.h"
32 #include "wine/test.h"
34 #define DEFINE_EXPECT(func) \
35 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
37 #define SET_EXPECT(func) \
38 expect_ ## func = TRUE
40 #define CHECK_EXPECT2(func) \
42 ok(expect_ ##func, "unexpected call " #func "\n"); \
43 called_ ## func = TRUE; \
46 #define CHECK_EXPECT(func) \
48 CHECK_EXPECT2(func); \
49 expect_ ## func = FALSE; \
52 #define CHECK_CALLED(func) \
54 ok(called_ ## func, "expected " #func "\n"); \
55 expect_ ## func = called_ ## func = FALSE; \
58 DEFINE_EXPECT(ReceiveConnection
);
59 DEFINE_EXPECT(GetAllocatorRequirements
);
60 DEFINE_EXPECT(NotifyAllocator
);
61 DEFINE_EXPECT(Reconnect
);
62 DEFINE_EXPECT(Read_FccHandler
);
63 DEFINE_EXPECT(MediaSeeking_GetPositions
);
64 DEFINE_EXPECT(MemAllocator_GetProperties
);
65 DEFINE_EXPECT(MemInputPin_QueryInterface_IStream
);
66 DEFINE_EXPECT(MediaSample_QueryInterface_MediaSample2
);
67 DEFINE_EXPECT(MediaSample_IsDiscontinuity
);
68 DEFINE_EXPECT(MediaSample_IsPreroll
);
69 DEFINE_EXPECT(MediaSample_IsSyncPoint
);
70 DEFINE_EXPECT(MediaSample_GetTime
);
71 DEFINE_EXPECT(MediaSample_GetMediaType
);
72 DEFINE_EXPECT(MediaSample_GetPointer
);
73 DEFINE_EXPECT(MediaSample_GetActualDataLength
);
74 DEFINE_EXPECT(MediaSample_GetSize
);
75 DEFINE_EXPECT(MediaSample_GetMediaTime
);
77 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
80 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
81 return lstrcmpA(stra
, buf
);
84 static BSTR
a2bstr(const char *str
)
92 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
93 ret
= SysAllocStringLen(NULL
, len
-1);
94 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
106 static const char* debugstr_filter_type(filter_type type
)
110 return "SOURCE_FILTER";
112 return "SINK_FILTER";
113 case INTERMEDIATE_FILTER
:
114 return "INTERMEDIATE_FILTER";
128 ENUMMEDIATYPES_RESET
,
130 GRAPHBUILDER_CONNECT
,
132 BASEFILTER_QUERYINTERFACE
,
136 static const struct {
138 filter_type filter_type
;
141 BOOL optional
; /* fails on wine if missing */
143 } *current_calls_list
;
146 static void check_calls_list(const char *func
, call_id id
, filter_type type
)
148 if(!current_calls_list
)
151 while(current_calls_list
[call_no
].wine_missing
|| current_calls_list
[call_no
].wine_extra
||
152 current_calls_list
[call_no
].optional
|| current_calls_list
[call_no
].broken
) {
153 if(current_calls_list
[call_no
].wine_missing
) {
154 todo_wine
ok((current_calls_list
[call_no
].call_id
== id
&& current_calls_list
[call_no
].filter_type
== type
) ||
155 broken(current_calls_list
[call_no
].optional
&& (current_calls_list
[call_no
].call_id
!= id
||
156 current_calls_list
[call_no
].filter_type
!= type
)),
157 "missing call, got %s(%d), expected %d (%d)\n", func
, id
, current_calls_list
[call_no
].call_id
, call_no
);
159 if(current_calls_list
[call_no
].call_id
!= id
|| current_calls_list
[call_no
].filter_type
!= type
)
163 }else if(current_calls_list
[call_no
].wine_extra
) {
164 todo_wine
ok(current_calls_list
[call_no
].call_id
!= id
|| current_calls_list
[call_no
].filter_type
!= type
,
165 "extra call, got %s(%d) (%d)\n", func
, id
, call_no
);
167 if(current_calls_list
[call_no
].call_id
== id
&& current_calls_list
[call_no
].filter_type
== type
) {
172 }else if(current_calls_list
[call_no
].optional
) {
173 ok((current_calls_list
[call_no
].call_id
== id
&& current_calls_list
[call_no
].filter_type
== type
) ||
174 broken(current_calls_list
[call_no
].call_id
!= id
|| current_calls_list
[call_no
].filter_type
!= type
),
175 "unexpected call: %s on %s (%d)\n", func
, debugstr_filter_type(type
), call_no
);
177 if(current_calls_list
[call_no
].call_id
!= id
|| current_calls_list
[call_no
].filter_type
!= type
)
181 }else if(current_calls_list
[call_no
].broken
) {
182 ok(broken(current_calls_list
[call_no
].call_id
== id
&& current_calls_list
[call_no
].filter_type
== type
) ||
183 (current_calls_list
[call_no
].call_id
!= id
|| current_calls_list
[call_no
].filter_type
!= type
),
184 "unexpected call: %s on %s (%d)\n", func
, debugstr_filter_type(type
), call_no
);
186 if(current_calls_list
[call_no
].call_id
== id
&& current_calls_list
[call_no
].filter_type
== type
)
192 ok(current_calls_list
[call_no
].call_id
== id
, "unexpected call: %s on %s (%d)\n",
193 func
, debugstr_filter_type(type
), call_no
);
194 if(current_calls_list
[call_no
].call_id
!= id
)
197 ok(current_calls_list
[call_no
].filter_type
== type
, "unexpected call: %s on %s (%d)\n",
198 func
, debugstr_filter_type(type
), call_no
);
199 if(current_calls_list
[call_no
].filter_type
!= type
)
205 static HRESULT WINAPI
GraphBuilder_QueryInterface(
206 IGraphBuilder
*iface
, REFIID riid
, void **ppv
)
208 if(IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IFilterGraph
)
209 || IsEqualIID(riid
, &IID_IGraphBuilder
))
215 ok(IsEqualIID(riid
, &IID_IMediaEvent
) || IsEqualIID(riid
, &IID_IMediaEventSink
),
216 "QueryInterface(%s)\n", wine_dbgstr_guid(riid
));
218 return E_NOINTERFACE
;
221 static ULONG WINAPI
GraphBuilder_AddRef(IGraphBuilder
*iface
)
226 static ULONG WINAPI
GraphBuilder_Release(IGraphBuilder
*iface
)
231 static HRESULT WINAPI
GraphBuilder_AddFilter(IGraphBuilder
*iface
,
232 IBaseFilter
*pFilter
, LPCWSTR pName
)
234 ok(0, "unexpected call\n");
238 static HRESULT WINAPI
GraphBuilder_RemoveFilter(
239 IGraphBuilder
*iface
, IBaseFilter
*pFilter
)
241 ok(0, "unexpected call\n");
245 static HRESULT WINAPI
GraphBuilder_EnumFilters(
246 IGraphBuilder
*iface
, IEnumFilters
**ppEnum
)
248 ok(0, "unexpected call\n");
252 static HRESULT WINAPI
GraphBuilder_FindFilterByName(IGraphBuilder
*iface
,
253 LPCWSTR pName
, IBaseFilter
**ppFilter
)
255 ok(0, "unexpected call\n");
259 static HRESULT WINAPI
GraphBuilder_ConnectDirect(IGraphBuilder
*iface
,
260 IPin
*ppinOut
, IPin
*ppinIn
, const AM_MEDIA_TYPE
*pmt
)
262 ok(0, "unexpected call\n");
266 static HRESULT WINAPI
GraphBuilder_Reconnect(IGraphBuilder
*iface
, IPin
*ppin
)
268 CHECK_EXPECT(Reconnect
);
272 static HRESULT WINAPI
GraphBuilder_Disconnect(IGraphBuilder
*iface
, IPin
*ppin
)
274 ok(0, "unexpected call\n");
278 static HRESULT WINAPI
GraphBuilder_SetDefaultSyncSource(IGraphBuilder
*iface
)
280 ok(0, "unexpected call\n");
284 static HRESULT WINAPI
GraphBuilder_Connect(IGraphBuilder
*iface
, IPin
*ppinOut
, IPin
*ppinIn
)
286 check_calls_list("GraphBuilder_Connect", GRAPHBUILDER_CONNECT
, NOT_FILTER
);
290 static HRESULT WINAPI
GraphBuilder_Render(IGraphBuilder
*iface
, IPin
*ppinOut
)
292 ok(0, "unexpected call\n");
296 static HRESULT WINAPI
GraphBuilder_RenderFile(IGraphBuilder
*iface
,
297 LPCWSTR lpcwstrFile
, LPCWSTR lpcwstrPlayList
)
299 ok(0, "unexpected call\n");
303 static HRESULT WINAPI
GraphBuilder_AddSourceFilter(IGraphBuilder
*iface
, LPCWSTR lpcwstrFileName
,
304 LPCWSTR lpcwstrFilterName
, IBaseFilter
**ppFilter
)
306 ok(0, "unexpected call\n");
310 static HRESULT WINAPI
GraphBuilder_SetLogFile(IGraphBuilder
*iface
, DWORD_PTR hFile
)
312 ok(0, "unexpected call\n");
316 static HRESULT WINAPI
GraphBuilder_Abort(IGraphBuilder
*iface
)
318 ok(0, "unexpected call\n");
322 static HRESULT WINAPI
GraphBuilder_ShouldOperationContinue(IGraphBuilder
*iface
)
324 ok(0, "unexpected call\n");
328 static const IGraphBuilderVtbl GraphBuilder_vtbl
= {
329 GraphBuilder_QueryInterface
,
331 GraphBuilder_Release
,
332 GraphBuilder_AddFilter
,
333 GraphBuilder_RemoveFilter
,
334 GraphBuilder_EnumFilters
,
335 GraphBuilder_FindFilterByName
,
336 GraphBuilder_ConnectDirect
,
337 GraphBuilder_Reconnect
,
338 GraphBuilder_Disconnect
,
339 GraphBuilder_SetDefaultSyncSource
,
340 GraphBuilder_Connect
,
342 GraphBuilder_RenderFile
,
343 GraphBuilder_AddSourceFilter
,
344 GraphBuilder_SetLogFile
,
346 GraphBuilder_ShouldOperationContinue
349 static IGraphBuilder GraphBuilder
= {&GraphBuilder_vtbl
};
352 IBaseFilter IBaseFilter_iface
;
353 IEnumPins IEnumPins_iface
;
355 IKsPropertySet IKsPropertySet_iface
;
356 IMemInputPin IMemInputPin_iface
;
357 IMediaSeeking IMediaSeeking_iface
;
358 IEnumMediaTypes IEnumMediaTypes_iface
;
361 filter_type filter_type
;
364 int enum_media_types_pos
;
367 static test_filter
* impl_from_IBaseFilter(IBaseFilter
*iface
)
369 return CONTAINING_RECORD(iface
, test_filter
, IBaseFilter_iface
);
372 static HRESULT WINAPI
BaseFilter_QueryInterface(IBaseFilter
*iface
, REFIID riid
, void **ppv
)
374 test_filter
*This
= impl_from_IBaseFilter(iface
);
376 if(IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IPersist
)
377 || IsEqualIID(riid
, &IID_IMediaFilter
) || IsEqualIID(riid
, &IID_IBaseFilter
)) {
382 check_calls_list("BaseFilter_QueryInterface", BASEFILTER_QUERYINTERFACE
, This
->filter_type
);
383 ok(IsEqualIID(riid
, &IID_IPin
), "riid = %s\n", wine_dbgstr_guid(riid
));
384 return E_NOINTERFACE
;
387 static ULONG WINAPI
BaseFilter_AddRef(IBaseFilter
*iface
)
392 static ULONG WINAPI
BaseFilter_Release(IBaseFilter
*iface
)
397 static HRESULT WINAPI
BaseFilter_GetClassID(IBaseFilter
*iface
, CLSID
*pClassID
)
399 ok(0, "unexpected call\n");
403 static HRESULT WINAPI
BaseFilter_Stop(IBaseFilter
*iface
)
405 ok(0, "unexpected call\n");
409 static HRESULT WINAPI
BaseFilter_Pause(IBaseFilter
*iface
)
411 ok(0, "unexpected call\n");
415 static HRESULT WINAPI
BaseFilter_Run(IBaseFilter
*iface
, REFERENCE_TIME tStart
)
417 ok(0, "unexpected call\n");
421 static HRESULT WINAPI
BaseFilter_GetState(IBaseFilter
*iface
,
422 DWORD dwMilliSecsTimeout
, FILTER_STATE
*State
)
424 test_filter
*This
= impl_from_IBaseFilter(iface
);
425 check_calls_list("BaseFilter_GetState", BASEFILTER_GETSTATE
, This
->filter_type
);
429 static HRESULT WINAPI
BaseFilter_SetSyncSource(
430 IBaseFilter
*iface
, IReferenceClock
*pClock
)
432 ok(0, "unexpected call\n");
436 static HRESULT WINAPI
BaseFilter_GetSyncSource(
437 IBaseFilter
*iface
, IReferenceClock
**pClock
)
439 ok(0, "unexpected call\n");
443 static HRESULT WINAPI
BaseFilter_EnumPins(
444 IBaseFilter
*iface
, IEnumPins
**ppEnum
)
446 test_filter
*This
= impl_from_IBaseFilter(iface
);
447 check_calls_list("BaseFilter_EnumPins", BASEFILTER_ENUMPINS
, This
->filter_type
);
449 *ppEnum
= &This
->IEnumPins_iface
;
450 This
->enum_pins_pos
= 0;
454 static HRESULT WINAPI
BaseFilter_FindPin(IBaseFilter
*iface
,
455 LPCWSTR Id
, IPin
**ppPin
)
457 ok(0, "unexpected call\n");
461 static HRESULT WINAPI
BaseFilter_QueryFilterInfo(IBaseFilter
*iface
, FILTER_INFO
*pInfo
)
463 ok(0, "unexpected call\n");
467 static HRESULT WINAPI
BaseFilter_JoinFilterGraph(IBaseFilter
*iface
,
468 IFilterGraph
*pGraph
, LPCWSTR pName
)
470 ok(0, "unexpected call\n");
474 static HRESULT WINAPI
BaseFilter_QueryVendorInfo(IBaseFilter
*iface
, LPWSTR
*pVendorInfo
)
476 ok(0, "unexpected call\n");
480 static const IBaseFilterVtbl BaseFilterVtbl
= {
481 BaseFilter_QueryInterface
,
484 BaseFilter_GetClassID
,
489 BaseFilter_SetSyncSource
,
490 BaseFilter_GetSyncSource
,
493 BaseFilter_QueryFilterInfo
,
494 BaseFilter_JoinFilterGraph
,
495 BaseFilter_QueryVendorInfo
498 static test_filter
* impl_from_IEnumPins(IEnumPins
*iface
)
500 return CONTAINING_RECORD(iface
, test_filter
, IEnumPins_iface
);
503 static HRESULT WINAPI
EnumPins_QueryInterface(IEnumPins
*iface
, REFIID riid
, void **ppv
)
505 ok(0, "unexpected call\n");
509 static ULONG WINAPI
EnumPins_AddRef(IEnumPins
*iface
)
514 static ULONG WINAPI
EnumPins_Release(IEnumPins
*iface
)
519 static HRESULT WINAPI
EnumPins_Next(IEnumPins
*iface
,
520 ULONG cPins
, IPin
**ppPins
, ULONG
*pcFetched
)
522 test_filter
*This
= impl_from_IEnumPins(iface
);
523 check_calls_list("EnumPins_Next", ENUMPINS_NEXT
, This
->filter_type
);
525 ok(cPins
== 1, "cPins = %d\n", cPins
);
526 ok(ppPins
!= NULL
, "ppPins == NULL\n");
527 ok(pcFetched
!= NULL
, "pcFetched == NULL\n");
529 if(This
->enum_pins_pos
++ < (This
->filter_type
== INTERMEDIATE_FILTER
? 2 : 1)) {
530 *ppPins
= &This
->IPin_iface
;
538 static HRESULT WINAPI
EnumPins_Skip(IEnumPins
*iface
, ULONG cPins
)
540 ok(0, "unexpected call\n");
544 static HRESULT WINAPI
EnumPins_Reset(IEnumPins
*iface
)
546 ok(0, "unexpected call\n");
550 static HRESULT WINAPI
EnumPins_Clone(IEnumPins
*iface
, IEnumPins
**ppEnum
)
552 ok(0, "unexpected call\n");
556 static const IEnumPinsVtbl EnumPinsVtbl
= {
557 EnumPins_QueryInterface
,
566 static test_filter
* impl_from_IPin(IPin
*iface
)
568 return CONTAINING_RECORD(iface
, test_filter
, IPin_iface
);
571 static HRESULT WINAPI
Pin_QueryInterface(IPin
*iface
, REFIID riid
, void **ppv
)
573 test_filter
*This
= impl_from_IPin(iface
);
575 if(IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IPin
)) {
580 if(IsEqualIID(riid
, &IID_IKsPropertySet
)) {
581 *ppv
= &This
->IKsPropertySet_iface
;
585 if(IsEqualIID(riid
, &IID_IMemInputPin
)) {
586 *ppv
= &This
->IMemInputPin_iface
;
590 if(IsEqualIID(riid
, &IID_IMediaSeeking
)) {
591 *ppv
= &This
->IMediaSeeking_iface
;
595 ok(0, "unexpected call: %s\n", wine_dbgstr_guid(riid
));
597 return E_NOINTERFACE
;
600 static ULONG WINAPI
Pin_AddRef(IPin
*iface
)
605 static ULONG WINAPI
Pin_Release(IPin
*iface
)
610 static HRESULT WINAPI
Pin_Connect(IPin
*iface
, IPin
*pReceivePin
, const AM_MEDIA_TYPE
*pmt
)
612 ok(0, "unexpected call\n");
616 static HRESULT WINAPI
Pin_ReceiveConnection(IPin
*iface
,
617 IPin
*pConnector
, const AM_MEDIA_TYPE
*pmt
)
619 CHECK_EXPECT(ReceiveConnection
);
621 ok(IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Stream
), "majortype = %s\n",
622 wine_dbgstr_guid(&pmt
->majortype
));
623 ok(IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_Avi
), "subtype = %s\n",
624 wine_dbgstr_guid(&pmt
->subtype
));
625 ok(pmt
->bFixedSizeSamples
, "bFixedSizeSamples = %x\n", pmt
->bFixedSizeSamples
);
626 ok(!pmt
->bTemporalCompression
, "bTemporalCompression = %x\n", pmt
->bTemporalCompression
);
627 ok(pmt
->lSampleSize
== 1, "lSampleSize = %d\n", pmt
->lSampleSize
);
628 ok(IsEqualIID(&pmt
->formattype
, &GUID_NULL
), "formattype = %s\n",
629 wine_dbgstr_guid(&pmt
->formattype
));
630 ok(!pmt
->pUnk
, "pUnk = %p\n", pmt
->pUnk
);
631 ok(!pmt
->cbFormat
, "cbFormat = %d\n", pmt
->cbFormat
);
632 ok(!pmt
->pbFormat
, "pbFormat = %p\n", pmt
->pbFormat
);
636 static HRESULT WINAPI
Pin_Disconnect(IPin
*iface
)
638 ok(0, "unexpected call\n");
642 static HRESULT WINAPI
Pin_ConnectedTo(IPin
*iface
, IPin
**pPin
)
644 test_filter
*This
= impl_from_IPin(iface
);
645 check_calls_list("Pin_ConnectedTo", PIN_CONNECTEDTO
, This
->filter_type
);
651 static HRESULT WINAPI
Pin_ConnectionMediaType(IPin
*iface
, AM_MEDIA_TYPE
*pmt
)
653 ok(0, "unexpected call\n");
657 static HRESULT WINAPI
Pin_QueryPinInfo(IPin
*iface
, PIN_INFO
*pInfo
)
659 test_filter
*This
= impl_from_IPin(iface
);
660 check_calls_list("Pin_QueryPinInfo", PIN_QUERYPININFO
, This
->filter_type
);
664 static HRESULT WINAPI
Pin_QueryDirection(IPin
*iface
, PIN_DIRECTION
*pPinDir
)
666 test_filter
*This
= impl_from_IPin(iface
);
667 check_calls_list("Pin_QueryDirection", PIN_QUERYDIRECTION
, This
->filter_type
);
669 *pPinDir
= This
->dir
;
670 if(This
->filter_type
==INTERMEDIATE_FILTER
&& This
->enum_pins_pos
==2)
671 *pPinDir
= PINDIR_INPUT
;
675 static HRESULT WINAPI
Pin_QueryId(IPin
*iface
, LPWSTR
*Id
)
677 ok(0, "unexpected call\n");
681 static HRESULT WINAPI
Pin_QueryAccept(IPin
*iface
, const AM_MEDIA_TYPE
*pmt
)
683 ok(0, "unexpected call\n");
687 static HRESULT WINAPI
Pin_EnumMediaTypes(IPin
*iface
, IEnumMediaTypes
**ppEnum
)
689 test_filter
*This
= impl_from_IPin(iface
);
690 check_calls_list("Pin_EnumMediaTypes", PIN_ENUMMEDIATYPES
, This
->filter_type
);
692 ok(ppEnum
!= NULL
, "ppEnum == NULL\n");
693 *ppEnum
= &This
->IEnumMediaTypes_iface
;
697 static HRESULT WINAPI
Pin_QueryInternalConnections(IPin
*iface
, IPin
**apPin
, ULONG
*nPin
)
699 ok(0, "unexpected call\n");
703 static HRESULT WINAPI
Pin_EndOfStream(IPin
*iface
)
705 ok(0, "unexpected call\n");
709 static HRESULT WINAPI
Pin_BeginFlush(IPin
*iface
)
711 ok(0, "unexpected call\n");
715 static HRESULT WINAPI
Pin_EndFlush(IPin
*iface
)
717 ok(0, "unexpected call\n");
721 static HRESULT WINAPI
Pin_NewSegment(IPin
*iface
, REFERENCE_TIME tStart
,
722 REFERENCE_TIME tStop
, double dRate
)
724 ok(0, "unexpected call\n");
728 static const IPinVtbl PinVtbl
= {
733 Pin_ReceiveConnection
,
736 Pin_ConnectionMediaType
,
742 Pin_QueryInternalConnections
,
749 static test_filter
* impl_from_IKsPropertySet(IKsPropertySet
*iface
)
751 return CONTAINING_RECORD(iface
, test_filter
, IKsPropertySet_iface
);
754 static HRESULT WINAPI
KsPropertySet_QueryInterface(IKsPropertySet
*iface
, REFIID riid
, void **ppv
)
756 ok(0, "unexpected call\n");
760 static ULONG WINAPI
KsPropertySet_AddRef(IKsPropertySet
*iface
)
765 static ULONG WINAPI
KsPropertySet_Release(IKsPropertySet
*iface
)
770 static HRESULT WINAPI
KsPropertySet_Set(IKsPropertySet
*iface
, REFGUID guidPropSet
, DWORD dwPropID
,
771 LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
, DWORD cbPropData
)
773 ok(0, "unexpected call\n");
777 static HRESULT WINAPI
KsPropertySet_Get(IKsPropertySet
*iface
, REFGUID guidPropSet
, DWORD dwPropID
,
778 LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
, DWORD cbPropData
, DWORD
*pcbReturned
)
780 test_filter
*This
= impl_from_IKsPropertySet(iface
);
781 check_calls_list("KsPropertySet_Get", KSPROPERTYSET_GET
, This
->filter_type
);
783 ok(IsEqualIID(guidPropSet
, &ROPSETID_Pin
), "guidPropSet = %s\n", wine_dbgstr_guid(guidPropSet
));
784 ok(dwPropID
== 0, "dwPropID = %d\n", dwPropID
);
785 ok(pInstanceData
== NULL
, "pInstanceData != NULL\n");
786 ok(cbInstanceData
== 0, "cbInstanceData != 0\n");
787 ok(cbPropData
== sizeof(GUID
), "cbPropData = %d\n", cbPropData
);
788 *pcbReturned
= sizeof(GUID
);
789 memcpy(pPropData
, &PIN_CATEGORY_EDS
, sizeof(GUID
));
793 static HRESULT WINAPI
KsPropertySet_QuerySupported(IKsPropertySet
*iface
,
794 REFGUID guidPropSet
, DWORD dwPropID
, DWORD
*pTypeSupport
)
796 ok(0, "unexpected call\n");
800 static const IKsPropertySetVtbl KsPropertySetVtbl
= {
801 KsPropertySet_QueryInterface
,
802 KsPropertySet_AddRef
,
803 KsPropertySet_Release
,
806 KsPropertySet_QuerySupported
809 static IStream
*avi_stream
;
810 static HRESULT WINAPI
MemInputPin_QueryInterface(IMemInputPin
*iface
, REFIID riid
, void **ppv
)
812 if(IsEqualIID(riid
, &IID_IStream
)) {
813 CHECK_EXPECT(MemInputPin_QueryInterface_IStream
);
816 return E_NOINTERFACE
;
819 IStream_AddRef(avi_stream
);
823 ok(0, "unexpected call: %s\n", wine_dbgstr_guid(riid
));
827 static ULONG WINAPI
MemInputPin_AddRef(IMemInputPin
*iface
)
832 static ULONG WINAPI
MemInputPin_Release(IMemInputPin
*iface
)
837 static HRESULT WINAPI
MemInputPin_GetAllocator(IMemInputPin
*iface
, IMemAllocator
**ppAllocator
)
839 ok(0, "unexpected call\n");
843 static HRESULT WINAPI
MemInputPin_NotifyAllocator(IMemInputPin
*iface
,
844 IMemAllocator
*pAllocator
, BOOL bReadOnly
)
846 ALLOCATOR_PROPERTIES ap
;
849 CHECK_EXPECT(NotifyAllocator
);
851 ok(pAllocator
!= NULL
, "pAllocator = %p\n", pAllocator
);
852 ok(bReadOnly
, "bReadOnly = %x\n", bReadOnly
);
854 hr
= IMemAllocator_GetProperties(pAllocator
, &ap
);
855 ok(hr
== S_OK
, "GetProperties returned %x\n", hr
);
856 ok(ap
.cBuffers
== 32, "cBuffers = %d\n", ap
.cBuffers
);
857 ok(ap
.cbBuffer
== 0, "cbBuffer = %d\n", ap
.cbBuffer
);
858 ok(ap
.cbAlign
== 1, "cbAlign = %d\n", ap
.cbAlign
);
859 ok(ap
.cbPrefix
== 0, "cbPrefix = %d\n", ap
.cbPrefix
);
863 static HRESULT WINAPI
MemInputPin_GetAllocatorRequirements(
864 IMemInputPin
*iface
, ALLOCATOR_PROPERTIES
*pProps
)
866 CHECK_EXPECT(GetAllocatorRequirements
);
870 static HRESULT WINAPI
MemInputPin_Receive(IMemInputPin
*iface
, IMediaSample
*pSample
)
872 REFERENCE_TIME off
, tmp
;
877 hr
= IMediaSample_GetTime(pSample
, &off
, &tmp
);
878 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
879 hr
= IMediaSample_GetPointer(pSample
, &data
);
880 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
882 IStream_Seek(avi_stream
, li
, STREAM_SEEK_SET
, NULL
);
883 IStream_Write(avi_stream
, data
, IMediaSample_GetActualDataLength(pSample
), NULL
);
887 static HRESULT WINAPI
MemInputPin_ReceiveMultiple(IMemInputPin
*iface
,
888 IMediaSample
**pSamples
, LONG nSamples
, LONG
*nSamplesProcessed
)
890 ok(0, "unexpected call\n");
894 static HRESULT WINAPI
MemInputPin_ReceiveCanBlock(IMemInputPin
*iface
)
896 ok(0, "unexpected call\n");
900 static const IMemInputPinVtbl MemInputPinVtbl
= {
901 MemInputPin_QueryInterface
,
904 MemInputPin_GetAllocator
,
905 MemInputPin_NotifyAllocator
,
906 MemInputPin_GetAllocatorRequirements
,
908 MemInputPin_ReceiveMultiple
,
909 MemInputPin_ReceiveCanBlock
912 static HRESULT WINAPI
MediaSeeking_QueryInterface(
913 IMediaSeeking
*iface
, REFIID riid
, void **ppv
)
915 ok(0, "unexpected call\n");
919 static ULONG WINAPI
MediaSeeking_AddRef(IMediaSeeking
*iface
)
924 static ULONG WINAPI
MediaSeeking_Release(IMediaSeeking
*iface
)
929 static HRESULT WINAPI
MediaSeeking_GetCapabilities(
930 IMediaSeeking
*iface
, DWORD
*pCapabilities
)
932 ok(0, "unexpected call\n");
936 static HRESULT WINAPI
MediaSeeking_CheckCapabilities(
937 IMediaSeeking
*iface
, DWORD
*pCapabilities
)
939 ok(0, "unexpected call\n");
943 static HRESULT WINAPI
MediaSeeking_IsFormatSupported(
944 IMediaSeeking
*iface
, const GUID
*pFormat
)
946 ok(0, "unexpected call\n");
950 static HRESULT WINAPI
MediaSeeking_QueryPreferredFormat(
951 IMediaSeeking
*iface
, GUID
*pFormat
)
953 ok(0, "unexpected call\n");
957 static HRESULT WINAPI
MediaSeeking_GetTimeFormat(
958 IMediaSeeking
*iface
, GUID
*pFormat
)
960 ok(0, "unexpected call\n");
964 static HRESULT WINAPI
MediaSeeking_IsUsingTimeFormat(
965 IMediaSeeking
*iface
, const GUID
*pFormat
)
967 ok(0, "unexpected call\n");
971 static HRESULT WINAPI
MediaSeeking_SetTimeFormat(
972 IMediaSeeking
*iface
, const GUID
*pFormat
)
974 ok(0, "unexpected call\n");
978 static HRESULT WINAPI
MediaSeeking_GetDuration(
979 IMediaSeeking
*iface
, LONGLONG
*pDuration
)
981 ok(0, "unexpected call\n");
985 static HRESULT WINAPI
MediaSeeking_GetStopPosition(
986 IMediaSeeking
*iface
, LONGLONG
*pStop
)
988 ok(0, "unexpected call\n");
992 static HRESULT WINAPI
MediaSeeking_GetCurrentPosition(
993 IMediaSeeking
*iface
, LONGLONG
*pCurrent
)
995 ok(0, "unexpected call\n");
999 static HRESULT WINAPI
MediaSeeking_ConvertTimeFormat(IMediaSeeking
*iface
, LONGLONG
*pTarget
,
1000 const GUID
*pTargetFormat
, LONGLONG Source
, const GUID
*pSourceFormat
)
1002 ok(0, "unexpected call\n");
1006 static HRESULT WINAPI
MediaSeeking_SetPositions(IMediaSeeking
*iface
, LONGLONG
*pCurrent
,
1007 DWORD dwCurrentFlags
, LONGLONG
*pStop
, DWORD dwStopFlags
)
1009 ok(0, "unexpected call\n");
1013 static HRESULT WINAPI
MediaSeeking_GetPositions(IMediaSeeking
*iface
,
1014 LONGLONG
*pCurrent
, LONGLONG
*pStop
)
1016 CHECK_EXPECT(MediaSeeking_GetPositions
);
1020 static HRESULT WINAPI
MediaSeeking_GetAvailable(IMediaSeeking
*iface
,
1021 LONGLONG
*pEarliest
, LONGLONG
*pLatest
)
1023 ok(0, "unexpected call\n");
1027 static HRESULT WINAPI
MediaSeeking_SetRate(IMediaSeeking
*iface
, double dRate
)
1029 ok(0, "unexpected call\n");
1033 static HRESULT WINAPI
MediaSeeking_GetRate(IMediaSeeking
*iface
, double *pdRate
)
1035 ok(0, "unexpected call\n");
1039 static HRESULT WINAPI
MediaSeeking_GetPreroll(IMediaSeeking
*iface
, LONGLONG
*pllPreroll
)
1041 ok(0, "unexpected call\n");
1045 static const IMediaSeekingVtbl MediaSeekingVtbl
= {
1046 MediaSeeking_QueryInterface
,
1047 MediaSeeking_AddRef
,
1048 MediaSeeking_Release
,
1049 MediaSeeking_GetCapabilities
,
1050 MediaSeeking_CheckCapabilities
,
1051 MediaSeeking_IsFormatSupported
,
1052 MediaSeeking_QueryPreferredFormat
,
1053 MediaSeeking_GetTimeFormat
,
1054 MediaSeeking_IsUsingTimeFormat
,
1055 MediaSeeking_SetTimeFormat
,
1056 MediaSeeking_GetDuration
,
1057 MediaSeeking_GetStopPosition
,
1058 MediaSeeking_GetCurrentPosition
,
1059 MediaSeeking_ConvertTimeFormat
,
1060 MediaSeeking_SetPositions
,
1061 MediaSeeking_GetPositions
,
1062 MediaSeeking_GetAvailable
,
1063 MediaSeeking_SetRate
,
1064 MediaSeeking_GetRate
,
1065 MediaSeeking_GetPreroll
1068 static test_filter
* impl_from_IEnumMediaTypes(IEnumMediaTypes
*iface
)
1070 return CONTAINING_RECORD(iface
, test_filter
, IEnumMediaTypes_iface
);
1073 static HRESULT WINAPI
EnumMediaTypes_QueryInterface(IEnumMediaTypes
*iface
, REFIID riid
, void **ppv
)
1075 ok(0, "unexpected call\n");
1079 static ULONG WINAPI
EnumMediaTypes_AddRef(IEnumMediaTypes
*iface
)
1084 static ULONG WINAPI
EnumMediaTypes_Release(IEnumMediaTypes
*iface
)
1089 static HRESULT WINAPI
EnumMediaTypes_Next(IEnumMediaTypes
*iface
, ULONG cMediaTypes
,
1090 AM_MEDIA_TYPE
**ppMediaTypes
, ULONG
*pcFetched
)
1092 test_filter
*This
= impl_from_IEnumMediaTypes(iface
);
1093 check_calls_list("EnumMediaTypes_Next", ENUMMEDIATYPES_NEXT
, This
->filter_type
);
1095 ok(cMediaTypes
== 1, "cMediaTypes = %d\n", cMediaTypes
);
1096 ok(ppMediaTypes
!= NULL
, "ppMediaTypes == NULL\n");
1097 ok(pcFetched
!= NULL
, "pcFetched == NULL\n");
1099 if(!This
->enum_media_types_pos
++) {
1100 ppMediaTypes
[0] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE
));
1101 memset(ppMediaTypes
[0], 0, sizeof(AM_MEDIA_TYPE
));
1102 ppMediaTypes
[0]->majortype
= MEDIATYPE_Video
;
1111 static HRESULT WINAPI
EnumMediaTypes_Skip(IEnumMediaTypes
*iface
, ULONG cMediaTypes
)
1113 ok(0, "unexpected call\n");
1117 static HRESULT WINAPI
EnumMediaTypes_Reset(IEnumMediaTypes
*iface
)
1119 test_filter
*This
= impl_from_IEnumMediaTypes(iface
);
1120 check_calls_list("EnumMediaTypes_Reset", ENUMMEDIATYPES_RESET
, This
->filter_type
);
1122 This
->enum_media_types_pos
= 0;
1126 static HRESULT WINAPI
EnumMediaTypes_Clone(IEnumMediaTypes
*iface
, IEnumMediaTypes
**ppEnum
)
1128 ok(0, "unexpected call\n");
1132 static const IEnumMediaTypesVtbl EnumMediaTypesVtbl
= {
1133 EnumMediaTypes_QueryInterface
,
1134 EnumMediaTypes_AddRef
,
1135 EnumMediaTypes_Release
,
1136 EnumMediaTypes_Next
,
1137 EnumMediaTypes_Skip
,
1138 EnumMediaTypes_Reset
,
1139 EnumMediaTypes_Clone
1142 static void init_test_filter(test_filter
*This
, PIN_DIRECTION dir
, filter_type type
)
1144 memset(This
, 0, sizeof(*This
));
1145 This
->IBaseFilter_iface
.lpVtbl
= &BaseFilterVtbl
;
1146 This
->IEnumPins_iface
.lpVtbl
= &EnumPinsVtbl
;
1147 This
->IPin_iface
.lpVtbl
= &PinVtbl
;
1148 This
->IKsPropertySet_iface
.lpVtbl
= &KsPropertySetVtbl
;
1149 This
->IMemInputPin_iface
.lpVtbl
= &MemInputPinVtbl
;
1150 This
->IMediaSeeking_iface
.lpVtbl
= &MediaSeekingVtbl
;
1151 This
->IEnumMediaTypes_iface
.lpVtbl
= &EnumMediaTypesVtbl
;
1154 This
->filter_type
= type
;
1157 static void test_AviMux_QueryInterface(void)
1159 IUnknown
*avimux
, *unk
;
1162 hr
= CoCreateInstance(&CLSID_AviDest
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&avimux
);
1163 ok(hr
== S_OK
|| broken(hr
== REGDB_E_CLASSNOTREG
),
1164 "couldn't create AVI Mux filter, hr = %08x\n", hr
);
1166 win_skip("AVI Mux filter is not registered\n");
1170 hr
= IUnknown_QueryInterface(avimux
, &IID_IBaseFilter
, (void**)&unk
);
1171 ok(hr
== S_OK
, "QueryInterface(IID_IBaseFilter) failed: %x\n", hr
);
1172 IUnknown_Release(unk
);
1174 hr
= IUnknown_QueryInterface(avimux
, &IID_IConfigAviMux
, (void**)&unk
);
1175 ok(hr
== S_OK
, "QueryInterface(IID_IConfigAviMux) failed: %x\n", hr
);
1176 IUnknown_Release(unk
);
1178 hr
= IUnknown_QueryInterface(avimux
, &IID_IConfigInterleaving
, (void**)&unk
);
1179 ok(hr
== S_OK
, "QueryInterface(IID_IConfigInterleaving) failed: %x\n", hr
);
1180 IUnknown_Release(unk
);
1182 hr
= IUnknown_QueryInterface(avimux
, &IID_IMediaSeeking
, (void**)&unk
);
1183 ok(hr
== S_OK
, "QueryInterface(IID_IMediaSeeking) failed: %x\n", hr
);
1184 IUnknown_Release(unk
);
1186 hr
= IUnknown_QueryInterface(avimux
, &IID_IPersistMediaPropertyBag
, (void**)&unk
);
1187 ok(hr
== S_OK
, "QueryInterface(IID_IPersistMediaPropertyBag) failed: %x\n", hr
);
1188 IUnknown_Release(unk
);
1190 hr
= IUnknown_QueryInterface(avimux
, &IID_ISpecifyPropertyPages
, (void**)&unk
);
1191 ok(hr
== S_OK
, "QueryInterface(IID_ISpecifyPropertyPages) failed: %x\n", hr
);
1192 IUnknown_Release(unk
);
1194 IUnknown_Release(avimux
);
1197 static HRESULT WINAPI
MemAllocator_QueryInterface(IMemAllocator
*iface
, REFIID riid
, void **ppvObject
)
1199 if(IsEqualIID(riid
, &IID_IUnknown
)) {
1204 ok(0, "unexpected call: %s\n", wine_dbgstr_guid(riid
));
1208 static ULONG WINAPI
MemAllocator_AddRef(IMemAllocator
*iface
)
1213 static ULONG WINAPI
MemAllocator_Release(IMemAllocator
*iface
)
1218 static HRESULT WINAPI
MemAllocator_SetProperties(IMemAllocator
*iface
,
1219 ALLOCATOR_PROPERTIES
*pRequest
, ALLOCATOR_PROPERTIES
*pActual
)
1221 ok(0, "unexpected call\n");
1225 static HRESULT WINAPI
MemAllocator_GetProperties(IMemAllocator
*iface
, ALLOCATOR_PROPERTIES
*pProps
)
1227 CHECK_EXPECT2(MemAllocator_GetProperties
);
1229 pProps
->cBuffers
= 1;
1230 pProps
->cbBuffer
= 1024;
1231 pProps
->cbAlign
= 0;
1232 pProps
->cbPrefix
= 0;
1236 static HRESULT WINAPI
MemAllocator_Commit(IMemAllocator
*iface
)
1238 ok(0, "unexpected call\n");
1242 static HRESULT WINAPI
MemAllocator_Decommit(IMemAllocator
*iface
)
1244 ok(0, "unexpected call\n");
1248 static HRESULT WINAPI
MemAllocator_GetBuffer(IMemAllocator
*iface
, IMediaSample
**ppBuffer
,
1249 REFERENCE_TIME
*pStartTime
, REFERENCE_TIME
*pEndTime
, DWORD dwFlags
)
1251 ok(0, "unexpected call\n");
1255 static HRESULT WINAPI
MemAllocator_ReleaseBuffer(IMemAllocator
*iface
, IMediaSample
*pBuffer
)
1257 ok(0, "unexpected call\n");
1261 static const IMemAllocatorVtbl MemAllocatorVtbl
= {
1262 MemAllocator_QueryInterface
,
1263 MemAllocator_AddRef
,
1264 MemAllocator_Release
,
1265 MemAllocator_SetProperties
,
1266 MemAllocator_GetProperties
,
1267 MemAllocator_Commit
,
1268 MemAllocator_Decommit
,
1269 MemAllocator_GetBuffer
,
1270 MemAllocator_ReleaseBuffer
1272 IMemAllocator MemAllocator
= {&MemAllocatorVtbl
};
1274 static HRESULT WINAPI
MediaSample_QueryInterface(IMediaSample
* This
, REFIID riid
, void **ppv
)
1276 if(IsEqualIID(riid
, &IID_IMediaSample2
))
1277 CHECK_EXPECT(MediaSample_QueryInterface_MediaSample2
);
1279 ok(0, "MediaSample_QueryInterface: %s\n", wine_dbgstr_guid(riid
));
1282 return E_NOINTERFACE
;
1285 static ULONG WINAPI
MediaSample_AddRef(IMediaSample
* This
)
1290 static ULONG WINAPI
MediaSample_Release(IMediaSample
* This
)
1295 static BYTE buf
[1024];
1296 static HRESULT WINAPI
MediaSample_GetPointer(IMediaSample
* This
, BYTE
**ppBuffer
)
1298 CHECK_EXPECT2(MediaSample_GetPointer
);
1300 memset(buf
, 'z', sizeof(buf
));
1304 static LONG WINAPI
MediaSample_GetSize(IMediaSample
* This
)
1306 CHECK_EXPECT2(MediaSample_GetSize
);
1310 static REFERENCE_TIME start_time
, end_time
;
1311 static HRESULT WINAPI
MediaSample_GetTime(IMediaSample
* This
,
1312 REFERENCE_TIME
*pTimeStart
, REFERENCE_TIME
*pTimeEnd
)
1314 CHECK_EXPECT2(MediaSample_GetTime
);
1315 *pTimeStart
= start_time
;
1316 *pTimeEnd
= end_time
;
1320 static HRESULT WINAPI
MediaSample_SetTime(IMediaSample
* This
,
1321 REFERENCE_TIME
*pTimeStart
, REFERENCE_TIME
*pTimeEnd
)
1323 ok(0, "unexpected call\n");
1327 static HRESULT WINAPI
MediaSample_IsSyncPoint(IMediaSample
* This
)
1329 CHECK_EXPECT2(MediaSample_IsSyncPoint
);
1333 static HRESULT WINAPI
MediaSample_SetSyncPoint(IMediaSample
* This
, BOOL bIsSyncPoint
)
1335 ok(0, "unexpected call\n");
1339 static HRESULT WINAPI
MediaSample_IsPreroll(IMediaSample
* This
)
1341 CHECK_EXPECT2(MediaSample_IsPreroll
);
1345 static HRESULT WINAPI
MediaSample_SetPreroll(IMediaSample
* This
, BOOL bIsPreroll
)
1347 ok(0, "unexpected call\n");
1351 static LONG WINAPI
MediaSample_GetActualDataLength(IMediaSample
* This
)
1353 CHECK_EXPECT2(MediaSample_GetActualDataLength
);
1357 static HRESULT WINAPI
MediaSample_SetActualDataLength(IMediaSample
* This
, LONG length
)
1359 ok(0, "unexpected call\n");
1363 static HRESULT WINAPI
MediaSample_GetMediaType(IMediaSample
* This
, AM_MEDIA_TYPE
**ppMediaType
)
1365 CHECK_EXPECT2(MediaSample_GetMediaType
);
1366 *ppMediaType
= NULL
;
1370 static HRESULT WINAPI
MediaSample_SetMediaType(IMediaSample
* This
, AM_MEDIA_TYPE
*pMediaType
)
1372 ok(0, "unexpected call\n");
1376 static HRESULT WINAPI
MediaSample_IsDiscontinuity(IMediaSample
* This
)
1378 CHECK_EXPECT(MediaSample_IsDiscontinuity
);
1382 static HRESULT WINAPI
MediaSample_SetDiscontinuity(IMediaSample
* This
, BOOL bDiscontinuity
)
1384 ok(0, "unexpected call\n");
1388 static HRESULT WINAPI
MediaSample_GetMediaTime(IMediaSample
* This
,
1389 LONGLONG
*pTimeStart
, LONGLONG
*pTimeEnd
)
1391 CHECK_EXPECT(MediaSample_GetMediaTime
);
1395 static HRESULT WINAPI
MediaSample_SetMediaTime(IMediaSample
* This
,
1396 LONGLONG
*pTimeStart
, LONGLONG
*pTimeEnd
)
1398 ok(0, "unexpected call\n");
1402 static const IMediaSampleVtbl MediaSampleVtbl
= {
1403 MediaSample_QueryInterface
,
1405 MediaSample_Release
,
1406 MediaSample_GetPointer
,
1407 MediaSample_GetSize
,
1408 MediaSample_GetTime
,
1409 MediaSample_SetTime
,
1410 MediaSample_IsSyncPoint
,
1411 MediaSample_SetSyncPoint
,
1412 MediaSample_IsPreroll
,
1413 MediaSample_SetPreroll
,
1414 MediaSample_GetActualDataLength
,
1415 MediaSample_SetActualDataLength
,
1416 MediaSample_GetMediaType
,
1417 MediaSample_SetMediaType
,
1418 MediaSample_IsDiscontinuity
,
1419 MediaSample_SetDiscontinuity
,
1420 MediaSample_GetMediaTime
,
1421 MediaSample_SetMediaTime
,
1423 IMediaSample MediaSample
= {&MediaSampleVtbl
};
1425 static void test_AviMux(char *arg
)
1427 test_filter source_filter
, sink_filter
;
1428 VIDEOINFO videoinfo
;
1429 IPin
*avimux_in
, *avimux_out
, *pin
;
1430 AM_MEDIA_TYPE source_media_type
;
1431 AM_MEDIA_TYPE
*media_type
;
1433 IBaseFilter
*avimux
;
1435 IEnumMediaTypes
*emt
;
1436 IMemInputPin
*memin
;
1437 ALLOCATOR_PROPERTIES props
;
1438 IMemAllocator
*memalloc
;
1439 IConfigInterleaving
*ci
;
1444 init_test_filter(&source_filter
, PINDIR_OUTPUT
, SOURCE_FILTER
);
1445 init_test_filter(&sink_filter
, PINDIR_INPUT
, SINK_FILTER
);
1447 hr
= CoCreateInstance(&CLSID_AviDest
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (void**)&avimux
);
1448 ok(hr
== S_OK
|| broken(hr
== REGDB_E_CLASSNOTREG
),
1449 "couldn't create AVI Mux filter, hr = %08x\n", hr
);
1451 win_skip("AVI Mux filter is not registered\n");
1455 hr
= IBaseFilter_EnumPins(avimux
, &ep
);
1456 ok(hr
== S_OK
, "EnumPins returned %x\n", hr
);
1458 hr
= IEnumPins_Next(ep
, 1, &avimux_out
, NULL
);
1459 ok(hr
== S_OK
, "Next returned %x\n", hr
);
1460 hr
= IPin_QueryDirection(avimux_out
, &dir
);
1461 ok(hr
== S_OK
, "QueryDirection returned %x\n", hr
);
1462 ok(dir
== PINDIR_OUTPUT
, "dir = %d\n", dir
);
1464 hr
= IEnumPins_Next(ep
, 1, &avimux_in
, NULL
);
1465 ok(hr
== S_OK
, "Next returned %x\n", hr
);
1466 hr
= IPin_QueryDirection(avimux_in
, &dir
);
1467 ok(hr
== S_OK
, "QueryDirection returned %x\n", hr
);
1468 ok(dir
== PINDIR_INPUT
, "dir = %d\n", dir
);
1469 IEnumPins_Release(ep
);
1471 hr
= IPin_EnumMediaTypes(avimux_out
, &emt
);
1472 ok(hr
== S_OK
, "EnumMediaTypes returned %x\n", hr
);
1473 hr
= IEnumMediaTypes_Next(emt
, 1, &media_type
, NULL
);
1474 ok(hr
== S_OK
, "Next returned %x\n", hr
);
1475 ok(IsEqualIID(&media_type
->majortype
, &MEDIATYPE_Stream
), "majortype = %s\n",
1476 wine_dbgstr_guid(&media_type
->majortype
));
1477 ok(IsEqualIID(&media_type
->subtype
, &MEDIASUBTYPE_Avi
), "subtype = %s\n",
1478 wine_dbgstr_guid(&media_type
->subtype
));
1479 ok(media_type
->bFixedSizeSamples
, "bFixedSizeSamples = %x\n", media_type
->bFixedSizeSamples
);
1480 ok(!media_type
->bTemporalCompression
, "bTemporalCompression = %x\n", media_type
->bTemporalCompression
);
1481 ok(media_type
->lSampleSize
== 1, "lSampleSize = %d\n", media_type
->lSampleSize
);
1482 ok(IsEqualIID(&media_type
->formattype
, &GUID_NULL
), "formattype = %s\n",
1483 wine_dbgstr_guid(&media_type
->formattype
));
1484 ok(!media_type
->pUnk
, "pUnk = %p\n", media_type
->pUnk
);
1485 ok(!media_type
->cbFormat
, "cbFormat = %d\n", media_type
->cbFormat
);
1486 ok(!media_type
->pbFormat
, "pbFormat = %p\n", media_type
->pbFormat
);
1487 CoTaskMemFree(media_type
);
1488 hr
= IEnumMediaTypes_Next(emt
, 1, &media_type
, NULL
);
1489 ok(hr
== S_FALSE
, "Next returned %x\n", hr
);
1490 IEnumMediaTypes_Release(emt
);
1492 hr
= IPin_EnumMediaTypes(avimux_in
, &emt
);
1493 ok(hr
== S_OK
, "EnumMediaTypes returned %x\n", hr
);
1494 hr
= IEnumMediaTypes_Reset(emt
);
1495 ok(hr
== S_OK
, "Reset returned %x\n", hr
);
1496 hr
= IEnumMediaTypes_Next(emt
, 1, &media_type
, NULL
);
1497 ok(hr
== S_FALSE
, "Next returned %x\n", hr
);
1498 IEnumMediaTypes_Release(emt
);
1500 hr
= IPin_ReceiveConnection(avimux_in
, &source_filter
.IPin_iface
, NULL
);
1501 ok(hr
== E_POINTER
, "ReceiveConnection returned %x\n", hr
);
1503 current_calls_list
= NULL
;
1504 memset(&source_media_type
, 0, sizeof(AM_MEDIA_TYPE
));
1505 memset(&videoinfo
, 0, sizeof(VIDEOINFO
));
1506 source_media_type
.majortype
= MEDIATYPE_Video
;
1507 source_media_type
.subtype
= MEDIASUBTYPE_RGB32
;
1508 source_media_type
.formattype
= FORMAT_VideoInfo
;
1509 source_media_type
.bFixedSizeSamples
= TRUE
;
1510 source_media_type
.lSampleSize
= 40000;
1511 source_media_type
.cbFormat
= sizeof(VIDEOINFO
);
1512 source_media_type
.pbFormat
= (BYTE
*)&videoinfo
;
1513 videoinfo
.AvgTimePerFrame
= 333333;
1514 videoinfo
.bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
1515 videoinfo
.bmiHeader
.biWidth
= 100;
1516 videoinfo
.bmiHeader
.biHeight
= 100;
1517 videoinfo
.bmiHeader
.biPlanes
= 1;
1518 videoinfo
.bmiHeader
.biBitCount
= 32;
1519 videoinfo
.bmiHeader
.biSizeImage
= 40000;
1520 videoinfo
.bmiHeader
.biClrImportant
= 256;
1521 hr
= IPin_ReceiveConnection(avimux_in
, &source_filter
.IPin_iface
, &source_media_type
);
1522 ok(hr
== S_OK
, "ReceiveConnection returned %x\n", hr
);
1524 hr
= IPin_ConnectedTo(avimux_in
, &pin
);
1525 ok(hr
== S_OK
, "ConnectedTo returned %x\n", hr
);
1526 ok(pin
== &source_filter
.IPin_iface
, "incorrect pin: %p, expected %p\n",
1527 pin
, &source_filter
.IPin_iface
);
1529 hr
= IPin_Connect(avimux_out
, &source_filter
.IPin_iface
, NULL
);
1530 todo_wine
ok(hr
== VFW_E_INVALID_DIRECTION
, "Connect returned %x\n", hr
);
1532 hr
= IBaseFilter_JoinFilterGraph(avimux
, (IFilterGraph
*)&GraphBuilder
, NULL
);
1533 ok(hr
== S_OK
, "JoinFilterGraph returned %x\n", hr
);
1535 SET_EXPECT(ReceiveConnection
);
1536 SET_EXPECT(GetAllocatorRequirements
);
1537 SET_EXPECT(NotifyAllocator
);
1538 SET_EXPECT(Reconnect
);
1539 hr
= IPin_Connect(avimux_out
, &sink_filter
.IPin_iface
, NULL
);
1540 ok(hr
== S_OK
, "Connect returned %x\n", hr
);
1541 CHECK_CALLED(ReceiveConnection
);
1542 CHECK_CALLED(GetAllocatorRequirements
);
1543 CHECK_CALLED(NotifyAllocator
);
1544 CHECK_CALLED(Reconnect
);
1546 hr
= IPin_ConnectedTo(avimux_out
, &pin
);
1547 ok(hr
== S_OK
, "ConnectedTo returned %x\n", hr
);
1548 ok(pin
== &sink_filter
.IPin_iface
, "incorrect pin: %p, expected %p\n",
1549 pin
, &source_filter
.IPin_iface
);
1551 hr
= IPin_QueryInterface(avimux_in
, &IID_IMemInputPin
, (void**)&memin
);
1552 ok(hr
== S_OK
, "QueryInterface returned %x\n", hr
);
1554 props
.cBuffers
= 0xdeadbee1;
1555 props
.cbBuffer
= 0xdeadbee2;
1556 props
.cbAlign
= 0xdeadbee3;
1557 props
.cbPrefix
= 0xdeadbee4;
1558 hr
= IMemInputPin_GetAllocatorRequirements(memin
, &props
);
1559 ok(hr
==S_OK
|| broken(hr
==E_INVALIDARG
), "GetAllocatorRequirements returned %x\n", hr
);
1561 ok(props
.cBuffers
== 0xdeadbee1, "cBuffers = %d\n", props
.cBuffers
);
1562 ok(props
.cbBuffer
== 0xdeadbee2, "cbBuffer = %d\n", props
.cbBuffer
);
1563 ok(props
.cbAlign
== 1, "cbAlign = %d\n", props
.cbAlign
);
1564 ok(props
.cbPrefix
== 8, "cbPrefix = %d\n", props
.cbPrefix
);
1567 hr
= IMemInputPin_GetAllocator(memin
, &memalloc
);
1568 ok(hr
== S_OK
, "GetAllocator returned %x\n", hr
);
1570 props
.cBuffers
= 0xdeadbee1;
1571 props
.cbBuffer
= 0xdeadbee2;
1572 props
.cbAlign
= 0xdeadbee3;
1573 props
.cbPrefix
= 0xdeadbee4;
1574 hr
= IMemAllocator_GetProperties(memalloc
, &props
);
1575 ok(hr
== S_OK
, "GetProperties returned %x\n", hr
);
1576 ok(props
.cBuffers
== 0, "cBuffers = %d\n", props
.cBuffers
);
1577 ok(props
.cbBuffer
== 0, "cbBuffer = %d\n", props
.cbBuffer
);
1578 ok(props
.cbAlign
== 0, "cbAlign = %d\n", props
.cbAlign
);
1579 ok(props
.cbPrefix
== 0, "cbPrefix = %d\n", props
.cbPrefix
);
1580 IMemAllocator_Release(memalloc
);
1582 hr
= IBaseFilter_QueryInterface(avimux
, &IID_IConfigInterleaving
, (void**)&ci
);
1583 ok(hr
== S_OK
, "QueryInterface(IID_IConfigInterleaving) returned %x\n", hr
);
1584 hr
= IConfigInterleaving_put_Mode(ci
, 5);
1585 ok(hr
== E_INVALIDARG
, "put_Mode returned %x\n", hr
);
1586 SET_EXPECT(Reconnect
);
1587 hr
= IConfigInterleaving_put_Mode(ci
, INTERLEAVE_FULL
);
1588 ok(hr
== S_OK
, "put_Mode returned %x\n", hr
);
1589 CHECK_CALLED(Reconnect
);
1590 IConfigInterleaving_Release(ci
);
1592 hr
= IBaseFilter_GetState(avimux
, 0, &state
);
1593 ok(hr
== S_OK
, "GetState returned %x\n", hr
);
1594 ok(state
== State_Stopped
, "state = %d\n", state
);
1596 SET_EXPECT(MemAllocator_GetProperties
);
1597 hr
= IMemInputPin_NotifyAllocator(memin
, &MemAllocator
, TRUE
);
1598 ok(hr
== S_OK
, "NotifyAllocator returned %x\n", hr
);
1599 CHECK_CALLED(MemAllocator_GetProperties
);
1601 hr
= IMemInputPin_GetAllocator(memin
, &memalloc
);
1602 ok(hr
== S_OK
, "GetAllocator returned %x\n", hr
);
1603 ok(memalloc
!= &MemAllocator
, "memalloc == &MemAllocator\n");
1604 IMemAllocator_Release(memalloc
);
1606 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &avi_stream
);
1607 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
1608 SET_EXPECT(MediaSeeking_GetPositions
);
1609 SET_EXPECT(MemInputPin_QueryInterface_IStream
);
1610 hr
= IBaseFilter_Run(avimux
, 0);
1611 ok(hr
== S_OK
, "Run returned %x\n", hr
);
1612 CHECK_CALLED(MediaSeeking_GetPositions
);
1614 hr
= IBaseFilter_GetState(avimux
, 0, &state
);
1615 ok(hr
== S_OK
, "GetState returned %x\n", hr
);
1616 ok(state
== State_Running
, "state = %d\n", state
);
1618 SET_EXPECT(MediaSample_QueryInterface_MediaSample2
);
1619 SET_EXPECT(MediaSample_IsDiscontinuity
);
1620 SET_EXPECT(MediaSample_IsPreroll
);
1621 SET_EXPECT(MediaSample_IsSyncPoint
);
1622 SET_EXPECT(MediaSample_GetTime
);
1623 SET_EXPECT(MediaSample_GetMediaType
);
1624 SET_EXPECT(MediaSample_GetPointer
);
1625 SET_EXPECT(MediaSample_GetActualDataLength
);
1626 SET_EXPECT(MediaSample_GetSize
);
1627 SET_EXPECT(MediaSample_GetMediaTime
);
1628 start_time
= end_time
= 0;
1629 hr
= IMemInputPin_Receive(memin
, &MediaSample
);
1630 ok(hr
== S_OK
, "Receive returned %x\n", hr
);
1631 CHECK_CALLED(MediaSample_QueryInterface_MediaSample2
);
1632 todo_wine
CHECK_CALLED(MediaSample_IsDiscontinuity
);
1633 todo_wine
CHECK_CALLED(MediaSample_IsPreroll
);
1634 CHECK_CALLED(MediaSample_IsSyncPoint
);
1635 CHECK_CALLED(MediaSample_GetTime
);
1636 todo_wine
CHECK_CALLED(MediaSample_GetMediaType
);
1637 CHECK_CALLED(MediaSample_GetPointer
);
1638 CHECK_CALLED(MediaSample_GetActualDataLength
);
1639 todo_wine
CHECK_CALLED(MediaSample_GetSize
);
1640 todo_wine
CHECK_CALLED(MediaSample_GetMediaTime
);
1642 SET_EXPECT(MediaSample_QueryInterface_MediaSample2
);
1643 SET_EXPECT(MediaSample_IsDiscontinuity
);
1644 SET_EXPECT(MediaSample_IsPreroll
);
1645 SET_EXPECT(MediaSample_IsSyncPoint
);
1646 SET_EXPECT(MediaSample_GetTime
);
1647 SET_EXPECT(MediaSample_GetMediaType
);
1648 SET_EXPECT(MediaSample_GetPointer
);
1649 SET_EXPECT(MediaSample_GetActualDataLength
);
1650 SET_EXPECT(MediaSample_GetSize
);
1651 SET_EXPECT(MediaSample_GetMediaTime
);
1652 hr
= IMemInputPin_Receive(memin
, &MediaSample
);
1653 ok(hr
== S_OK
, "Receive returned %x\n", hr
);
1654 CHECK_CALLED(MediaSample_QueryInterface_MediaSample2
);
1655 todo_wine
CHECK_CALLED(MediaSample_IsDiscontinuity
);
1656 todo_wine
CHECK_CALLED(MediaSample_IsPreroll
);
1657 CHECK_CALLED(MediaSample_IsSyncPoint
);
1658 CHECK_CALLED(MediaSample_GetTime
);
1659 todo_wine
CHECK_CALLED(MediaSample_GetMediaType
);
1660 CHECK_CALLED(MediaSample_GetPointer
);
1661 CHECK_CALLED(MediaSample_GetActualDataLength
);
1662 todo_wine
CHECK_CALLED(MediaSample_GetSize
);
1663 todo_wine
CHECK_CALLED(MediaSample_GetMediaTime
);
1665 SET_EXPECT(MediaSample_QueryInterface_MediaSample2
);
1666 SET_EXPECT(MediaSample_IsDiscontinuity
);
1667 SET_EXPECT(MediaSample_IsPreroll
);
1668 SET_EXPECT(MediaSample_IsSyncPoint
);
1669 SET_EXPECT(MediaSample_GetTime
);
1670 SET_EXPECT(MediaSample_GetMediaType
);
1671 SET_EXPECT(MediaSample_GetPointer
);
1672 SET_EXPECT(MediaSample_GetActualDataLength
);
1673 SET_EXPECT(MediaSample_GetSize
);
1674 SET_EXPECT(MediaSample_GetMediaTime
);
1675 start_time
= 20000000;
1676 end_time
= 21000000;
1677 hr
= IMemInputPin_Receive(memin
, &MediaSample
);
1678 ok(hr
== S_OK
, "Receive returned %x\n", hr
);
1679 CHECK_CALLED(MediaSample_QueryInterface_MediaSample2
);
1680 todo_wine
CHECK_CALLED(MediaSample_IsDiscontinuity
);
1681 todo_wine
CHECK_CALLED(MediaSample_IsPreroll
);
1682 CHECK_CALLED(MediaSample_IsSyncPoint
);
1683 CHECK_CALLED(MediaSample_GetTime
);
1684 todo_wine
CHECK_CALLED(MediaSample_GetMediaType
);
1685 CHECK_CALLED(MediaSample_GetPointer
);
1686 CHECK_CALLED(MediaSample_GetActualDataLength
);
1687 todo_wine
CHECK_CALLED(MediaSample_GetSize
);
1688 todo_wine
CHECK_CALLED(MediaSample_GetMediaTime
);
1689 IMemInputPin_Release(memin
);
1691 hr
= IBaseFilter_Stop(avimux
);
1692 ok(hr
== S_OK
, "Stop returned %x\n", hr
);
1693 CHECK_CALLED(MemInputPin_QueryInterface_IStream
);
1695 hr
= IBaseFilter_GetState(avimux
, 0, &state
);
1696 ok(hr
== S_OK
, "GetState returned %x\n", hr
);
1697 ok(state
== State_Stopped
, "state = %d\n", state
);
1699 hr
= IPin_Disconnect(avimux_out
);
1700 ok(hr
== S_OK
, "Disconnect returned %x\n", hr
);
1702 IPin_Release(avimux_in
);
1703 IPin_Release(avimux_out
);
1704 ref
= IBaseFilter_Release(avimux
);
1705 ok(ref
== 0, "Avi Mux filter was not destroyed (%d)\n", ref
);
1707 if(arg
&& !strcmp(arg
, "save")) {
1713 f
= CreateFileA("avimux.avi", GENERIC_WRITE
, 0, NULL
,
1714 CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
1715 ok(f
!= INVALID_HANDLE_VALUE
, "CreateFile failed\n");
1718 hr
= IStream_Seek(avi_stream
, li
, STREAM_SEEK_SET
, NULL
);
1719 ok(hr
== S_OK
, "IStream_Seek failed: %x\n", hr
);
1722 hr
= IStream_Read(avi_stream
, buf
, sizeof(buf
), &read
);
1724 ok(0, "IStream_Read failed: %x\n", hr
);
1729 ok(WriteFile(f
, buf
, read
, &read
, NULL
), "WriteFile failed\n");
1736 ref
= IStream_Release(avi_stream
);
1737 ok(ref
== 0, "IStream was not destroyed (%d)\n", ref
);
1740 static HRESULT WINAPI
PropertyBag_QueryInterface(IPropertyBag
*iface
, REFIID riid
, void **ppv
)
1742 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IPropertyBag
, riid
)) {
1747 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid
));
1749 return E_NOINTERFACE
;
1752 static ULONG WINAPI
PropertyBag_AddRef(IPropertyBag
*iface
)
1757 static ULONG WINAPI
PropertyBag_Release(IPropertyBag
*iface
)
1762 static HRESULT WINAPI
PropertyBag_Read(IPropertyBag
*iface
, LPCOLESTR pszPropName
, VARIANT
*pVar
, IErrorLog
*pErrorLog
)
1764 ok(!pErrorLog
, "pErrorLog = %p\n", pErrorLog
);
1766 if(!strcmp_wa(pszPropName
, "FccHandler")) {
1767 CHECK_EXPECT(Read_FccHandler
);
1768 V_VT(pVar
) = VT_BSTR
;
1769 V_BSTR(pVar
) = a2bstr("mrle");
1773 ok(0, "unexpected call: %s\n", wine_dbgstr_w(pszPropName
));
1777 static HRESULT WINAPI
PropertyBag_Write(IPropertyBag
*iface
, LPCOLESTR pszPropName
, VARIANT
*pVar
)
1779 ok(0, "unexpected call: %s\n", wine_dbgstr_w(pszPropName
));
1783 static const IPropertyBagVtbl PropertyBagVtbl
= {
1784 PropertyBag_QueryInterface
,
1786 PropertyBag_Release
,
1791 static IPropertyBag PropertyBag
= { &PropertyBagVtbl
};
1793 static void test_AviCo(void)
1795 IPersistPropertyBag
*persist_bag
;
1796 IPin
*pin
, *in_pin
, *out_pin
;
1797 IEnumPins
*enum_pins
;
1802 static const WCHAR inputW
[] = {'I','n','p','u','t',0};
1803 static const WCHAR outputW
[] = {'O','u','t','p','u','t',0};
1805 hres
= CoCreateInstance(&CLSID_AVICo
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (void**)&avico
);
1806 if(hres
== REGDB_E_CLASSNOTREG
) {
1807 win_skip("CLSID_AVICo not registered\n");
1810 ok(hres
== S_OK
, "Could not create CLSID_AVICo class: %08x\n", hres
);
1812 hres
= IBaseFilter_QueryInterface(avico
, &IID_IPin
, (void**)&pin
);
1813 ok(hres
== E_NOINTERFACE
, "QueryInterface(IID_IPin) returned: %08x\n", hres
);
1815 hres
= IBaseFilter_QueryInterface(avico
, &IID_IPersistPropertyBag
, (void**)&persist_bag
);
1816 ok(hres
== S_OK
, "QueryInterface(IID_IPersistPropertyBag) returned: %08x\n", hres
);
1818 SET_EXPECT(Read_FccHandler
);
1819 hres
= IPersistPropertyBag_Load(persist_bag
, &PropertyBag
, NULL
);
1820 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
1821 CHECK_CALLED(Read_FccHandler
);
1823 IPersistPropertyBag_Release(persist_bag
);
1825 hres
= IBaseFilter_EnumPins(avico
, &enum_pins
);
1826 ok(hres
== S_OK
, "EnumPins failed: %08x\n", hres
);
1828 hres
= IEnumPins_Next(enum_pins
, 1, &in_pin
, NULL
);
1829 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
1831 hres
= IPin_QueryPinInfo(in_pin
, &pin_info
);
1832 ok(hres
== S_OK
, "QueryPinInfo failed: %08x\n", hres
);
1833 ok(pin_info
.pFilter
== avico
, "pin_info.pFilter != avico\n");
1834 ok(pin_info
.dir
== PINDIR_INPUT
, "pin_info.dir = %d\n", pin_info
.dir
);
1835 ok(!lstrcmpW(pin_info
.achName
, inputW
), "pin_info.achName = %s\n", wine_dbgstr_w(pin_info
.achName
));
1837 hres
= IEnumPins_Next(enum_pins
, 1, &out_pin
, NULL
);
1838 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
1840 hres
= IPin_QueryPinInfo(out_pin
, &pin_info
);
1841 ok(hres
== S_OK
, "QueryPinInfo failed: %08x\n", hres
);
1842 ok(pin_info
.pFilter
== avico
, "pin_info.pFilter != avico\n");
1843 ok(pin_info
.dir
== PINDIR_OUTPUT
, "pin_info.dir = %d\n", pin_info
.dir
);
1844 ok(!lstrcmpW(pin_info
.achName
, outputW
), "pin_info.achName = %s\n", wine_dbgstr_w(pin_info
.achName
));
1846 IEnumPins_Release(enum_pins
);
1848 IPin_Release(in_pin
);
1849 IPin_Release(out_pin
);
1850 IBaseFilter_Release(avico
);
1853 /* Outer IUnknown for COM aggregation tests */
1855 IUnknown IUnknown_iface
;
1857 IUnknown
*inner_unk
;
1860 static inline struct unk_impl
*impl_from_IUnknown(IUnknown
*iface
)
1862 return CONTAINING_RECORD(iface
, struct unk_impl
, IUnknown_iface
);
1865 static HRESULT WINAPI
unk_QueryInterface(IUnknown
*iface
, REFIID riid
, void **ret_iface
)
1867 struct unk_impl
*This
= impl_from_IUnknown(iface
);
1869 return IUnknown_QueryInterface(This
->inner_unk
, riid
, ret_iface
);
1872 static ULONG WINAPI
unk_AddRef(IUnknown
*iface
)
1874 struct unk_impl
*This
= impl_from_IUnknown(iface
);
1876 return InterlockedIncrement(&This
->ref
);
1879 static ULONG WINAPI
unk_Release(IUnknown
*iface
)
1881 struct unk_impl
*This
= impl_from_IUnknown(iface
);
1883 return InterlockedDecrement(&This
->ref
);
1886 static const IUnknownVtbl unk_vtbl
=
1893 static void test_COM_vfwcapture(void)
1895 struct unk_impl unk_obj
= {{&unk_vtbl
}, 19, NULL
};
1899 IPersistPropertyBag
*ppb
;
1900 IAMVfwCaptureDialogs
*amvcd
;
1901 IAMFilterMiscFlags
*amfmf
;
1902 ISpecifyPropertyPages
*spp
;
1907 /* COM aggregation */
1908 hr
= CoCreateInstance(&CLSID_VfwCapture
, &unk_obj
.IUnknown_iface
, CLSCTX_INPROC_SERVER
,
1909 &IID_IUnknown
, (void**)&unk_obj
.inner_unk
);
1910 if (hr
== REGDB_E_CLASSNOTREG
)
1912 win_skip("CLSID_VfwCapture not registered\n");
1915 ok(hr
== S_OK
, "VfwCapture create failed: %08x\n", hr
);
1916 hr
= IUnknown_QueryInterface(unk_obj
.inner_unk
, &IID_IBaseFilter
, (void**)&bf
);
1917 ok(hr
== S_OK
, "QueryInterface for IID_IBaseFilter failed: %08x\n", hr
);
1918 refcount
= IBaseFilter_AddRef(bf
);
1919 ok(refcount
== unk_obj
.ref
, "VfwCapture just pretends to support COM aggregation\n");
1920 refcount
= IBaseFilter_Release(bf
);
1921 ok(refcount
== unk_obj
.ref
, "VfwCapture just pretends to support COM aggregation\n");
1922 refcount
= IBaseFilter_Release(bf
);
1923 ok(refcount
== 19, "Refcount should be back at 19 but is %u\n", refcount
);
1924 IUnknown_Release(unk_obj
.inner_unk
);
1927 hr
= CoCreateInstance(&CLSID_VfwCapture
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IClassFactory
,
1929 ok(hr
== E_NOINTERFACE
, "VfwCapture create failed: %08x, expected E_NOINTERFACE\n", hr
);
1931 /* Same refcount for all VfwCapture interfaces */
1932 hr
= CoCreateInstance(&CLSID_VfwCapture
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
,
1934 ok(hr
== S_OK
, "VfwCapture create failed: %08x, expected S_OK\n", hr
);
1935 refcount
= IBaseFilter_AddRef(bf
);
1936 ok(refcount
== 2, "refcount == %u, expected 2\n", refcount
);
1938 hr
= IBaseFilter_QueryInterface(bf
, &IID_IMediaFilter
, (void**)&mf
);
1939 ok(hr
== S_OK
, "QueryInterface for IID_IMediaFilter failed: %08x\n", hr
);
1940 refcount
= IMediaFilter_AddRef(mf
);
1941 ok(refcount
== 4, "refcount == %u, expected 4\n", refcount
);
1942 refcount
= IMediaFilter_Release(mf
);
1944 hr
= IBaseFilter_QueryInterface(bf
, &IID_IPersist
, (void**)&p
);
1945 ok(hr
== S_OK
, "QueryInterface for IID_IPersist failed: %08x\n", hr
);
1946 refcount
= IPersist_AddRef(p
);
1947 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
1948 refcount
= IPersist_Release(p
);
1950 hr
= IBaseFilter_QueryInterface(bf
, &IID_IPersistPropertyBag
, (void**)&ppb
);
1951 ok(hr
== S_OK
, "QueryInterface for IID_IPersistPropertyBag failed: %08x\n", hr
);
1952 refcount
= IPersistPropertyBag_AddRef(ppb
);
1953 ok(refcount
== 6, "refcount == %u, expected 6\n", refcount
);
1954 refcount
= IPersistPropertyBag_Release(ppb
);
1956 hr
= IBaseFilter_QueryInterface(bf
, &IID_IAMVfwCaptureDialogs
, (void**)&amvcd
);
1957 todo_wine
ok(hr
== S_OK
, "QueryInterface for IID_IAMVfwCaptureDialogs failed: %08x\n", hr
);
1959 refcount
= IAMVfwCaptureDialogs_AddRef(amvcd
);
1960 ok(refcount
== 7, "refcount == %u, expected 7\n", refcount
);
1961 refcount
= IAMVfwCaptureDialogs_Release(amvcd
);
1964 hr
= IBaseFilter_QueryInterface(bf
, &IID_IAMFilterMiscFlags
, (void**)&amfmf
);
1965 todo_wine
ok(hr
== S_OK
, "QueryInterface for IID_IAMFilterMiscFlags failed: %08x\n", hr
);
1967 refcount
= IAMFilterMiscFlags_AddRef(amfmf
);
1968 ok(refcount
== 8, "refcount == %u, expected 8\n", refcount
);
1969 refcount
= IAMFilterMiscFlags_Release(amfmf
);
1972 hr
= IBaseFilter_QueryInterface(bf
, &IID_ISpecifyPropertyPages
, (void**)&spp
);
1973 todo_wine
ok(hr
== S_OK
, "QueryInterface for IID_ISpecifyPropertyPages failed: %08x\n", hr
);
1975 refcount
= ISpecifyPropertyPages_AddRef(spp
);
1976 ok(refcount
== 9, "refcount == %u, expected 9\n", refcount
);
1977 refcount
= ISpecifyPropertyPages_Release(spp
);
1980 hr
= IBaseFilter_QueryInterface(bf
, &IID_IUnknown
, (void**)&unk
);
1981 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
1982 refcount
= IUnknown_AddRef(unk
);
1983 todo_wine
ok(refcount
== 10, "refcount == %u, expected 10\n", refcount
);
1984 refcount
= IUnknown_Release(unk
);
1986 /* Unsupported interfaces */
1987 hr
= IBaseFilter_QueryInterface(bf
, &IID_IAMStreamConfig
, (void**)&unk
);
1988 todo_wine
ok(hr
== E_NOINTERFACE
, "QueryInterface for IID_IAMStreamConfig failed: %08x\n", hr
);
1989 hr
= IBaseFilter_QueryInterface(bf
, &IID_IAMVideoProcAmp
, (void**)&unk
);
1990 todo_wine
ok(hr
== E_NOINTERFACE
, "QueryInterface for IID_IAMVideoProcAmp failed: %08x\n", hr
);
1991 hr
= IBaseFilter_QueryInterface(bf
, &IID_IOverlayNotify
, (void**)&unk
);
1992 ok(hr
== E_NOINTERFACE
, "QueryInterface for IID_IOverlayNotify failed: %08x\n", hr
);
1994 while (IBaseFilter_Release(bf
));
1999 if (SUCCEEDED(CoInitialize(NULL
)))
2004 arg_c
= winetest_get_mainargs(&arg_v
);
2006 test_AviMux_QueryInterface();
2007 test_AviMux(arg_c
>2 ? arg_v
[2] : NULL
);
2009 test_COM_vfwcapture();
2014 skip("CoInitialize failed\n");