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
);
99 static void test_smart_tee_filter(void)
102 IBaseFilter
*smartTeeFilter
= NULL
;
103 IEnumPins
*enumPins
= NULL
;
105 FILTER_INFO filterInfo
;
108 hr
= CoCreateInstance(&CLSID_SmartTee
, NULL
, CLSCTX_INPROC_SERVER
,
109 &IID_IBaseFilter
, (void**)&smartTeeFilter
);
110 todo_wine
ok(SUCCEEDED(hr
), "couldn't create smart tee filter, hr=%08x\n", hr
);
114 hr
= IBaseFilter_QueryFilterInfo(smartTeeFilter
, &filterInfo
);
115 ok(SUCCEEDED(hr
), "QueryFilterInfo failed, hr=%08x\n", hr
);
119 ok(lstrlenW(filterInfo
.achName
) == 0,
120 "filter's name is meant to be empty but it's %s\n", wine_dbgstr_w(filterInfo
.achName
));
122 hr
= IBaseFilter_EnumPins(smartTeeFilter
, &enumPins
);
123 ok(SUCCEEDED(hr
), "cannot enum filter pins, hr=%08x\n", hr
);
127 while (IEnumPins_Next(enumPins
, 1, &pin
, NULL
) == S_OK
)
130 hr
= IPin_QueryPinInfo(pin
, &pinInfo
);
131 ok(SUCCEEDED(hr
), "QueryPinInfo failed, hr=%08x\n", hr
);
137 static const WCHAR wszInput
[] = {'I','n','p','u','t',0};
138 ok(pinInfo
.dir
== PINDIR_INPUT
, "pin 0 isn't an input pin\n");
139 ok(!lstrcmpW(pinInfo
.achName
, wszInput
), "pin 0 is called %s, not 'Input'\n", wine_dbgstr_w(pinInfo
.achName
));
141 else if (pinNumber
== 1)
143 static const WCHAR wszCapture
[] = {'C','a','p','t','u','r','e',0};
144 ok(pinInfo
.dir
== PINDIR_OUTPUT
, "pin 1 isn't an output pin\n");
145 ok(!lstrcmpW(pinInfo
.achName
, wszCapture
), "pin 1 is called %s, not 'Capture'\n", wine_dbgstr_w(pinInfo
.achName
));
147 else if (pinNumber
== 2)
149 static const WCHAR wszPreview
[] = {'P','r','e','v','i','e','w',0};
150 ok(pinInfo
.dir
== PINDIR_OUTPUT
, "pin 2 isn't an output pin\n");
151 ok(!lstrcmpW(pinInfo
.achName
, wszPreview
), "pin 2 is called %s, not 'Preview'\n", wine_dbgstr_w(pinInfo
.achName
));
154 ok(0, "pin %d isn't supposed to exist\n", pinNumber
);
163 IBaseFilter_Release(smartTeeFilter
);
165 IEnumPins_Release(enumPins
);
175 static const char* debugstr_filter_type(filter_type type
)
179 return "SOURCE_FILTER";
181 return "SINK_FILTER";
182 case INTERMEDIATE_FILTER
:
183 return "INTERMEDIATE_FILTER";
197 ENUMMEDIATYPES_RESET
,
199 GRAPHBUILDER_CONNECT
,
201 BASEFILTER_QUERYINTERFACE
,
205 static const struct {
207 filter_type filter_type
;
210 BOOL optional
; /* fails on wine if missing */
212 } renderstream_cat_media
[] = {
213 {BASEFILTER_QUERYINTERFACE
, SOURCE_FILTER
},
214 {BASEFILTER_ENUMPINS
, SOURCE_FILTER
},
215 {ENUMPINS_NEXT
, SOURCE_FILTER
},
216 {PIN_QUERYDIRECTION
, SOURCE_FILTER
},
217 {PIN_CONNECTEDTO
, SOURCE_FILTER
},
218 {PIN_QUERYPININFO
, SOURCE_FILTER
, TRUE
},
219 {KSPROPERTYSET_GET
, SOURCE_FILTER
},
220 {PIN_ENUMMEDIATYPES
, SOURCE_FILTER
},
221 {ENUMMEDIATYPES_RESET
, SOURCE_FILTER
},
222 {ENUMMEDIATYPES_NEXT
, SOURCE_FILTER
},
223 {BASEFILTER_QUERYINTERFACE
, SOURCE_FILTER
},
224 {BASEFILTER_ENUMPINS
, SOURCE_FILTER
},
225 {ENUMPINS_NEXT
, SOURCE_FILTER
},
226 {PIN_QUERYDIRECTION
, SOURCE_FILTER
},
227 {PIN_CONNECTEDTO
, SOURCE_FILTER
},
228 {PIN_QUERYPININFO
, SOURCE_FILTER
, TRUE
},
229 {KSPROPERTYSET_GET
, SOURCE_FILTER
},
230 {ENUMPINS_NEXT
, SOURCE_FILTER
},
231 {BASEFILTER_QUERYINTERFACE
, SOURCE_FILTER
, TRUE
},
232 {BASEFILTER_ENUMPINS
, SOURCE_FILTER
, TRUE
},
233 {ENUMPINS_NEXT
, SOURCE_FILTER
, TRUE
},
234 {PIN_QUERYDIRECTION
, SOURCE_FILTER
, TRUE
},
235 {PIN_CONNECTEDTO
, SOURCE_FILTER
, TRUE
},
236 {PIN_QUERYPININFO
, SOURCE_FILTER
, TRUE
},
237 {KSPROPERTYSET_GET
, SOURCE_FILTER
, TRUE
},
238 {ENUMPINS_NEXT
, SOURCE_FILTER
, TRUE
},
239 {BASEFILTER_QUERYINTERFACE
, SOURCE_FILTER
, TRUE
},
240 {BASEFILTER_ENUMPINS
, SOURCE_FILTER
, TRUE
},
241 {ENUMPINS_NEXT
, SOURCE_FILTER
, TRUE
},
242 {PIN_QUERYDIRECTION
, SOURCE_FILTER
, TRUE
},
243 {PIN_CONNECTEDTO
, SOURCE_FILTER
, TRUE
},
244 {PIN_QUERYPININFO
, SOURCE_FILTER
, TRUE
},
245 {KSPROPERTYSET_GET
, SOURCE_FILTER
, TRUE
},
246 {ENUMPINS_NEXT
, SOURCE_FILTER
, TRUE
},
247 {PIN_ENUMMEDIATYPES
, SOURCE_FILTER
, TRUE
, FALSE
, TRUE
},
248 {ENUMMEDIATYPES_NEXT
, SOURCE_FILTER
, TRUE
, FALSE
, TRUE
},
249 {BASEFILTER_QUERYINTERFACE
, SINK_FILTER
, FALSE
, TRUE
},
250 {BASEFILTER_ENUMPINS
, SINK_FILTER
},
251 {ENUMPINS_NEXT
, SINK_FILTER
},
252 {PIN_QUERYDIRECTION
, SINK_FILTER
},
253 {PIN_CONNECTEDTO
, SINK_FILTER
},
254 {GRAPHBUILDER_CONNECT
, NOT_FILTER
},
255 {BASEFILTER_GETSTATE
, SOURCE_FILTER
, TRUE
, FALSE
, TRUE
},
256 {BASEFILTER_ENUMPINS
, SOURCE_FILTER
, FALSE
, FALSE
, FALSE
, TRUE
},
257 {ENUMPINS_NEXT
, SOURCE_FILTER
, FALSE
, FALSE
, FALSE
, TRUE
},
258 {PIN_QUERYDIRECTION
, SOURCE_FILTER
, FALSE
, FALSE
, FALSE
, TRUE
},
259 {PIN_CONNECTEDTO
, SOURCE_FILTER
, FALSE
, FALSE
, FALSE
, TRUE
},
260 {ENUMPINS_NEXT
, SOURCE_FILTER
, FALSE
, FALSE
, FALSE
, TRUE
},
262 }, renderstream_intermediate
[] = {
263 {BASEFILTER_QUERYINTERFACE
, SOURCE_FILTER
},
264 {BASEFILTER_ENUMPINS
, SOURCE_FILTER
},
265 {ENUMPINS_NEXT
, SOURCE_FILTER
},
266 {PIN_QUERYDIRECTION
, SOURCE_FILTER
},
267 {PIN_CONNECTEDTO
, SOURCE_FILTER
},
268 {PIN_QUERYPININFO
, SOURCE_FILTER
, TRUE
},
269 {KSPROPERTYSET_GET
, SOURCE_FILTER
},
270 {PIN_ENUMMEDIATYPES
, SOURCE_FILTER
},
271 {ENUMMEDIATYPES_RESET
, SOURCE_FILTER
},
272 {ENUMMEDIATYPES_NEXT
, SOURCE_FILTER
},
273 {BASEFILTER_QUERYINTERFACE
, SOURCE_FILTER
},
274 {BASEFILTER_ENUMPINS
, SOURCE_FILTER
},
275 {ENUMPINS_NEXT
, SOURCE_FILTER
},
276 {PIN_QUERYDIRECTION
, SOURCE_FILTER
},
277 {PIN_CONNECTEDTO
, SOURCE_FILTER
},
278 {PIN_QUERYPININFO
, SOURCE_FILTER
, TRUE
},
279 {KSPROPERTYSET_GET
, SOURCE_FILTER
},
280 {ENUMPINS_NEXT
, SOURCE_FILTER
},
281 {BASEFILTER_QUERYINTERFACE
, SOURCE_FILTER
, TRUE
},
282 {BASEFILTER_ENUMPINS
, SOURCE_FILTER
, TRUE
},
283 {ENUMPINS_NEXT
, SOURCE_FILTER
, TRUE
},
284 {PIN_QUERYDIRECTION
, SOURCE_FILTER
, TRUE
},
285 {PIN_CONNECTEDTO
, SOURCE_FILTER
, TRUE
},
286 {PIN_QUERYPININFO
, SOURCE_FILTER
, TRUE
},
287 {KSPROPERTYSET_GET
, SOURCE_FILTER
, TRUE
},
288 {ENUMPINS_NEXT
, SOURCE_FILTER
, TRUE
},
289 {BASEFILTER_QUERYINTERFACE
, SOURCE_FILTER
, TRUE
},
290 {BASEFILTER_ENUMPINS
, SOURCE_FILTER
, TRUE
},
291 {ENUMPINS_NEXT
, SOURCE_FILTER
, TRUE
},
292 {PIN_QUERYDIRECTION
, SOURCE_FILTER
, TRUE
},
293 {PIN_CONNECTEDTO
, SOURCE_FILTER
, TRUE
},
294 {PIN_QUERYPININFO
, SOURCE_FILTER
, TRUE
},
295 {KSPROPERTYSET_GET
, SOURCE_FILTER
, TRUE
},
296 {ENUMPINS_NEXT
, SOURCE_FILTER
, TRUE
},
297 {PIN_ENUMMEDIATYPES
, SOURCE_FILTER
, TRUE
, FALSE
, TRUE
},
298 {ENUMMEDIATYPES_NEXT
, SOURCE_FILTER
, TRUE
, FALSE
, TRUE
},
299 {BASEFILTER_QUERYINTERFACE
, SINK_FILTER
, FALSE
, TRUE
},
300 {BASEFILTER_ENUMPINS
, SINK_FILTER
},
301 {ENUMPINS_NEXT
, SINK_FILTER
},
302 {PIN_QUERYDIRECTION
, SINK_FILTER
},
303 {PIN_CONNECTEDTO
, SINK_FILTER
},
304 {BASEFILTER_QUERYINTERFACE
, INTERMEDIATE_FILTER
, FALSE
, TRUE
},
305 {BASEFILTER_ENUMPINS
, INTERMEDIATE_FILTER
},
306 {ENUMPINS_NEXT
, INTERMEDIATE_FILTER
},
307 {PIN_QUERYDIRECTION
, INTERMEDIATE_FILTER
},
308 {PIN_CONNECTEDTO
, INTERMEDIATE_FILTER
},
309 {ENUMPINS_NEXT
, INTERMEDIATE_FILTER
},
310 {PIN_QUERYDIRECTION
, INTERMEDIATE_FILTER
},
311 {PIN_CONNECTEDTO
, INTERMEDIATE_FILTER
},
312 {GRAPHBUILDER_CONNECT
, NOT_FILTER
},
313 {BASEFILTER_QUERYINTERFACE
, INTERMEDIATE_FILTER
, FALSE
, TRUE
},
314 {BASEFILTER_ENUMPINS
, INTERMEDIATE_FILTER
},
315 {ENUMPINS_NEXT
, INTERMEDIATE_FILTER
},
316 {PIN_QUERYDIRECTION
, INTERMEDIATE_FILTER
},
317 {PIN_CONNECTEDTO
, INTERMEDIATE_FILTER
},
318 {GRAPHBUILDER_CONNECT
, NOT_FILTER
},
319 {BASEFILTER_GETSTATE
, SOURCE_FILTER
, TRUE
, FALSE
, TRUE
},
320 {BASEFILTER_ENUMPINS
, SOURCE_FILTER
, FALSE
, FALSE
, FALSE
, TRUE
},
321 {ENUMPINS_NEXT
, SOURCE_FILTER
, FALSE
, FALSE
, FALSE
, TRUE
},
322 {PIN_QUERYDIRECTION
, SOURCE_FILTER
, FALSE
, FALSE
, FALSE
, TRUE
},
323 {PIN_CONNECTEDTO
, SOURCE_FILTER
, FALSE
, FALSE
, FALSE
, TRUE
},
324 {ENUMPINS_NEXT
, SOURCE_FILTER
, FALSE
, FALSE
, FALSE
, TRUE
},
326 }, *current_calls_list
;
329 static void check_calls_list(const char *func
, call_id id
, filter_type type
)
331 if(!current_calls_list
)
334 while(current_calls_list
[call_no
].wine_missing
|| current_calls_list
[call_no
].wine_extra
||
335 current_calls_list
[call_no
].optional
|| current_calls_list
[call_no
].broken
) {
336 if(current_calls_list
[call_no
].wine_missing
) {
337 todo_wine
ok((current_calls_list
[call_no
].call_id
== id
&& current_calls_list
[call_no
].filter_type
== type
) ||
338 broken(current_calls_list
[call_no
].optional
&& (current_calls_list
[call_no
].call_id
!= id
||
339 current_calls_list
[call_no
].filter_type
!= type
)),
340 "missing call, got %s(%d), expected %d (%d)\n", func
, id
, current_calls_list
[call_no
].call_id
, call_no
);
342 if(current_calls_list
[call_no
].call_id
!= id
|| current_calls_list
[call_no
].filter_type
!= type
)
346 }else if(current_calls_list
[call_no
].wine_extra
) {
347 todo_wine
ok(current_calls_list
[call_no
].call_id
!= id
|| current_calls_list
[call_no
].filter_type
!= type
,
348 "extra call, got %s(%d) (%d)\n", func
, id
, call_no
);
350 if(current_calls_list
[call_no
].call_id
== id
&& current_calls_list
[call_no
].filter_type
== type
) {
355 }else if(current_calls_list
[call_no
].optional
) {
356 ok((current_calls_list
[call_no
].call_id
== id
&& current_calls_list
[call_no
].filter_type
== type
) ||
357 broken(current_calls_list
[call_no
].call_id
!= id
|| current_calls_list
[call_no
].filter_type
!= type
),
358 "unexpected call: %s on %s (%d)\n", func
, debugstr_filter_type(type
), call_no
);
360 if(current_calls_list
[call_no
].call_id
!= id
|| current_calls_list
[call_no
].filter_type
!= type
)
364 }else if(current_calls_list
[call_no
].broken
) {
365 ok(broken(current_calls_list
[call_no
].call_id
== id
&& current_calls_list
[call_no
].filter_type
== type
) ||
366 (current_calls_list
[call_no
].call_id
!= id
|| current_calls_list
[call_no
].filter_type
!= type
),
367 "unexpected call: %s on %s (%d)\n", func
, debugstr_filter_type(type
), call_no
);
369 if(current_calls_list
[call_no
].call_id
== id
&& current_calls_list
[call_no
].filter_type
== type
)
375 ok(current_calls_list
[call_no
].call_id
== id
, "unexpected call: %s on %s (%d)\n",
376 func
, debugstr_filter_type(type
), call_no
);
377 if(current_calls_list
[call_no
].call_id
!= id
)
380 ok(current_calls_list
[call_no
].filter_type
== type
, "unexpected call: %s on %s (%d)\n",
381 func
, debugstr_filter_type(type
), call_no
);
382 if(current_calls_list
[call_no
].filter_type
!= type
)
388 static HRESULT WINAPI
GraphBuilder_QueryInterface(
389 IGraphBuilder
*iface
, REFIID riid
, void **ppv
)
391 if(IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IFilterGraph
)
392 || IsEqualIID(riid
, &IID_IGraphBuilder
))
398 ok(IsEqualIID(riid
, &IID_IMediaEvent
) || IsEqualIID(riid
, &IID_IMediaEventSink
),
399 "QueryInterface(%s)\n", wine_dbgstr_guid(riid
));
401 return E_NOINTERFACE
;
404 static ULONG WINAPI
GraphBuilder_AddRef(IGraphBuilder
*iface
)
409 static ULONG WINAPI
GraphBuilder_Release(IGraphBuilder
*iface
)
414 static HRESULT WINAPI
GraphBuilder_AddFilter(IGraphBuilder
*iface
,
415 IBaseFilter
*pFilter
, LPCWSTR pName
)
417 ok(0, "unexpected call\n");
421 static HRESULT WINAPI
GraphBuilder_RemoveFilter(
422 IGraphBuilder
*iface
, IBaseFilter
*pFilter
)
424 ok(0, "unexpected call\n");
428 static HRESULT WINAPI
GraphBuilder_EnumFilters(
429 IGraphBuilder
*iface
, IEnumFilters
**ppEnum
)
431 ok(0, "unexpected call\n");
435 static HRESULT WINAPI
GraphBuilder_FindFilterByName(IGraphBuilder
*iface
,
436 LPCWSTR pName
, IBaseFilter
**ppFilter
)
438 ok(0, "unexpected call\n");
442 static HRESULT WINAPI
GraphBuilder_ConnectDirect(IGraphBuilder
*iface
,
443 IPin
*ppinOut
, IPin
*ppinIn
, const AM_MEDIA_TYPE
*pmt
)
445 ok(0, "unexpected call\n");
449 static HRESULT WINAPI
GraphBuilder_Reconnect(IGraphBuilder
*iface
, IPin
*ppin
)
451 CHECK_EXPECT(Reconnect
);
455 static HRESULT WINAPI
GraphBuilder_Disconnect(IGraphBuilder
*iface
, IPin
*ppin
)
457 ok(0, "unexpected call\n");
461 static HRESULT WINAPI
GraphBuilder_SetDefaultSyncSource(IGraphBuilder
*iface
)
463 ok(0, "unexpected call\n");
467 static HRESULT WINAPI
GraphBuilder_Connect(IGraphBuilder
*iface
, IPin
*ppinOut
, IPin
*ppinIn
)
469 check_calls_list("GraphBuilder_Connect", GRAPHBUILDER_CONNECT
, NOT_FILTER
);
473 static HRESULT WINAPI
GraphBuilder_Render(IGraphBuilder
*iface
, IPin
*ppinOut
)
475 ok(0, "unexpected call\n");
479 static HRESULT WINAPI
GraphBuilder_RenderFile(IGraphBuilder
*iface
,
480 LPCWSTR lpcwstrFile
, LPCWSTR lpcwstrPlayList
)
482 ok(0, "unexpected call\n");
486 static HRESULT WINAPI
GraphBuilder_AddSourceFilter(IGraphBuilder
*iface
, LPCWSTR lpcwstrFileName
,
487 LPCWSTR lpcwstrFilterName
, IBaseFilter
**ppFilter
)
489 ok(0, "unexpected call\n");
493 static HRESULT WINAPI
GraphBuilder_SetLogFile(IGraphBuilder
*iface
, DWORD_PTR hFile
)
495 ok(0, "unexpected call\n");
499 static HRESULT WINAPI
GraphBuilder_Abort(IGraphBuilder
*iface
)
501 ok(0, "unexpected call\n");
505 static HRESULT WINAPI
GraphBuilder_ShouldOperationContinue(IGraphBuilder
*iface
)
507 ok(0, "unexpected call\n");
511 static const IGraphBuilderVtbl GraphBuilder_vtbl
= {
512 GraphBuilder_QueryInterface
,
514 GraphBuilder_Release
,
515 GraphBuilder_AddFilter
,
516 GraphBuilder_RemoveFilter
,
517 GraphBuilder_EnumFilters
,
518 GraphBuilder_FindFilterByName
,
519 GraphBuilder_ConnectDirect
,
520 GraphBuilder_Reconnect
,
521 GraphBuilder_Disconnect
,
522 GraphBuilder_SetDefaultSyncSource
,
523 GraphBuilder_Connect
,
525 GraphBuilder_RenderFile
,
526 GraphBuilder_AddSourceFilter
,
527 GraphBuilder_SetLogFile
,
529 GraphBuilder_ShouldOperationContinue
532 static IGraphBuilder GraphBuilder
= {&GraphBuilder_vtbl
};
535 IBaseFilter IBaseFilter_iface
;
536 IEnumPins IEnumPins_iface
;
538 IKsPropertySet IKsPropertySet_iface
;
539 IMemInputPin IMemInputPin_iface
;
540 IMediaSeeking IMediaSeeking_iface
;
541 IEnumMediaTypes IEnumMediaTypes_iface
;
544 filter_type filter_type
;
547 int enum_media_types_pos
;
550 static test_filter
* impl_from_IBaseFilter(IBaseFilter
*iface
)
552 return CONTAINING_RECORD(iface
, test_filter
, IBaseFilter_iface
);
555 static HRESULT WINAPI
BaseFilter_QueryInterface(IBaseFilter
*iface
, REFIID riid
, void **ppv
)
557 test_filter
*This
= impl_from_IBaseFilter(iface
);
559 if(IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IPersist
)
560 || IsEqualIID(riid
, &IID_IMediaFilter
) || IsEqualIID(riid
, &IID_IBaseFilter
)) {
565 check_calls_list("BaseFilter_QueryInterface", BASEFILTER_QUERYINTERFACE
, This
->filter_type
);
566 ok(IsEqualIID(riid
, &IID_IPin
), "riid = %s\n", wine_dbgstr_guid(riid
));
567 return E_NOINTERFACE
;
570 static ULONG WINAPI
BaseFilter_AddRef(IBaseFilter
*iface
)
575 static ULONG WINAPI
BaseFilter_Release(IBaseFilter
*iface
)
580 static HRESULT WINAPI
BaseFilter_GetClassID(IBaseFilter
*iface
, CLSID
*pClassID
)
582 ok(0, "unexpected call\n");
586 static HRESULT WINAPI
BaseFilter_Stop(IBaseFilter
*iface
)
588 ok(0, "unexpected call\n");
592 static HRESULT WINAPI
BaseFilter_Pause(IBaseFilter
*iface
)
594 ok(0, "unexpected call\n");
598 static HRESULT WINAPI
BaseFilter_Run(IBaseFilter
*iface
, REFERENCE_TIME tStart
)
600 ok(0, "unexpected call\n");
604 static HRESULT WINAPI
BaseFilter_GetState(IBaseFilter
*iface
,
605 DWORD dwMilliSecsTimeout
, FILTER_STATE
*State
)
607 test_filter
*This
= impl_from_IBaseFilter(iface
);
608 check_calls_list("BaseFilter_GetState", BASEFILTER_GETSTATE
, This
->filter_type
);
612 static HRESULT WINAPI
BaseFilter_SetSyncSource(
613 IBaseFilter
*iface
, IReferenceClock
*pClock
)
615 ok(0, "unexpected call\n");
619 static HRESULT WINAPI
BaseFilter_GetSyncSource(
620 IBaseFilter
*iface
, IReferenceClock
**pClock
)
622 ok(0, "unexpected call\n");
626 static HRESULT WINAPI
BaseFilter_EnumPins(
627 IBaseFilter
*iface
, IEnumPins
**ppEnum
)
629 test_filter
*This
= impl_from_IBaseFilter(iface
);
630 check_calls_list("BaseFilter_EnumPins", BASEFILTER_ENUMPINS
, This
->filter_type
);
632 *ppEnum
= &This
->IEnumPins_iface
;
633 This
->enum_pins_pos
= 0;
637 static HRESULT WINAPI
BaseFilter_FindPin(IBaseFilter
*iface
,
638 LPCWSTR Id
, IPin
**ppPin
)
640 ok(0, "unexpected call\n");
644 static HRESULT WINAPI
BaseFilter_QueryFilterInfo(IBaseFilter
*iface
, FILTER_INFO
*pInfo
)
646 ok(0, "unexpected call\n");
650 static HRESULT WINAPI
BaseFilter_JoinFilterGraph(IBaseFilter
*iface
,
651 IFilterGraph
*pGraph
, LPCWSTR pName
)
653 ok(0, "unexpected call\n");
657 static HRESULT WINAPI
BaseFilter_QueryVendorInfo(IBaseFilter
*iface
, LPWSTR
*pVendorInfo
)
659 ok(0, "unexpected call\n");
663 static const IBaseFilterVtbl BaseFilterVtbl
= {
664 BaseFilter_QueryInterface
,
667 BaseFilter_GetClassID
,
672 BaseFilter_SetSyncSource
,
673 BaseFilter_GetSyncSource
,
676 BaseFilter_QueryFilterInfo
,
677 BaseFilter_JoinFilterGraph
,
678 BaseFilter_QueryVendorInfo
681 static test_filter
* impl_from_IEnumPins(IEnumPins
*iface
)
683 return CONTAINING_RECORD(iface
, test_filter
, IEnumPins_iface
);
686 static HRESULT WINAPI
EnumPins_QueryInterface(IEnumPins
*iface
, REFIID riid
, void **ppv
)
688 ok(0, "unexpected call\n");
692 static ULONG WINAPI
EnumPins_AddRef(IEnumPins
*iface
)
697 static ULONG WINAPI
EnumPins_Release(IEnumPins
*iface
)
702 static HRESULT WINAPI
EnumPins_Next(IEnumPins
*iface
,
703 ULONG cPins
, IPin
**ppPins
, ULONG
*pcFetched
)
705 test_filter
*This
= impl_from_IEnumPins(iface
);
706 check_calls_list("EnumPins_Next", ENUMPINS_NEXT
, This
->filter_type
);
708 ok(cPins
== 1, "cPins = %d\n", cPins
);
709 ok(ppPins
!= NULL
, "ppPins == NULL\n");
710 ok(pcFetched
!= NULL
, "pcFetched == NULL\n");
712 if(This
->enum_pins_pos
++ < (This
->filter_type
== INTERMEDIATE_FILTER
? 2 : 1)) {
713 *ppPins
= &This
->IPin_iface
;
721 static HRESULT WINAPI
EnumPins_Skip(IEnumPins
*iface
, ULONG cPins
)
723 ok(0, "unexpected call\n");
727 static HRESULT WINAPI
EnumPins_Reset(IEnumPins
*iface
)
729 ok(0, "unexpected call\n");
733 static HRESULT WINAPI
EnumPins_Clone(IEnumPins
*iface
, IEnumPins
**ppEnum
)
735 ok(0, "unexpected call\n");
739 static const IEnumPinsVtbl EnumPinsVtbl
= {
740 EnumPins_QueryInterface
,
749 static test_filter
* impl_from_IPin(IPin
*iface
)
751 return CONTAINING_RECORD(iface
, test_filter
, IPin_iface
);
754 static HRESULT WINAPI
Pin_QueryInterface(IPin
*iface
, REFIID riid
, void **ppv
)
756 test_filter
*This
= impl_from_IPin(iface
);
758 if(IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IPin
)) {
763 if(IsEqualIID(riid
, &IID_IKsPropertySet
)) {
764 *ppv
= &This
->IKsPropertySet_iface
;
768 if(IsEqualIID(riid
, &IID_IMemInputPin
)) {
769 *ppv
= &This
->IMemInputPin_iface
;
773 if(IsEqualIID(riid
, &IID_IMediaSeeking
)) {
774 *ppv
= &This
->IMediaSeeking_iface
;
778 ok(0, "unexpected call: %s\n", wine_dbgstr_guid(riid
));
780 return E_NOINTERFACE
;
783 static ULONG WINAPI
Pin_AddRef(IPin
*iface
)
788 static ULONG WINAPI
Pin_Release(IPin
*iface
)
793 static HRESULT WINAPI
Pin_Connect(IPin
*iface
, IPin
*pReceivePin
, const AM_MEDIA_TYPE
*pmt
)
795 ok(0, "unexpected call\n");
799 static HRESULT WINAPI
Pin_ReceiveConnection(IPin
*iface
,
800 IPin
*pConnector
, const AM_MEDIA_TYPE
*pmt
)
802 CHECK_EXPECT(ReceiveConnection
);
804 ok(IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Stream
), "majortype = %s\n",
805 wine_dbgstr_guid(&pmt
->majortype
));
806 ok(IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_Avi
), "subtype = %s\n",
807 wine_dbgstr_guid(&pmt
->subtype
));
808 ok(pmt
->bFixedSizeSamples
, "bFixedSizeSamples = %x\n", pmt
->bFixedSizeSamples
);
809 ok(!pmt
->bTemporalCompression
, "bTemporalCompression = %x\n", pmt
->bTemporalCompression
);
810 ok(pmt
->lSampleSize
== 1, "lSampleSize = %d\n", pmt
->lSampleSize
);
811 ok(IsEqualIID(&pmt
->formattype
, &GUID_NULL
), "formattype = %s\n",
812 wine_dbgstr_guid(&pmt
->formattype
));
813 ok(!pmt
->pUnk
, "pUnk = %p\n", pmt
->pUnk
);
814 ok(!pmt
->cbFormat
, "cbFormat = %d\n", pmt
->cbFormat
);
815 ok(!pmt
->pbFormat
, "pbFormat = %p\n", pmt
->pbFormat
);
819 static HRESULT WINAPI
Pin_Disconnect(IPin
*iface
)
821 ok(0, "unexpected call\n");
825 static HRESULT WINAPI
Pin_ConnectedTo(IPin
*iface
, IPin
**pPin
)
827 test_filter
*This
= impl_from_IPin(iface
);
828 check_calls_list("Pin_ConnectedTo", PIN_CONNECTEDTO
, This
->filter_type
);
834 static HRESULT WINAPI
Pin_ConnectionMediaType(IPin
*iface
, AM_MEDIA_TYPE
*pmt
)
836 ok(0, "unexpected call\n");
840 static HRESULT WINAPI
Pin_QueryPinInfo(IPin
*iface
, PIN_INFO
*pInfo
)
842 test_filter
*This
= impl_from_IPin(iface
);
843 check_calls_list("Pin_QueryPinInfo", PIN_QUERYPININFO
, This
->filter_type
);
847 static HRESULT WINAPI
Pin_QueryDirection(IPin
*iface
, PIN_DIRECTION
*pPinDir
)
849 test_filter
*This
= impl_from_IPin(iface
);
850 check_calls_list("Pin_QueryDirection", PIN_QUERYDIRECTION
, This
->filter_type
);
852 *pPinDir
= This
->dir
;
853 if(This
->filter_type
==INTERMEDIATE_FILTER
&& This
->enum_pins_pos
==2)
854 *pPinDir
= PINDIR_INPUT
;
858 static HRESULT WINAPI
Pin_QueryId(IPin
*iface
, LPWSTR
*Id
)
860 ok(0, "unexpected call\n");
864 static HRESULT WINAPI
Pin_QueryAccept(IPin
*iface
, const AM_MEDIA_TYPE
*pmt
)
866 ok(0, "unexpected call\n");
870 static HRESULT WINAPI
Pin_EnumMediaTypes(IPin
*iface
, IEnumMediaTypes
**ppEnum
)
872 test_filter
*This
= impl_from_IPin(iface
);
873 check_calls_list("Pin_EnumMediaTypes", PIN_ENUMMEDIATYPES
, This
->filter_type
);
875 ok(ppEnum
!= NULL
, "ppEnum == NULL\n");
876 *ppEnum
= &This
->IEnumMediaTypes_iface
;
880 static HRESULT WINAPI
Pin_QueryInternalConnections(IPin
*iface
, IPin
**apPin
, ULONG
*nPin
)
882 ok(0, "unexpected call\n");
886 static HRESULT WINAPI
Pin_EndOfStream(IPin
*iface
)
888 ok(0, "unexpected call\n");
892 static HRESULT WINAPI
Pin_BeginFlush(IPin
*iface
)
894 ok(0, "unexpected call\n");
898 static HRESULT WINAPI
Pin_EndFlush(IPin
*iface
)
900 ok(0, "unexpected call\n");
904 static HRESULT WINAPI
Pin_NewSegment(IPin
*iface
, REFERENCE_TIME tStart
,
905 REFERENCE_TIME tStop
, double dRate
)
907 ok(0, "unexpected call\n");
911 static const IPinVtbl PinVtbl
= {
916 Pin_ReceiveConnection
,
919 Pin_ConnectionMediaType
,
925 Pin_QueryInternalConnections
,
932 static test_filter
* impl_from_IKsPropertySet(IKsPropertySet
*iface
)
934 return CONTAINING_RECORD(iface
, test_filter
, IKsPropertySet_iface
);
937 static HRESULT WINAPI
KsPropertySet_QueryInterface(IKsPropertySet
*iface
, REFIID riid
, void **ppv
)
939 ok(0, "unexpected call\n");
943 static ULONG WINAPI
KsPropertySet_AddRef(IKsPropertySet
*iface
)
948 static ULONG WINAPI
KsPropertySet_Release(IKsPropertySet
*iface
)
953 static HRESULT WINAPI
KsPropertySet_Set(IKsPropertySet
*iface
, REFGUID guidPropSet
, DWORD dwPropID
,
954 LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
, DWORD cbPropData
)
956 ok(0, "unexpected call\n");
960 static HRESULT WINAPI
KsPropertySet_Get(IKsPropertySet
*iface
, REFGUID guidPropSet
, DWORD dwPropID
,
961 LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
, DWORD cbPropData
, DWORD
*pcbReturned
)
963 test_filter
*This
= impl_from_IKsPropertySet(iface
);
964 check_calls_list("KsPropertySet_Get", KSPROPERTYSET_GET
, This
->filter_type
);
966 ok(IsEqualIID(guidPropSet
, &ROPSETID_Pin
), "guidPropSet = %s\n", wine_dbgstr_guid(guidPropSet
));
967 ok(dwPropID
== 0, "dwPropID = %d\n", dwPropID
);
968 ok(pInstanceData
== NULL
, "pInstanceData != NULL\n");
969 ok(cbInstanceData
== 0, "cbInstanceData != 0\n");
970 ok(cbPropData
== sizeof(GUID
), "cbPropData = %d\n", cbPropData
);
971 *pcbReturned
= sizeof(GUID
);
972 memcpy(pPropData
, &PIN_CATEGORY_EDS
, sizeof(GUID
));
976 static HRESULT WINAPI
KsPropertySet_QuerySupported(IKsPropertySet
*iface
,
977 REFGUID guidPropSet
, DWORD dwPropID
, DWORD
*pTypeSupport
)
979 ok(0, "unexpected call\n");
983 static const IKsPropertySetVtbl KsPropertySetVtbl
= {
984 KsPropertySet_QueryInterface
,
985 KsPropertySet_AddRef
,
986 KsPropertySet_Release
,
989 KsPropertySet_QuerySupported
992 static IStream
*avi_stream
;
993 static HRESULT WINAPI
MemInputPin_QueryInterface(IMemInputPin
*iface
, REFIID riid
, void **ppv
)
995 if(IsEqualIID(riid
, &IID_IStream
)) {
996 CHECK_EXPECT(MemInputPin_QueryInterface_IStream
);
999 return E_NOINTERFACE
;
1002 IStream_AddRef(avi_stream
);
1006 ok(0, "unexpected call: %s\n", wine_dbgstr_guid(riid
));
1010 static ULONG WINAPI
MemInputPin_AddRef(IMemInputPin
*iface
)
1015 static ULONG WINAPI
MemInputPin_Release(IMemInputPin
*iface
)
1020 static HRESULT WINAPI
MemInputPin_GetAllocator(IMemInputPin
*iface
, IMemAllocator
**ppAllocator
)
1022 ok(0, "unexpected call\n");
1026 static HRESULT WINAPI
MemInputPin_NotifyAllocator(IMemInputPin
*iface
,
1027 IMemAllocator
*pAllocator
, BOOL bReadOnly
)
1029 ALLOCATOR_PROPERTIES ap
;
1032 CHECK_EXPECT(NotifyAllocator
);
1034 ok(pAllocator
!= NULL
, "pAllocator = %p\n", pAllocator
);
1035 ok(bReadOnly
, "bReadOnly = %x\n", bReadOnly
);
1037 hr
= IMemAllocator_GetProperties(pAllocator
, &ap
);
1038 ok(hr
== S_OK
, "GetProperties returned %x\n", hr
);
1039 ok(ap
.cBuffers
== 32, "cBuffers = %d\n", ap
.cBuffers
);
1040 ok(ap
.cbBuffer
== 0, "cbBuffer = %d\n", ap
.cbBuffer
);
1041 ok(ap
.cbAlign
== 1, "cbAlign = %d\n", ap
.cbAlign
);
1042 ok(ap
.cbPrefix
== 0, "cbPrefix = %d\n", ap
.cbPrefix
);
1046 static HRESULT WINAPI
MemInputPin_GetAllocatorRequirements(
1047 IMemInputPin
*iface
, ALLOCATOR_PROPERTIES
*pProps
)
1049 CHECK_EXPECT(GetAllocatorRequirements
);
1053 static HRESULT WINAPI
MemInputPin_Receive(IMemInputPin
*iface
, IMediaSample
*pSample
)
1055 REFERENCE_TIME off
, tmp
;
1060 hr
= IMediaSample_GetTime(pSample
, &off
, &tmp
);
1061 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
1062 hr
= IMediaSample_GetPointer(pSample
, &data
);
1063 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
1065 IStream_Seek(avi_stream
, li
, STREAM_SEEK_SET
, NULL
);
1066 IStream_Write(avi_stream
, data
, IMediaSample_GetActualDataLength(pSample
), NULL
);
1070 static HRESULT WINAPI
MemInputPin_ReceiveMultiple(IMemInputPin
*iface
,
1071 IMediaSample
**pSamples
, LONG nSamples
, LONG
*nSamplesProcessed
)
1073 ok(0, "unexpected call\n");
1077 static HRESULT WINAPI
MemInputPin_ReceiveCanBlock(IMemInputPin
*iface
)
1079 ok(0, "unexpected call\n");
1083 static const IMemInputPinVtbl MemInputPinVtbl
= {
1084 MemInputPin_QueryInterface
,
1086 MemInputPin_Release
,
1087 MemInputPin_GetAllocator
,
1088 MemInputPin_NotifyAllocator
,
1089 MemInputPin_GetAllocatorRequirements
,
1090 MemInputPin_Receive
,
1091 MemInputPin_ReceiveMultiple
,
1092 MemInputPin_ReceiveCanBlock
1095 static HRESULT WINAPI
MediaSeeking_QueryInterface(
1096 IMediaSeeking
*iface
, REFIID riid
, void **ppv
)
1098 ok(0, "unexpected call\n");
1102 static ULONG WINAPI
MediaSeeking_AddRef(IMediaSeeking
*iface
)
1107 static ULONG WINAPI
MediaSeeking_Release(IMediaSeeking
*iface
)
1112 static HRESULT WINAPI
MediaSeeking_GetCapabilities(
1113 IMediaSeeking
*iface
, DWORD
*pCapabilities
)
1115 ok(0, "unexpected call\n");
1119 static HRESULT WINAPI
MediaSeeking_CheckCapabilities(
1120 IMediaSeeking
*iface
, DWORD
*pCapabilities
)
1122 ok(0, "unexpected call\n");
1126 static HRESULT WINAPI
MediaSeeking_IsFormatSupported(
1127 IMediaSeeking
*iface
, const GUID
*pFormat
)
1129 ok(0, "unexpected call\n");
1133 static HRESULT WINAPI
MediaSeeking_QueryPreferredFormat(
1134 IMediaSeeking
*iface
, GUID
*pFormat
)
1136 ok(0, "unexpected call\n");
1140 static HRESULT WINAPI
MediaSeeking_GetTimeFormat(
1141 IMediaSeeking
*iface
, GUID
*pFormat
)
1143 ok(0, "unexpected call\n");
1147 static HRESULT WINAPI
MediaSeeking_IsUsingTimeFormat(
1148 IMediaSeeking
*iface
, const GUID
*pFormat
)
1150 ok(0, "unexpected call\n");
1154 static HRESULT WINAPI
MediaSeeking_SetTimeFormat(
1155 IMediaSeeking
*iface
, const GUID
*pFormat
)
1157 ok(0, "unexpected call\n");
1161 static HRESULT WINAPI
MediaSeeking_GetDuration(
1162 IMediaSeeking
*iface
, LONGLONG
*pDuration
)
1164 ok(0, "unexpected call\n");
1168 static HRESULT WINAPI
MediaSeeking_GetStopPosition(
1169 IMediaSeeking
*iface
, LONGLONG
*pStop
)
1171 ok(0, "unexpected call\n");
1175 static HRESULT WINAPI
MediaSeeking_GetCurrentPosition(
1176 IMediaSeeking
*iface
, LONGLONG
*pCurrent
)
1178 ok(0, "unexpected call\n");
1182 static HRESULT WINAPI
MediaSeeking_ConvertTimeFormat(IMediaSeeking
*iface
, LONGLONG
*pTarget
,
1183 const GUID
*pTargetFormat
, LONGLONG Source
, const GUID
*pSourceFormat
)
1185 ok(0, "unexpected call\n");
1189 static HRESULT WINAPI
MediaSeeking_SetPositions(IMediaSeeking
*iface
, LONGLONG
*pCurrent
,
1190 DWORD dwCurrentFlags
, LONGLONG
*pStop
, DWORD dwStopFlags
)
1192 ok(0, "unexpected call\n");
1196 static HRESULT WINAPI
MediaSeeking_GetPositions(IMediaSeeking
*iface
,
1197 LONGLONG
*pCurrent
, LONGLONG
*pStop
)
1199 CHECK_EXPECT(MediaSeeking_GetPositions
);
1203 static HRESULT WINAPI
MediaSeeking_GetAvailable(IMediaSeeking
*iface
,
1204 LONGLONG
*pEarliest
, LONGLONG
*pLatest
)
1206 ok(0, "unexpected call\n");
1210 static HRESULT WINAPI
MediaSeeking_SetRate(IMediaSeeking
*iface
, double dRate
)
1212 ok(0, "unexpected call\n");
1216 static HRESULT WINAPI
MediaSeeking_GetRate(IMediaSeeking
*iface
, double *pdRate
)
1218 ok(0, "unexpected call\n");
1222 static HRESULT WINAPI
MediaSeeking_GetPreroll(IMediaSeeking
*iface
, LONGLONG
*pllPreroll
)
1224 ok(0, "unexpected call\n");
1228 static const IMediaSeekingVtbl MediaSeekingVtbl
= {
1229 MediaSeeking_QueryInterface
,
1230 MediaSeeking_AddRef
,
1231 MediaSeeking_Release
,
1232 MediaSeeking_GetCapabilities
,
1233 MediaSeeking_CheckCapabilities
,
1234 MediaSeeking_IsFormatSupported
,
1235 MediaSeeking_QueryPreferredFormat
,
1236 MediaSeeking_GetTimeFormat
,
1237 MediaSeeking_IsUsingTimeFormat
,
1238 MediaSeeking_SetTimeFormat
,
1239 MediaSeeking_GetDuration
,
1240 MediaSeeking_GetStopPosition
,
1241 MediaSeeking_GetCurrentPosition
,
1242 MediaSeeking_ConvertTimeFormat
,
1243 MediaSeeking_SetPositions
,
1244 MediaSeeking_GetPositions
,
1245 MediaSeeking_GetAvailable
,
1246 MediaSeeking_SetRate
,
1247 MediaSeeking_GetRate
,
1248 MediaSeeking_GetPreroll
1251 static test_filter
* impl_from_IEnumMediaTypes(IEnumMediaTypes
*iface
)
1253 return CONTAINING_RECORD(iface
, test_filter
, IEnumMediaTypes_iface
);
1256 static HRESULT WINAPI
EnumMediaTypes_QueryInterface(IEnumMediaTypes
*iface
, REFIID riid
, void **ppv
)
1258 ok(0, "unexpected call\n");
1262 static ULONG WINAPI
EnumMediaTypes_AddRef(IEnumMediaTypes
*iface
)
1267 static ULONG WINAPI
EnumMediaTypes_Release(IEnumMediaTypes
*iface
)
1272 static HRESULT WINAPI
EnumMediaTypes_Next(IEnumMediaTypes
*iface
, ULONG cMediaTypes
,
1273 AM_MEDIA_TYPE
**ppMediaTypes
, ULONG
*pcFetched
)
1275 test_filter
*This
= impl_from_IEnumMediaTypes(iface
);
1276 check_calls_list("EnumMediaTypes_Next", ENUMMEDIATYPES_NEXT
, This
->filter_type
);
1278 ok(cMediaTypes
== 1, "cMediaTypes = %d\n", cMediaTypes
);
1279 ok(ppMediaTypes
!= NULL
, "ppMediaTypes == NULL\n");
1280 ok(pcFetched
!= NULL
, "pcFetched == NULL\n");
1282 if(!This
->enum_media_types_pos
++) {
1283 ppMediaTypes
[0] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE
));
1284 memset(ppMediaTypes
[0], 0, sizeof(AM_MEDIA_TYPE
));
1285 ppMediaTypes
[0]->majortype
= MEDIATYPE_Video
;
1294 static HRESULT WINAPI
EnumMediaTypes_Skip(IEnumMediaTypes
*iface
, ULONG cMediaTypes
)
1296 ok(0, "unexpected call\n");
1300 static HRESULT WINAPI
EnumMediaTypes_Reset(IEnumMediaTypes
*iface
)
1302 test_filter
*This
= impl_from_IEnumMediaTypes(iface
);
1303 check_calls_list("EnumMediaTypes_Reset", ENUMMEDIATYPES_RESET
, This
->filter_type
);
1305 This
->enum_media_types_pos
= 0;
1309 static HRESULT WINAPI
EnumMediaTypes_Clone(IEnumMediaTypes
*iface
, IEnumMediaTypes
**ppEnum
)
1311 ok(0, "unexpected call\n");
1315 static const IEnumMediaTypesVtbl EnumMediaTypesVtbl
= {
1316 EnumMediaTypes_QueryInterface
,
1317 EnumMediaTypes_AddRef
,
1318 EnumMediaTypes_Release
,
1319 EnumMediaTypes_Next
,
1320 EnumMediaTypes_Skip
,
1321 EnumMediaTypes_Reset
,
1322 EnumMediaTypes_Clone
1325 static void init_test_filter(test_filter
*This
, PIN_DIRECTION dir
, filter_type type
)
1327 memset(This
, 0, sizeof(*This
));
1328 This
->IBaseFilter_iface
.lpVtbl
= &BaseFilterVtbl
;
1329 This
->IEnumPins_iface
.lpVtbl
= &EnumPinsVtbl
;
1330 This
->IPin_iface
.lpVtbl
= &PinVtbl
;
1331 This
->IKsPropertySet_iface
.lpVtbl
= &KsPropertySetVtbl
;
1332 This
->IMemInputPin_iface
.lpVtbl
= &MemInputPinVtbl
;
1333 This
->IMediaSeeking_iface
.lpVtbl
= &MediaSeekingVtbl
;
1334 This
->IEnumMediaTypes_iface
.lpVtbl
= &EnumMediaTypesVtbl
;
1337 This
->filter_type
= type
;
1340 static void test_CaptureGraphBuilder_RenderStream(void)
1342 test_filter source_filter
, sink_filter
, intermediate_filter
;
1343 ICaptureGraphBuilder2
*cgb
;
1346 init_test_filter(&source_filter
, PINDIR_OUTPUT
, SOURCE_FILTER
);
1347 init_test_filter(&sink_filter
, PINDIR_INPUT
, SINK_FILTER
);
1348 init_test_filter(&intermediate_filter
, PINDIR_OUTPUT
, INTERMEDIATE_FILTER
);
1350 hr
= CoCreateInstance(&CLSID_CaptureGraphBuilder2
, NULL
, CLSCTX_INPROC_SERVER
,
1351 &IID_ICaptureGraphBuilder2
, (void**)&cgb
);
1352 ok(hr
== S_OK
|| broken(hr
== REGDB_E_CLASSNOTREG
),
1353 "couldn't create CaptureGraphBuilder, hr = %08x\n", hr
);
1355 win_skip("CaptureGraphBuilder is not registered\n");
1359 hr
= ICaptureGraphBuilder2_SetFiltergraph(cgb
, &GraphBuilder
);
1360 ok(hr
== S_OK
, "SetFiltergraph failed: %08x\n", hr
);
1362 trace("RenderStream with category and mediatype test\n");
1363 current_calls_list
= renderstream_cat_media
;
1365 hr
= ICaptureGraphBuilder2_RenderStream(cgb
, &PIN_CATEGORY_EDS
,
1366 &MEDIATYPE_Video
, (IUnknown
*)&source_filter
.IBaseFilter_iface
,
1367 NULL
, &sink_filter
.IBaseFilter_iface
);
1368 ok(hr
== S_OK
, "RenderStream failed: %08x\n", hr
);
1369 check_calls_list("test_CaptureGraphBuilder_RenderStream", END
, NOT_FILTER
);
1371 trace("RenderStream with intermediate filter\n");
1372 current_calls_list
= renderstream_intermediate
;
1374 hr
= ICaptureGraphBuilder2_RenderStream(cgb
, &PIN_CATEGORY_EDS
,
1375 &MEDIATYPE_Video
, (IUnknown
*)&source_filter
.IBaseFilter_iface
,
1376 &intermediate_filter
.IBaseFilter_iface
, &sink_filter
.IBaseFilter_iface
);
1377 ok(hr
== S_OK
, "RenderStream failed: %08x\n", hr
);
1378 check_calls_list("test_CaptureGraphBuilder_RenderStream", END
, NOT_FILTER
);
1380 ICaptureGraphBuilder2_Release(cgb
);
1383 static void test_AviMux_QueryInterface(void)
1385 IUnknown
*avimux
, *unk
;
1388 hr
= CoCreateInstance(&CLSID_AviDest
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&avimux
);
1389 ok(hr
== S_OK
|| broken(hr
== REGDB_E_CLASSNOTREG
),
1390 "couldn't create AVI Mux filter, hr = %08x\n", hr
);
1392 win_skip("AVI Mux filter is not registered\n");
1396 hr
= IUnknown_QueryInterface(avimux
, &IID_IBaseFilter
, (void**)&unk
);
1397 ok(hr
== S_OK
, "QueryInterface(IID_IBaseFilter) failed: %x\n", hr
);
1398 IUnknown_Release(unk
);
1400 hr
= IUnknown_QueryInterface(avimux
, &IID_IConfigAviMux
, (void**)&unk
);
1401 ok(hr
== S_OK
, "QueryInterface(IID_IConfigAviMux) failed: %x\n", hr
);
1402 IUnknown_Release(unk
);
1404 hr
= IUnknown_QueryInterface(avimux
, &IID_IConfigInterleaving
, (void**)&unk
);
1405 ok(hr
== S_OK
, "QueryInterface(IID_IConfigInterleaving) failed: %x\n", hr
);
1406 IUnknown_Release(unk
);
1408 hr
= IUnknown_QueryInterface(avimux
, &IID_IMediaSeeking
, (void**)&unk
);
1409 ok(hr
== S_OK
, "QueryInterface(IID_IMediaSeeking) failed: %x\n", hr
);
1410 IUnknown_Release(unk
);
1412 hr
= IUnknown_QueryInterface(avimux
, &IID_IPersistMediaPropertyBag
, (void**)&unk
);
1413 ok(hr
== S_OK
, "QueryInterface(IID_IPersistMediaPropertyBag) failed: %x\n", hr
);
1414 IUnknown_Release(unk
);
1416 hr
= IUnknown_QueryInterface(avimux
, &IID_ISpecifyPropertyPages
, (void**)&unk
);
1417 ok(hr
== S_OK
, "QueryInterface(IID_ISpecifyPropertyPages) failed: %x\n", hr
);
1418 IUnknown_Release(unk
);
1420 IUnknown_Release(avimux
);
1423 static HRESULT WINAPI
MemAllocator_QueryInterface(IMemAllocator
*iface
, REFIID riid
, void **ppvObject
)
1425 if(IsEqualIID(riid
, &IID_IUnknown
)) {
1430 ok(0, "unexpected call: %s\n", wine_dbgstr_guid(riid
));
1434 static ULONG WINAPI
MemAllocator_AddRef(IMemAllocator
*iface
)
1439 static ULONG WINAPI
MemAllocator_Release(IMemAllocator
*iface
)
1444 static HRESULT WINAPI
MemAllocator_SetProperties(IMemAllocator
*iface
,
1445 ALLOCATOR_PROPERTIES
*pRequest
, ALLOCATOR_PROPERTIES
*pActual
)
1447 ok(0, "unexpected call\n");
1451 static HRESULT WINAPI
MemAllocator_GetProperties(IMemAllocator
*iface
, ALLOCATOR_PROPERTIES
*pProps
)
1453 CHECK_EXPECT2(MemAllocator_GetProperties
);
1455 pProps
->cBuffers
= 1;
1456 pProps
->cbBuffer
= 1024;
1457 pProps
->cbAlign
= 0;
1458 pProps
->cbPrefix
= 0;
1462 static HRESULT WINAPI
MemAllocator_Commit(IMemAllocator
*iface
)
1464 ok(0, "unexpected call\n");
1468 static HRESULT WINAPI
MemAllocator_Decommit(IMemAllocator
*iface
)
1470 ok(0, "unexpected call\n");
1474 static HRESULT WINAPI
MemAllocator_GetBuffer(IMemAllocator
*iface
, IMediaSample
**ppBuffer
,
1475 REFERENCE_TIME
*pStartTime
, REFERENCE_TIME
*pEndTime
, DWORD dwFlags
)
1477 ok(0, "unexpected call\n");
1481 static HRESULT WINAPI
MemAllocator_ReleaseBuffer(IMemAllocator
*iface
, IMediaSample
*pBuffer
)
1483 ok(0, "unexpected call\n");
1487 static const IMemAllocatorVtbl MemAllocatorVtbl
= {
1488 MemAllocator_QueryInterface
,
1489 MemAllocator_AddRef
,
1490 MemAllocator_Release
,
1491 MemAllocator_SetProperties
,
1492 MemAllocator_GetProperties
,
1493 MemAllocator_Commit
,
1494 MemAllocator_Decommit
,
1495 MemAllocator_GetBuffer
,
1496 MemAllocator_ReleaseBuffer
1498 IMemAllocator MemAllocator
= {&MemAllocatorVtbl
};
1500 static HRESULT WINAPI
MediaSample_QueryInterface(IMediaSample
* This
, REFIID riid
, void **ppv
)
1502 if(IsEqualIID(riid
, &IID_IMediaSample2
))
1503 CHECK_EXPECT(MediaSample_QueryInterface_MediaSample2
);
1505 ok(0, "MediaSample_QueryInterface: %s\n", wine_dbgstr_guid(riid
));
1508 return E_NOINTERFACE
;
1511 static ULONG WINAPI
MediaSample_AddRef(IMediaSample
* This
)
1516 static ULONG WINAPI
MediaSample_Release(IMediaSample
* This
)
1521 static BYTE buf
[1024];
1522 static HRESULT WINAPI
MediaSample_GetPointer(IMediaSample
* This
, BYTE
**ppBuffer
)
1524 CHECK_EXPECT2(MediaSample_GetPointer
);
1526 memset(buf
, 'z', sizeof(buf
));
1530 static LONG WINAPI
MediaSample_GetSize(IMediaSample
* This
)
1532 CHECK_EXPECT2(MediaSample_GetSize
);
1536 static REFERENCE_TIME start_time
, end_time
;
1537 static HRESULT WINAPI
MediaSample_GetTime(IMediaSample
* This
,
1538 REFERENCE_TIME
*pTimeStart
, REFERENCE_TIME
*pTimeEnd
)
1540 CHECK_EXPECT2(MediaSample_GetTime
);
1541 *pTimeStart
= start_time
;
1542 *pTimeEnd
= end_time
;
1546 static HRESULT WINAPI
MediaSample_SetTime(IMediaSample
* This
,
1547 REFERENCE_TIME
*pTimeStart
, REFERENCE_TIME
*pTimeEnd
)
1549 ok(0, "unexpected call\n");
1553 static HRESULT WINAPI
MediaSample_IsSyncPoint(IMediaSample
* This
)
1555 CHECK_EXPECT2(MediaSample_IsSyncPoint
);
1559 static HRESULT WINAPI
MediaSample_SetSyncPoint(IMediaSample
* This
, BOOL bIsSyncPoint
)
1561 ok(0, "unexpected call\n");
1565 static HRESULT WINAPI
MediaSample_IsPreroll(IMediaSample
* This
)
1567 CHECK_EXPECT2(MediaSample_IsPreroll
);
1571 static HRESULT WINAPI
MediaSample_SetPreroll(IMediaSample
* This
, BOOL bIsPreroll
)
1573 ok(0, "unexpected call\n");
1577 static LONG WINAPI
MediaSample_GetActualDataLength(IMediaSample
* This
)
1579 CHECK_EXPECT2(MediaSample_GetActualDataLength
);
1583 static HRESULT WINAPI
MediaSample_SetActualDataLength(IMediaSample
* This
, LONG length
)
1585 ok(0, "unexpected call\n");
1589 static HRESULT WINAPI
MediaSample_GetMediaType(IMediaSample
* This
, AM_MEDIA_TYPE
**ppMediaType
)
1591 CHECK_EXPECT2(MediaSample_GetMediaType
);
1592 *ppMediaType
= NULL
;
1596 static HRESULT WINAPI
MediaSample_SetMediaType(IMediaSample
* This
, AM_MEDIA_TYPE
*pMediaType
)
1598 ok(0, "unexpected call\n");
1602 static HRESULT WINAPI
MediaSample_IsDiscontinuity(IMediaSample
* This
)
1604 CHECK_EXPECT(MediaSample_IsDiscontinuity
);
1608 static HRESULT WINAPI
MediaSample_SetDiscontinuity(IMediaSample
* This
, BOOL bDiscontinuity
)
1610 ok(0, "unexpected call\n");
1614 static HRESULT WINAPI
MediaSample_GetMediaTime(IMediaSample
* This
,
1615 LONGLONG
*pTimeStart
, LONGLONG
*pTimeEnd
)
1617 CHECK_EXPECT(MediaSample_GetMediaTime
);
1621 static HRESULT WINAPI
MediaSample_SetMediaTime(IMediaSample
* This
,
1622 LONGLONG
*pTimeStart
, LONGLONG
*pTimeEnd
)
1624 ok(0, "unexpected call\n");
1628 static const IMediaSampleVtbl MediaSampleVtbl
= {
1629 MediaSample_QueryInterface
,
1631 MediaSample_Release
,
1632 MediaSample_GetPointer
,
1633 MediaSample_GetSize
,
1634 MediaSample_GetTime
,
1635 MediaSample_SetTime
,
1636 MediaSample_IsSyncPoint
,
1637 MediaSample_SetSyncPoint
,
1638 MediaSample_IsPreroll
,
1639 MediaSample_SetPreroll
,
1640 MediaSample_GetActualDataLength
,
1641 MediaSample_SetActualDataLength
,
1642 MediaSample_GetMediaType
,
1643 MediaSample_SetMediaType
,
1644 MediaSample_IsDiscontinuity
,
1645 MediaSample_SetDiscontinuity
,
1646 MediaSample_GetMediaTime
,
1647 MediaSample_SetMediaTime
,
1649 IMediaSample MediaSample
= {&MediaSampleVtbl
};
1651 static void test_AviMux(char *arg
)
1653 test_filter source_filter
, sink_filter
;
1654 VIDEOINFO videoinfo
;
1655 IPin
*avimux_in
, *avimux_out
, *pin
;
1656 AM_MEDIA_TYPE source_media_type
;
1657 AM_MEDIA_TYPE
*media_type
;
1659 IBaseFilter
*avimux
;
1661 IEnumMediaTypes
*emt
;
1662 IMemInputPin
*memin
;
1663 ALLOCATOR_PROPERTIES props
;
1664 IMemAllocator
*memalloc
;
1665 IConfigInterleaving
*ci
;
1670 init_test_filter(&source_filter
, PINDIR_OUTPUT
, SOURCE_FILTER
);
1671 init_test_filter(&sink_filter
, PINDIR_INPUT
, SINK_FILTER
);
1673 hr
= CoCreateInstance(&CLSID_AviDest
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (void**)&avimux
);
1674 ok(hr
== S_OK
|| broken(hr
== REGDB_E_CLASSNOTREG
),
1675 "couldn't create AVI Mux filter, hr = %08x\n", hr
);
1677 win_skip("AVI Mux filter is not registered\n");
1681 hr
= IBaseFilter_EnumPins(avimux
, &ep
);
1682 ok(hr
== S_OK
, "EnumPins returned %x\n", hr
);
1684 hr
= IEnumPins_Next(ep
, 1, &avimux_out
, NULL
);
1685 ok(hr
== S_OK
, "Next returned %x\n", hr
);
1686 hr
= IPin_QueryDirection(avimux_out
, &dir
);
1687 ok(hr
== S_OK
, "QueryDirection returned %x\n", hr
);
1688 ok(dir
== PINDIR_OUTPUT
, "dir = %d\n", dir
);
1690 hr
= IEnumPins_Next(ep
, 1, &avimux_in
, NULL
);
1691 ok(hr
== S_OK
, "Next returned %x\n", hr
);
1692 hr
= IPin_QueryDirection(avimux_in
, &dir
);
1693 ok(hr
== S_OK
, "QueryDirection returned %x\n", hr
);
1694 ok(dir
== PINDIR_INPUT
, "dir = %d\n", dir
);
1695 IEnumPins_Release(ep
);
1697 hr
= IPin_EnumMediaTypes(avimux_out
, &emt
);
1698 ok(hr
== S_OK
, "EnumMediaTypes returned %x\n", hr
);
1699 hr
= IEnumMediaTypes_Next(emt
, 1, &media_type
, NULL
);
1700 ok(hr
== S_OK
, "Next returned %x\n", hr
);
1701 ok(IsEqualIID(&media_type
->majortype
, &MEDIATYPE_Stream
), "majortype = %s\n",
1702 wine_dbgstr_guid(&media_type
->majortype
));
1703 ok(IsEqualIID(&media_type
->subtype
, &MEDIASUBTYPE_Avi
), "subtype = %s\n",
1704 wine_dbgstr_guid(&media_type
->subtype
));
1705 ok(media_type
->bFixedSizeSamples
, "bFixedSizeSamples = %x\n", media_type
->bFixedSizeSamples
);
1706 ok(!media_type
->bTemporalCompression
, "bTemporalCompression = %x\n", media_type
->bTemporalCompression
);
1707 ok(media_type
->lSampleSize
== 1, "lSampleSize = %d\n", media_type
->lSampleSize
);
1708 ok(IsEqualIID(&media_type
->formattype
, &GUID_NULL
), "formattype = %s\n",
1709 wine_dbgstr_guid(&media_type
->formattype
));
1710 ok(!media_type
->pUnk
, "pUnk = %p\n", media_type
->pUnk
);
1711 ok(!media_type
->cbFormat
, "cbFormat = %d\n", media_type
->cbFormat
);
1712 ok(!media_type
->pbFormat
, "pbFormat = %p\n", media_type
->pbFormat
);
1713 CoTaskMemFree(media_type
);
1714 hr
= IEnumMediaTypes_Next(emt
, 1, &media_type
, NULL
);
1715 ok(hr
== S_FALSE
, "Next returned %x\n", hr
);
1716 IEnumMediaTypes_Release(emt
);
1718 hr
= IPin_EnumMediaTypes(avimux_in
, &emt
);
1719 ok(hr
== S_OK
, "EnumMediaTypes returned %x\n", hr
);
1720 hr
= IEnumMediaTypes_Reset(emt
);
1721 ok(hr
== S_OK
, "Reset returned %x\n", hr
);
1722 hr
= IEnumMediaTypes_Next(emt
, 1, &media_type
, NULL
);
1723 ok(hr
== S_FALSE
, "Next returned %x\n", hr
);
1724 IEnumMediaTypes_Release(emt
);
1726 hr
= IPin_ReceiveConnection(avimux_in
, &source_filter
.IPin_iface
, NULL
);
1727 ok(hr
== E_POINTER
, "ReceiveConnection returned %x\n", hr
);
1729 current_calls_list
= NULL
;
1730 memset(&source_media_type
, 0, sizeof(AM_MEDIA_TYPE
));
1731 memset(&videoinfo
, 0, sizeof(VIDEOINFO
));
1732 source_media_type
.majortype
= MEDIATYPE_Video
;
1733 source_media_type
.subtype
= MEDIASUBTYPE_RGB32
;
1734 source_media_type
.formattype
= FORMAT_VideoInfo
;
1735 source_media_type
.bFixedSizeSamples
= TRUE
;
1736 source_media_type
.lSampleSize
= 40000;
1737 source_media_type
.cbFormat
= sizeof(VIDEOINFO
);
1738 source_media_type
.pbFormat
= (BYTE
*)&videoinfo
;
1739 videoinfo
.AvgTimePerFrame
= 333333;
1740 videoinfo
.bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
1741 videoinfo
.bmiHeader
.biWidth
= 100;
1742 videoinfo
.bmiHeader
.biHeight
= 100;
1743 videoinfo
.bmiHeader
.biPlanes
= 1;
1744 videoinfo
.bmiHeader
.biBitCount
= 32;
1745 videoinfo
.bmiHeader
.biSizeImage
= 40000;
1746 videoinfo
.bmiHeader
.biClrImportant
= 256;
1747 hr
= IPin_ReceiveConnection(avimux_in
, &source_filter
.IPin_iface
, &source_media_type
);
1748 ok(hr
== S_OK
, "ReceiveConnection returned %x\n", hr
);
1750 hr
= IPin_ConnectedTo(avimux_in
, &pin
);
1751 ok(hr
== S_OK
, "ConnectedTo returned %x\n", hr
);
1752 ok(pin
== &source_filter
.IPin_iface
, "incorrect pin: %p, expected %p\n",
1753 pin
, &source_filter
.IPin_iface
);
1755 hr
= IPin_Connect(avimux_out
, &source_filter
.IPin_iface
, NULL
);
1756 todo_wine
ok(hr
== VFW_E_INVALID_DIRECTION
, "Connect returned %x\n", hr
);
1758 hr
= IBaseFilter_JoinFilterGraph(avimux
, (IFilterGraph
*)&GraphBuilder
, NULL
);
1759 ok(hr
== S_OK
, "JoinFilterGraph returned %x\n", hr
);
1761 SET_EXPECT(ReceiveConnection
);
1762 SET_EXPECT(GetAllocatorRequirements
);
1763 SET_EXPECT(NotifyAllocator
);
1764 SET_EXPECT(Reconnect
);
1765 hr
= IPin_Connect(avimux_out
, &sink_filter
.IPin_iface
, NULL
);
1766 ok(hr
== S_OK
, "Connect returned %x\n", hr
);
1767 CHECK_CALLED(ReceiveConnection
);
1768 CHECK_CALLED(GetAllocatorRequirements
);
1769 CHECK_CALLED(NotifyAllocator
);
1770 CHECK_CALLED(Reconnect
);
1772 hr
= IPin_ConnectedTo(avimux_out
, &pin
);
1773 ok(hr
== S_OK
, "ConnectedTo returned %x\n", hr
);
1774 ok(pin
== &sink_filter
.IPin_iface
, "incorrect pin: %p, expected %p\n",
1775 pin
, &source_filter
.IPin_iface
);
1777 hr
= IPin_QueryInterface(avimux_in
, &IID_IMemInputPin
, (void**)&memin
);
1778 ok(hr
== S_OK
, "QueryInterface returned %x\n", hr
);
1780 props
.cBuffers
= 0xdeadbee1;
1781 props
.cbBuffer
= 0xdeadbee2;
1782 props
.cbAlign
= 0xdeadbee3;
1783 props
.cbPrefix
= 0xdeadbee4;
1784 hr
= IMemInputPin_GetAllocatorRequirements(memin
, &props
);
1785 ok(hr
==S_OK
|| broken(hr
==E_INVALIDARG
), "GetAllocatorRequirments returned %x\n", hr
);
1787 ok(props
.cBuffers
== 0xdeadbee1, "cBuffers = %d\n", props
.cBuffers
);
1788 ok(props
.cbBuffer
== 0xdeadbee2, "cbBuffer = %d\n", props
.cbBuffer
);
1789 ok(props
.cbAlign
== 1, "cbAlign = %d\n", props
.cbAlign
);
1790 ok(props
.cbPrefix
== 8, "cbPrefix = %d\n", props
.cbPrefix
);
1793 hr
= IMemInputPin_GetAllocator(memin
, &memalloc
);
1794 ok(hr
== S_OK
, "GetAllocator returned %x\n", hr
);
1796 props
.cBuffers
= 0xdeadbee1;
1797 props
.cbBuffer
= 0xdeadbee2;
1798 props
.cbAlign
= 0xdeadbee3;
1799 props
.cbPrefix
= 0xdeadbee4;
1800 hr
= IMemAllocator_GetProperties(memalloc
, &props
);
1801 ok(hr
== S_OK
, "GetProperties returned %x\n", hr
);
1802 ok(props
.cBuffers
== 0, "cBuffers = %d\n", props
.cBuffers
);
1803 ok(props
.cbBuffer
== 0, "cbBuffer = %d\n", props
.cbBuffer
);
1804 ok(props
.cbAlign
== 0, "cbAlign = %d\n", props
.cbAlign
);
1805 ok(props
.cbPrefix
== 0, "cbPrefix = %d\n", props
.cbPrefix
);
1806 IMemAllocator_Release(memalloc
);
1808 hr
= IBaseFilter_QueryInterface(avimux
, &IID_IConfigInterleaving
, (void**)&ci
);
1809 ok(hr
== S_OK
, "QueryInterface(IID_IConfigInterleaving) returned %x\n", hr
);
1810 hr
= IConfigInterleaving_put_Mode(ci
, 5);
1811 ok(hr
== E_INVALIDARG
, "put_Mode returned %x\n", hr
);
1812 SET_EXPECT(Reconnect
);
1813 hr
= IConfigInterleaving_put_Mode(ci
, INTERLEAVE_FULL
);
1814 ok(hr
== S_OK
, "put_Mode returned %x\n", hr
);
1815 CHECK_CALLED(Reconnect
);
1816 IConfigInterleaving_Release(ci
);
1818 hr
= IBaseFilter_GetState(avimux
, 0, &state
);
1819 ok(hr
== S_OK
, "GetState returned %x\n", hr
);
1820 ok(state
== State_Stopped
, "state = %d\n", state
);
1822 SET_EXPECT(MemAllocator_GetProperties
);
1823 hr
= IMemInputPin_NotifyAllocator(memin
, &MemAllocator
, TRUE
);
1824 ok(hr
== S_OK
, "NotifyAllocator returned %x\n", hr
);
1825 CHECK_CALLED(MemAllocator_GetProperties
);
1827 hr
= IMemInputPin_GetAllocator(memin
, &memalloc
);
1828 ok(hr
== S_OK
, "GetAllocator returned %x\n", hr
);
1829 ok(memalloc
!= &MemAllocator
, "memalloc == &MemAllocator\n");
1830 IMemAllocator_Release(memalloc
);
1832 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &avi_stream
);
1833 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
1834 SET_EXPECT(MediaSeeking_GetPositions
);
1835 SET_EXPECT(MemInputPin_QueryInterface_IStream
);
1836 hr
= IBaseFilter_Run(avimux
, 0);
1837 ok(hr
== S_OK
, "Run returned %x\n", hr
);
1838 CHECK_CALLED(MediaSeeking_GetPositions
);
1840 hr
= IBaseFilter_GetState(avimux
, 0, &state
);
1841 ok(hr
== S_OK
, "GetState returned %x\n", hr
);
1842 ok(state
== State_Running
, "state = %d\n", state
);
1844 SET_EXPECT(MediaSample_QueryInterface_MediaSample2
);
1845 SET_EXPECT(MediaSample_IsDiscontinuity
);
1846 SET_EXPECT(MediaSample_IsPreroll
);
1847 SET_EXPECT(MediaSample_IsSyncPoint
);
1848 SET_EXPECT(MediaSample_GetTime
);
1849 SET_EXPECT(MediaSample_GetMediaType
);
1850 SET_EXPECT(MediaSample_GetPointer
);
1851 SET_EXPECT(MediaSample_GetActualDataLength
);
1852 SET_EXPECT(MediaSample_GetSize
);
1853 SET_EXPECT(MediaSample_GetMediaTime
);
1854 start_time
= end_time
= 0;
1855 hr
= IMemInputPin_Receive(memin
, &MediaSample
);
1856 ok(hr
== S_OK
, "Receive returned %x\n", hr
);
1857 CHECK_CALLED(MediaSample_QueryInterface_MediaSample2
);
1858 todo_wine
CHECK_CALLED(MediaSample_IsDiscontinuity
);
1859 todo_wine
CHECK_CALLED(MediaSample_IsPreroll
);
1860 CHECK_CALLED(MediaSample_IsSyncPoint
);
1861 CHECK_CALLED(MediaSample_GetTime
);
1862 todo_wine
CHECK_CALLED(MediaSample_GetMediaType
);
1863 CHECK_CALLED(MediaSample_GetPointer
);
1864 CHECK_CALLED(MediaSample_GetActualDataLength
);
1865 todo_wine
CHECK_CALLED(MediaSample_GetSize
);
1866 todo_wine
CHECK_CALLED(MediaSample_GetMediaTime
);
1868 SET_EXPECT(MediaSample_QueryInterface_MediaSample2
);
1869 SET_EXPECT(MediaSample_IsDiscontinuity
);
1870 SET_EXPECT(MediaSample_IsPreroll
);
1871 SET_EXPECT(MediaSample_IsSyncPoint
);
1872 SET_EXPECT(MediaSample_GetTime
);
1873 SET_EXPECT(MediaSample_GetMediaType
);
1874 SET_EXPECT(MediaSample_GetPointer
);
1875 SET_EXPECT(MediaSample_GetActualDataLength
);
1876 SET_EXPECT(MediaSample_GetSize
);
1877 SET_EXPECT(MediaSample_GetMediaTime
);
1878 hr
= IMemInputPin_Receive(memin
, &MediaSample
);
1879 ok(hr
== S_OK
, "Receive returned %x\n", hr
);
1880 CHECK_CALLED(MediaSample_QueryInterface_MediaSample2
);
1881 todo_wine
CHECK_CALLED(MediaSample_IsDiscontinuity
);
1882 todo_wine
CHECK_CALLED(MediaSample_IsPreroll
);
1883 CHECK_CALLED(MediaSample_IsSyncPoint
);
1884 CHECK_CALLED(MediaSample_GetTime
);
1885 todo_wine
CHECK_CALLED(MediaSample_GetMediaType
);
1886 CHECK_CALLED(MediaSample_GetPointer
);
1887 CHECK_CALLED(MediaSample_GetActualDataLength
);
1888 todo_wine
CHECK_CALLED(MediaSample_GetSize
);
1889 todo_wine
CHECK_CALLED(MediaSample_GetMediaTime
);
1891 SET_EXPECT(MediaSample_QueryInterface_MediaSample2
);
1892 SET_EXPECT(MediaSample_IsDiscontinuity
);
1893 SET_EXPECT(MediaSample_IsPreroll
);
1894 SET_EXPECT(MediaSample_IsSyncPoint
);
1895 SET_EXPECT(MediaSample_GetTime
);
1896 SET_EXPECT(MediaSample_GetMediaType
);
1897 SET_EXPECT(MediaSample_GetPointer
);
1898 SET_EXPECT(MediaSample_GetActualDataLength
);
1899 SET_EXPECT(MediaSample_GetSize
);
1900 SET_EXPECT(MediaSample_GetMediaTime
);
1901 start_time
= 20000000;
1902 end_time
= 21000000;
1903 hr
= IMemInputPin_Receive(memin
, &MediaSample
);
1904 ok(hr
== S_OK
, "Receive returned %x\n", hr
);
1905 CHECK_CALLED(MediaSample_QueryInterface_MediaSample2
);
1906 todo_wine
CHECK_CALLED(MediaSample_IsDiscontinuity
);
1907 todo_wine
CHECK_CALLED(MediaSample_IsPreroll
);
1908 CHECK_CALLED(MediaSample_IsSyncPoint
);
1909 CHECK_CALLED(MediaSample_GetTime
);
1910 todo_wine
CHECK_CALLED(MediaSample_GetMediaType
);
1911 CHECK_CALLED(MediaSample_GetPointer
);
1912 CHECK_CALLED(MediaSample_GetActualDataLength
);
1913 todo_wine
CHECK_CALLED(MediaSample_GetSize
);
1914 todo_wine
CHECK_CALLED(MediaSample_GetMediaTime
);
1915 IMemInputPin_Release(memin
);
1917 hr
= IBaseFilter_Stop(avimux
);
1918 ok(hr
== S_OK
, "Stop returned %x\n", hr
);
1919 CHECK_CALLED(MemInputPin_QueryInterface_IStream
);
1921 hr
= IBaseFilter_GetState(avimux
, 0, &state
);
1922 ok(hr
== S_OK
, "GetState returned %x\n", hr
);
1923 ok(state
== State_Stopped
, "state = %d\n", state
);
1925 hr
= IPin_Disconnect(avimux_out
);
1926 ok(hr
== S_OK
, "Disconnect returned %x\n", hr
);
1928 IPin_Release(avimux_in
);
1929 IPin_Release(avimux_out
);
1930 ref
= IBaseFilter_Release(avimux
);
1931 ok(ref
== 0, "Avi Mux filter was not destroyed (%d)\n", ref
);
1933 if(arg
&& !strcmp(arg
, "save")) {
1939 f
= CreateFileA("avimux.avi", GENERIC_WRITE
, 0, NULL
,
1940 CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
1941 ok(f
!= INVALID_HANDLE_VALUE
, "CreateFile failed\n");
1944 hr
= IStream_Seek(avi_stream
, li
, STREAM_SEEK_SET
, NULL
);
1945 ok(hr
== S_OK
, "IStream_Seek failed: %x\n", hr
);
1948 hr
= IStream_Read(avi_stream
, buf
, sizeof(buf
), &read
);
1950 ok(0, "IStream_Read failed: %x\n", hr
);
1955 ok(WriteFile(f
, buf
, read
, &read
, NULL
), "WriteFile failed\n");
1962 ref
= IStream_Release(avi_stream
);
1963 ok(ref
== 0, "IStream was not destroyed (%d)\n", ref
);
1966 static HRESULT WINAPI
PropertyBag_QueryInterface(IPropertyBag
*iface
, REFIID riid
, void **ppv
)
1968 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IPropertyBag
, riid
)) {
1973 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid
));
1975 return E_NOINTERFACE
;
1978 static ULONG WINAPI
PropertyBag_AddRef(IPropertyBag
*iface
)
1983 static ULONG WINAPI
PropertyBag_Release(IPropertyBag
*iface
)
1988 static HRESULT WINAPI
PropertyBag_Read(IPropertyBag
*iface
, LPCOLESTR pszPropName
, VARIANT
*pVar
, IErrorLog
*pErrorLog
)
1990 ok(!pErrorLog
, "pErrorLog = %p\n", pErrorLog
);
1992 if(!strcmp_wa(pszPropName
, "FccHandler")) {
1993 CHECK_EXPECT(Read_FccHandler
);
1994 V_VT(pVar
) = VT_BSTR
;
1995 V_BSTR(pVar
) = a2bstr("mrle");
1999 ok(0, "unexpected call: %s\n", wine_dbgstr_w(pszPropName
));
2003 static HRESULT WINAPI
PropertyBag_Write(IPropertyBag
*iface
, LPCOLESTR pszPropName
, VARIANT
*pVar
)
2005 ok(0, "unexpected call: %s\n", wine_dbgstr_w(pszPropName
));
2009 static const IPropertyBagVtbl PropertyBagVtbl
= {
2010 PropertyBag_QueryInterface
,
2012 PropertyBag_Release
,
2017 static IPropertyBag PropertyBag
= { &PropertyBagVtbl
};
2019 static void test_AviCo(void)
2021 IPersistPropertyBag
*persist_bag
;
2022 IPin
*pin
, *in_pin
, *out_pin
;
2023 IEnumPins
*enum_pins
;
2028 static const WCHAR inputW
[] = {'I','n','p','u','t',0};
2029 static const WCHAR outputW
[] = {'O','u','t','p','u','t',0};
2031 hres
= CoCreateInstance(&CLSID_AVICo
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (void**)&avico
);
2032 if(hres
== REGDB_E_CLASSNOTREG
) {
2033 win_skip("CLSID_AVICo not registered\n");
2036 ok(hres
== S_OK
, "Could not create CLSID_AVICo class: %08x\n", hres
);
2038 hres
= IBaseFilter_QueryInterface(avico
, &IID_IPin
, (void**)&pin
);
2039 ok(hres
== E_NOINTERFACE
, "QueryInterface(IID_IPin) returned: %08x\n", hres
);
2041 hres
= IBaseFilter_QueryInterface(avico
, &IID_IPersistPropertyBag
, (void**)&persist_bag
);
2042 ok(hres
== S_OK
, "QueryInterface(IID_IPersistPropertyBag) returned: %08x\n", hres
);
2044 SET_EXPECT(Read_FccHandler
);
2045 hres
= IPersistPropertyBag_Load(persist_bag
, &PropertyBag
, NULL
);
2046 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
2047 CHECK_CALLED(Read_FccHandler
);
2049 IPersistPropertyBag_Release(persist_bag
);
2051 hres
= IBaseFilter_EnumPins(avico
, &enum_pins
);
2052 ok(hres
== S_OK
, "EnumPins failed: %08x\n", hres
);
2054 hres
= IEnumPins_Next(enum_pins
, 1, &in_pin
, NULL
);
2055 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
2057 hres
= IPin_QueryPinInfo(in_pin
, &pin_info
);
2058 ok(hres
== S_OK
, "QueryPinInfo failed: %08x\n", hres
);
2059 ok(pin_info
.pFilter
== avico
, "pin_info.pFilter != avico\n");
2060 ok(pin_info
.dir
== PINDIR_INPUT
, "pin_info.dir = %d\n", pin_info
.dir
);
2061 ok(!lstrcmpW(pin_info
.achName
, inputW
), "pin_info.achName = %s\n", wine_dbgstr_w(pin_info
.achName
));
2063 hres
= IEnumPins_Next(enum_pins
, 1, &out_pin
, NULL
);
2064 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
2066 hres
= IPin_QueryPinInfo(out_pin
, &pin_info
);
2067 ok(hres
== S_OK
, "QueryPinInfo failed: %08x\n", hres
);
2068 ok(pin_info
.pFilter
== avico
, "pin_info.pFilter != avico\n");
2069 ok(pin_info
.dir
== PINDIR_OUTPUT
, "pin_info.dir = %d\n", pin_info
.dir
);
2070 ok(!lstrcmpW(pin_info
.achName
, outputW
), "pin_info.achName = %s\n", wine_dbgstr_w(pin_info
.achName
));
2072 IEnumPins_Release(enum_pins
);
2074 IPin_Release(in_pin
);
2075 IPin_Release(out_pin
);
2076 IBaseFilter_Release(avico
);
2081 if (SUCCEEDED(CoInitialize(NULL
)))
2086 arg_c
= winetest_get_mainargs(&arg_v
);
2088 test_smart_tee_filter();
2089 test_CaptureGraphBuilder_RenderStream();
2090 test_AviMux_QueryInterface();
2091 test_AviMux(arg_c
>2 ? arg_v
[2] : NULL
);
2097 skip("CoInitialize failed\n");