1 /* DirectShow FilterGraph object (QUARTZ.DLL)
3 * Copyright 2002 Lionel Ulmer
4 * Copyright 2004 Christian Costa
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
35 #include "wine/debug.h"
36 #include "quartz_private.h"
42 #include "wine/unicode.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
48 HWND hWnd
; /* Target window */
49 UINT msg
; /* User window message */
50 LONG_PTR instance
; /* User data */
51 int disabled
; /* Disabled messages posting */
55 LONG lEventCode
; /* Event code */
56 LONG_PTR lParam1
; /* Param1 */
57 LONG_PTR lParam2
; /* Param2 */
60 /* messages ring implementation for queuing events (taken from winmm) */
61 #define EVENTS_RING_BUFFER_INCREMENT 64
67 CRITICAL_SECTION msg_crst
;
68 HANDLE msg_event
; /* Signaled for no empty queue */
71 static int EventsQueue_Init(EventsQueue
* omr
)
75 omr
->msg_event
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
76 omr
->ring_buffer_size
= EVENTS_RING_BUFFER_INCREMENT
;
77 omr
->messages
= CoTaskMemAlloc(omr
->ring_buffer_size
* sizeof(Event
));
78 ZeroMemory(omr
->messages
, omr
->ring_buffer_size
* sizeof(Event
));
80 InitializeCriticalSection(&omr
->msg_crst
);
81 omr
->msg_crst
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": EventsQueue.msg_crst");
85 static int EventsQueue_Destroy(EventsQueue
* omr
)
87 CloseHandle(omr
->msg_event
);
88 CoTaskMemFree(omr
->messages
);
89 omr
->msg_crst
.DebugInfo
->Spare
[0] = 0;
90 DeleteCriticalSection(&omr
->msg_crst
);
94 static int EventsQueue_PutEvent(EventsQueue
* omr
, const Event
* evt
)
96 EnterCriticalSection(&omr
->msg_crst
);
97 if (omr
->msg_toget
== ((omr
->msg_tosave
+ 1) % omr
->ring_buffer_size
))
99 int old_ring_buffer_size
= omr
->ring_buffer_size
;
100 omr
->ring_buffer_size
+= EVENTS_RING_BUFFER_INCREMENT
;
101 TRACE("omr->ring_buffer_size=%d\n",omr
->ring_buffer_size
);
102 omr
->messages
= CoTaskMemRealloc(omr
->messages
, omr
->ring_buffer_size
* sizeof(Event
));
103 /* Now we need to rearrange the ring buffer so that the new
104 buffers just allocated are in between omr->msg_tosave and
107 if (omr
->msg_tosave
< omr
->msg_toget
)
109 memmove(&(omr
->messages
[omr
->msg_toget
+ EVENTS_RING_BUFFER_INCREMENT
]),
110 &(omr
->messages
[omr
->msg_toget
]),
111 sizeof(Event
)*(old_ring_buffer_size
- omr
->msg_toget
)
113 omr
->msg_toget
+= EVENTS_RING_BUFFER_INCREMENT
;
116 omr
->messages
[omr
->msg_tosave
] = *evt
;
117 SetEvent(omr
->msg_event
);
118 omr
->msg_tosave
= (omr
->msg_tosave
+ 1) % omr
->ring_buffer_size
;
119 LeaveCriticalSection(&omr
->msg_crst
);
123 static int EventsQueue_GetEvent(EventsQueue
* omr
, Event
* evt
, LONG msTimeOut
)
125 if (WaitForSingleObject(omr
->msg_event
, msTimeOut
) != WAIT_OBJECT_0
)
128 EnterCriticalSection(&omr
->msg_crst
);
130 if (omr
->msg_toget
== omr
->msg_tosave
) /* buffer empty ? */
132 LeaveCriticalSection(&omr
->msg_crst
);
136 *evt
= omr
->messages
[omr
->msg_toget
];
137 omr
->msg_toget
= (omr
->msg_toget
+ 1) % omr
->ring_buffer_size
;
139 /* Mark the buffer as empty if needed */
140 if (omr
->msg_toget
== omr
->msg_tosave
) /* buffer empty ? */
141 ResetEvent(omr
->msg_event
);
143 LeaveCriticalSection(&omr
->msg_crst
);
147 #define MAX_ITF_CACHE_ENTRIES 3
148 typedef struct _ITF_CACHE_ENTRY
{
154 typedef struct _IFilterGraphImpl
{
155 IFilterGraph2 IFilterGraph2_iface
;
156 IMediaControl IMediaControl_iface
;
157 IMediaSeeking IMediaSeeking_iface
;
158 IBasicAudio IBasicAudio_iface
;
159 IBasicVideo2 IBasicVideo2_iface
;
160 IVideoWindow IVideoWindow_iface
;
161 IMediaEventEx IMediaEventEx_iface
;
162 IMediaFilter IMediaFilter_iface
;
163 IMediaEventSink IMediaEventSink_iface
;
164 IGraphConfig IGraphConfig_iface
;
165 IMediaPosition IMediaPosition_iface
;
166 const IUnknownVtbl
* IInner_vtbl
;
167 /* IAMGraphStreams */
173 /* IRegisterServiceProvider */
174 /* IResourceMananger */
175 /* IServiceProvider */
176 /* IVideoFrameStep */
179 IUnknown
*punkFilterMapper2
;
180 IFilterMapper2
* pFilterMapper2
;
181 IBaseFilter
** ppFiltersInGraph
;
182 LPWSTR
* pFilterNames
;
186 IReferenceClock
*refClock
;
187 IBaseFilter
*refClockProvider
;
189 HANDLE hEventCompletion
;
190 int CompletionStatus
;
194 int HandleEcComplete
;
196 int HandleEcClockChanged
;
199 ITF_CACHE_ENTRY ItfCacheEntries
[MAX_ITF_CACHE_ENTRIES
];
200 int nItfCacheEntries
;
201 IUnknown
* pUnkOuter
;
206 REFERENCE_TIME start_time
;
207 REFERENCE_TIME pause_time
;
208 LONGLONG stop_position
;
212 static HRESULT
Filtergraph_QueryInterface(IFilterGraphImpl
*This
,
213 REFIID riid
, LPVOID
* ppv
);
214 static ULONG
Filtergraph_AddRef(IFilterGraphImpl
*This
);
215 static ULONG
Filtergraph_Release(IFilterGraphImpl
*This
);
217 static HRESULT WINAPI
FilterGraphInner_QueryInterface(IUnknown
* iface
,
220 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
221 TRACE("(%p)->(%s (%p), %p)\n", This
, debugstr_guid(riid
), riid
, ppvObj
);
223 if (This
->bAggregatable
)
224 This
->bUnkOuterValid
= TRUE
;
226 if (IsEqualGUID(&IID_IUnknown
, riid
)) {
227 *ppvObj
= &(This
->IInner_vtbl
);
228 TRACE(" returning IUnknown interface (%p)\n", *ppvObj
);
229 } else if (IsEqualGUID(&IID_IFilterGraph
, riid
) ||
230 IsEqualGUID(&IID_IFilterGraph2
, riid
) ||
231 IsEqualGUID(&IID_IGraphBuilder
, riid
)) {
232 *ppvObj
= &This
->IFilterGraph2_iface
;
233 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj
);
234 } else if (IsEqualGUID(&IID_IMediaControl
, riid
)) {
235 *ppvObj
= &This
->IMediaControl_iface
;
236 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj
);
237 } else if (IsEqualGUID(&IID_IMediaSeeking
, riid
)) {
238 *ppvObj
= &This
->IMediaSeeking_iface
;
239 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj
);
240 } else if (IsEqualGUID(&IID_IBasicAudio
, riid
)) {
241 *ppvObj
= &This
->IBasicAudio_iface
;
242 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj
);
243 } else if (IsEqualGUID(&IID_IBasicVideo
, riid
) ||
244 IsEqualGUID(&IID_IBasicVideo2
, riid
)) {
245 *ppvObj
= &This
->IBasicVideo2_iface
;
246 TRACE(" returning IBasicVideo2 interface (%p)\n", *ppvObj
);
247 } else if (IsEqualGUID(&IID_IVideoWindow
, riid
)) {
248 *ppvObj
= &This
->IVideoWindow_iface
;
249 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj
);
250 } else if (IsEqualGUID(&IID_IMediaEvent
, riid
) ||
251 IsEqualGUID(&IID_IMediaEventEx
, riid
)) {
252 *ppvObj
= &This
->IMediaEventEx_iface
;
253 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj
);
254 } else if (IsEqualGUID(&IID_IMediaFilter
, riid
) ||
255 IsEqualGUID(&IID_IPersist
, riid
)) {
256 *ppvObj
= &This
->IMediaFilter_iface
;
257 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj
);
258 } else if (IsEqualGUID(&IID_IMediaEventSink
, riid
)) {
259 *ppvObj
= &This
->IMediaEventSink_iface
;
260 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj
);
261 } else if (IsEqualGUID(&IID_IGraphConfig
, riid
)) {
262 *ppvObj
= &This
->IGraphConfig_iface
;
263 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj
);
264 } else if (IsEqualGUID(&IID_IMediaPosition
, riid
)) {
265 *ppvObj
= &This
->IMediaPosition_iface
;
266 TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj
);
267 } else if (IsEqualGUID(&IID_IFilterMapper
, riid
)) {
268 TRACE(" requesting IFilterMapper interface from aggregated filtermapper (%p)\n", *ppvObj
);
269 return IUnknown_QueryInterface(This
->punkFilterMapper2
, riid
, ppvObj
);
270 } else if (IsEqualGUID(&IID_IFilterMapper2
, riid
)) {
271 *ppvObj
= This
->pFilterMapper2
;
272 TRACE(" returning IFilterMapper2 interface from aggregated filtermapper (%p)\n", *ppvObj
);
273 } else if (IsEqualGUID(&IID_IFilterMapper3
, riid
)) {
274 *ppvObj
= This
->pFilterMapper2
;
275 TRACE(" returning IFilterMapper3 interface from aggregated filtermapper (%p)\n", *ppvObj
);
278 FIXME("unknown interface %s\n", debugstr_guid(riid
));
279 return E_NOINTERFACE
;
282 IUnknown_AddRef((IUnknown
*)(*ppvObj
));
286 static ULONG WINAPI
FilterGraphInner_AddRef(IUnknown
* iface
) {
287 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
288 ULONG ref
= InterlockedIncrement(&This
->ref
);
290 TRACE("(%p)->(): new ref = %d\n", This
, ref
);
295 static ULONG WINAPI
FilterGraphInner_Release(IUnknown
* iface
)
297 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
298 ULONG ref
= InterlockedDecrement(&This
->ref
);
300 TRACE("(%p)->(): new ref = %d\n", This
, ref
);
305 This
->ref
= 1; /* guard against reentrancy (aggregation). */
307 IMediaControl_Stop(&This
->IMediaControl_iface
);
309 while (This
->nFilters
)
310 IFilterGraph2_RemoveFilter((IFilterGraph2
*)This
, This
->ppFiltersInGraph
[0]);
313 IReferenceClock_Release(This
->refClock
);
315 for (i
= 0; i
< This
->nItfCacheEntries
; i
++)
317 if (This
->ItfCacheEntries
[i
].iface
)
318 IUnknown_Release(This
->ItfCacheEntries
[i
].iface
);
321 /* AddRef on controlling IUnknown, to compensate for Release of cached IFilterMapper2 interface below.
323 * NOTE: Filtergraph_AddRef isn't suitable, because bUnkOuterValid may be FALSE but punkOuter non-NULL
324 * and already passed as punkOuter to filtermapper in FilterGraph_create - this will happen in case of
325 * CoCreateInstance of filtergraph with non-null pUnkOuter and REFIID other than IID_Unknown that is
326 * cleaning up after error. */
327 if (This
->pUnkOuter
) IUnknown_AddRef(This
->pUnkOuter
);
328 else IUnknown_AddRef((IUnknown
*)&This
->IInner_vtbl
);
330 IFilterMapper2_Release(This
->pFilterMapper2
);
331 IUnknown_Release(This
->punkFilterMapper2
);
333 CloseHandle(This
->hEventCompletion
);
334 EventsQueue_Destroy(&This
->evqueue
);
335 This
->cs
.DebugInfo
->Spare
[0] = 0;
336 DeleteCriticalSection(&This
->cs
);
337 CoTaskMemFree(This
->ppFiltersInGraph
);
338 CoTaskMemFree(This
->pFilterNames
);
344 static inline IFilterGraphImpl
*impl_from_IFilterGraph2(IFilterGraph2
*iface
)
346 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IFilterGraph2_iface
);
349 static HRESULT WINAPI
FilterGraph2_QueryInterface(IFilterGraph2
*iface
, REFIID riid
, void **ppvObj
)
351 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
353 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
355 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
358 static ULONG WINAPI
FilterGraph2_AddRef(IFilterGraph2
*iface
)
360 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
362 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This
, iface
);
364 return Filtergraph_AddRef(This
);
367 static ULONG WINAPI
FilterGraph2_Release(IFilterGraph2
*iface
)
369 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
371 TRACE("(%p/%p)->() calling FilterGraph Release\n", This
, iface
);
373 return Filtergraph_Release(This
);
376 /*** IFilterGraph methods ***/
377 static HRESULT WINAPI
FilterGraph2_AddFilter(IFilterGraph2
*iface
, IBaseFilter
*pFilter
,
380 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
383 WCHAR
* wszFilterName
= NULL
;
384 int duplicate_name
= FALSE
;
386 TRACE("(%p/%p)->(%p, %s (%p))\n", This
, iface
, pFilter
, debugstr_w(pName
), pName
);
391 wszFilterName
= CoTaskMemAlloc( (pName
? strlenW(pName
) + 6 : 5) * sizeof(WCHAR
) );
395 /* Check if name already exists */
396 for(i
= 0; i
< This
->nFilters
; i
++)
397 if (!strcmpW(This
->pFilterNames
[i
], pName
))
399 duplicate_name
= TRUE
;
404 /* If no name given or name already existing, generate one */
405 if (!pName
|| duplicate_name
)
407 static const WCHAR wszFmt1
[] = {'%','s',' ','%','0','4','d',0};
408 static const WCHAR wszFmt2
[] = {'%','0','4','d',0};
410 for (j
= 0; j
< 10000 ; j
++)
414 sprintfW(wszFilterName
, wszFmt1
, pName
, This
->nameIndex
);
416 sprintfW(wszFilterName
, wszFmt2
, This
->nameIndex
);
417 TRACE("Generated name %s\n", debugstr_w(wszFilterName
));
419 /* Check if the generated name already exists */
420 for(i
= 0; i
< This
->nFilters
; i
++)
421 if (!strcmpW(This
->pFilterNames
[i
], wszFilterName
))
424 /* Compute next index and exit if generated name is suitable */
425 if (This
->nameIndex
++ == 10000)
427 if (i
== This
->nFilters
)
430 /* Unable to find a suitable name */
433 CoTaskMemFree(wszFilterName
);
434 return VFW_E_DUPLICATE_NAME
;
438 memcpy(wszFilterName
, pName
, (strlenW(pName
) + 1) * sizeof(WCHAR
));
440 if (This
->nFilters
+ 1 > This
->filterCapacity
)
442 int newCapacity
= This
->filterCapacity
? 2 * This
->filterCapacity
: 1;
443 IBaseFilter
** ppNewFilters
= CoTaskMemAlloc(newCapacity
* sizeof(IBaseFilter
*));
444 LPWSTR
* pNewNames
= CoTaskMemAlloc(newCapacity
* sizeof(LPWSTR
));
445 memcpy(ppNewFilters
, This
->ppFiltersInGraph
, This
->nFilters
* sizeof(IBaseFilter
*));
446 memcpy(pNewNames
, This
->pFilterNames
, This
->nFilters
* sizeof(LPWSTR
));
447 if (This
->filterCapacity
)
449 CoTaskMemFree(This
->ppFiltersInGraph
);
450 CoTaskMemFree(This
->pFilterNames
);
452 This
->ppFiltersInGraph
= ppNewFilters
;
453 This
->pFilterNames
= pNewNames
;
454 This
->filterCapacity
= newCapacity
;
457 hr
= IBaseFilter_JoinFilterGraph(pFilter
, (IFilterGraph
*)This
, wszFilterName
);
461 IBaseFilter_AddRef(pFilter
);
462 This
->ppFiltersInGraph
[This
->nFilters
] = pFilter
;
463 This
->pFilterNames
[This
->nFilters
] = wszFilterName
;
465 IBaseFilter_SetSyncSource(pFilter
, This
->refClock
);
468 CoTaskMemFree(wszFilterName
);
470 if (SUCCEEDED(hr
) && duplicate_name
)
471 return VFW_S_DUPLICATE_NAME
;
476 static HRESULT WINAPI
FilterGraph2_RemoveFilter(IFilterGraph2
*iface
, IBaseFilter
*pFilter
)
478 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
482 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFilter
);
484 /* FIXME: check graph is stopped */
486 for (i
= 0; i
< This
->nFilters
; i
++)
488 if (This
->ppFiltersInGraph
[i
] == pFilter
)
490 IEnumPins
*penumpins
= NULL
;
493 if (This
->defaultclock
&& This
->refClockProvider
== pFilter
)
495 IMediaFilter_SetSyncSource(&This
->IMediaFilter_iface
, NULL
);
496 This
->defaultclock
= 1;
499 TRACE("Removing filter %s\n", debugstr_w(This
->pFilterNames
[i
]));
500 IBaseFilter_GetState(pFilter
, 0, &state
);
501 if (state
== State_Running
)
502 IBaseFilter_Pause(pFilter
);
503 if (state
!= State_Stopped
)
504 IBaseFilter_Stop(pFilter
);
506 hr
= IBaseFilter_EnumPins(pFilter
, &penumpins
);
509 while(IEnumPins_Next(penumpins
, 1, &ppin
, NULL
) == S_OK
)
513 IPin_ConnectedTo(ppin
, &victim
);
516 h
= IPin_Disconnect(victim
);
517 TRACE("Disconnect other side: %08x\n", h
);
518 if (h
== VFW_E_NOT_STOPPED
)
521 IPin_QueryPinInfo(victim
, &pinfo
);
523 IBaseFilter_GetState(pinfo
.pFilter
, 0, &state
);
524 if (state
== State_Running
)
525 IBaseFilter_Pause(pinfo
.pFilter
);
526 IBaseFilter_Stop(pinfo
.pFilter
);
527 IBaseFilter_Release(pinfo
.pFilter
);
528 h
= IPin_Disconnect(victim
);
529 TRACE("Disconnect retry: %08x\n", h
);
531 IPin_Release(victim
);
533 h
= IPin_Disconnect(ppin
);
534 TRACE("Disconnect 2: %08x\n", h
);
538 IEnumPins_Release(penumpins
);
541 hr
= IBaseFilter_JoinFilterGraph(pFilter
, NULL
, This
->pFilterNames
[i
]);
544 IBaseFilter_SetSyncSource(pFilter
, NULL
);
545 IBaseFilter_Release(pFilter
);
546 CoTaskMemFree(This
->pFilterNames
[i
]);
547 memmove(This
->ppFiltersInGraph
+i
, This
->ppFiltersInGraph
+i
+1, sizeof(IBaseFilter
*)*(This
->nFilters
- 1 - i
));
548 memmove(This
->pFilterNames
+i
, This
->pFilterNames
+i
+1, sizeof(LPWSTR
)*(This
->nFilters
- 1 - i
));
550 /* Invalidate interfaces in the cache */
551 for (i
= 0; i
< This
->nItfCacheEntries
; i
++)
552 if (pFilter
== This
->ItfCacheEntries
[i
].filter
)
554 IUnknown_Release(This
->ItfCacheEntries
[i
].iface
);
555 This
->ItfCacheEntries
[i
].iface
= NULL
;
556 This
->ItfCacheEntries
[i
].filter
= NULL
;
564 return hr
; /* FIXME: check this error code */
567 static HRESULT WINAPI
FilterGraph2_EnumFilters(IFilterGraph2
*iface
, IEnumFilters
**ppEnum
)
569 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
571 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
573 return IEnumFiltersImpl_Construct(This
->ppFiltersInGraph
, This
->nFilters
, ppEnum
);
576 static HRESULT WINAPI
FilterGraph2_FindFilterByName(IFilterGraph2
*iface
, LPCWSTR pName
,
577 IBaseFilter
**ppFilter
)
579 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
582 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_w(pName
), pName
, ppFilter
);
587 for (i
= 0; i
< This
->nFilters
; i
++)
589 if (!strcmpW(pName
, This
->pFilterNames
[i
]))
591 *ppFilter
= This
->ppFiltersInGraph
[i
];
592 IBaseFilter_AddRef(*ppFilter
);
598 return VFW_E_NOT_FOUND
;
601 /* Don't allow a circular connection to form, return VFW_E_CIRCULAR_GRAPH if this would be the case.
602 * A circular connection will be formed if from the filter of the output pin, the input pin can be reached
604 static HRESULT
CheckCircularConnection(IFilterGraphImpl
*This
, IPin
*out
, IPin
*in
)
608 PIN_INFO info_out
, info_in
;
610 hr
= IPin_QueryPinInfo(out
, &info_out
);
613 if (info_out
.dir
!= PINDIR_OUTPUT
)
615 IBaseFilter_Release(info_out
.pFilter
);
619 hr
= IPin_QueryPinInfo(in
, &info_in
);
621 IBaseFilter_Release(info_in
.pFilter
);
624 if (info_in
.dir
!= PINDIR_INPUT
)
630 if (info_out
.pFilter
== info_in
.pFilter
)
631 hr
= VFW_E_CIRCULAR_GRAPH
;
637 hr
= IBaseFilter_EnumPins(info_out
.pFilter
, &enumpins
);
641 IEnumPins_Reset(enumpins
);
642 while ((hr
= IEnumPins_Next(enumpins
, 1, &test
, NULL
)) == S_OK
)
644 PIN_DIRECTION dir
= PINDIR_OUTPUT
;
645 IPin_QueryDirection(test
, &dir
);
646 if (dir
== PINDIR_INPUT
)
649 IPin_ConnectedTo(test
, &victim
);
652 hr
= CheckCircularConnection(This
, victim
, in
);
653 IPin_Release(victim
);
663 IEnumPins_Release(enumpins
);
667 IBaseFilter_Release(info_out
.pFilter
);
669 ERR("Checking filtergraph returned %08x, something's not right!\n", hr
);
672 /* Debugging filtergraphs not enabled */
678 /* NOTE: despite the implication, it doesn't matter which
679 * way round you put in the input and output pins */
680 static HRESULT WINAPI
FilterGraph2_ConnectDirect(IFilterGraph2
*iface
, IPin
*ppinIn
, IPin
*ppinOut
,
681 const AM_MEDIA_TYPE
*pmt
)
683 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
687 TRACE("(%p/%p)->(%p, %p, %p)\n", This
, iface
, ppinIn
, ppinOut
, pmt
);
689 /* FIXME: check pins are in graph */
691 if (TRACE_ON(quartz
))
695 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
699 TRACE("Filter owning first pin => %p\n", PinInfo
.pFilter
);
700 IBaseFilter_Release(PinInfo
.pFilter
);
702 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
706 TRACE("Filter owning second pin => %p\n", PinInfo
.pFilter
);
707 IBaseFilter_Release(PinInfo
.pFilter
);
710 hr
= IPin_QueryDirection(ppinIn
, &dir
);
713 if (dir
== PINDIR_INPUT
)
715 hr
= CheckCircularConnection(This
, ppinOut
, ppinIn
);
717 hr
= IPin_Connect(ppinOut
, ppinIn
, pmt
);
721 hr
= CheckCircularConnection(This
, ppinIn
, ppinOut
);
723 hr
= IPin_Connect(ppinIn
, ppinOut
, pmt
);
730 static HRESULT WINAPI
FilterGraph2_Reconnect(IFilterGraph2
*iface
, IPin
*ppin
)
732 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
733 IPin
*pConnectedTo
= NULL
;
735 PIN_DIRECTION pindir
;
737 IPin_QueryDirection(ppin
, &pindir
);
738 hr
= IPin_ConnectedTo(ppin
, &pConnectedTo
);
740 TRACE("Querying connected to failed: %x\n", hr
);
743 IPin_Disconnect(ppin
);
744 IPin_Disconnect(pConnectedTo
);
745 if (pindir
== PINDIR_INPUT
)
746 hr
= IPin_Connect(pConnectedTo
, ppin
, NULL
);
748 hr
= IPin_Connect(ppin
, pConnectedTo
, NULL
);
749 IPin_Release(pConnectedTo
);
751 WARN("Reconnecting pins failed, pins are not connected now..\n");
752 TRACE("(%p->%p) -- %p %p -> %x\n", iface
, This
, ppin
, pConnectedTo
, hr
);
756 static HRESULT WINAPI
FilterGraph2_Disconnect(IFilterGraph2
*iface
, IPin
*ppin
)
758 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
760 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppin
);
765 return IPin_Disconnect(ppin
);
768 static HRESULT WINAPI
FilterGraph2_SetDefaultSyncSource(IFilterGraph2
*iface
)
770 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
771 IReferenceClock
*pClock
= NULL
;
775 TRACE("(%p/%p)->() live sources not handled properly!\n", iface
, This
);
777 EnterCriticalSection(&This
->cs
);
779 for (i
= 0; i
< This
->nFilters
; ++i
)
782 IAMFilterMiscFlags
*flags
= NULL
;
783 IUnknown_QueryInterface(This
->ppFiltersInGraph
[i
], &IID_IAMFilterMiscFlags
, (void**)&flags
);
786 miscflags
= IAMFilterMiscFlags_GetMiscFlags(flags
);
787 IUnknown_Release(flags
);
788 if (miscflags
== AM_FILTER_MISC_FLAGS_IS_RENDERER
)
789 IUnknown_QueryInterface(This
->ppFiltersInGraph
[i
], &IID_IReferenceClock
, (void**)&pClock
);
796 hr
= CoCreateInstance(&CLSID_SystemClock
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IReferenceClock
, (LPVOID
*)&pClock
);
797 This
->refClockProvider
= NULL
;
800 This
->refClockProvider
= This
->ppFiltersInGraph
[i
];
804 hr
= IMediaFilter_SetSyncSource(&This
->IMediaFilter_iface
, pClock
);
805 This
->defaultclock
= TRUE
;
806 IReferenceClock_Release(pClock
);
808 LeaveCriticalSection(&This
->cs
);
813 static HRESULT
GetFilterInfo(IMoniker
* pMoniker
, GUID
* pclsid
, VARIANT
* pvar
)
815 static const WCHAR wszClsidName
[] = {'C','L','S','I','D',0};
816 static const WCHAR wszFriendlyName
[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
817 IPropertyBag
* pPropBagCat
= NULL
;
822 hr
= IMoniker_BindToStorage(pMoniker
, NULL
, NULL
, &IID_IPropertyBag
, (LPVOID
*)&pPropBagCat
);
825 hr
= IPropertyBag_Read(pPropBagCat
, wszClsidName
, pvar
, NULL
);
828 hr
= CLSIDFromString(V_UNION(pvar
, bstrVal
), pclsid
);
833 hr
= IPropertyBag_Read(pPropBagCat
, wszFriendlyName
, pvar
, NULL
);
836 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid
), debugstr_w(V_UNION(pvar
, bstrVal
)));
839 IPropertyBag_Release(pPropBagCat
);
844 static HRESULT
GetInternalConnections(IBaseFilter
* pfilter
, IPin
* pinputpin
, IPin
*** pppins
, ULONG
* pnb
)
849 TRACE("(%p, %p, %p, %p)\n", pfilter
, pinputpin
, pppins
, pnb
);
850 hr
= IPin_QueryInternalConnections(pinputpin
, NULL
, &nb
);
853 } else if (hr
== S_FALSE
) {
854 *pppins
= CoTaskMemAlloc(sizeof(IPin
*)*nb
);
855 hr
= IPin_QueryInternalConnections(pinputpin
, *pppins
, &nb
);
857 WARN("Error (%x)\n", hr
);
859 } else if (hr
== E_NOTIMPL
) {
860 /* Input connected to all outputs */
861 IEnumPins
* penumpins
;
864 TRACE("E_NOTIMPL\n");
865 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
867 WARN("filter Enumpins failed (%x)\n", hr
);
871 /* Count output pins */
872 while(IEnumPins_Next(penumpins
, 1, &ppin
, &nb
) == S_OK
) {
873 PIN_DIRECTION pindir
;
874 IPin_QueryDirection(ppin
, &pindir
);
875 if (pindir
== PINDIR_OUTPUT
)
879 *pppins
= CoTaskMemAlloc(sizeof(IPin
*)*i
);
880 /* Retrieve output pins */
881 IEnumPins_Reset(penumpins
);
883 while(IEnumPins_Next(penumpins
, 1, &ppin
, &nb
) == S_OK
) {
884 PIN_DIRECTION pindir
;
885 IPin_QueryDirection(ppin
, &pindir
);
886 if (pindir
== PINDIR_OUTPUT
)
887 (*pppins
)[i
++] = ppin
;
891 IEnumPins_Release(penumpins
);
894 WARN("Next failed (%x)\n", hr
);
897 } else if (FAILED(hr
)) {
898 WARN("Cannot get internal connection (%x)\n", hr
);
906 /*** IGraphBuilder methods ***/
907 static HRESULT WINAPI
FilterGraph2_Connect(IFilterGraph2
*iface
, IPin
*ppinOut
, IPin
*ppinIn
)
909 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
911 AM_MEDIA_TYPE
* mt
= NULL
;
912 IEnumMediaTypes
* penummt
= NULL
;
914 IEnumPins
* penumpins
;
915 IEnumMoniker
* pEnumMoniker
;
924 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, ppinOut
, ppinIn
);
926 if (TRACE_ON(quartz
))
928 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
932 TRACE("Filter owning first pin => %p\n", PinInfo
.pFilter
);
933 IBaseFilter_Release(PinInfo
.pFilter
);
935 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
939 TRACE("Filter owning second pin => %p\n", PinInfo
.pFilter
);
940 IBaseFilter_Release(PinInfo
.pFilter
);
943 EnterCriticalSection(&This
->cs
);
944 ++This
->recursioncount
;
945 if (This
->recursioncount
>= 5)
947 WARN("Recursion count has reached %d\n", This
->recursioncount
);
948 hr
= VFW_E_CANNOT_CONNECT
;
952 hr
= IPin_QueryDirection(ppinOut
, &dir
);
956 if (dir
== PINDIR_INPUT
)
965 hr
= CheckCircularConnection(This
, ppinOut
, ppinIn
);
969 /* Try direct connection first */
970 hr
= IPin_Connect(ppinOut
, ppinIn
, NULL
);
974 TRACE("Direct connection failed, trying to render using extra filters\n");
976 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
980 hr
= IBaseFilter_GetClassID(PinInfo
.pFilter
, &FilterCLSID
);
981 IBaseFilter_Release(PinInfo
.pFilter
);
985 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
986 * filter to the minor mediatype of input pin of the renderer */
987 hr
= IPin_EnumMediaTypes(ppinOut
, &penummt
);
990 WARN("EnumMediaTypes (%x)\n", hr
);
994 hr
= IEnumMediaTypes_Next(penummt
, 1, &mt
, &nbmt
);
996 WARN("IEnumMediaTypes_Next (%x)\n", hr
);
1002 WARN("No media type found!\n");
1003 hr
= VFW_E_INVALIDMEDIATYPE
;
1006 TRACE("MajorType %s\n", debugstr_guid(&mt
->majortype
));
1007 TRACE("SubType %s\n", debugstr_guid(&mt
->subtype
));
1009 /* Try to find a suitable filter that can connect to the pin to render */
1010 tab
[0] = mt
->majortype
;
1011 tab
[1] = mt
->subtype
;
1012 hr
= IFilterMapper2_EnumMatchingFilters(This
->pFilterMapper2
, &pEnumMoniker
, 0, FALSE
, MERIT_UNLIKELY
, TRUE
, 1, tab
, NULL
, NULL
, FALSE
, FALSE
, 0, NULL
, NULL
, NULL
);
1014 WARN("Unable to enum filters (%x)\n", hr
);
1018 hr
= VFW_E_CANNOT_RENDER
;
1019 while(IEnumMoniker_Next(pEnumMoniker
, 1, &pMoniker
, &nb
) == S_OK
)
1024 IPin
* ppinfilter
= NULL
;
1025 IBaseFilter
* pfilter
= NULL
;
1027 hr
= GetFilterInfo(pMoniker
, &clsid
, &var
);
1028 IMoniker_Release(pMoniker
);
1030 WARN("Unable to retrieve filter info (%x)\n", hr
);
1034 if (IsEqualGUID(&clsid
, &FilterCLSID
)) {
1035 /* Skip filter (same as the one the output pin belongs to) */
1039 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&pfilter
);
1041 WARN("Unable to create filter (%x), trying next one\n", hr
);
1045 hr
= IFilterGraph2_AddFilter(iface
, pfilter
, V_UNION(&var
, bstrVal
));
1047 WARN("Unable to add filter (%x)\n", hr
);
1048 IBaseFilter_Release(pfilter
);
1055 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
1057 WARN("Enumpins (%x)\n", hr
);
1061 hr
= IEnumPins_Next(penumpins
, 1, &ppinfilter
, &pin
);
1062 IEnumPins_Release(penumpins
);
1065 WARN("Obtaining next pin: (%x)\n", hr
);
1069 WARN("Cannot use this filter: no pins\n");
1073 hr
= IPin_Connect(ppinOut
, ppinfilter
, NULL
);
1075 TRACE("Cannot connect to filter (%x), trying next one\n", hr
);
1078 TRACE("Successfully connected to filter, follow chain...\n");
1080 /* Render all output pins of the filter by calling IFilterGraph2_Connect on each of them */
1081 hr
= GetInternalConnections(pfilter
, ppinfilter
, &ppins
, &nb
);
1083 if (SUCCEEDED(hr
)) {
1086 IPin_Disconnect(ppinfilter
);
1087 IPin_Disconnect(ppinOut
);
1090 TRACE("pins to consider: %d\n", nb
);
1091 for(i
= 0; i
< nb
; i
++)
1093 LPWSTR pinname
= NULL
;
1095 TRACE("Processing pin %u\n", i
);
1097 hr
= IPin_QueryId(ppins
[i
], &pinname
);
1100 if (pinname
[0] == '~')
1102 TRACE("Pinname=%s, skipping\n", debugstr_w(pinname
));
1106 hr
= IFilterGraph2_Connect(iface
, ppins
[i
], ppinIn
);
1107 CoTaskMemFree(pinname
);
1111 TRACE("Cannot connect pin %p (%x)\n", ppinfilter
, hr
);
1113 IPin_Release(ppins
[i
]);
1114 if (SUCCEEDED(hr
)) break;
1116 while (++i
< nb
) IPin_Release(ppins
[i
]);
1117 CoTaskMemFree(ppins
);
1118 IPin_Release(ppinfilter
);
1119 IBaseFilter_Release(pfilter
);
1122 IPin_Disconnect(ppinfilter
);
1123 IPin_Disconnect(ppinOut
);
1124 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1132 if (ppinfilter
) IPin_Release(ppinfilter
);
1134 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1135 IBaseFilter_Release(pfilter
);
1141 IEnumMediaTypes_Release(penummt
);
1143 DeleteMediaType(mt
);
1144 --This
->recursioncount
;
1145 LeaveCriticalSection(&This
->cs
);
1146 TRACE("--> %08x\n", hr
);
1147 return SUCCEEDED(hr
) ? S_OK
: hr
;
1150 static HRESULT
FilterGraph2_RenderRecurse(IFilterGraphImpl
*This
, IPin
*ppinOut
)
1152 /* This pin has been connected now, try to call render on all pins that aren't connected */
1155 IEnumPins
*enumpins
= NULL
;
1156 BOOL renderany
= FALSE
;
1157 BOOL renderall
= TRUE
;
1159 IPin_QueryPinInfo(ppinOut
, &info
);
1161 IBaseFilter_EnumPins(info
.pFilter
, &enumpins
);
1162 /* Don't need to hold a reference, IEnumPins does */
1163 IBaseFilter_Release(info
.pFilter
);
1165 IEnumPins_Reset(enumpins
);
1166 while (IEnumPins_Next(enumpins
, 1, &to
, NULL
) == S_OK
)
1168 PIN_DIRECTION dir
= PINDIR_INPUT
;
1170 IPin_QueryDirection(to
, &dir
);
1172 if (dir
== PINDIR_OUTPUT
)
1176 IPin_ConnectedTo(to
, &out
);
1180 hr
= IFilterGraph2_Render(&This
->IFilterGraph2_iface
, to
);
1193 IEnumPins_Release(enumpins
);
1199 return VFW_S_PARTIAL_RENDER
;
1201 return VFW_E_CANNOT_RENDER
;
1204 /* Ogg hates me if I create a direct rendering method
1206 * It can only connect to a pin properly once, so use a recursive method that does
1208 * +----+ --- (PIN 1) (Render is called on this pin)
1210 * +----+ --- (PIN 2)
1212 * Enumerate possible renderers that EXACTLY match the requested type
1214 * If none is available, try to add intermediate filters that can connect to the input pin
1215 * then call Render on that intermediate pin's output pins
1216 * if it succeeds: Render returns success, if it doesn't, the intermediate filter is removed,
1217 * and another filter that can connect to the input pin is tried
1218 * if we run out of filters that can, give up and return VFW_E_CANNOT_RENDER
1219 * It's recursive, but fun!
1222 static HRESULT WINAPI
FilterGraph2_Render(IFilterGraph2
*iface
, IPin
*ppinOut
)
1224 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1225 IEnumMediaTypes
* penummt
;
1230 IEnumMoniker
* pEnumMoniker
;
1236 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppinOut
);
1238 if (TRACE_ON(quartz
))
1242 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
1246 TRACE("Filter owning pin => %p\n", PinInfo
.pFilter
);
1247 IBaseFilter_Release(PinInfo
.pFilter
);
1250 /* Try to find out if there is a renderer for the specified subtype already, and use that
1252 EnterCriticalSection(&This
->cs
);
1253 for (x
= 0; x
< This
->nFilters
; ++x
)
1255 IEnumPins
*enumpins
= NULL
;
1258 hr
= IBaseFilter_EnumPins(This
->ppFiltersInGraph
[x
], &enumpins
);
1260 if (FAILED(hr
) || !enumpins
)
1263 IEnumPins_Reset(enumpins
);
1264 while (IEnumPins_Next(enumpins
, 1, &pin
, NULL
) == S_OK
)
1267 PIN_DIRECTION dir
= PINDIR_OUTPUT
;
1269 IPin_QueryDirection(pin
, &dir
);
1270 if (dir
!= PINDIR_INPUT
)
1275 IPin_ConnectedTo(pin
, &to
);
1279 hr
= FilterGraph2_ConnectDirect(iface
, ppinOut
, pin
, NULL
);
1282 TRACE("Connected successfully %p/%p, %08x look if we should render more!\n", ppinOut
, pin
, hr
);
1285 hr
= FilterGraph2_RenderRecurse(This
, pin
);
1288 IPin_Disconnect(ppinOut
);
1289 IPin_Disconnect(pin
);
1292 IEnumPins_Release(enumpins
);
1293 LeaveCriticalSection(&This
->cs
);
1296 WARN("Could not connect!\n");
1303 IEnumPins_Release(enumpins
);
1306 LeaveCriticalSection(&This
->cs
);
1308 hr
= IPin_EnumMediaTypes(ppinOut
, &penummt
);
1310 WARN("EnumMediaTypes (%x)\n", hr
);
1314 IEnumMediaTypes_Reset(penummt
);
1316 /* Looks like no existing renderer of the kind exists
1317 * Try adding new ones
1319 tab
[0] = tab
[1] = GUID_NULL
;
1320 while (SUCCEEDED(hr
))
1322 hr
= IEnumMediaTypes_Next(penummt
, 1, &mt
, &nbmt
);
1324 WARN("IEnumMediaTypes_Next (%x)\n", hr
);
1329 hr
= VFW_E_CANNOT_RENDER
;
1334 TRACE("MajorType %s\n", debugstr_guid(&mt
->majortype
));
1335 TRACE("SubType %s\n", debugstr_guid(&mt
->subtype
));
1337 /* Only enumerate once, this doesn't account for all previous ones, but this should be enough nonetheless */
1338 if (IsEqualIID(&tab
[0], &mt
->majortype
) && IsEqualIID(&tab
[1], &mt
->subtype
))
1340 DeleteMediaType(mt
);
1344 /* Try to find a suitable renderer with the same media type */
1345 tab
[0] = mt
->majortype
;
1346 tab
[1] = mt
->subtype
;
1347 hr
= IFilterMapper2_EnumMatchingFilters(This
->pFilterMapper2
, &pEnumMoniker
, 0, FALSE
, MERIT_UNLIKELY
, TRUE
, 1, tab
, NULL
, NULL
, FALSE
, FALSE
, 0, NULL
, NULL
, NULL
);
1350 WARN("Unable to enum filters (%x)\n", hr
);
1356 while (IEnumMoniker_Next(pEnumMoniker
, 1, &pMoniker
, &nb
) == S_OK
)
1361 IBaseFilter
* pfilter
= NULL
;
1362 IEnumPins
* penumpins
= NULL
;
1365 hr
= GetFilterInfo(pMoniker
, &clsid
, &var
);
1366 IMoniker_Release(pMoniker
);
1368 WARN("Unable to retrieve filter info (%x)\n", hr
);
1372 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&pfilter
);
1375 WARN("Unable to create filter (%x), trying next one\n", hr
);
1379 hr
= IFilterGraph2_AddFilter(iface
, pfilter
, V_UNION(&var
, bstrVal
));
1381 WARN("Unable to add filter (%x)\n", hr
);
1382 IBaseFilter_Release(pfilter
);
1387 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
1389 WARN("Splitter Enumpins (%x)\n", hr
);
1393 while ((hr
= IEnumPins_Next(penumpins
, 1, &ppinfilter
, &pin
)) == S_OK
)
1403 hr
= IPin_QueryDirection(ppinfilter
, &dir
);
1405 IPin_Release(ppinfilter
);
1406 WARN("QueryDirection failed (%x)\n", hr
);
1409 if (dir
!= PINDIR_INPUT
) {
1410 IPin_Release(ppinfilter
);
1411 continue; /* Wrong direction */
1414 /* Connect the pin to the "Renderer" */
1415 hr
= IPin_Connect(ppinOut
, ppinfilter
, NULL
);
1416 IPin_Release(ppinfilter
);
1419 WARN("Unable to connect %s to renderer (%x)\n", debugstr_w(V_UNION(&var
, bstrVal
)), hr
);
1422 TRACE("Connected, recursing %s\n", debugstr_w(V_UNION(&var
, bstrVal
)));
1426 hr
= FilterGraph2_RenderRecurse(This
, ppinfilter
);
1428 WARN("Unable to connect recursively (%x)\n", hr
);
1431 IBaseFilter_Release(pfilter
);
1434 if (SUCCEEDED(hr
)) {
1435 IEnumPins_Release(penumpins
);
1436 break; /* out of IEnumMoniker_Next loop */
1439 /* IEnumPins_Next failed, all other failure case caught by goto error */
1440 WARN("IEnumPins_Next (%x)\n", hr
);
1446 IEnumPins_Release(penumpins
);
1448 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1449 IBaseFilter_Release(pfilter
);
1451 if (SUCCEEDED(hr
)) DebugBreak();
1454 IEnumMoniker_Release(pEnumMoniker
);
1456 DeleteMediaType(mt
);
1462 IEnumMediaTypes_Release(penummt
);
1466 static HRESULT WINAPI
FilterGraph2_RenderFile(IFilterGraph2
*iface
, LPCWSTR lpcwstrFile
,
1467 LPCWSTR lpcwstrPlayList
)
1469 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1470 static const WCHAR string
[] = {'R','e','a','d','e','r',0};
1471 IBaseFilter
* preader
= NULL
;
1472 IPin
* ppinreader
= NULL
;
1473 IEnumPins
* penumpins
= NULL
;
1475 BOOL partial
= FALSE
;
1476 HRESULT any
= FALSE
;
1478 TRACE("(%p/%p)->(%s, %s)\n", This
, iface
, debugstr_w(lpcwstrFile
), debugstr_w(lpcwstrPlayList
));
1480 if (lpcwstrPlayList
!= NULL
)
1481 return E_INVALIDARG
;
1483 hr
= IFilterGraph2_AddSourceFilter(iface
, lpcwstrFile
, string
, &preader
);
1488 hr
= IBaseFilter_EnumPins(preader
, &penumpins
);
1491 while (IEnumPins_Next(penumpins
, 1, &ppinreader
, NULL
) == S_OK
)
1495 IPin_QueryDirection(ppinreader
, &dir
);
1496 if (dir
== PINDIR_OUTPUT
)
1500 hr
= IFilterGraph2_Render(iface
, ppinreader
);
1501 TRACE("Render %08x\n", hr
);
1503 for (i
= 0; i
< This
->nFilters
; ++i
)
1504 TRACE("Filters in chain: %s\n", debugstr_w(This
->pFilterNames
[i
]));
1511 IPin_Release(ppinreader
);
1513 IEnumPins_Release(penumpins
);
1516 hr
= VFW_E_CANNOT_RENDER
;
1518 hr
= VFW_S_PARTIAL_RENDER
;
1522 IBaseFilter_Release(preader
);
1524 TRACE("--> %08x\n", hr
);
1528 /* Some filters implement their own asynchronous reader (Theoretically they all should, try to load it first */
1529 static HRESULT
GetFileSourceFilter(LPCOLESTR pszFileName
, IBaseFilter
**filter
)
1531 static const WCHAR wszReg
[] = {'M','e','d','i','a',' ','T','y','p','e','\\','E','x','t','e','n','s','i','o','n','s',0};
1536 lRet
= RegOpenKeyExW(HKEY_CLASSES_ROOT
, wszReg
, 0, KEY_READ
, &extkey
);
1537 hr
= HRESULT_FROM_WIN32(lRet
);
1541 static const WCHAR filtersource
[] = {'S','o','u','r','c','e',' ','F','i','l','t','e','r',0};
1542 WCHAR
*ext
= PathFindExtensionW(pszFileName
);
1543 WCHAR clsid_key
[39];
1545 DWORD size
= sizeof(clsid_key
);
1550 CloseHandle(extkey
);
1554 lRet
= RegOpenKeyExW(extkey
, ext
, 0, KEY_READ
, &pathkey
);
1555 hr
= HRESULT_FROM_WIN32(lRet
);
1556 CloseHandle(extkey
);
1560 lRet
= RegQueryValueExW(pathkey
, filtersource
, NULL
, NULL
, (LPBYTE
)clsid_key
, &size
);
1561 hr
= HRESULT_FROM_WIN32(lRet
);
1562 CloseHandle(pathkey
);
1566 CLSIDFromString(clsid_key
, &clsid
);
1568 TRACE("CLSID: %s\n", debugstr_guid(&clsid
));
1569 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)filter
);
1572 IFileSourceFilter
*source
= NULL
;
1573 hr
= IBaseFilter_QueryInterface(*filter
, &IID_IFileSourceFilter
, (LPVOID
*)&source
);
1575 IFileSourceFilter_Release(source
);
1577 IBaseFilter_Release(*filter
);
1585 static HRESULT WINAPI
FilterGraph2_AddSourceFilter(IFilterGraph2
*iface
, LPCWSTR lpcwstrFileName
,
1586 LPCWSTR lpcwstrFilterName
, IBaseFilter
**ppFilter
)
1588 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1590 IBaseFilter
* preader
;
1591 IFileSourceFilter
* pfile
= NULL
;
1595 TRACE("(%p/%p)->(%s, %s, %p)\n", This
, iface
, debugstr_w(lpcwstrFileName
), debugstr_w(lpcwstrFilterName
), ppFilter
);
1597 /* Try from file name first, then fall back to default asynchronous reader */
1598 hr
= GetFileSourceFilter(lpcwstrFileName
, &preader
);
1601 hr
= CoCreateInstance(&CLSID_AsyncReader
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&preader
);
1603 WARN("Unable to create file source filter (%x)\n", hr
);
1607 hr
= IFilterGraph2_AddFilter(iface
, preader
, lpcwstrFilterName
);
1609 WARN("Unable add filter (%x)\n", hr
);
1610 IBaseFilter_Release(preader
);
1614 hr
= IBaseFilter_QueryInterface(preader
, &IID_IFileSourceFilter
, (LPVOID
*)&pfile
);
1616 WARN("Unable to get IFileSourceInterface (%x)\n", hr
);
1620 /* Load the file in the file source filter */
1621 hr
= IFileSourceFilter_Load(pfile
, lpcwstrFileName
, NULL
);
1623 WARN("Load (%x)\n", hr
);
1627 IFileSourceFilter_GetCurFile(pfile
, &filename
, &mt
);
1629 WARN("GetCurFile (%x)\n", hr
);
1633 TRACE("File %s\n", debugstr_w(filename
));
1634 TRACE("MajorType %s\n", debugstr_guid(&mt
.majortype
));
1635 TRACE("SubType %s\n", debugstr_guid(&mt
.subtype
));
1638 *ppFilter
= preader
;
1639 IFileSourceFilter_Release(pfile
);
1645 IFileSourceFilter_Release(pfile
);
1646 IFilterGraph2_RemoveFilter(iface
, preader
);
1647 IBaseFilter_Release(preader
);
1652 static HRESULT WINAPI
FilterGraph2_SetLogFile(IFilterGraph2
*iface
, DWORD_PTR hFile
)
1654 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1656 TRACE("(%p/%p)->(%08x): stub !!!\n", This
, iface
, (DWORD
) hFile
);
1661 static HRESULT WINAPI
FilterGraph2_Abort(IFilterGraph2
*iface
)
1663 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1665 TRACE("(%p/%p)->(): stub !!!\n", This
, iface
);
1670 static HRESULT WINAPI
FilterGraph2_ShouldOperationContinue(IFilterGraph2
*iface
)
1672 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1674 TRACE("(%p/%p)->(): stub !!!\n", This
, iface
);
1679 /*** IFilterGraph2 methods ***/
1680 static HRESULT WINAPI
FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2
*iface
,
1681 IMoniker
*pMoniker
, IBindCtx
*pCtx
, LPCWSTR lpcwstrFilterName
, IBaseFilter
**ppFilter
)
1683 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1685 TRACE("(%p/%p)->(%p %p %s %p): stub !!!\n", This
, iface
, pMoniker
, pCtx
, debugstr_w(lpcwstrFilterName
), ppFilter
);
1690 static HRESULT WINAPI
FilterGraph2_ReconnectEx(IFilterGraph2
*iface
, IPin
*ppin
,
1691 const AM_MEDIA_TYPE
*pmt
)
1693 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1695 TRACE("(%p/%p)->(%p %p): stub !!!\n", This
, iface
, ppin
, pmt
);
1700 static HRESULT WINAPI
FilterGraph2_RenderEx(IFilterGraph2
*iface
, IPin
*pPinOut
, DWORD dwFlags
,
1703 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1705 TRACE("(%p/%p)->(%p %08x %p): stub !!!\n", This
, iface
, pPinOut
, dwFlags
, pvContext
);
1711 static const IFilterGraph2Vtbl IFilterGraph2_VTable
=
1713 FilterGraph2_QueryInterface
,
1714 FilterGraph2_AddRef
,
1715 FilterGraph2_Release
,
1716 FilterGraph2_AddFilter
,
1717 FilterGraph2_RemoveFilter
,
1718 FilterGraph2_EnumFilters
,
1719 FilterGraph2_FindFilterByName
,
1720 FilterGraph2_ConnectDirect
,
1721 FilterGraph2_Reconnect
,
1722 FilterGraph2_Disconnect
,
1723 FilterGraph2_SetDefaultSyncSource
,
1724 FilterGraph2_Connect
,
1725 FilterGraph2_Render
,
1726 FilterGraph2_RenderFile
,
1727 FilterGraph2_AddSourceFilter
,
1728 FilterGraph2_SetLogFile
,
1730 FilterGraph2_ShouldOperationContinue
,
1731 FilterGraph2_AddSourceFilterForMoniker
,
1732 FilterGraph2_ReconnectEx
,
1733 FilterGraph2_RenderEx
1736 static inline IFilterGraphImpl
*impl_from_IMediaControl(IMediaControl
*iface
)
1738 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaControl_iface
);
1741 static HRESULT WINAPI
MediaControl_QueryInterface(IMediaControl
*iface
, REFIID riid
, void **ppvObj
)
1743 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1745 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1747 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
1750 static ULONG WINAPI
MediaControl_AddRef(IMediaControl
*iface
)
1752 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1754 TRACE("(%p/%p)->()\n", This
, iface
);
1756 return Filtergraph_AddRef(This
);
1759 static ULONG WINAPI
MediaControl_Release(IMediaControl
*iface
)
1761 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1763 TRACE("(%p/%p)->()\n", This
, iface
);
1765 return Filtergraph_Release(This
);
1769 /*** IDispatch methods ***/
1770 static HRESULT WINAPI
MediaControl_GetTypeInfoCount(IMediaControl
*iface
, UINT
*pctinfo
)
1772 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1774 TRACE("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1779 static HRESULT WINAPI
MediaControl_GetTypeInfo(IMediaControl
*iface
, UINT iTInfo
, LCID lcid
,
1780 ITypeInfo
**ppTInfo
)
1782 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1784 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1789 static HRESULT WINAPI
MediaControl_GetIDsOfNames(IMediaControl
*iface
, REFIID riid
,
1790 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1792 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1794 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1799 static HRESULT WINAPI
MediaControl_Invoke(IMediaControl
*iface
, DISPID dispIdMember
, REFIID riid
,
1800 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
1803 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1805 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
1810 typedef HRESULT(WINAPI
*fnFoundFilter
)(IBaseFilter
*, DWORD_PTR data
);
1812 static HRESULT
ExploreGraph(IFilterGraphImpl
* pGraph
, IPin
* pOutputPin
, fnFoundFilter FoundFilter
, DWORD_PTR data
)
1821 TRACE("%p %p\n", pGraph
, pOutputPin
);
1822 PinInfo
.pFilter
= NULL
;
1824 hr
= IPin_ConnectedTo(pOutputPin
, &pInputPin
);
1828 hr
= IPin_QueryPinInfo(pInputPin
, &PinInfo
);
1830 hr
= GetInternalConnections(PinInfo
.pFilter
, pInputPin
, &ppPins
, &nb
);
1831 IPin_Release(pInputPin
);
1838 TRACE("Reached a renderer\n");
1839 /* Count renderers for end of stream notification */
1840 pGraph
->nRenderers
++;
1844 for(i
= 0; i
< nb
; i
++)
1846 /* Explore the graph downstream from this pin
1847 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1848 * several input pins are connected to the same output (a MUX for instance). */
1849 ExploreGraph(pGraph
, ppPins
[i
], FoundFilter
, data
);
1850 IPin_Release(ppPins
[i
]);
1853 CoTaskMemFree(ppPins
);
1855 TRACE("Doing stuff with filter %p\n", PinInfo
.pFilter
);
1857 FoundFilter(PinInfo
.pFilter
, data
);
1860 if (PinInfo
.pFilter
) IBaseFilter_Release(PinInfo
.pFilter
);
1864 static HRESULT WINAPI
SendRun(IBaseFilter
*pFilter
, DWORD_PTR data
)
1866 REFERENCE_TIME time
= *(REFERENCE_TIME
*)data
;
1867 return IBaseFilter_Run(pFilter
, time
);
1870 static HRESULT WINAPI
SendPause(IBaseFilter
*pFilter
, DWORD_PTR data
)
1872 return IBaseFilter_Pause(pFilter
);
1875 static HRESULT WINAPI
SendStop(IBaseFilter
*pFilter
, DWORD_PTR data
)
1877 return IBaseFilter_Stop(pFilter
);
1880 static HRESULT WINAPI
SendGetState(IBaseFilter
*pFilter
, DWORD_PTR data
)
1883 DWORD time_end
= data
;
1884 DWORD time_now
= GetTickCount();
1887 if (time_end
== INFINITE
)
1891 else if (time_end
> time_now
)
1893 wait
= time_end
- time_now
;
1898 return IBaseFilter_GetState(pFilter
, wait
, &state
);
1902 static HRESULT
SendFilterMessage(IFilterGraphImpl
*This
, fnFoundFilter FoundFilter
, DWORD_PTR data
)
1905 IBaseFilter
* pfilter
;
1912 TRACE("(%p)->()\n", This
);
1914 /* Explorer the graph from source filters to renderers, determine renderers
1915 * number and run filters from renderers to source filters */
1916 This
->nRenderers
= 0;
1917 ResetEvent(This
->hEventCompletion
);
1919 for(i
= 0; i
< This
->nFilters
; i
++)
1922 pfilter
= This
->ppFiltersInGraph
[i
];
1923 hr
= IBaseFilter_EnumPins(pfilter
, &pEnum
);
1926 WARN("Enum pins failed %x\n", hr
);
1929 /* Check if it is a source filter */
1930 while(IEnumPins_Next(pEnum
, 1, &pPin
, &dummy
) == S_OK
)
1932 IPin_QueryDirection(pPin
, &dir
);
1934 if (dir
== PINDIR_INPUT
)
1942 TRACE("Found a source filter %p\n", pfilter
);
1943 IEnumPins_Reset(pEnum
);
1944 while(IEnumPins_Next(pEnum
, 1, &pPin
, &dummy
) == S_OK
)
1946 /* Explore the graph downstream from this pin */
1947 ExploreGraph(This
, pPin
, FoundFilter
, data
);
1950 FoundFilter(pfilter
, data
);
1952 IEnumPins_Release(pEnum
);
1958 /*** IMediaControl methods ***/
1959 static HRESULT WINAPI
MediaControl_Run(IMediaControl
*iface
)
1961 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1963 TRACE("(%p/%p)->()\n", This
, iface
);
1965 EnterCriticalSection(&This
->cs
);
1966 if (This
->state
== State_Running
)
1968 This
->EcCompleteCount
= 0;
1970 if (This
->defaultclock
&& !This
->refClock
)
1971 IFilterGraph2_SetDefaultSyncSource((IFilterGraph2
*)This
);
1976 IReferenceClock_GetTime(This
->refClock
, &now
);
1977 if (This
->state
== State_Stopped
)
1978 This
->start_time
= now
+ 500000;
1979 else if (This
->pause_time
>= 0)
1980 This
->start_time
+= now
- This
->pause_time
;
1982 This
->start_time
= now
;
1984 else This
->start_time
= 0;
1986 SendFilterMessage(This
, SendRun
, (DWORD_PTR
)&This
->start_time
);
1987 This
->state
= State_Running
;
1989 LeaveCriticalSection(&This
->cs
);
1993 static HRESULT WINAPI
MediaControl_Pause(IMediaControl
*iface
)
1995 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1997 TRACE("(%p/%p)->()\n", This
, iface
);
1999 EnterCriticalSection(&This
->cs
);
2000 if (This
->state
== State_Paused
)
2003 if (This
->state
== State_Running
&& This
->refClock
&& This
->start_time
>= 0)
2004 IReferenceClock_GetTime(This
->refClock
, &This
->pause_time
);
2006 This
->pause_time
= -1;
2008 SendFilterMessage(This
, SendPause
, 0);
2009 This
->state
= State_Paused
;
2011 LeaveCriticalSection(&This
->cs
);
2015 static HRESULT WINAPI
MediaControl_Stop(IMediaControl
*iface
)
2017 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2019 TRACE("(%p/%p)->()\n", This
, iface
);
2021 if (This
->state
== State_Stopped
) return S_OK
;
2023 EnterCriticalSection(&This
->cs
);
2024 if (This
->state
== State_Running
) SendFilterMessage(This
, SendPause
, 0);
2025 SendFilterMessage(This
, SendStop
, 0);
2026 This
->state
= State_Stopped
;
2027 LeaveCriticalSection(&This
->cs
);
2031 static HRESULT WINAPI
MediaControl_GetState(IMediaControl
*iface
, LONG msTimeout
,
2034 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2037 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, msTimeout
, pfs
);
2042 EnterCriticalSection(&This
->cs
);
2047 end
= GetTickCount() + msTimeout
;
2049 else if (msTimeout
< 0)
2058 SendFilterMessage(This
, SendGetState
, end
);
2060 LeaveCriticalSection(&This
->cs
);
2065 static HRESULT WINAPI
MediaControl_RenderFile(IMediaControl
*iface
, BSTR strFilename
)
2067 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2069 FIXME("(%p/%p)->(%s (%p)): stub !!!\n", This
, iface
, debugstr_w(strFilename
), strFilename
);
2074 static HRESULT WINAPI
MediaControl_AddSourceFilter(IMediaControl
*iface
, BSTR strFilename
,
2077 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2079 FIXME("(%p/%p)->(%s (%p), %p): stub !!!\n", This
, iface
, debugstr_w(strFilename
), strFilename
, ppUnk
);
2084 static HRESULT WINAPI
MediaControl_get_FilterCollection(IMediaControl
*iface
, IDispatch
**ppUnk
)
2086 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2088 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, ppUnk
);
2093 static HRESULT WINAPI
MediaControl_get_RegFilterCollection(IMediaControl
*iface
, IDispatch
**ppUnk
)
2095 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2097 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, ppUnk
);
2102 static HRESULT WINAPI
MediaControl_StopWhenReady(IMediaControl
*iface
)
2104 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2106 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
2112 static const IMediaControlVtbl IMediaControl_VTable
=
2114 MediaControl_QueryInterface
,
2115 MediaControl_AddRef
,
2116 MediaControl_Release
,
2117 MediaControl_GetTypeInfoCount
,
2118 MediaControl_GetTypeInfo
,
2119 MediaControl_GetIDsOfNames
,
2120 MediaControl_Invoke
,
2124 MediaControl_GetState
,
2125 MediaControl_RenderFile
,
2126 MediaControl_AddSourceFilter
,
2127 MediaControl_get_FilterCollection
,
2128 MediaControl_get_RegFilterCollection
,
2129 MediaControl_StopWhenReady
2132 static inline IFilterGraphImpl
*impl_from_IMediaSeeking(IMediaSeeking
*iface
)
2134 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaSeeking_iface
);
2137 static HRESULT WINAPI
MediaSeeking_QueryInterface(IMediaSeeking
*iface
, REFIID riid
, void **ppvObj
)
2139 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2141 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2143 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2146 static ULONG WINAPI
MediaSeeking_AddRef(IMediaSeeking
*iface
)
2148 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2150 TRACE("(%p/%p)->()\n", This
, iface
);
2152 return Filtergraph_AddRef(This
);
2155 static ULONG WINAPI
MediaSeeking_Release(IMediaSeeking
*iface
)
2157 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2159 TRACE("(%p/%p)->()\n", This
, iface
);
2161 return Filtergraph_Release(This
);
2164 typedef HRESULT (WINAPI
*fnFoundSeek
)(IFilterGraphImpl
*This
, IMediaSeeking
*, DWORD_PTR arg
);
2166 static HRESULT
all_renderers_seek(IFilterGraphImpl
*This
, fnFoundSeek FoundSeek
, DWORD_PTR arg
) {
2167 BOOL allnotimpl
= TRUE
;
2169 HRESULT hr
, hr_return
= S_OK
;
2171 TRACE("(%p)->(%p %08lx)\n", This
, FoundSeek
, arg
);
2172 /* Send a message to all renderers, they are responsible for broadcasting it further */
2174 for(i
= 0; i
< This
->nFilters
; i
++)
2176 IMediaSeeking
*seek
= NULL
;
2177 IBaseFilter
* pfilter
= This
->ppFiltersInGraph
[i
];
2178 IAMFilterMiscFlags
*flags
= NULL
;
2180 IUnknown_QueryInterface(pfilter
, &IID_IAMFilterMiscFlags
, (void**)&flags
);
2183 filterflags
= IAMFilterMiscFlags_GetMiscFlags(flags
);
2184 IUnknown_Release(flags
);
2185 if (filterflags
!= AM_FILTER_MISC_FLAGS_IS_RENDERER
)
2188 IBaseFilter_QueryInterface(pfilter
, &IID_IMediaSeeking
, (void**)&seek
);
2191 hr
= FoundSeek(This
, seek
, arg
);
2192 IMediaSeeking_Release(seek
);
2193 if (hr_return
!= E_NOTIMPL
)
2195 if (hr_return
== S_OK
|| (FAILED(hr
) && hr
!= E_NOTIMPL
&& SUCCEEDED(hr_return
)))
2204 static HRESULT WINAPI
FoundCapabilities(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pcaps
)
2209 hr
= IMediaSeeking_GetCapabilities(seek
, &caps
);
2213 /* Only add common capabilities everything supports */
2214 *(DWORD
*)pcaps
&= caps
;
2219 /*** IMediaSeeking methods ***/
2220 static HRESULT WINAPI
MediaSeeking_GetCapabilities(IMediaSeeking
*iface
, DWORD
*pCapabilities
)
2222 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2225 TRACE("(%p/%p)->(%p)\n", This
, iface
, pCapabilities
);
2230 EnterCriticalSection(&This
->cs
);
2231 *pCapabilities
= 0xffffffff;
2233 hr
= all_renderers_seek(This
, FoundCapabilities
, (DWORD_PTR
)pCapabilities
);
2234 LeaveCriticalSection(&This
->cs
);
2239 static HRESULT WINAPI
MediaSeeking_CheckCapabilities(IMediaSeeking
*iface
, DWORD
*pCapabilities
)
2241 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2245 TRACE("(%p/%p)->(%p)\n", This
, iface
, pCapabilities
);
2250 EnterCriticalSection(&This
->cs
);
2251 originalcaps
= *pCapabilities
;
2252 hr
= all_renderers_seek(This
, FoundCapabilities
, (DWORD_PTR
)pCapabilities
);
2253 LeaveCriticalSection(&This
->cs
);
2258 if (!*pCapabilities
)
2260 if (*pCapabilities
!= originalcaps
)
2265 static HRESULT WINAPI
MediaSeeking_IsFormatSupported(IMediaSeeking
*iface
, const GUID
*pFormat
)
2267 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2272 TRACE("(%p/%p)->(%s)\n", This
, iface
, debugstr_guid(pFormat
));
2274 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, pFormat
))
2276 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat
));
2283 static HRESULT WINAPI
MediaSeeking_QueryPreferredFormat(IMediaSeeking
*iface
, GUID
*pFormat
)
2285 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2290 FIXME("(%p/%p)->(%p): semi-stub !!!\n", This
, iface
, pFormat
);
2291 memcpy(pFormat
, &TIME_FORMAT_MEDIA_TIME
, sizeof(GUID
));
2296 static HRESULT WINAPI
MediaSeeking_GetTimeFormat(IMediaSeeking
*iface
, GUID
*pFormat
)
2298 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2303 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFormat
);
2304 memcpy(pFormat
, &This
->timeformatseek
, sizeof(GUID
));
2309 static HRESULT WINAPI
MediaSeeking_IsUsingTimeFormat(IMediaSeeking
*iface
, const GUID
*pFormat
)
2311 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2313 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFormat
);
2317 if (memcmp(pFormat
, &This
->timeformatseek
, sizeof(GUID
)))
2323 static HRESULT WINAPI
MediaSeeking_SetTimeFormat(IMediaSeeking
*iface
, const GUID
*pFormat
)
2325 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2330 TRACE("(%p/%p)->(%s)\n", This
, iface
, debugstr_guid(pFormat
));
2332 if (This
->state
!= State_Stopped
)
2333 return VFW_E_WRONG_STATE
;
2335 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, pFormat
))
2337 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat
));
2338 return E_INVALIDARG
;
2344 static HRESULT WINAPI
FoundDuration(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pduration
)
2347 LONGLONG duration
= 0, *pdur
= (LONGLONG
*)pduration
;
2349 hr
= IMediaSeeking_GetDuration(seek
, &duration
);
2353 if (*pdur
< duration
)
2358 static HRESULT WINAPI
MediaSeeking_GetDuration(IMediaSeeking
*iface
, LONGLONG
*pDuration
)
2360 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2363 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDuration
);
2368 EnterCriticalSection(&This
->cs
);
2370 hr
= all_renderers_seek(This
, FoundDuration
, (DWORD_PTR
)pDuration
);
2371 LeaveCriticalSection(&This
->cs
);
2373 TRACE("--->%08x\n", hr
);
2377 static HRESULT WINAPI
MediaSeeking_GetStopPosition(IMediaSeeking
*iface
, LONGLONG
*pStop
)
2379 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2382 TRACE("(%p/%p)->(%p)\n", This
, iface
, pStop
);
2387 EnterCriticalSection(&This
->cs
);
2388 if (This
->stop_position
< 0)
2389 /* Stop position not set, use duration instead */
2390 hr
= IMediaSeeking_GetDuration(iface
, pStop
);
2392 *pStop
= This
->stop_position
;
2393 LeaveCriticalSection(&This
->cs
);
2398 static HRESULT WINAPI
FoundCurrentPosition(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pposition
)
2401 LONGLONG pos
= 0, *ppos
= (LONGLONG
*)pposition
;
2403 hr
= IMediaSeeking_GetCurrentPosition(seek
, &pos
);
2407 if (*ppos
< 0 || pos
< *ppos
)
2412 static HRESULT WINAPI
MediaSeeking_GetCurrentPosition(IMediaSeeking
*iface
, LONGLONG
*pCurrent
)
2414 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2420 EnterCriticalSection(&This
->cs
);
2422 hr
= all_renderers_seek(This
, FoundCurrentPosition
, (DWORD_PTR
)pCurrent
);
2423 if (hr
== E_NOTIMPL
) {
2427 LeaveCriticalSection(&This
->cs
);
2429 TRACE("Time: %u.%03u\n", (DWORD
)(*pCurrent
/ 10000000), (DWORD
)((*pCurrent
/ 10000)%1000));
2434 static HRESULT WINAPI
MediaSeeking_ConvertTimeFormat(IMediaSeeking
*iface
, LONGLONG
*pTarget
,
2435 const GUID
*pTargetFormat
, LONGLONG Source
, const GUID
*pSourceFormat
)
2437 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2439 FIXME("(%p/%p)->(%p, %p, 0x%s, %p): stub !!!\n", This
, iface
, pTarget
,
2440 pTargetFormat
, wine_dbgstr_longlong(Source
), pSourceFormat
);
2446 LONGLONG
* current
, *stop
;
2447 DWORD curflags
, stopflags
;
2450 static HRESULT WINAPI
found_setposition(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pargs
)
2452 struct pos_args
*args
= (void*)pargs
;
2454 return IMediaSeeking_SetPositions(seek
, args
->current
, args
->curflags
, args
->stop
, args
->stopflags
);
2457 static HRESULT WINAPI
MediaSeeking_SetPositions(IMediaSeeking
*iface
, LONGLONG
*pCurrent
,
2458 DWORD dwCurrentFlags
, LONGLONG
*pStop
, DWORD dwStopFlags
)
2460 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2463 struct pos_args args
;
2465 TRACE("(%p/%p)->(%p, %08x, %p, %08x)\n", This
, iface
, pCurrent
, dwCurrentFlags
, pStop
, dwStopFlags
);
2467 EnterCriticalSection(&This
->cs
);
2468 state
= This
->state
;
2469 TRACE("State: %s\n", state
== State_Running
? "Running" : (state
== State_Paused
? "Paused" : (state
== State_Stopped
? "Stopped" : "UNKNOWN")));
2471 if ((dwCurrentFlags
& 0x7) != AM_SEEKING_AbsolutePositioning
&&
2472 (dwCurrentFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2473 FIXME("Adjust method %x not handled yet!\n", dwCurrentFlags
& 0x7);
2475 if ((dwStopFlags
& 0x7) == AM_SEEKING_AbsolutePositioning
)
2476 This
->stop_position
= *pStop
;
2477 else if ((dwStopFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2478 FIXME("Stop position not handled yet!\n");
2480 if (state
== State_Running
&& !(dwCurrentFlags
& AM_SEEKING_NoFlush
))
2481 IMediaControl_Pause(&This
->IMediaControl_iface
);
2482 args
.current
= pCurrent
;
2484 args
.curflags
= dwCurrentFlags
;
2485 args
.stopflags
= dwStopFlags
;
2486 hr
= all_renderers_seek(This
, found_setposition
, (DWORD_PTR
)&args
);
2488 if ((dwCurrentFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2489 This
->pause_time
= This
->start_time
= -1;
2490 if (state
== State_Running
&& !(dwCurrentFlags
& AM_SEEKING_NoFlush
))
2491 IMediaControl_Run(&This
->IMediaControl_iface
);
2492 LeaveCriticalSection(&This
->cs
);
2497 static HRESULT WINAPI
MediaSeeking_GetPositions(IMediaSeeking
*iface
, LONGLONG
*pCurrent
,
2500 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2503 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pCurrent
, pStop
);
2504 hr
= IMediaSeeking_GetCurrentPosition(iface
, pCurrent
);
2506 hr
= IMediaSeeking_GetStopPosition(iface
, pStop
);
2511 static HRESULT WINAPI
MediaSeeking_GetAvailable(IMediaSeeking
*iface
, LONGLONG
*pEarliest
,
2514 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2516 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This
, iface
, pEarliest
, pLatest
);
2521 static HRESULT WINAPI
MediaSeeking_SetRate(IMediaSeeking
*iface
, double dRate
)
2523 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2525 FIXME("(%p/%p)->(%f): stub !!!\n", This
, iface
, dRate
);
2530 static HRESULT WINAPI
MediaSeeking_GetRate(IMediaSeeking
*iface
, double *pdRate
)
2532 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2534 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pdRate
);
2539 static HRESULT WINAPI
MediaSeeking_GetPreroll(IMediaSeeking
*iface
, LONGLONG
*pllPreroll
)
2541 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2543 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pllPreroll
);
2549 static const IMediaSeekingVtbl IMediaSeeking_VTable
=
2551 MediaSeeking_QueryInterface
,
2552 MediaSeeking_AddRef
,
2553 MediaSeeking_Release
,
2554 MediaSeeking_GetCapabilities
,
2555 MediaSeeking_CheckCapabilities
,
2556 MediaSeeking_IsFormatSupported
,
2557 MediaSeeking_QueryPreferredFormat
,
2558 MediaSeeking_GetTimeFormat
,
2559 MediaSeeking_IsUsingTimeFormat
,
2560 MediaSeeking_SetTimeFormat
,
2561 MediaSeeking_GetDuration
,
2562 MediaSeeking_GetStopPosition
,
2563 MediaSeeking_GetCurrentPosition
,
2564 MediaSeeking_ConvertTimeFormat
,
2565 MediaSeeking_SetPositions
,
2566 MediaSeeking_GetPositions
,
2567 MediaSeeking_GetAvailable
,
2568 MediaSeeking_SetRate
,
2569 MediaSeeking_GetRate
,
2570 MediaSeeking_GetPreroll
2573 static inline IFilterGraphImpl
*impl_from_IMediaPosition(IMediaPosition
*iface
)
2575 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaPosition_iface
);
2578 /*** IUnknown methods ***/
2579 static HRESULT WINAPI
MediaPosition_QueryInterface(IMediaPosition
* iface
, REFIID riid
, void** ppvObj
)
2581 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2583 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2584 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2587 static ULONG WINAPI
MediaPosition_AddRef(IMediaPosition
*iface
)
2589 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2591 TRACE("(%p/%p)->()\n", This
, iface
);
2592 return Filtergraph_AddRef(This
);
2595 static ULONG WINAPI
MediaPosition_Release(IMediaPosition
*iface
)
2597 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2599 TRACE("(%p/%p)->()\n", This
, iface
);
2600 return Filtergraph_Release(This
);
2603 /*** IDispatch methods ***/
2604 static HRESULT WINAPI
MediaPosition_GetTypeInfoCount(IMediaPosition
*iface
, UINT
* pctinfo
){
2605 FIXME("(%p) stub!\n", iface
);
2609 static HRESULT WINAPI
MediaPosition_GetTypeInfo(IMediaPosition
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
** ppTInfo
){
2610 FIXME("(%p) stub!\n", iface
);
2614 static HRESULT WINAPI
MediaPosition_GetIDsOfNames(IMediaPosition
* iface
, REFIID riid
, LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
){
2615 FIXME("(%p) stub!\n", iface
);
2619 static HRESULT WINAPI
MediaPosition_Invoke(IMediaPosition
* iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
, VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
){
2620 FIXME("(%p) stub!\n", iface
);
2624 static HRESULT
ConvertFromREFTIME(IMediaSeeking
*seek
, REFTIME time_in
, LONGLONG
*time_out
)
2629 hr
= MediaSeeking_GetTimeFormat(seek
, &time_format
);
2632 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, &time_format
))
2634 FIXME("Unsupported time format.\n");
2638 *time_out
= (LONGLONG
) (time_in
* 10000000); /* convert from 1 second intervals to 100 ns intervals */
2642 static HRESULT
ConvertToREFTIME(IMediaSeeking
*seek
, LONGLONG time_in
, REFTIME
*time_out
)
2647 hr
= MediaSeeking_GetTimeFormat(seek
, &time_format
);
2650 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, &time_format
))
2652 FIXME("Unsupported time format.\n");
2656 *time_out
= (REFTIME
)time_in
/ 10000000; /* convert from 100 ns intervals to 1 second intervals */
2660 /*** IMediaPosition methods ***/
2661 static HRESULT WINAPI
MediaPosition_get_Duration(IMediaPosition
* iface
, REFTIME
*plength
)
2664 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2665 HRESULT hr
= IMediaSeeking_GetDuration(&This
->IMediaSeeking_iface
, &duration
);
2668 return ConvertToREFTIME(&This
->IMediaSeeking_iface
, duration
, plength
);
2671 static HRESULT WINAPI
MediaPosition_put_CurrentPosition(IMediaPosition
* iface
, REFTIME llTime
)
2673 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2677 hr
= ConvertFromREFTIME(&This
->IMediaSeeking_iface
, llTime
, &reftime
);
2680 return IMediaSeeking_SetPositions(&This
->IMediaSeeking_iface
, &reftime
,
2681 AM_SEEKING_AbsolutePositioning
, NULL
, AM_SEEKING_NoPositioning
);
2684 static HRESULT WINAPI
MediaPosition_get_CurrentPosition(IMediaPosition
* iface
, REFTIME
*pllTime
)
2686 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2690 hr
= IMediaSeeking_GetCurrentPosition(&This
->IMediaSeeking_iface
, &pos
);
2693 return ConvertToREFTIME(&This
->IMediaSeeking_iface
, pos
, pllTime
);
2696 static HRESULT WINAPI
MediaPosition_get_StopTime(IMediaPosition
* iface
, REFTIME
*pllTime
)
2698 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2700 HRESULT hr
= IMediaSeeking_GetStopPosition(&This
->IMediaSeeking_iface
, &pos
);
2703 return ConvertToREFTIME(&This
->IMediaSeeking_iface
, pos
, pllTime
);
2706 static HRESULT WINAPI
MediaPosition_put_StopTime(IMediaPosition
* iface
, REFTIME llTime
)
2708 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2712 hr
= ConvertFromREFTIME(&This
->IMediaSeeking_iface
, llTime
, &reftime
);
2715 return IMediaSeeking_SetPositions(&This
->IMediaSeeking_iface
, NULL
, AM_SEEKING_NoPositioning
,
2716 &reftime
, AM_SEEKING_AbsolutePositioning
);
2719 static HRESULT WINAPI
MediaPosition_get_PrerollTime(IMediaPosition
* iface
, REFTIME
*pllTime
){
2720 FIXME("(%p)->(%p) stub!\n", iface
, pllTime
);
2724 static HRESULT WINAPI
MediaPosition_put_PrerollTime(IMediaPosition
* iface
, REFTIME llTime
){
2725 FIXME("(%p)->(%f) stub!\n", iface
, llTime
);
2729 static HRESULT WINAPI
MediaPosition_put_Rate(IMediaPosition
* iface
, double dRate
)
2731 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2732 return IMediaSeeking_SetRate(&This
->IMediaSeeking_iface
, dRate
);
2735 static HRESULT WINAPI
MediaPosition_get_Rate(IMediaPosition
* iface
, double *pdRate
)
2737 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2738 return IMediaSeeking_GetRate(&This
->IMediaSeeking_iface
, pdRate
);
2741 static HRESULT WINAPI
MediaPosition_CanSeekForward(IMediaPosition
* iface
, LONG
*pCanSeekForward
){
2742 FIXME("(%p)->(%p) stub!\n", iface
, pCanSeekForward
);
2746 static HRESULT WINAPI
MediaPosition_CanSeekBackward(IMediaPosition
* iface
, LONG
*pCanSeekBackward
){
2747 FIXME("(%p)->(%p) stub!\n", iface
, pCanSeekBackward
);
2752 static const IMediaPositionVtbl IMediaPosition_VTable
=
2754 MediaPosition_QueryInterface
,
2755 MediaPosition_AddRef
,
2756 MediaPosition_Release
,
2757 MediaPosition_GetTypeInfoCount
,
2758 MediaPosition_GetTypeInfo
,
2759 MediaPosition_GetIDsOfNames
,
2760 MediaPosition_Invoke
,
2761 MediaPosition_get_Duration
,
2762 MediaPosition_put_CurrentPosition
,
2763 MediaPosition_get_CurrentPosition
,
2764 MediaPosition_get_StopTime
,
2765 MediaPosition_put_StopTime
,
2766 MediaPosition_get_PrerollTime
,
2767 MediaPosition_put_PrerollTime
,
2768 MediaPosition_put_Rate
,
2769 MediaPosition_get_Rate
,
2770 MediaPosition_CanSeekForward
,
2771 MediaPosition_CanSeekBackward
2774 static HRESULT
GetTargetInterface(IFilterGraphImpl
* pGraph
, REFIID riid
, LPVOID
* ppvObj
)
2776 HRESULT hr
= E_NOINTERFACE
;
2780 /* Check if the interface type is already registered */
2781 for (entry
= 0; entry
< pGraph
->nItfCacheEntries
; entry
++)
2782 if (riid
== pGraph
->ItfCacheEntries
[entry
].riid
)
2784 if (pGraph
->ItfCacheEntries
[entry
].iface
)
2786 /* Return the interface if available */
2787 *ppvObj
= pGraph
->ItfCacheEntries
[entry
].iface
;
2793 if (entry
>= MAX_ITF_CACHE_ENTRIES
)
2795 FIXME("Not enough space to store interface in the cache\n");
2796 return E_OUTOFMEMORY
;
2799 /* Find a filter supporting the requested interface */
2800 for (i
= 0; i
< pGraph
->nFilters
; i
++)
2802 hr
= IBaseFilter_QueryInterface(pGraph
->ppFiltersInGraph
[i
], riid
, ppvObj
);
2805 pGraph
->ItfCacheEntries
[entry
].riid
= riid
;
2806 pGraph
->ItfCacheEntries
[entry
].filter
= pGraph
->ppFiltersInGraph
[i
];
2807 pGraph
->ItfCacheEntries
[entry
].iface
= *ppvObj
;
2808 if (entry
>= pGraph
->nItfCacheEntries
)
2809 pGraph
->nItfCacheEntries
++;
2812 if (hr
!= E_NOINTERFACE
)
2819 static inline IFilterGraphImpl
*impl_from_IBasicAudio(IBasicAudio
*iface
)
2821 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IBasicAudio_iface
);
2824 static HRESULT WINAPI
BasicAudio_QueryInterface(IBasicAudio
*iface
, REFIID riid
, void **ppvObj
)
2826 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2828 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2830 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2833 static ULONG WINAPI
BasicAudio_AddRef(IBasicAudio
*iface
)
2835 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2837 TRACE("(%p/%p)->()\n", This
, iface
);
2839 return Filtergraph_AddRef(This
);
2842 static ULONG WINAPI
BasicAudio_Release(IBasicAudio
*iface
)
2844 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2846 TRACE("(%p/%p)->()\n", This
, iface
);
2848 return Filtergraph_Release(This
);
2851 /*** IDispatch methods ***/
2852 static HRESULT WINAPI
BasicAudio_GetTypeInfoCount(IBasicAudio
*iface
, UINT
*pctinfo
)
2854 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2855 IBasicAudio
* pBasicAudio
;
2858 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
2860 EnterCriticalSection(&This
->cs
);
2862 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2865 hr
= IBasicAudio_GetTypeInfoCount(pBasicAudio
, pctinfo
);
2867 LeaveCriticalSection(&This
->cs
);
2872 static HRESULT WINAPI
BasicAudio_GetTypeInfo(IBasicAudio
*iface
, UINT iTInfo
, LCID lcid
,
2873 ITypeInfo
**ppTInfo
)
2875 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2876 IBasicAudio
* pBasicAudio
;
2879 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
2881 EnterCriticalSection(&This
->cs
);
2883 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2886 hr
= IBasicAudio_GetTypeInfo(pBasicAudio
, iTInfo
, lcid
, ppTInfo
);
2888 LeaveCriticalSection(&This
->cs
);
2893 static HRESULT WINAPI
BasicAudio_GetIDsOfNames(IBasicAudio
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
2894 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2896 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2897 IBasicAudio
* pBasicAudio
;
2900 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2902 EnterCriticalSection(&This
->cs
);
2904 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2907 hr
= IBasicAudio_GetIDsOfNames(pBasicAudio
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2909 LeaveCriticalSection(&This
->cs
);
2914 static HRESULT WINAPI
BasicAudio_Invoke(IBasicAudio
*iface
, DISPID dispIdMember
, REFIID riid
,
2915 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
2918 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2919 IBasicAudio
* pBasicAudio
;
2922 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p)\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
2924 EnterCriticalSection(&This
->cs
);
2926 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2929 hr
= IBasicAudio_Invoke(pBasicAudio
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
2931 LeaveCriticalSection(&This
->cs
);
2936 /*** IBasicAudio methods ***/
2937 static HRESULT WINAPI
BasicAudio_put_Volume(IBasicAudio
*iface
, LONG lVolume
)
2939 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2940 IBasicAudio
* pBasicAudio
;
2943 TRACE("(%p/%p)->(%d)\n", This
, iface
, lVolume
);
2945 EnterCriticalSection(&This
->cs
);
2947 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2950 hr
= IBasicAudio_put_Volume(pBasicAudio
, lVolume
);
2952 LeaveCriticalSection(&This
->cs
);
2957 static HRESULT WINAPI
BasicAudio_get_Volume(IBasicAudio
*iface
, LONG
*plVolume
)
2959 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2960 IBasicAudio
* pBasicAudio
;
2963 TRACE("(%p/%p)->(%p)\n", This
, iface
, plVolume
);
2965 EnterCriticalSection(&This
->cs
);
2967 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2970 hr
= IBasicAudio_get_Volume(pBasicAudio
, plVolume
);
2972 LeaveCriticalSection(&This
->cs
);
2977 static HRESULT WINAPI
BasicAudio_put_Balance(IBasicAudio
*iface
, LONG lBalance
)
2979 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2980 IBasicAudio
* pBasicAudio
;
2983 TRACE("(%p/%p)->(%d)\n", This
, iface
, lBalance
);
2985 EnterCriticalSection(&This
->cs
);
2987 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2990 hr
= IBasicAudio_put_Balance(pBasicAudio
, lBalance
);
2992 LeaveCriticalSection(&This
->cs
);
2997 static HRESULT WINAPI
BasicAudio_get_Balance(IBasicAudio
*iface
, LONG
*plBalance
)
2999 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
3000 IBasicAudio
* pBasicAudio
;
3003 TRACE("(%p/%p)->(%p)\n", This
, iface
, plBalance
);
3005 EnterCriticalSection(&This
->cs
);
3007 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
3010 hr
= IBasicAudio_get_Balance(pBasicAudio
, plBalance
);
3012 LeaveCriticalSection(&This
->cs
);
3017 static const IBasicAudioVtbl IBasicAudio_VTable
=
3019 BasicAudio_QueryInterface
,
3022 BasicAudio_GetTypeInfoCount
,
3023 BasicAudio_GetTypeInfo
,
3024 BasicAudio_GetIDsOfNames
,
3026 BasicAudio_put_Volume
,
3027 BasicAudio_get_Volume
,
3028 BasicAudio_put_Balance
,
3029 BasicAudio_get_Balance
3032 static inline IFilterGraphImpl
*impl_from_IBasicVideo2(IBasicVideo2
*iface
)
3034 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IBasicVideo2_iface
);
3037 static HRESULT WINAPI
BasicVideo_QueryInterface(IBasicVideo2
*iface
, REFIID riid
, void **ppvObj
)
3039 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3041 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
3043 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
3046 static ULONG WINAPI
BasicVideo_AddRef(IBasicVideo2
*iface
)
3048 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3050 TRACE("(%p/%p)->()\n", This
, iface
);
3052 return Filtergraph_AddRef(This
);
3055 static ULONG WINAPI
BasicVideo_Release(IBasicVideo2
*iface
)
3057 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3059 TRACE("(%p/%p)->()\n", This
, iface
);
3061 return Filtergraph_Release(This
);
3064 /*** IDispatch methods ***/
3065 static HRESULT WINAPI
BasicVideo_GetTypeInfoCount(IBasicVideo2
*iface
, UINT
*pctinfo
)
3067 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3068 IBasicVideo
*pBasicVideo
;
3071 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
3073 EnterCriticalSection(&This
->cs
);
3075 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3078 hr
= IBasicVideo_GetTypeInfoCount(pBasicVideo
, pctinfo
);
3080 LeaveCriticalSection(&This
->cs
);
3085 static HRESULT WINAPI
BasicVideo_GetTypeInfo(IBasicVideo2
*iface
, UINT iTInfo
, LCID lcid
,
3086 ITypeInfo
**ppTInfo
)
3088 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3089 IBasicVideo
*pBasicVideo
;
3092 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
3094 EnterCriticalSection(&This
->cs
);
3096 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3099 hr
= IBasicVideo_GetTypeInfo(pBasicVideo
, iTInfo
, lcid
, ppTInfo
);
3101 LeaveCriticalSection(&This
->cs
);
3106 static HRESULT WINAPI
BasicVideo_GetIDsOfNames(IBasicVideo2
*iface
, REFIID riid
,
3107 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3109 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3110 IBasicVideo
*pBasicVideo
;
3113 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3115 EnterCriticalSection(&This
->cs
);
3117 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3120 hr
= IBasicVideo_GetIDsOfNames(pBasicVideo
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3122 LeaveCriticalSection(&This
->cs
);
3127 static HRESULT WINAPI
BasicVideo_Invoke(IBasicVideo2
*iface
, DISPID dispIdMember
, REFIID riid
,
3128 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
3131 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3132 IBasicVideo
*pBasicVideo
;
3135 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p)\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
3137 EnterCriticalSection(&This
->cs
);
3139 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3142 hr
= IBasicVideo_Invoke(pBasicVideo
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
3144 LeaveCriticalSection(&This
->cs
);
3149 /*** IBasicVideo methods ***/
3150 static HRESULT WINAPI
BasicVideo_get_AvgTimePerFrame(IBasicVideo2
*iface
, REFTIME
*pAvgTimePerFrame
)
3152 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3153 IBasicVideo
*pBasicVideo
;
3156 TRACE("(%p/%p)->(%p)\n", This
, iface
, pAvgTimePerFrame
);
3158 EnterCriticalSection(&This
->cs
);
3160 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3163 hr
= IBasicVideo_get_AvgTimePerFrame(pBasicVideo
, pAvgTimePerFrame
);
3165 LeaveCriticalSection(&This
->cs
);
3170 static HRESULT WINAPI
BasicVideo_get_BitRate(IBasicVideo2
*iface
, LONG
*pBitRate
)
3172 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3173 IBasicVideo
*pBasicVideo
;
3176 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBitRate
);
3178 EnterCriticalSection(&This
->cs
);
3180 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3183 hr
= IBasicVideo_get_BitRate(pBasicVideo
, pBitRate
);
3185 LeaveCriticalSection(&This
->cs
);
3190 static HRESULT WINAPI
BasicVideo_get_BitErrorRate(IBasicVideo2
*iface
, LONG
*pBitErrorRate
)
3192 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3193 IBasicVideo
*pBasicVideo
;
3196 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBitErrorRate
);
3198 EnterCriticalSection(&This
->cs
);
3200 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3203 hr
= IBasicVideo_get_BitErrorRate(pBasicVideo
, pBitErrorRate
);
3205 LeaveCriticalSection(&This
->cs
);
3210 static HRESULT WINAPI
BasicVideo_get_VideoWidth(IBasicVideo2
*iface
, LONG
*pVideoWidth
)
3212 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3213 IBasicVideo
*pBasicVideo
;
3216 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
3218 EnterCriticalSection(&This
->cs
);
3220 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3223 hr
= IBasicVideo_get_VideoWidth(pBasicVideo
, pVideoWidth
);
3225 LeaveCriticalSection(&This
->cs
);
3230 static HRESULT WINAPI
BasicVideo_get_VideoHeight(IBasicVideo2
*iface
, LONG
*pVideoHeight
)
3232 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3233 IBasicVideo
*pBasicVideo
;
3236 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
3238 EnterCriticalSection(&This
->cs
);
3240 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3243 hr
= IBasicVideo_get_VideoHeight(pBasicVideo
, pVideoHeight
);
3245 LeaveCriticalSection(&This
->cs
);
3250 static HRESULT WINAPI
BasicVideo_put_SourceLeft(IBasicVideo2
*iface
, LONG SourceLeft
)
3252 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3253 IBasicVideo
*pBasicVideo
;
3256 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceLeft
);
3258 EnterCriticalSection(&This
->cs
);
3260 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3263 hr
= IBasicVideo_put_SourceLeft(pBasicVideo
, SourceLeft
);
3265 LeaveCriticalSection(&This
->cs
);
3270 static HRESULT WINAPI
BasicVideo_get_SourceLeft(IBasicVideo2
*iface
, LONG
*pSourceLeft
)
3272 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3273 IBasicVideo
*pBasicVideo
;
3276 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
3278 EnterCriticalSection(&This
->cs
);
3280 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3283 hr
= IBasicVideo_get_SourceLeft(pBasicVideo
, pSourceLeft
);
3285 LeaveCriticalSection(&This
->cs
);
3290 static HRESULT WINAPI
BasicVideo_put_SourceWidth(IBasicVideo2
*iface
, LONG SourceWidth
)
3292 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3293 IBasicVideo
*pBasicVideo
;
3296 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceWidth
);
3298 EnterCriticalSection(&This
->cs
);
3300 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3303 hr
= IBasicVideo_put_SourceWidth(pBasicVideo
, SourceWidth
);
3305 LeaveCriticalSection(&This
->cs
);
3310 static HRESULT WINAPI
BasicVideo_get_SourceWidth(IBasicVideo2
*iface
, LONG
*pSourceWidth
)
3312 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3313 IBasicVideo
*pBasicVideo
;
3316 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
3318 EnterCriticalSection(&This
->cs
);
3320 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3323 hr
= IBasicVideo_get_SourceWidth(pBasicVideo
, pSourceWidth
);
3325 LeaveCriticalSection(&This
->cs
);
3330 static HRESULT WINAPI
BasicVideo_put_SourceTop(IBasicVideo2
*iface
, LONG SourceTop
)
3332 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3333 IBasicVideo
*pBasicVideo
;
3336 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceTop
);
3338 EnterCriticalSection(&This
->cs
);
3340 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3343 hr
= IBasicVideo_put_SourceTop(pBasicVideo
, SourceTop
);
3345 LeaveCriticalSection(&This
->cs
);
3350 static HRESULT WINAPI
BasicVideo_get_SourceTop(IBasicVideo2
*iface
, LONG
*pSourceTop
)
3352 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3353 IBasicVideo
*pBasicVideo
;
3356 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
3358 EnterCriticalSection(&This
->cs
);
3360 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3363 hr
= IBasicVideo_get_SourceTop(pBasicVideo
, pSourceTop
);
3365 LeaveCriticalSection(&This
->cs
);
3370 static HRESULT WINAPI
BasicVideo_put_SourceHeight(IBasicVideo2
*iface
, LONG SourceHeight
)
3372 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3373 IBasicVideo
*pBasicVideo
;
3376 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceHeight
);
3378 EnterCriticalSection(&This
->cs
);
3380 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3383 hr
= IBasicVideo_put_SourceHeight(pBasicVideo
, SourceHeight
);
3385 LeaveCriticalSection(&This
->cs
);
3390 static HRESULT WINAPI
BasicVideo_get_SourceHeight(IBasicVideo2
*iface
, LONG
*pSourceHeight
)
3392 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3393 IBasicVideo
*pBasicVideo
;
3396 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
3398 EnterCriticalSection(&This
->cs
);
3400 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3403 hr
= IBasicVideo_get_SourceHeight(pBasicVideo
, pSourceHeight
);
3405 LeaveCriticalSection(&This
->cs
);
3410 static HRESULT WINAPI
BasicVideo_put_DestinationLeft(IBasicVideo2
*iface
, LONG DestinationLeft
)
3412 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3413 IBasicVideo
*pBasicVideo
;
3416 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationLeft
);
3418 EnterCriticalSection(&This
->cs
);
3420 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3423 hr
= IBasicVideo_put_DestinationLeft(pBasicVideo
, DestinationLeft
);
3425 LeaveCriticalSection(&This
->cs
);
3430 static HRESULT WINAPI
BasicVideo_get_DestinationLeft(IBasicVideo2
*iface
, LONG
*pDestinationLeft
)
3432 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3433 IBasicVideo
*pBasicVideo
;
3436 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
3438 EnterCriticalSection(&This
->cs
);
3440 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3443 hr
= IBasicVideo_get_DestinationLeft(pBasicVideo
, pDestinationLeft
);
3445 LeaveCriticalSection(&This
->cs
);
3450 static HRESULT WINAPI
BasicVideo_put_DestinationWidth(IBasicVideo2
*iface
, LONG DestinationWidth
)
3452 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3453 IBasicVideo
*pBasicVideo
;
3456 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationWidth
);
3458 EnterCriticalSection(&This
->cs
);
3460 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3463 hr
= IBasicVideo_put_DestinationWidth(pBasicVideo
, DestinationWidth
);
3465 LeaveCriticalSection(&This
->cs
);
3470 static HRESULT WINAPI
BasicVideo_get_DestinationWidth(IBasicVideo2
*iface
, LONG
*pDestinationWidth
)
3472 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3473 IBasicVideo
*pBasicVideo
;
3476 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
3478 EnterCriticalSection(&This
->cs
);
3480 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3483 hr
= IBasicVideo_get_DestinationWidth(pBasicVideo
, pDestinationWidth
);
3485 LeaveCriticalSection(&This
->cs
);
3490 static HRESULT WINAPI
BasicVideo_put_DestinationTop(IBasicVideo2
*iface
, LONG DestinationTop
)
3492 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3493 IBasicVideo
*pBasicVideo
;
3496 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationTop
);
3498 EnterCriticalSection(&This
->cs
);
3500 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3503 hr
= IBasicVideo_put_DestinationTop(pBasicVideo
, DestinationTop
);
3505 LeaveCriticalSection(&This
->cs
);
3510 static HRESULT WINAPI
BasicVideo_get_DestinationTop(IBasicVideo2
*iface
, LONG
*pDestinationTop
)
3512 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3513 IBasicVideo
*pBasicVideo
;
3516 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
3518 EnterCriticalSection(&This
->cs
);
3520 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3523 hr
= IBasicVideo_get_DestinationTop(pBasicVideo
, pDestinationTop
);
3525 LeaveCriticalSection(&This
->cs
);
3530 static HRESULT WINAPI
BasicVideo_put_DestinationHeight(IBasicVideo2
*iface
, LONG DestinationHeight
)
3532 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3533 IBasicVideo
*pBasicVideo
;
3536 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationHeight
);
3538 EnterCriticalSection(&This
->cs
);
3540 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3543 hr
= IBasicVideo_put_DestinationHeight(pBasicVideo
, DestinationHeight
);
3545 LeaveCriticalSection(&This
->cs
);
3550 static HRESULT WINAPI
BasicVideo_get_DestinationHeight(IBasicVideo2
*iface
,
3551 LONG
*pDestinationHeight
)
3553 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3554 IBasicVideo
*pBasicVideo
;
3557 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
3559 EnterCriticalSection(&This
->cs
);
3561 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3564 hr
= IBasicVideo_get_DestinationHeight(pBasicVideo
, pDestinationHeight
);
3566 LeaveCriticalSection(&This
->cs
);
3571 static HRESULT WINAPI
BasicVideo_SetSourcePosition(IBasicVideo2
*iface
, LONG Left
, LONG Top
,
3572 LONG Width
, LONG Height
)
3574 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3575 IBasicVideo
*pBasicVideo
;
3578 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
3580 EnterCriticalSection(&This
->cs
);
3582 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3585 hr
= IBasicVideo_SetSourcePosition(pBasicVideo
, Left
, Top
, Width
, Height
);
3587 LeaveCriticalSection(&This
->cs
);
3592 static HRESULT WINAPI
BasicVideo_GetSourcePosition(IBasicVideo2
*iface
, LONG
*pLeft
, LONG
*pTop
,
3593 LONG
*pWidth
, LONG
*pHeight
)
3595 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3596 IBasicVideo
*pBasicVideo
;
3599 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
3601 EnterCriticalSection(&This
->cs
);
3603 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3606 hr
= IBasicVideo_GetSourcePosition(pBasicVideo
, pLeft
, pTop
, pWidth
, pHeight
);
3608 LeaveCriticalSection(&This
->cs
);
3613 static HRESULT WINAPI
BasicVideo_SetDefaultSourcePosition(IBasicVideo2
*iface
)
3615 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3616 IBasicVideo
*pBasicVideo
;
3619 TRACE("(%p/%p)->()\n", This
, iface
);
3621 EnterCriticalSection(&This
->cs
);
3623 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3626 hr
= IBasicVideo_SetDefaultSourcePosition(pBasicVideo
);
3628 LeaveCriticalSection(&This
->cs
);
3633 static HRESULT WINAPI
BasicVideo_SetDestinationPosition(IBasicVideo2
*iface
, LONG Left
, LONG Top
,
3634 LONG Width
, LONG Height
)
3636 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3637 IBasicVideo
*pBasicVideo
;
3640 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
3642 EnterCriticalSection(&This
->cs
);
3644 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3647 hr
= IBasicVideo_SetDestinationPosition(pBasicVideo
, Left
, Top
, Width
, Height
);
3649 LeaveCriticalSection(&This
->cs
);
3654 static HRESULT WINAPI
BasicVideo_GetDestinationPosition(IBasicVideo2
*iface
, LONG
*pLeft
,
3655 LONG
*pTop
, LONG
*pWidth
, LONG
*pHeight
)
3657 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3658 IBasicVideo
*pBasicVideo
;
3661 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
3663 EnterCriticalSection(&This
->cs
);
3665 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3668 hr
= IBasicVideo_GetDestinationPosition(pBasicVideo
, pLeft
, pTop
, pWidth
, pHeight
);
3670 LeaveCriticalSection(&This
->cs
);
3675 static HRESULT WINAPI
BasicVideo_SetDefaultDestinationPosition(IBasicVideo2
*iface
)
3677 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3678 IBasicVideo
*pBasicVideo
;
3681 TRACE("(%p/%p)->()\n", This
, iface
);
3683 EnterCriticalSection(&This
->cs
);
3685 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3688 hr
= IBasicVideo_SetDefaultDestinationPosition(pBasicVideo
);
3690 LeaveCriticalSection(&This
->cs
);
3695 static HRESULT WINAPI
BasicVideo_GetVideoSize(IBasicVideo2
*iface
, LONG
*pWidth
, LONG
*pHeight
)
3697 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3698 IBasicVideo
*pBasicVideo
;
3701 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
3703 EnterCriticalSection(&This
->cs
);
3705 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3708 hr
= IBasicVideo_GetVideoSize(pBasicVideo
, pWidth
, pHeight
);
3710 LeaveCriticalSection(&This
->cs
);
3715 static HRESULT WINAPI
BasicVideo_GetVideoPaletteEntries(IBasicVideo2
*iface
, LONG StartIndex
,
3716 LONG Entries
, LONG
*pRetrieved
, LONG
*pPalette
)
3718 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3719 IBasicVideo
*pBasicVideo
;
3722 TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
3724 EnterCriticalSection(&This
->cs
);
3726 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3729 hr
= IBasicVideo_GetVideoPaletteEntries(pBasicVideo
, StartIndex
, Entries
, pRetrieved
, pPalette
);
3731 LeaveCriticalSection(&This
->cs
);
3736 static HRESULT WINAPI
BasicVideo_GetCurrentImage(IBasicVideo2
*iface
, LONG
*pBufferSize
,
3739 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3740 IBasicVideo
*pBasicVideo
;
3743 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pBufferSize
, pDIBImage
);
3745 EnterCriticalSection(&This
->cs
);
3747 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3750 hr
= IBasicVideo_GetCurrentImage(pBasicVideo
, pBufferSize
, pDIBImage
);
3752 LeaveCriticalSection(&This
->cs
);
3757 static HRESULT WINAPI
BasicVideo_IsUsingDefaultSource(IBasicVideo2
*iface
)
3759 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3760 IBasicVideo
*pBasicVideo
;
3763 TRACE("(%p/%p)->()\n", This
, iface
);
3765 EnterCriticalSection(&This
->cs
);
3767 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3770 hr
= IBasicVideo_IsUsingDefaultSource(pBasicVideo
);
3772 LeaveCriticalSection(&This
->cs
);
3777 static HRESULT WINAPI
BasicVideo_IsUsingDefaultDestination(IBasicVideo2
*iface
)
3779 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3780 IBasicVideo
*pBasicVideo
;
3783 TRACE("(%p/%p)->()\n", This
, iface
);
3785 EnterCriticalSection(&This
->cs
);
3787 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3790 hr
= IBasicVideo_IsUsingDefaultDestination(pBasicVideo
);
3792 LeaveCriticalSection(&This
->cs
);
3797 static HRESULT WINAPI
BasicVideo2_GetPreferredAspectRatio(IBasicVideo2
*iface
, LONG
*plAspectX
,
3800 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3801 IBasicVideo2
*pBasicVideo2
;
3804 TRACE("(%p/%p)->()\n", This
, iface
);
3806 EnterCriticalSection(&This
->cs
);
3808 hr
= GetTargetInterface(This
, &IID_IBasicVideo2
, (LPVOID
*)&pBasicVideo2
);
3811 hr
= BasicVideo2_GetPreferredAspectRatio(iface
, plAspectX
, plAspectY
);
3813 LeaveCriticalSection(&This
->cs
);
3818 static const IBasicVideo2Vtbl IBasicVideo_VTable
=
3820 BasicVideo_QueryInterface
,
3823 BasicVideo_GetTypeInfoCount
,
3824 BasicVideo_GetTypeInfo
,
3825 BasicVideo_GetIDsOfNames
,
3827 BasicVideo_get_AvgTimePerFrame
,
3828 BasicVideo_get_BitRate
,
3829 BasicVideo_get_BitErrorRate
,
3830 BasicVideo_get_VideoWidth
,
3831 BasicVideo_get_VideoHeight
,
3832 BasicVideo_put_SourceLeft
,
3833 BasicVideo_get_SourceLeft
,
3834 BasicVideo_put_SourceWidth
,
3835 BasicVideo_get_SourceWidth
,
3836 BasicVideo_put_SourceTop
,
3837 BasicVideo_get_SourceTop
,
3838 BasicVideo_put_SourceHeight
,
3839 BasicVideo_get_SourceHeight
,
3840 BasicVideo_put_DestinationLeft
,
3841 BasicVideo_get_DestinationLeft
,
3842 BasicVideo_put_DestinationWidth
,
3843 BasicVideo_get_DestinationWidth
,
3844 BasicVideo_put_DestinationTop
,
3845 BasicVideo_get_DestinationTop
,
3846 BasicVideo_put_DestinationHeight
,
3847 BasicVideo_get_DestinationHeight
,
3848 BasicVideo_SetSourcePosition
,
3849 BasicVideo_GetSourcePosition
,
3850 BasicVideo_SetDefaultSourcePosition
,
3851 BasicVideo_SetDestinationPosition
,
3852 BasicVideo_GetDestinationPosition
,
3853 BasicVideo_SetDefaultDestinationPosition
,
3854 BasicVideo_GetVideoSize
,
3855 BasicVideo_GetVideoPaletteEntries
,
3856 BasicVideo_GetCurrentImage
,
3857 BasicVideo_IsUsingDefaultSource
,
3858 BasicVideo_IsUsingDefaultDestination
,
3859 BasicVideo2_GetPreferredAspectRatio
3862 static inline IFilterGraphImpl
*impl_from_IVideoWindow(IVideoWindow
*iface
)
3864 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IVideoWindow_iface
);
3867 static HRESULT WINAPI
VideoWindow_QueryInterface(IVideoWindow
*iface
, REFIID riid
, void **ppvObj
)
3869 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3871 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
3873 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
3876 static ULONG WINAPI
VideoWindow_AddRef(IVideoWindow
*iface
)
3878 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3880 TRACE("(%p/%p)->()\n", This
, iface
);
3882 return Filtergraph_AddRef(This
);
3885 static ULONG WINAPI
VideoWindow_Release(IVideoWindow
*iface
)
3887 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3889 TRACE("(%p/%p)->()\n", This
, iface
);
3891 return Filtergraph_Release(This
);
3894 /*** IDispatch methods ***/
3895 static HRESULT WINAPI
VideoWindow_GetTypeInfoCount(IVideoWindow
*iface
, UINT
*pctinfo
)
3897 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3898 IVideoWindow
*pVideoWindow
;
3901 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
3903 EnterCriticalSection(&This
->cs
);
3905 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3908 hr
= IVideoWindow_GetTypeInfoCount(pVideoWindow
, pctinfo
);
3910 LeaveCriticalSection(&This
->cs
);
3915 static HRESULT WINAPI
VideoWindow_GetTypeInfo(IVideoWindow
*iface
, UINT iTInfo
, LCID lcid
,
3916 ITypeInfo
**ppTInfo
)
3918 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3919 IVideoWindow
*pVideoWindow
;
3922 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
3924 EnterCriticalSection(&This
->cs
);
3926 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3929 hr
= IVideoWindow_GetTypeInfo(pVideoWindow
, iTInfo
, lcid
, ppTInfo
);
3931 LeaveCriticalSection(&This
->cs
);
3936 static HRESULT WINAPI
VideoWindow_GetIDsOfNames(IVideoWindow
*iface
, REFIID riid
,
3937 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3939 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3940 IVideoWindow
*pVideoWindow
;
3943 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3945 EnterCriticalSection(&This
->cs
);
3947 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3950 hr
= IVideoWindow_GetIDsOfNames(pVideoWindow
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3952 LeaveCriticalSection(&This
->cs
);
3957 static HRESULT WINAPI
VideoWindow_Invoke(IVideoWindow
*iface
, DISPID dispIdMember
, REFIID riid
,
3958 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
3961 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3962 IVideoWindow
*pVideoWindow
;
3965 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p)\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
3967 EnterCriticalSection(&This
->cs
);
3969 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3972 hr
= IVideoWindow_Invoke(pVideoWindow
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
3974 LeaveCriticalSection(&This
->cs
);
3980 /*** IVideoWindow methods ***/
3981 static HRESULT WINAPI
VideoWindow_put_Caption(IVideoWindow
*iface
, BSTR strCaption
)
3983 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3984 IVideoWindow
*pVideoWindow
;
3987 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
3989 EnterCriticalSection(&This
->cs
);
3991 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3994 hr
= IVideoWindow_put_Caption(pVideoWindow
, strCaption
);
3996 LeaveCriticalSection(&This
->cs
);
4001 static HRESULT WINAPI
VideoWindow_get_Caption(IVideoWindow
*iface
, BSTR
*strCaption
)
4003 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4004 IVideoWindow
*pVideoWindow
;
4007 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
4009 EnterCriticalSection(&This
->cs
);
4011 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4014 hr
= IVideoWindow_get_Caption(pVideoWindow
, strCaption
);
4016 LeaveCriticalSection(&This
->cs
);
4021 static HRESULT WINAPI
VideoWindow_put_WindowStyle(IVideoWindow
*iface
, LONG WindowStyle
)
4023 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4024 IVideoWindow
*pVideoWindow
;
4027 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyle
);
4029 EnterCriticalSection(&This
->cs
);
4031 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4034 hr
= IVideoWindow_put_WindowStyle(pVideoWindow
, WindowStyle
);
4036 LeaveCriticalSection(&This
->cs
);
4041 static HRESULT WINAPI
VideoWindow_get_WindowStyle(IVideoWindow
*iface
, LONG
*WindowStyle
)
4043 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4044 IVideoWindow
*pVideoWindow
;
4047 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
4049 EnterCriticalSection(&This
->cs
);
4051 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4054 hr
= IVideoWindow_get_WindowStyle(pVideoWindow
, WindowStyle
);
4056 LeaveCriticalSection(&This
->cs
);
4061 static HRESULT WINAPI
VideoWindow_put_WindowStyleEx(IVideoWindow
*iface
, LONG WindowStyleEx
)
4063 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4064 IVideoWindow
*pVideoWindow
;
4067 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyleEx
);
4069 EnterCriticalSection(&This
->cs
);
4071 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4074 hr
= IVideoWindow_put_WindowStyleEx(pVideoWindow
, WindowStyleEx
);
4076 LeaveCriticalSection(&This
->cs
);
4081 static HRESULT WINAPI
VideoWindow_get_WindowStyleEx(IVideoWindow
*iface
, LONG
*WindowStyleEx
)
4083 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4084 IVideoWindow
*pVideoWindow
;
4087 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
4089 EnterCriticalSection(&This
->cs
);
4091 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4094 hr
= IVideoWindow_get_WindowStyleEx(pVideoWindow
, WindowStyleEx
);
4096 LeaveCriticalSection(&This
->cs
);
4101 static HRESULT WINAPI
VideoWindow_put_AutoShow(IVideoWindow
*iface
, LONG AutoShow
)
4103 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4104 IVideoWindow
*pVideoWindow
;
4107 TRACE("(%p/%p)->(%d)\n", This
, iface
, AutoShow
);
4109 EnterCriticalSection(&This
->cs
);
4111 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4114 hr
= IVideoWindow_put_AutoShow(pVideoWindow
, AutoShow
);
4116 LeaveCriticalSection(&This
->cs
);
4121 static HRESULT WINAPI
VideoWindow_get_AutoShow(IVideoWindow
*iface
, LONG
*AutoShow
)
4123 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4124 IVideoWindow
*pVideoWindow
;
4127 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
4129 EnterCriticalSection(&This
->cs
);
4131 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4134 hr
= IVideoWindow_get_AutoShow(pVideoWindow
, AutoShow
);
4136 LeaveCriticalSection(&This
->cs
);
4141 static HRESULT WINAPI
VideoWindow_put_WindowState(IVideoWindow
*iface
, LONG WindowState
)
4143 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4144 IVideoWindow
*pVideoWindow
;
4147 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowState
);
4149 EnterCriticalSection(&This
->cs
);
4151 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4154 hr
= IVideoWindow_put_WindowState(pVideoWindow
, WindowState
);
4156 LeaveCriticalSection(&This
->cs
);
4161 static HRESULT WINAPI
VideoWindow_get_WindowState(IVideoWindow
*iface
, LONG
*WindowState
)
4163 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4164 IVideoWindow
*pVideoWindow
;
4167 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowState
);
4169 EnterCriticalSection(&This
->cs
);
4171 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4174 hr
= IVideoWindow_get_WindowState(pVideoWindow
, WindowState
);
4176 LeaveCriticalSection(&This
->cs
);
4181 static HRESULT WINAPI
VideoWindow_put_BackgroundPalette(IVideoWindow
*iface
, LONG BackgroundPalette
)
4183 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4184 IVideoWindow
*pVideoWindow
;
4187 TRACE("(%p/%p)->(%d)\n", This
, iface
, BackgroundPalette
);
4189 EnterCriticalSection(&This
->cs
);
4191 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4194 hr
= IVideoWindow_put_BackgroundPalette(pVideoWindow
, BackgroundPalette
);
4196 LeaveCriticalSection(&This
->cs
);
4201 static HRESULT WINAPI
VideoWindow_get_BackgroundPalette(IVideoWindow
*iface
,
4202 LONG
*pBackgroundPalette
)
4204 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4205 IVideoWindow
*pVideoWindow
;
4208 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBackgroundPalette
);
4210 EnterCriticalSection(&This
->cs
);
4212 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4215 hr
= IVideoWindow_get_BackgroundPalette(pVideoWindow
, pBackgroundPalette
);
4217 LeaveCriticalSection(&This
->cs
);
4222 static HRESULT WINAPI
VideoWindow_put_Visible(IVideoWindow
*iface
, LONG Visible
)
4224 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4225 IVideoWindow
*pVideoWindow
;
4228 TRACE("(%p/%p)->(%d)\n", This
, iface
, Visible
);
4230 EnterCriticalSection(&This
->cs
);
4232 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4235 hr
= IVideoWindow_put_Visible(pVideoWindow
, Visible
);
4237 LeaveCriticalSection(&This
->cs
);
4242 static HRESULT WINAPI
VideoWindow_get_Visible(IVideoWindow
*iface
, LONG
*pVisible
)
4244 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4245 IVideoWindow
*pVideoWindow
;
4248 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
4250 EnterCriticalSection(&This
->cs
);
4252 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4255 hr
= IVideoWindow_get_Visible(pVideoWindow
, pVisible
);
4257 LeaveCriticalSection(&This
->cs
);
4262 static HRESULT WINAPI
VideoWindow_put_Left(IVideoWindow
*iface
, LONG Left
)
4264 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4265 IVideoWindow
*pVideoWindow
;
4268 TRACE("(%p/%p)->(%d)\n", This
, iface
, Left
);
4270 EnterCriticalSection(&This
->cs
);
4272 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4275 hr
= IVideoWindow_put_Left(pVideoWindow
, Left
);
4277 LeaveCriticalSection(&This
->cs
);
4282 static HRESULT WINAPI
VideoWindow_get_Left(IVideoWindow
*iface
, LONG
*pLeft
)
4284 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4285 IVideoWindow
*pVideoWindow
;
4288 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
4290 EnterCriticalSection(&This
->cs
);
4292 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4295 hr
= IVideoWindow_get_Left(pVideoWindow
, pLeft
);
4297 LeaveCriticalSection(&This
->cs
);
4302 static HRESULT WINAPI
VideoWindow_put_Width(IVideoWindow
*iface
, LONG Width
)
4304 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4305 IVideoWindow
*pVideoWindow
;
4308 TRACE("(%p/%p)->(%d)\n", This
, iface
, Width
);
4310 EnterCriticalSection(&This
->cs
);
4312 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4315 hr
= IVideoWindow_put_Width(pVideoWindow
, Width
);
4317 LeaveCriticalSection(&This
->cs
);
4322 static HRESULT WINAPI
VideoWindow_get_Width(IVideoWindow
*iface
, LONG
*pWidth
)
4324 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4325 IVideoWindow
*pVideoWindow
;
4328 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
4330 EnterCriticalSection(&This
->cs
);
4332 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4335 hr
= IVideoWindow_get_Width(pVideoWindow
, pWidth
);
4337 LeaveCriticalSection(&This
->cs
);
4342 static HRESULT WINAPI
VideoWindow_put_Top(IVideoWindow
*iface
, LONG Top
)
4344 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4345 IVideoWindow
*pVideoWindow
;
4348 TRACE("(%p/%p)->(%d)\n", This
, iface
, Top
);
4350 EnterCriticalSection(&This
->cs
);
4352 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4355 hr
= IVideoWindow_put_Top(pVideoWindow
, Top
);
4357 LeaveCriticalSection(&This
->cs
);
4362 static HRESULT WINAPI
VideoWindow_get_Top(IVideoWindow
*iface
, LONG
*pTop
)
4364 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4365 IVideoWindow
*pVideoWindow
;
4368 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
4370 EnterCriticalSection(&This
->cs
);
4372 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4375 hr
= IVideoWindow_get_Top(pVideoWindow
, pTop
);
4377 LeaveCriticalSection(&This
->cs
);
4382 static HRESULT WINAPI
VideoWindow_put_Height(IVideoWindow
*iface
, LONG Height
)
4384 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4385 IVideoWindow
*pVideoWindow
;
4388 TRACE("(%p/%p)->(%d)\n", This
, iface
, Height
);
4390 EnterCriticalSection(&This
->cs
);
4392 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4395 hr
= IVideoWindow_put_Height(pVideoWindow
, Height
);
4397 LeaveCriticalSection(&This
->cs
);
4402 static HRESULT WINAPI
VideoWindow_get_Height(IVideoWindow
*iface
, LONG
*pHeight
)
4404 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4405 IVideoWindow
*pVideoWindow
;
4408 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
4410 EnterCriticalSection(&This
->cs
);
4412 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4415 hr
= IVideoWindow_get_Height(pVideoWindow
, pHeight
);
4417 LeaveCriticalSection(&This
->cs
);
4422 static HRESULT WINAPI
VideoWindow_put_Owner(IVideoWindow
*iface
, OAHWND Owner
)
4424 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4425 IVideoWindow
*pVideoWindow
;
4428 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
4430 EnterCriticalSection(&This
->cs
);
4432 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4435 hr
= IVideoWindow_put_Owner(pVideoWindow
, Owner
);
4437 LeaveCriticalSection(&This
->cs
);
4442 static HRESULT WINAPI
VideoWindow_get_Owner(IVideoWindow
*iface
, OAHWND
*Owner
)
4444 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4445 IVideoWindow
*pVideoWindow
;
4448 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
4450 EnterCriticalSection(&This
->cs
);
4452 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4455 hr
= IVideoWindow_get_Owner(pVideoWindow
, Owner
);
4457 LeaveCriticalSection(&This
->cs
);
4462 static HRESULT WINAPI
VideoWindow_put_MessageDrain(IVideoWindow
*iface
, OAHWND Drain
)
4464 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4465 IVideoWindow
*pVideoWindow
;
4468 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
4470 EnterCriticalSection(&This
->cs
);
4472 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4475 hr
= IVideoWindow_put_MessageDrain(pVideoWindow
, Drain
);
4477 LeaveCriticalSection(&This
->cs
);
4482 static HRESULT WINAPI
VideoWindow_get_MessageDrain(IVideoWindow
*iface
, OAHWND
*Drain
)
4484 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4485 IVideoWindow
*pVideoWindow
;
4488 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
4490 EnterCriticalSection(&This
->cs
);
4492 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4495 hr
= IVideoWindow_get_MessageDrain(pVideoWindow
, Drain
);
4497 LeaveCriticalSection(&This
->cs
);
4502 static HRESULT WINAPI
VideoWindow_get_BorderColor(IVideoWindow
*iface
, LONG
*Color
)
4504 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4505 IVideoWindow
*pVideoWindow
;
4508 TRACE("(%p/%p)->(%p)\n", This
, iface
, Color
);
4510 EnterCriticalSection(&This
->cs
);
4512 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4515 hr
= IVideoWindow_get_BorderColor(pVideoWindow
, Color
);
4517 LeaveCriticalSection(&This
->cs
);
4522 static HRESULT WINAPI
VideoWindow_put_BorderColor(IVideoWindow
*iface
, LONG Color
)
4524 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4525 IVideoWindow
*pVideoWindow
;
4528 TRACE("(%p/%p)->(%d)\n", This
, iface
, Color
);
4530 EnterCriticalSection(&This
->cs
);
4532 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4535 hr
= IVideoWindow_put_BorderColor(pVideoWindow
, Color
);
4537 LeaveCriticalSection(&This
->cs
);
4542 static HRESULT WINAPI
VideoWindow_get_FullScreenMode(IVideoWindow
*iface
, LONG
*FullScreenMode
)
4544 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4545 IVideoWindow
*pVideoWindow
;
4548 TRACE("(%p/%p)->(%p)\n", This
, iface
, FullScreenMode
);
4550 EnterCriticalSection(&This
->cs
);
4552 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4555 hr
= IVideoWindow_get_FullScreenMode(pVideoWindow
, FullScreenMode
);
4557 LeaveCriticalSection(&This
->cs
);
4562 static HRESULT WINAPI
VideoWindow_put_FullScreenMode(IVideoWindow
*iface
, LONG FullScreenMode
)
4564 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4565 IVideoWindow
*pVideoWindow
;
4568 TRACE("(%p/%p)->(%d)\n", This
, iface
, FullScreenMode
);
4570 EnterCriticalSection(&This
->cs
);
4572 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4575 hr
= IVideoWindow_put_FullScreenMode(pVideoWindow
, FullScreenMode
);
4577 LeaveCriticalSection(&This
->cs
);
4582 static HRESULT WINAPI
VideoWindow_SetWindowForeground(IVideoWindow
*iface
, LONG Focus
)
4584 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4585 IVideoWindow
*pVideoWindow
;
4588 TRACE("(%p/%p)->(%d)\n", This
, iface
, Focus
);
4590 EnterCriticalSection(&This
->cs
);
4592 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4595 hr
= IVideoWindow_SetWindowForeground(pVideoWindow
, Focus
);
4597 LeaveCriticalSection(&This
->cs
);
4602 static HRESULT WINAPI
VideoWindow_NotifyOwnerMessage(IVideoWindow
*iface
, OAHWND hwnd
, LONG uMsg
,
4603 LONG_PTR wParam
, LONG_PTR lParam
)
4605 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4606 IVideoWindow
*pVideoWindow
;
4609 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This
, iface
, hwnd
, uMsg
, wParam
, lParam
);
4611 EnterCriticalSection(&This
->cs
);
4613 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4616 hr
= IVideoWindow_NotifyOwnerMessage(pVideoWindow
, hwnd
, uMsg
, wParam
, lParam
);
4618 LeaveCriticalSection(&This
->cs
);
4623 static HRESULT WINAPI
VideoWindow_SetWindowPosition(IVideoWindow
*iface
, LONG Left
, LONG Top
,
4624 LONG Width
, LONG Height
)
4626 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4627 IVideoWindow
*pVideoWindow
;
4630 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
4632 EnterCriticalSection(&This
->cs
);
4634 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4637 hr
= IVideoWindow_SetWindowPosition(pVideoWindow
, Left
, Top
, Width
, Height
);
4639 LeaveCriticalSection(&This
->cs
);
4644 static HRESULT WINAPI
VideoWindow_GetWindowPosition(IVideoWindow
*iface
, LONG
*pLeft
, LONG
*pTop
,
4645 LONG
*pWidth
, LONG
*pHeight
)
4647 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4648 IVideoWindow
*pVideoWindow
;
4651 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
4653 EnterCriticalSection(&This
->cs
);
4655 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4658 hr
= IVideoWindow_GetWindowPosition(pVideoWindow
, pLeft
, pTop
, pWidth
, pHeight
);
4660 LeaveCriticalSection(&This
->cs
);
4665 static HRESULT WINAPI
VideoWindow_GetMinIdealImageSize(IVideoWindow
*iface
, LONG
*pWidth
,
4668 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4669 IVideoWindow
*pVideoWindow
;
4672 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
4674 EnterCriticalSection(&This
->cs
);
4676 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4679 hr
= IVideoWindow_GetMinIdealImageSize(pVideoWindow
, pWidth
, pHeight
);
4681 LeaveCriticalSection(&This
->cs
);
4686 static HRESULT WINAPI
VideoWindow_GetMaxIdealImageSize(IVideoWindow
*iface
, LONG
*pWidth
,
4689 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4690 IVideoWindow
*pVideoWindow
;
4693 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
4695 EnterCriticalSection(&This
->cs
);
4697 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4700 hr
= IVideoWindow_GetMaxIdealImageSize(pVideoWindow
, pWidth
, pHeight
);
4702 LeaveCriticalSection(&This
->cs
);
4707 static HRESULT WINAPI
VideoWindow_GetRestorePosition(IVideoWindow
*iface
, LONG
*pLeft
, LONG
*pTop
,
4708 LONG
*pWidth
, LONG
*pHeight
)
4710 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4711 IVideoWindow
*pVideoWindow
;
4714 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
4716 EnterCriticalSection(&This
->cs
);
4718 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4721 hr
= IVideoWindow_GetRestorePosition(pVideoWindow
, pLeft
, pTop
, pWidth
, pHeight
);
4723 LeaveCriticalSection(&This
->cs
);
4728 static HRESULT WINAPI
VideoWindow_HideCursor(IVideoWindow
*iface
, LONG HideCursor
)
4730 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4731 IVideoWindow
*pVideoWindow
;
4734 TRACE("(%p/%p)->(%d)\n", This
, iface
, HideCursor
);
4736 EnterCriticalSection(&This
->cs
);
4738 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4741 hr
= IVideoWindow_HideCursor(pVideoWindow
, HideCursor
);
4743 LeaveCriticalSection(&This
->cs
);
4748 static HRESULT WINAPI
VideoWindow_IsCursorHidden(IVideoWindow
*iface
, LONG
*CursorHidden
)
4750 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4751 IVideoWindow
*pVideoWindow
;
4754 TRACE("(%p/%p)->(%p)\n", This
, iface
, CursorHidden
);
4756 EnterCriticalSection(&This
->cs
);
4758 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4761 hr
= IVideoWindow_IsCursorHidden(pVideoWindow
, CursorHidden
);
4763 LeaveCriticalSection(&This
->cs
);
4769 static const IVideoWindowVtbl IVideoWindow_VTable
=
4771 VideoWindow_QueryInterface
,
4773 VideoWindow_Release
,
4774 VideoWindow_GetTypeInfoCount
,
4775 VideoWindow_GetTypeInfo
,
4776 VideoWindow_GetIDsOfNames
,
4778 VideoWindow_put_Caption
,
4779 VideoWindow_get_Caption
,
4780 VideoWindow_put_WindowStyle
,
4781 VideoWindow_get_WindowStyle
,
4782 VideoWindow_put_WindowStyleEx
,
4783 VideoWindow_get_WindowStyleEx
,
4784 VideoWindow_put_AutoShow
,
4785 VideoWindow_get_AutoShow
,
4786 VideoWindow_put_WindowState
,
4787 VideoWindow_get_WindowState
,
4788 VideoWindow_put_BackgroundPalette
,
4789 VideoWindow_get_BackgroundPalette
,
4790 VideoWindow_put_Visible
,
4791 VideoWindow_get_Visible
,
4792 VideoWindow_put_Left
,
4793 VideoWindow_get_Left
,
4794 VideoWindow_put_Width
,
4795 VideoWindow_get_Width
,
4796 VideoWindow_put_Top
,
4797 VideoWindow_get_Top
,
4798 VideoWindow_put_Height
,
4799 VideoWindow_get_Height
,
4800 VideoWindow_put_Owner
,
4801 VideoWindow_get_Owner
,
4802 VideoWindow_put_MessageDrain
,
4803 VideoWindow_get_MessageDrain
,
4804 VideoWindow_get_BorderColor
,
4805 VideoWindow_put_BorderColor
,
4806 VideoWindow_get_FullScreenMode
,
4807 VideoWindow_put_FullScreenMode
,
4808 VideoWindow_SetWindowForeground
,
4809 VideoWindow_NotifyOwnerMessage
,
4810 VideoWindow_SetWindowPosition
,
4811 VideoWindow_GetWindowPosition
,
4812 VideoWindow_GetMinIdealImageSize
,
4813 VideoWindow_GetMaxIdealImageSize
,
4814 VideoWindow_GetRestorePosition
,
4815 VideoWindow_HideCursor
,
4816 VideoWindow_IsCursorHidden
4819 static inline IFilterGraphImpl
*impl_from_IMediaEventEx(IMediaEventEx
*iface
)
4821 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaEventEx_iface
);
4824 static HRESULT WINAPI
MediaEvent_QueryInterface(IMediaEventEx
*iface
, REFIID riid
, void **ppvObj
)
4826 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4828 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
4830 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
4833 static ULONG WINAPI
MediaEvent_AddRef(IMediaEventEx
*iface
)
4835 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4837 TRACE("(%p/%p)->()\n", This
, iface
);
4839 return Filtergraph_AddRef(This
);
4842 static ULONG WINAPI
MediaEvent_Release(IMediaEventEx
*iface
)
4844 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4846 TRACE("(%p/%p)->()\n", This
, iface
);
4848 return Filtergraph_Release(This
);
4851 /*** IDispatch methods ***/
4852 static HRESULT WINAPI
MediaEvent_GetTypeInfoCount(IMediaEventEx
*iface
, UINT
*pctinfo
)
4854 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4856 TRACE("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
4861 static HRESULT WINAPI
MediaEvent_GetTypeInfo(IMediaEventEx
*iface
, UINT iTInfo
, LCID lcid
,
4862 ITypeInfo
**ppTInfo
)
4864 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4866 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
4871 static HRESULT WINAPI
MediaEvent_GetIDsOfNames(IMediaEventEx
*iface
, REFIID riid
,
4872 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4874 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4876 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
4881 static HRESULT WINAPI
MediaEvent_Invoke(IMediaEventEx
*iface
, DISPID dispIdMember
, REFIID riid
,
4882 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
4885 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4887 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
4892 /*** IMediaEvent methods ***/
4893 static HRESULT WINAPI
MediaEvent_GetEventHandle(IMediaEventEx
*iface
, OAEVENT
*hEvent
)
4895 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4897 TRACE("(%p/%p)->(%p)\n", This
, iface
, hEvent
);
4899 *hEvent
= (OAEVENT
)This
->evqueue
.msg_event
;
4904 static HRESULT WINAPI
MediaEvent_GetEvent(IMediaEventEx
*iface
, LONG
*lEventCode
, LONG_PTR
*lParam1
,
4905 LONG_PTR
*lParam2
, LONG msTimeout
)
4907 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4910 TRACE("(%p/%p)->(%p, %p, %p, %d)\n", This
, iface
, lEventCode
, lParam1
, lParam2
, msTimeout
);
4912 if (EventsQueue_GetEvent(&This
->evqueue
, &evt
, msTimeout
))
4914 *lEventCode
= evt
.lEventCode
;
4915 *lParam1
= evt
.lParam1
;
4916 *lParam2
= evt
.lParam2
;
4924 static HRESULT WINAPI
MediaEvent_WaitForCompletion(IMediaEventEx
*iface
, LONG msTimeout
,
4927 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4929 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, msTimeout
, pEvCode
);
4931 if (This
->state
!= State_Running
)
4932 return VFW_E_WRONG_STATE
;
4934 if (WaitForSingleObject(This
->hEventCompletion
, msTimeout
) == WAIT_OBJECT_0
)
4936 *pEvCode
= This
->CompletionStatus
;
4944 static HRESULT WINAPI
MediaEvent_CancelDefaultHandling(IMediaEventEx
*iface
, LONG lEvCode
)
4946 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4948 TRACE("(%p/%p)->(%d)\n", This
, iface
, lEvCode
);
4950 if (lEvCode
== EC_COMPLETE
)
4951 This
->HandleEcComplete
= FALSE
;
4952 else if (lEvCode
== EC_REPAINT
)
4953 This
->HandleEcRepaint
= FALSE
;
4954 else if (lEvCode
== EC_CLOCK_CHANGED
)
4955 This
->HandleEcClockChanged
= FALSE
;
4962 static HRESULT WINAPI
MediaEvent_RestoreDefaultHandling(IMediaEventEx
*iface
, LONG lEvCode
)
4964 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4966 TRACE("(%p/%p)->(%d)\n", This
, iface
, lEvCode
);
4968 if (lEvCode
== EC_COMPLETE
)
4969 This
->HandleEcComplete
= TRUE
;
4970 else if (lEvCode
== EC_REPAINT
)
4971 This
->HandleEcRepaint
= TRUE
;
4972 else if (lEvCode
== EC_CLOCK_CHANGED
)
4973 This
->HandleEcClockChanged
= TRUE
;
4980 static HRESULT WINAPI
MediaEvent_FreeEventParams(IMediaEventEx
*iface
, LONG lEvCode
,
4981 LONG_PTR lParam1
, LONG_PTR lParam2
)
4983 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4985 TRACE("(%p/%p)->(%d, %08lx, %08lx): stub !!!\n", This
, iface
, lEvCode
, lParam1
, lParam2
);
4990 /*** IMediaEventEx methods ***/
4991 static HRESULT WINAPI
MediaEvent_SetNotifyWindow(IMediaEventEx
*iface
, OAHWND hwnd
, LONG lMsg
,
4992 LONG_PTR lInstanceData
)
4994 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4996 TRACE("(%p/%p)->(%08lx, %d, %08lx)\n", This
, iface
, hwnd
, lMsg
, lInstanceData
);
4998 This
->notif
.hWnd
= (HWND
)hwnd
;
4999 This
->notif
.msg
= lMsg
;
5000 This
->notif
.instance
= lInstanceData
;
5005 static HRESULT WINAPI
MediaEvent_SetNotifyFlags(IMediaEventEx
*iface
, LONG lNoNotifyFlags
)
5007 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
5009 TRACE("(%p/%p)->(%d)\n", This
, iface
, lNoNotifyFlags
);
5011 if ((lNoNotifyFlags
!= 0) && (lNoNotifyFlags
!= 1))
5012 return E_INVALIDARG
;
5014 This
->notif
.disabled
= lNoNotifyFlags
;
5019 static HRESULT WINAPI
MediaEvent_GetNotifyFlags(IMediaEventEx
*iface
, LONG
*lplNoNotifyFlags
)
5021 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
5023 TRACE("(%p/%p)->(%p)\n", This
, iface
, lplNoNotifyFlags
);
5025 if (!lplNoNotifyFlags
)
5028 *lplNoNotifyFlags
= This
->notif
.disabled
;
5034 static const IMediaEventExVtbl IMediaEventEx_VTable
=
5036 MediaEvent_QueryInterface
,
5039 MediaEvent_GetTypeInfoCount
,
5040 MediaEvent_GetTypeInfo
,
5041 MediaEvent_GetIDsOfNames
,
5043 MediaEvent_GetEventHandle
,
5044 MediaEvent_GetEvent
,
5045 MediaEvent_WaitForCompletion
,
5046 MediaEvent_CancelDefaultHandling
,
5047 MediaEvent_RestoreDefaultHandling
,
5048 MediaEvent_FreeEventParams
,
5049 MediaEvent_SetNotifyWindow
,
5050 MediaEvent_SetNotifyFlags
,
5051 MediaEvent_GetNotifyFlags
5055 static inline IFilterGraphImpl
*impl_from_IMediaFilter(IMediaFilter
*iface
)
5057 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaFilter_iface
);
5060 static HRESULT WINAPI
MediaFilter_QueryInterface(IMediaFilter
*iface
, REFIID riid
, void **ppv
)
5062 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5064 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5067 static ULONG WINAPI
MediaFilter_AddRef(IMediaFilter
*iface
)
5069 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5071 return Filtergraph_AddRef(This
);
5074 static ULONG WINAPI
MediaFilter_Release(IMediaFilter
*iface
)
5076 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5078 return Filtergraph_Release(This
);
5081 static HRESULT WINAPI
MediaFilter_GetClassID(IMediaFilter
*iface
, CLSID
* pClassID
)
5083 FIXME("(%p): stub\n", pClassID
);
5088 static HRESULT WINAPI
MediaFilter_Stop(IMediaFilter
*iface
)
5090 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5092 return MediaControl_Stop(&This
->IMediaControl_iface
);
5095 static HRESULT WINAPI
MediaFilter_Pause(IMediaFilter
*iface
)
5097 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5099 return MediaControl_Pause(&This
->IMediaControl_iface
);
5102 static HRESULT WINAPI
MediaFilter_Run(IMediaFilter
*iface
, REFERENCE_TIME tStart
)
5104 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5107 FIXME("Run called with non-null tStart: %x%08x\n",
5108 (int)(tStart
>>32), (int)tStart
);
5110 return MediaControl_Run(&This
->IMediaControl_iface
);
5113 static HRESULT WINAPI
MediaFilter_GetState(IMediaFilter
*iface
, DWORD dwMsTimeout
,
5114 FILTER_STATE
*pState
)
5116 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5118 return MediaControl_GetState(&This
->IMediaControl_iface
, dwMsTimeout
, (OAFilterState
*)pState
);
5121 static HRESULT WINAPI
MediaFilter_SetSyncSource(IMediaFilter
*iface
, IReferenceClock
*pClock
)
5123 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5127 TRACE("(%p/%p)->(%p)\n", iface
, This
, pClock
);
5129 EnterCriticalSection(&This
->cs
);
5131 for (i
= 0;i
< This
->nFilters
;i
++)
5133 hr
= IBaseFilter_SetSyncSource(This
->ppFiltersInGraph
[i
], pClock
);
5141 IBaseFilter_SetSyncSource(This
->ppFiltersInGraph
[i
], This
->refClock
);
5146 IReferenceClock_Release(This
->refClock
);
5147 This
->refClock
= pClock
;
5149 IReferenceClock_AddRef(This
->refClock
);
5150 This
->defaultclock
= FALSE
;
5152 if (This
->HandleEcClockChanged
)
5154 IMediaEventSink
*pEventSink
;
5157 eshr
= IMediaFilter_QueryInterface(iface
, &IID_IMediaEventSink
, (LPVOID
)&pEventSink
);
5158 if (SUCCEEDED(eshr
))
5160 IMediaEventSink_Notify(pEventSink
, EC_CLOCK_CHANGED
, 0, 0);
5161 IMediaEventSink_Release(pEventSink
);
5166 LeaveCriticalSection(&This
->cs
);
5171 static HRESULT WINAPI
MediaFilter_GetSyncSource(IMediaFilter
*iface
, IReferenceClock
**ppClock
)
5173 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5175 TRACE("(%p/%p)->(%p)\n", iface
, This
, ppClock
);
5180 EnterCriticalSection(&This
->cs
);
5182 *ppClock
= This
->refClock
;
5184 IReferenceClock_AddRef(*ppClock
);
5186 LeaveCriticalSection(&This
->cs
);
5191 static const IMediaFilterVtbl IMediaFilter_VTable
=
5193 MediaFilter_QueryInterface
,
5195 MediaFilter_Release
,
5196 MediaFilter_GetClassID
,
5200 MediaFilter_GetState
,
5201 MediaFilter_SetSyncSource
,
5202 MediaFilter_GetSyncSource
5205 static inline IFilterGraphImpl
*impl_from_IMediaEventSink(IMediaEventSink
*iface
)
5207 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaEventSink_iface
);
5210 static HRESULT WINAPI
MediaEventSink_QueryInterface(IMediaEventSink
*iface
, REFIID riid
, void **ppv
)
5212 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5214 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5217 static ULONG WINAPI
MediaEventSink_AddRef(IMediaEventSink
*iface
)
5219 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5221 return Filtergraph_AddRef(This
);
5224 static ULONG WINAPI
MediaEventSink_Release(IMediaEventSink
*iface
)
5226 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5228 return Filtergraph_Release(This
);
5231 static HRESULT WINAPI
MediaEventSink_Notify(IMediaEventSink
*iface
, LONG EventCode
,
5232 LONG_PTR EventParam1
, LONG_PTR EventParam2
)
5234 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5237 TRACE("(%p/%p)->(%d, %ld, %ld)\n", This
, iface
, EventCode
, EventParam1
, EventParam2
);
5239 /* We need thread safety here, let's use the events queue's one */
5240 EnterCriticalSection(&This
->evqueue
.msg_crst
);
5242 if ((EventCode
== EC_COMPLETE
) && This
->HandleEcComplete
)
5244 TRACE("Process EC_COMPLETE notification\n");
5245 if (++This
->EcCompleteCount
== This
->nRenderers
)
5247 evt
.lEventCode
= EC_COMPLETE
;
5250 TRACE("Send EC_COMPLETE to app\n");
5251 EventsQueue_PutEvent(&This
->evqueue
, &evt
);
5252 if (!This
->notif
.disabled
&& This
->notif
.hWnd
)
5254 TRACE("Send Window message\n");
5255 PostMessageW(This
->notif
.hWnd
, This
->notif
.msg
, 0, This
->notif
.instance
);
5257 This
->CompletionStatus
= EC_COMPLETE
;
5258 SetEvent(This
->hEventCompletion
);
5261 else if ((EventCode
== EC_REPAINT
) && This
->HandleEcRepaint
)
5263 /* FIXME: Not handled yet */
5267 evt
.lEventCode
= EventCode
;
5268 evt
.lParam1
= EventParam1
;
5269 evt
.lParam2
= EventParam2
;
5270 EventsQueue_PutEvent(&This
->evqueue
, &evt
);
5271 if (!This
->notif
.disabled
&& This
->notif
.hWnd
)
5272 PostMessageW(This
->notif
.hWnd
, This
->notif
.msg
, 0, This
->notif
.instance
);
5275 LeaveCriticalSection(&This
->evqueue
.msg_crst
);
5279 static const IMediaEventSinkVtbl IMediaEventSink_VTable
=
5281 MediaEventSink_QueryInterface
,
5282 MediaEventSink_AddRef
,
5283 MediaEventSink_Release
,
5284 MediaEventSink_Notify
5287 static inline IFilterGraphImpl
*impl_from_IGraphConfig(IGraphConfig
*iface
)
5289 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IGraphConfig_iface
);
5292 static HRESULT WINAPI
GraphConfig_QueryInterface(IGraphConfig
*iface
, REFIID riid
, void **ppv
)
5294 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5296 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5299 static ULONG WINAPI
GraphConfig_AddRef(IGraphConfig
*iface
)
5301 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5303 return Filtergraph_AddRef(This
);
5306 static ULONG WINAPI
GraphConfig_Release(IGraphConfig
*iface
)
5308 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5310 return Filtergraph_Release(This
);
5313 static HRESULT WINAPI
GraphConfig_Reconnect(IGraphConfig
*iface
, IPin
*pOutputPin
, IPin
*pInputPin
,
5314 const AM_MEDIA_TYPE
*pmtFirstConnection
, IBaseFilter
*pUsingFilter
, HANDLE hAbortEvent
,
5317 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5319 FIXME("(%p)->(%p, %p, %p, %p, %p, %x): stub!\n", This
, pOutputPin
, pInputPin
, pmtFirstConnection
, pUsingFilter
, hAbortEvent
, dwFlags
);
5324 static HRESULT WINAPI
GraphConfig_Reconfigure(IGraphConfig
*iface
, IGraphConfigCallback
*pCallback
,
5325 void *pvContext
, DWORD dwFlags
, HANDLE hAbortEvent
)
5327 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5330 WARN("(%p)->(%p, %p, %x, %p): partial stub!\n", This
, pCallback
, pvContext
, dwFlags
, hAbortEvent
);
5333 FIXME("The parameter hAbortEvent is not handled!\n");
5335 EnterCriticalSection(&This
->cs
);
5337 hr
= IGraphConfigCallback_Reconfigure(pCallback
, pvContext
, dwFlags
);
5339 LeaveCriticalSection(&This
->cs
);
5344 static HRESULT WINAPI
GraphConfig_AddFilterToCache(IGraphConfig
*iface
, IBaseFilter
*pFilter
)
5346 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5348 FIXME("(%p)->(%p): stub!\n", This
, pFilter
);
5353 static HRESULT WINAPI
GraphConfig_EnumCacheFilter(IGraphConfig
*iface
, IEnumFilters
**pEnum
)
5355 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5357 FIXME("(%p)->(%p): stub!\n", This
, pEnum
);
5362 static HRESULT WINAPI
GraphConfig_RemoveFilterFromCache(IGraphConfig
*iface
, IBaseFilter
*pFilter
)
5364 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5366 FIXME("(%p)->(%p): stub!\n", This
, pFilter
);
5371 static HRESULT WINAPI
GraphConfig_GetStartTime(IGraphConfig
*iface
, REFERENCE_TIME
*prtStart
)
5373 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5375 FIXME("(%p)->(%p): stub!\n", This
, prtStart
);
5380 static HRESULT WINAPI
GraphConfig_PushThroughData(IGraphConfig
*iface
, IPin
*pOutputPin
,
5381 IPinConnection
*pConnection
, HANDLE hEventAbort
)
5383 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5385 FIXME("(%p)->(%p, %p, %p): stub!\n", This
, pOutputPin
, pConnection
, hEventAbort
);
5390 static HRESULT WINAPI
GraphConfig_SetFilterFlags(IGraphConfig
*iface
, IBaseFilter
*pFilter
,
5393 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5395 FIXME("(%p)->(%p, %x): stub!\n", This
, pFilter
, dwFlags
);
5400 static HRESULT WINAPI
GraphConfig_GetFilterFlags(IGraphConfig
*iface
, IBaseFilter
*pFilter
,
5403 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5405 FIXME("(%p)->(%p, %p): stub!\n", This
, pFilter
, dwFlags
);
5410 static HRESULT WINAPI
GraphConfig_RemoveFilterEx(IGraphConfig
*iface
, IBaseFilter
*pFilter
,
5413 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5415 FIXME("(%p)->(%p, %x): stub!\n", This
, pFilter
, dwFlags
);
5420 static const IGraphConfigVtbl IGraphConfig_VTable
=
5422 GraphConfig_QueryInterface
,
5424 GraphConfig_Release
,
5425 GraphConfig_Reconnect
,
5426 GraphConfig_Reconfigure
,
5427 GraphConfig_AddFilterToCache
,
5428 GraphConfig_EnumCacheFilter
,
5429 GraphConfig_RemoveFilterFromCache
,
5430 GraphConfig_GetStartTime
,
5431 GraphConfig_PushThroughData
,
5432 GraphConfig_SetFilterFlags
,
5433 GraphConfig_GetFilterFlags
,
5434 GraphConfig_RemoveFilterEx
5437 static const IUnknownVtbl IInner_VTable
=
5439 FilterGraphInner_QueryInterface
,
5440 FilterGraphInner_AddRef
,
5441 FilterGraphInner_Release
5444 static HRESULT
Filtergraph_QueryInterface(IFilterGraphImpl
*This
,
5447 if (This
->bAggregatable
)
5448 This
->bUnkOuterValid
= TRUE
;
5450 if (This
->pUnkOuter
)
5452 if (This
->bAggregatable
)
5453 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
5455 if (IsEqualIID(riid
, &IID_IUnknown
))
5459 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
5460 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
5461 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
5462 This
->bAggregatable
= TRUE
;
5467 return E_NOINTERFACE
;
5470 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
5473 static ULONG
Filtergraph_AddRef(IFilterGraphImpl
*This
) {
5474 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
5475 return IUnknown_AddRef(This
->pUnkOuter
);
5476 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
5479 static ULONG
Filtergraph_Release(IFilterGraphImpl
*This
) {
5480 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
5481 return IUnknown_Release(This
->pUnkOuter
);
5482 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
5485 /* This is the only function that actually creates a FilterGraph class... */
5486 HRESULT
FilterGraph_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
5488 IFilterGraphImpl
*fimpl
;
5491 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
5495 fimpl
= CoTaskMemAlloc(sizeof(*fimpl
));
5496 fimpl
->pUnkOuter
= pUnkOuter
;
5497 fimpl
->bUnkOuterValid
= FALSE
;
5498 fimpl
->bAggregatable
= FALSE
;
5499 fimpl
->defaultclock
= TRUE
;
5500 fimpl
->IInner_vtbl
= &IInner_VTable
;
5501 fimpl
->IFilterGraph2_iface
.lpVtbl
= &IFilterGraph2_VTable
;
5502 fimpl
->IMediaControl_iface
.lpVtbl
= &IMediaControl_VTable
;
5503 fimpl
->IMediaSeeking_iface
.lpVtbl
= &IMediaSeeking_VTable
;
5504 fimpl
->IBasicAudio_iface
.lpVtbl
= &IBasicAudio_VTable
;
5505 fimpl
->IBasicVideo2_iface
.lpVtbl
= &IBasicVideo_VTable
;
5506 fimpl
->IVideoWindow_iface
.lpVtbl
= &IVideoWindow_VTable
;
5507 fimpl
->IMediaEventEx_iface
.lpVtbl
= &IMediaEventEx_VTable
;
5508 fimpl
->IMediaFilter_iface
.lpVtbl
= &IMediaFilter_VTable
;
5509 fimpl
->IMediaEventSink_iface
.lpVtbl
= &IMediaEventSink_VTable
;
5510 fimpl
->IGraphConfig_iface
.lpVtbl
= &IGraphConfig_VTable
;
5511 fimpl
->IMediaPosition_iface
.lpVtbl
= &IMediaPosition_VTable
;
5513 fimpl
->ppFiltersInGraph
= NULL
;
5514 fimpl
->pFilterNames
= NULL
;
5515 fimpl
->nFilters
= 0;
5516 fimpl
->filterCapacity
= 0;
5517 fimpl
->nameIndex
= 1;
5518 fimpl
->refClock
= NULL
;
5519 fimpl
->hEventCompletion
= CreateEventW(0, TRUE
, FALSE
, 0);
5520 fimpl
->HandleEcComplete
= TRUE
;
5521 fimpl
->HandleEcRepaint
= TRUE
;
5522 fimpl
->HandleEcClockChanged
= TRUE
;
5523 fimpl
->notif
.hWnd
= 0;
5524 fimpl
->notif
.disabled
= FALSE
;
5525 fimpl
->nRenderers
= 0;
5526 fimpl
->EcCompleteCount
= 0;
5527 fimpl
->refClockProvider
= NULL
;
5528 fimpl
->state
= State_Stopped
;
5529 EventsQueue_Init(&fimpl
->evqueue
);
5530 InitializeCriticalSection(&fimpl
->cs
);
5531 fimpl
->cs
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": IFilterGraphImpl.cs");
5532 fimpl
->nItfCacheEntries
= 0;
5533 memcpy(&fimpl
->timeformatseek
, &TIME_FORMAT_MEDIA_TIME
, sizeof(GUID
));
5534 fimpl
->start_time
= fimpl
->pause_time
= 0;
5535 fimpl
->stop_position
= -1;
5536 fimpl
->punkFilterMapper2
= NULL
;
5537 fimpl
->recursioncount
= 0;
5539 /* create Filtermapper aggregated. */
5540 hr
= CoCreateInstance(&CLSID_FilterMapper2
, pUnkOuter
? pUnkOuter
: (IUnknown
*)&fimpl
->IInner_vtbl
, CLSCTX_INPROC_SERVER
,
5541 &IID_IUnknown
, (LPVOID
*)&fimpl
->punkFilterMapper2
);
5543 if (SUCCEEDED(hr
)) {
5544 hr
= IUnknown_QueryInterface(fimpl
->punkFilterMapper2
, &IID_IFilterMapper2
, (LPVOID
*)&fimpl
->pFilterMapper2
);
5547 if (SUCCEEDED(hr
)) {
5548 /* Release controlling IUnknown - compensate refcount increase from caching IFilterMapper2 interface. */
5549 if (pUnkOuter
) IUnknown_Release(pUnkOuter
);
5550 else IUnknown_Release((IUnknown
*)&fimpl
->IInner_vtbl
);
5554 ERR("Unable to create filter mapper (%x)\n", hr
);
5555 if (fimpl
->punkFilterMapper2
) IUnknown_Release(fimpl
->punkFilterMapper2
);
5556 CloseHandle(fimpl
->hEventCompletion
);
5557 EventsQueue_Destroy(&fimpl
->evqueue
);
5558 fimpl
->cs
.DebugInfo
->Spare
[0] = 0;
5559 DeleteCriticalSection(&fimpl
->cs
);
5560 CoTaskMemFree(fimpl
);
5568 HRESULT
FilterGraphNoThread_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
5570 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
5571 return FilterGraph_create(pUnkOuter
, ppObj
);