1 /* DirectShow FilterGraph object (QUARTZ.DLL)
3 * Copyright 2002 Lionel Ulmer
4 * Copyright 2004 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "wine/debug.h"
33 #include "quartz_private.h"
39 #include "wine/unicode.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
45 HWND hWnd
; /* Target window */
46 UINT msg
; /* User window message */
47 LONG_PTR instance
; /* User data */
48 int disabled
; /* Disabled messages posting */
52 LONG lEventCode
; /* Event code */
53 LONG_PTR lParam1
; /* Param1 */
54 LONG_PTR lParam2
; /* Param2 */
57 /* messages ring implementation for queuing events (taken from winmm) */
58 #define EVENTS_RING_BUFFER_INCREMENT 64
64 CRITICAL_SECTION msg_crst
;
65 HANDLE msg_event
; /* Signaled for no empty queue */
68 static int EventsQueue_Init(EventsQueue
* omr
)
72 omr
->msg_event
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
73 omr
->ring_buffer_size
= EVENTS_RING_BUFFER_INCREMENT
;
74 omr
->messages
= CoTaskMemAlloc(omr
->ring_buffer_size
* sizeof(Event
));
75 ZeroMemory(omr
->messages
, omr
->ring_buffer_size
* sizeof(Event
));
77 InitializeCriticalSection(&omr
->msg_crst
);
78 omr
->msg_crst
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": EventsQueue.msg_crst");
82 static int EventsQueue_Destroy(EventsQueue
* omr
)
84 CloseHandle(omr
->msg_event
);
85 CoTaskMemFree(omr
->messages
);
86 omr
->msg_crst
.DebugInfo
->Spare
[0] = 0;
87 DeleteCriticalSection(&omr
->msg_crst
);
91 static int EventsQueue_PutEvent(EventsQueue
* omr
, const Event
* evt
)
93 EnterCriticalSection(&omr
->msg_crst
);
94 if (omr
->msg_toget
== ((omr
->msg_tosave
+ 1) % omr
->ring_buffer_size
))
96 int old_ring_buffer_size
= omr
->ring_buffer_size
;
97 omr
->ring_buffer_size
+= EVENTS_RING_BUFFER_INCREMENT
;
98 TRACE("omr->ring_buffer_size=%d\n",omr
->ring_buffer_size
);
99 omr
->messages
= CoTaskMemRealloc(omr
->messages
, omr
->ring_buffer_size
* sizeof(Event
));
100 /* Now we need to rearrange the ring buffer so that the new
101 buffers just allocated are in between omr->msg_tosave and
104 if (omr
->msg_tosave
< omr
->msg_toget
)
106 memmove(&(omr
->messages
[omr
->msg_toget
+ EVENTS_RING_BUFFER_INCREMENT
]),
107 &(omr
->messages
[omr
->msg_toget
]),
108 sizeof(Event
)*(old_ring_buffer_size
- omr
->msg_toget
)
110 omr
->msg_toget
+= EVENTS_RING_BUFFER_INCREMENT
;
113 omr
->messages
[omr
->msg_tosave
] = *evt
;
114 SetEvent(omr
->msg_event
);
115 omr
->msg_tosave
= (omr
->msg_tosave
+ 1) % omr
->ring_buffer_size
;
116 LeaveCriticalSection(&omr
->msg_crst
);
120 static int EventsQueue_GetEvent(EventsQueue
* omr
, Event
* evt
, LONG msTimeOut
)
122 if (WaitForSingleObject(omr
->msg_event
, msTimeOut
) != WAIT_OBJECT_0
)
125 EnterCriticalSection(&omr
->msg_crst
);
127 if (omr
->msg_toget
== omr
->msg_tosave
) /* buffer empty ? */
129 LeaveCriticalSection(&omr
->msg_crst
);
133 *evt
= omr
->messages
[omr
->msg_toget
];
134 omr
->msg_toget
= (omr
->msg_toget
+ 1) % omr
->ring_buffer_size
;
136 /* Mark the buffer as empty if needed */
137 if (omr
->msg_toget
== omr
->msg_tosave
) /* buffer empty ? */
138 ResetEvent(omr
->msg_event
);
140 LeaveCriticalSection(&omr
->msg_crst
);
144 #define MAX_ITF_CACHE_ENTRIES 3
145 typedef struct _ITF_CACHE_ENTRY
{
151 typedef struct _IFilterGraphImpl
{
152 IFilterGraph2 IFilterGraph2_iface
;
153 IMediaControl IMediaControl_iface
;
154 IMediaSeeking IMediaSeeking_iface
;
155 IBasicAudio IBasicAudio_iface
;
156 IBasicVideo2 IBasicVideo2_iface
;
157 IVideoWindow IVideoWindow_iface
;
158 IMediaEventEx IMediaEventEx_iface
;
159 IMediaFilter IMediaFilter_iface
;
160 IMediaEventSink IMediaEventSink_iface
;
161 IGraphConfig IGraphConfig_iface
;
162 IMediaPosition IMediaPosition_iface
;
163 const IUnknownVtbl
* IInner_vtbl
;
164 /* IAMGraphStreams */
170 /* IRegisterServiceProvider */
171 /* IResourceMananger */
172 /* IServiceProvider */
173 /* IVideoFrameStep */
176 IUnknown
*punkFilterMapper2
;
177 IFilterMapper2
* pFilterMapper2
;
178 IBaseFilter
** ppFiltersInGraph
;
179 LPWSTR
* pFilterNames
;
183 IReferenceClock
*refClock
;
184 IBaseFilter
*refClockProvider
;
186 HANDLE hEventCompletion
;
187 int CompletionStatus
;
191 int HandleEcComplete
;
193 int HandleEcClockChanged
;
196 ITF_CACHE_ENTRY ItfCacheEntries
[MAX_ITF_CACHE_ENTRIES
];
197 int nItfCacheEntries
;
198 IUnknown
* pUnkOuter
;
203 REFERENCE_TIME start_time
;
204 REFERENCE_TIME pause_time
;
205 LONGLONG stop_position
;
209 static HRESULT
Filtergraph_QueryInterface(IFilterGraphImpl
*This
,
210 REFIID riid
, LPVOID
* ppv
);
211 static ULONG
Filtergraph_AddRef(IFilterGraphImpl
*This
);
212 static ULONG
Filtergraph_Release(IFilterGraphImpl
*This
);
214 static HRESULT WINAPI
FilterGraphInner_QueryInterface(IUnknown
* iface
,
217 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
218 TRACE("(%p)->(%s (%p), %p)\n", This
, debugstr_guid(riid
), riid
, ppvObj
);
220 if (This
->bAggregatable
)
221 This
->bUnkOuterValid
= TRUE
;
223 if (IsEqualGUID(&IID_IUnknown
, riid
)) {
224 *ppvObj
= &(This
->IInner_vtbl
);
225 TRACE(" returning IUnknown interface (%p)\n", *ppvObj
);
226 } else if (IsEqualGUID(&IID_IFilterGraph
, riid
) ||
227 IsEqualGUID(&IID_IFilterGraph2
, riid
) ||
228 IsEqualGUID(&IID_IGraphBuilder
, riid
)) {
229 *ppvObj
= &This
->IFilterGraph2_iface
;
230 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj
);
231 } else if (IsEqualGUID(&IID_IMediaControl
, riid
)) {
232 *ppvObj
= &This
->IMediaControl_iface
;
233 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj
);
234 } else if (IsEqualGUID(&IID_IMediaSeeking
, riid
)) {
235 *ppvObj
= &This
->IMediaSeeking_iface
;
236 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj
);
237 } else if (IsEqualGUID(&IID_IBasicAudio
, riid
)) {
238 *ppvObj
= &This
->IBasicAudio_iface
;
239 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj
);
240 } else if (IsEqualGUID(&IID_IBasicVideo
, riid
) ||
241 IsEqualGUID(&IID_IBasicVideo2
, riid
)) {
242 *ppvObj
= &This
->IBasicVideo2_iface
;
243 TRACE(" returning IBasicVideo2 interface (%p)\n", *ppvObj
);
244 } else if (IsEqualGUID(&IID_IVideoWindow
, riid
)) {
245 *ppvObj
= &This
->IVideoWindow_iface
;
246 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj
);
247 } else if (IsEqualGUID(&IID_IMediaEvent
, riid
) ||
248 IsEqualGUID(&IID_IMediaEventEx
, riid
)) {
249 *ppvObj
= &This
->IMediaEventEx_iface
;
250 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj
);
251 } else if (IsEqualGUID(&IID_IMediaFilter
, riid
) ||
252 IsEqualGUID(&IID_IPersist
, riid
)) {
253 *ppvObj
= &This
->IMediaFilter_iface
;
254 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj
);
255 } else if (IsEqualGUID(&IID_IMediaEventSink
, riid
)) {
256 *ppvObj
= &This
->IMediaEventSink_iface
;
257 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj
);
258 } else if (IsEqualGUID(&IID_IGraphConfig
, riid
)) {
259 *ppvObj
= &This
->IGraphConfig_iface
;
260 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj
);
261 } else if (IsEqualGUID(&IID_IMediaPosition
, riid
)) {
262 *ppvObj
= &This
->IMediaPosition_iface
;
263 TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj
);
264 } else if (IsEqualGUID(&IID_IFilterMapper
, riid
)) {
265 TRACE(" requesting IFilterMapper interface from aggregated filtermapper (%p)\n", *ppvObj
);
266 return IUnknown_QueryInterface(This
->punkFilterMapper2
, riid
, ppvObj
);
267 } else if (IsEqualGUID(&IID_IFilterMapper2
, riid
)) {
268 *ppvObj
= This
->pFilterMapper2
;
269 TRACE(" returning IFilterMapper2 interface from aggregated filtermapper (%p)\n", *ppvObj
);
270 } else if (IsEqualGUID(&IID_IFilterMapper3
, riid
)) {
271 *ppvObj
= This
->pFilterMapper2
;
272 TRACE(" returning IFilterMapper3 interface from aggregated filtermapper (%p)\n", *ppvObj
);
275 FIXME("unknown interface %s\n", debugstr_guid(riid
));
276 return E_NOINTERFACE
;
279 IUnknown_AddRef((IUnknown
*)(*ppvObj
));
283 static ULONG WINAPI
FilterGraphInner_AddRef(IUnknown
* iface
) {
284 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
285 ULONG ref
= InterlockedIncrement(&This
->ref
);
287 TRACE("(%p)->(): new ref = %d\n", This
, ref
);
292 static ULONG WINAPI
FilterGraphInner_Release(IUnknown
* iface
)
294 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
295 ULONG ref
= InterlockedDecrement(&This
->ref
);
297 TRACE("(%p)->(): new ref = %d\n", This
, ref
);
302 This
->ref
= 1; /* guard against reentrancy (aggregation). */
304 IMediaControl_Stop(&This
->IMediaControl_iface
);
306 while (This
->nFilters
)
307 IFilterGraph2_RemoveFilter((IFilterGraph2
*)This
, This
->ppFiltersInGraph
[0]);
310 IReferenceClock_Release(This
->refClock
);
312 for (i
= 0; i
< This
->nItfCacheEntries
; i
++)
314 if (This
->ItfCacheEntries
[i
].iface
)
315 IUnknown_Release(This
->ItfCacheEntries
[i
].iface
);
318 /* AddRef on controlling IUnknown, to compensate for Release of cached IFilterMapper2 interface below.
320 * NOTE: Filtergraph_AddRef isn't suitable, because bUnkOuterValid may be FALSE but punkOuter non-NULL
321 * and already passed as punkOuter to filtermapper in FilterGraph_create - this will happen in case of
322 * CoCreateInstance of filtergraph with non-null pUnkOuter and REFIID other than IID_Unknown that is
323 * cleaning up after error. */
324 if (This
->pUnkOuter
) IUnknown_AddRef(This
->pUnkOuter
);
325 else IUnknown_AddRef((IUnknown
*)&This
->IInner_vtbl
);
327 IFilterMapper2_Release(This
->pFilterMapper2
);
328 IUnknown_Release(This
->punkFilterMapper2
);
330 CloseHandle(This
->hEventCompletion
);
331 EventsQueue_Destroy(&This
->evqueue
);
332 This
->cs
.DebugInfo
->Spare
[0] = 0;
333 DeleteCriticalSection(&This
->cs
);
334 CoTaskMemFree(This
->ppFiltersInGraph
);
335 CoTaskMemFree(This
->pFilterNames
);
341 static inline IFilterGraphImpl
*impl_from_IFilterGraph2(IFilterGraph2
*iface
)
343 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IFilterGraph2_iface
);
346 static HRESULT WINAPI
FilterGraph2_QueryInterface(IFilterGraph2
*iface
, REFIID riid
, void **ppvObj
)
348 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
350 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
352 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
355 static ULONG WINAPI
FilterGraph2_AddRef(IFilterGraph2
*iface
)
357 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
359 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This
, iface
);
361 return Filtergraph_AddRef(This
);
364 static ULONG WINAPI
FilterGraph2_Release(IFilterGraph2
*iface
)
366 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
368 TRACE("(%p/%p)->() calling FilterGraph Release\n", This
, iface
);
370 return Filtergraph_Release(This
);
373 /*** IFilterGraph methods ***/
374 static HRESULT WINAPI
FilterGraph2_AddFilter(IFilterGraph2
*iface
, IBaseFilter
*pFilter
,
377 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
380 WCHAR
* wszFilterName
= NULL
;
381 int duplicate_name
= FALSE
;
383 TRACE("(%p/%p)->(%p, %s (%p))\n", This
, iface
, pFilter
, debugstr_w(pName
), pName
);
388 wszFilterName
= CoTaskMemAlloc( (pName
? strlenW(pName
) + 6 : 5) * sizeof(WCHAR
) );
392 /* Check if name already exists */
393 for(i
= 0; i
< This
->nFilters
; i
++)
394 if (!strcmpW(This
->pFilterNames
[i
], pName
))
396 duplicate_name
= TRUE
;
401 /* If no name given or name already existing, generate one */
402 if (!pName
|| duplicate_name
)
404 static const WCHAR wszFmt1
[] = {'%','s',' ','%','0','4','d',0};
405 static const WCHAR wszFmt2
[] = {'%','0','4','d',0};
407 for (j
= 0; j
< 10000 ; j
++)
411 sprintfW(wszFilterName
, wszFmt1
, pName
, This
->nameIndex
);
413 sprintfW(wszFilterName
, wszFmt2
, This
->nameIndex
);
414 TRACE("Generated name %s\n", debugstr_w(wszFilterName
));
416 /* Check if the generated name already exists */
417 for(i
= 0; i
< This
->nFilters
; i
++)
418 if (!strcmpW(This
->pFilterNames
[i
], wszFilterName
))
421 /* Compute next index and exit if generated name is suitable */
422 if (This
->nameIndex
++ == 10000)
424 if (i
== This
->nFilters
)
427 /* Unable to find a suitable name */
430 CoTaskMemFree(wszFilterName
);
431 return VFW_E_DUPLICATE_NAME
;
435 memcpy(wszFilterName
, pName
, (strlenW(pName
) + 1) * sizeof(WCHAR
));
437 if (This
->nFilters
+ 1 > This
->filterCapacity
)
439 int newCapacity
= This
->filterCapacity
? 2 * This
->filterCapacity
: 1;
440 IBaseFilter
** ppNewFilters
= CoTaskMemAlloc(newCapacity
* sizeof(IBaseFilter
*));
441 LPWSTR
* pNewNames
= CoTaskMemAlloc(newCapacity
* sizeof(LPWSTR
));
442 memcpy(ppNewFilters
, This
->ppFiltersInGraph
, This
->nFilters
* sizeof(IBaseFilter
*));
443 memcpy(pNewNames
, This
->pFilterNames
, This
->nFilters
* sizeof(LPWSTR
));
444 if (This
->filterCapacity
)
446 CoTaskMemFree(This
->ppFiltersInGraph
);
447 CoTaskMemFree(This
->pFilterNames
);
449 This
->ppFiltersInGraph
= ppNewFilters
;
450 This
->pFilterNames
= pNewNames
;
451 This
->filterCapacity
= newCapacity
;
454 hr
= IBaseFilter_JoinFilterGraph(pFilter
, (IFilterGraph
*)This
, wszFilterName
);
458 IBaseFilter_AddRef(pFilter
);
459 This
->ppFiltersInGraph
[This
->nFilters
] = pFilter
;
460 This
->pFilterNames
[This
->nFilters
] = wszFilterName
;
462 IBaseFilter_SetSyncSource(pFilter
, This
->refClock
);
465 CoTaskMemFree(wszFilterName
);
467 if (SUCCEEDED(hr
) && duplicate_name
)
468 return VFW_S_DUPLICATE_NAME
;
473 static HRESULT WINAPI
FilterGraph2_RemoveFilter(IFilterGraph2
*iface
, IBaseFilter
*pFilter
)
475 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
479 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFilter
);
481 /* FIXME: check graph is stopped */
483 for (i
= 0; i
< This
->nFilters
; i
++)
485 if (This
->ppFiltersInGraph
[i
] == pFilter
)
487 IEnumPins
*penumpins
= NULL
;
490 if (This
->defaultclock
&& This
->refClockProvider
== pFilter
)
492 IMediaFilter_SetSyncSource(&This
->IMediaFilter_iface
, NULL
);
493 This
->defaultclock
= 1;
496 TRACE("Removing filter %s\n", debugstr_w(This
->pFilterNames
[i
]));
497 IBaseFilter_GetState(pFilter
, 0, &state
);
498 if (state
== State_Running
)
499 IBaseFilter_Pause(pFilter
);
500 if (state
!= State_Stopped
)
501 IBaseFilter_Stop(pFilter
);
503 hr
= IBaseFilter_EnumPins(pFilter
, &penumpins
);
506 while(IEnumPins_Next(penumpins
, 1, &ppin
, NULL
) == S_OK
)
510 IPin_ConnectedTo(ppin
, &victim
);
513 h
= IPin_Disconnect(victim
);
514 TRACE("Disconnect other side: %08x\n", h
);
515 if (h
== VFW_E_NOT_STOPPED
)
518 IPin_QueryPinInfo(victim
, &pinfo
);
520 IBaseFilter_GetState(pinfo
.pFilter
, 0, &state
);
521 if (state
== State_Running
)
522 IBaseFilter_Pause(pinfo
.pFilter
);
523 IBaseFilter_Stop(pinfo
.pFilter
);
524 IBaseFilter_Release(pinfo
.pFilter
);
525 h
= IPin_Disconnect(victim
);
526 TRACE("Disconnect retry: %08x\n", h
);
528 IPin_Release(victim
);
530 h
= IPin_Disconnect(ppin
);
531 TRACE("Disconnect 2: %08x\n", h
);
535 IEnumPins_Release(penumpins
);
538 hr
= IBaseFilter_JoinFilterGraph(pFilter
, NULL
, This
->pFilterNames
[i
]);
541 IBaseFilter_SetSyncSource(pFilter
, NULL
);
542 IBaseFilter_Release(pFilter
);
543 CoTaskMemFree(This
->pFilterNames
[i
]);
544 memmove(This
->ppFiltersInGraph
+i
, This
->ppFiltersInGraph
+i
+1, sizeof(IBaseFilter
*)*(This
->nFilters
- 1 - i
));
545 memmove(This
->pFilterNames
+i
, This
->pFilterNames
+i
+1, sizeof(LPWSTR
)*(This
->nFilters
- 1 - i
));
547 /* Invalidate interfaces in the cache */
548 for (i
= 0; i
< This
->nItfCacheEntries
; i
++)
549 if (pFilter
== This
->ItfCacheEntries
[i
].filter
)
551 IUnknown_Release(This
->ItfCacheEntries
[i
].iface
);
552 This
->ItfCacheEntries
[i
].iface
= NULL
;
553 This
->ItfCacheEntries
[i
].filter
= NULL
;
561 return hr
; /* FIXME: check this error code */
564 static HRESULT WINAPI
FilterGraph2_EnumFilters(IFilterGraph2
*iface
, IEnumFilters
**ppEnum
)
566 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
568 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
570 return IEnumFiltersImpl_Construct(This
->ppFiltersInGraph
, This
->nFilters
, ppEnum
);
573 static HRESULT WINAPI
FilterGraph2_FindFilterByName(IFilterGraph2
*iface
, LPCWSTR pName
,
574 IBaseFilter
**ppFilter
)
576 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
579 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_w(pName
), pName
, ppFilter
);
584 for (i
= 0; i
< This
->nFilters
; i
++)
586 if (!strcmpW(pName
, This
->pFilterNames
[i
]))
588 *ppFilter
= This
->ppFiltersInGraph
[i
];
589 IBaseFilter_AddRef(*ppFilter
);
595 return VFW_E_NOT_FOUND
;
598 /* Don't allow a circular connection to form, return VFW_E_CIRCULAR_GRAPH if this would be the case.
599 * A circular connection will be formed if from the filter of the output pin, the input pin can be reached
601 static HRESULT
CheckCircularConnection(IFilterGraphImpl
*This
, IPin
*out
, IPin
*in
)
605 PIN_INFO info_out
, info_in
;
607 hr
= IPin_QueryPinInfo(out
, &info_out
);
610 if (info_out
.dir
!= PINDIR_OUTPUT
)
612 IBaseFilter_Release(info_out
.pFilter
);
616 hr
= IPin_QueryPinInfo(in
, &info_in
);
618 IBaseFilter_Release(info_in
.pFilter
);
621 if (info_in
.dir
!= PINDIR_INPUT
)
627 if (info_out
.pFilter
== info_in
.pFilter
)
628 hr
= VFW_E_CIRCULAR_GRAPH
;
634 hr
= IBaseFilter_EnumPins(info_out
.pFilter
, &enumpins
);
638 IEnumPins_Reset(enumpins
);
639 while ((hr
= IEnumPins_Next(enumpins
, 1, &test
, NULL
)) == S_OK
)
641 PIN_DIRECTION dir
= PINDIR_OUTPUT
;
642 IPin_QueryDirection(test
, &dir
);
643 if (dir
== PINDIR_INPUT
)
646 IPin_ConnectedTo(test
, &victim
);
649 hr
= CheckCircularConnection(This
, victim
, in
);
650 IPin_Release(victim
);
660 IEnumPins_Release(enumpins
);
664 IBaseFilter_Release(info_out
.pFilter
);
666 ERR("Checking filtergraph returned %08x, something's not right!\n", hr
);
669 /* Debugging filtergraphs not enabled */
675 /* NOTE: despite the implication, it doesn't matter which
676 * way round you put in the input and output pins */
677 static HRESULT WINAPI
FilterGraph2_ConnectDirect(IFilterGraph2
*iface
, IPin
*ppinIn
, IPin
*ppinOut
,
678 const AM_MEDIA_TYPE
*pmt
)
680 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
684 TRACE("(%p/%p)->(%p, %p, %p)\n", This
, iface
, ppinIn
, ppinOut
, pmt
);
686 /* FIXME: check pins are in graph */
688 if (TRACE_ON(quartz
))
692 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
696 TRACE("Filter owning first pin => %p\n", PinInfo
.pFilter
);
697 IBaseFilter_Release(PinInfo
.pFilter
);
699 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
703 TRACE("Filter owning second pin => %p\n", PinInfo
.pFilter
);
704 IBaseFilter_Release(PinInfo
.pFilter
);
707 hr
= IPin_QueryDirection(ppinIn
, &dir
);
710 if (dir
== PINDIR_INPUT
)
712 hr
= CheckCircularConnection(This
, ppinOut
, ppinIn
);
714 hr
= IPin_Connect(ppinOut
, ppinIn
, pmt
);
718 hr
= CheckCircularConnection(This
, ppinIn
, ppinOut
);
720 hr
= IPin_Connect(ppinIn
, ppinOut
, pmt
);
727 static HRESULT WINAPI
FilterGraph2_Reconnect(IFilterGraph2
*iface
, IPin
*ppin
)
729 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
730 IPin
*pConnectedTo
= NULL
;
732 PIN_DIRECTION pindir
;
734 IPin_QueryDirection(ppin
, &pindir
);
735 hr
= IPin_ConnectedTo(ppin
, &pConnectedTo
);
737 TRACE("Querying connected to failed: %x\n", hr
);
740 IPin_Disconnect(ppin
);
741 IPin_Disconnect(pConnectedTo
);
742 if (pindir
== PINDIR_INPUT
)
743 hr
= IPin_Connect(pConnectedTo
, ppin
, NULL
);
745 hr
= IPin_Connect(ppin
, pConnectedTo
, NULL
);
746 IPin_Release(pConnectedTo
);
748 WARN("Reconnecting pins failed, pins are not connected now..\n");
749 TRACE("(%p->%p) -- %p %p -> %x\n", iface
, This
, ppin
, pConnectedTo
, hr
);
753 static HRESULT WINAPI
FilterGraph2_Disconnect(IFilterGraph2
*iface
, IPin
*ppin
)
755 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
757 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppin
);
762 return IPin_Disconnect(ppin
);
765 static HRESULT WINAPI
FilterGraph2_SetDefaultSyncSource(IFilterGraph2
*iface
)
767 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
768 IReferenceClock
*pClock
= NULL
;
772 TRACE("(%p/%p)->() live sources not handled properly!\n", iface
, This
);
774 EnterCriticalSection(&This
->cs
);
776 for (i
= 0; i
< This
->nFilters
; ++i
)
779 IAMFilterMiscFlags
*flags
= NULL
;
780 IUnknown_QueryInterface(This
->ppFiltersInGraph
[i
], &IID_IAMFilterMiscFlags
, (void**)&flags
);
783 miscflags
= IAMFilterMiscFlags_GetMiscFlags(flags
);
784 IUnknown_Release(flags
);
785 if (miscflags
== AM_FILTER_MISC_FLAGS_IS_RENDERER
)
786 IUnknown_QueryInterface(This
->ppFiltersInGraph
[i
], &IID_IReferenceClock
, (void**)&pClock
);
793 hr
= CoCreateInstance(&CLSID_SystemClock
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IReferenceClock
, (LPVOID
*)&pClock
);
794 This
->refClockProvider
= NULL
;
797 This
->refClockProvider
= This
->ppFiltersInGraph
[i
];
801 hr
= IMediaFilter_SetSyncSource(&This
->IMediaFilter_iface
, pClock
);
802 This
->defaultclock
= TRUE
;
803 IReferenceClock_Release(pClock
);
805 LeaveCriticalSection(&This
->cs
);
810 static HRESULT
GetFilterInfo(IMoniker
* pMoniker
, GUID
* pclsid
, VARIANT
* pvar
)
812 static const WCHAR wszClsidName
[] = {'C','L','S','I','D',0};
813 static const WCHAR wszFriendlyName
[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
814 IPropertyBag
* pPropBagCat
= NULL
;
819 hr
= IMoniker_BindToStorage(pMoniker
, NULL
, NULL
, &IID_IPropertyBag
, (LPVOID
*)&pPropBagCat
);
822 hr
= IPropertyBag_Read(pPropBagCat
, wszClsidName
, pvar
, NULL
);
825 hr
= CLSIDFromString(V_UNION(pvar
, bstrVal
), pclsid
);
830 hr
= IPropertyBag_Read(pPropBagCat
, wszFriendlyName
, pvar
, NULL
);
833 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid
), debugstr_w(V_UNION(pvar
, bstrVal
)));
836 IPropertyBag_Release(pPropBagCat
);
841 static HRESULT
GetInternalConnections(IBaseFilter
* pfilter
, IPin
* pinputpin
, IPin
*** pppins
, ULONG
* pnb
)
846 TRACE("(%p, %p, %p, %p)\n", pfilter
, pinputpin
, pppins
, pnb
);
847 hr
= IPin_QueryInternalConnections(pinputpin
, NULL
, &nb
);
850 } else if (hr
== S_FALSE
) {
851 *pppins
= CoTaskMemAlloc(sizeof(IPin
*)*nb
);
852 hr
= IPin_QueryInternalConnections(pinputpin
, *pppins
, &nb
);
854 WARN("Error (%x)\n", hr
);
856 } else if (hr
== E_NOTIMPL
) {
857 /* Input connected to all outputs */
858 IEnumPins
* penumpins
;
861 TRACE("E_NOTIMPL\n");
862 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
864 WARN("filter Enumpins failed (%x)\n", hr
);
868 /* Count output pins */
869 while(IEnumPins_Next(penumpins
, 1, &ppin
, &nb
) == S_OK
) {
870 PIN_DIRECTION pindir
;
871 IPin_QueryDirection(ppin
, &pindir
);
872 if (pindir
== PINDIR_OUTPUT
)
876 *pppins
= CoTaskMemAlloc(sizeof(IPin
*)*i
);
877 /* Retrieve output pins */
878 IEnumPins_Reset(penumpins
);
880 while(IEnumPins_Next(penumpins
, 1, &ppin
, &nb
) == S_OK
) {
881 PIN_DIRECTION pindir
;
882 IPin_QueryDirection(ppin
, &pindir
);
883 if (pindir
== PINDIR_OUTPUT
)
884 (*pppins
)[i
++] = ppin
;
888 IEnumPins_Release(penumpins
);
891 WARN("Next failed (%x)\n", hr
);
894 } else if (FAILED(hr
)) {
895 WARN("Cannot get internal connection (%x)\n", hr
);
903 /*** IGraphBuilder methods ***/
904 static HRESULT WINAPI
FilterGraph2_Connect(IFilterGraph2
*iface
, IPin
*ppinOut
, IPin
*ppinIn
)
906 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
908 AM_MEDIA_TYPE
* mt
= NULL
;
909 IEnumMediaTypes
* penummt
= NULL
;
911 IEnumPins
* penumpins
;
912 IEnumMoniker
* pEnumMoniker
;
921 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, ppinOut
, ppinIn
);
923 if (TRACE_ON(quartz
))
925 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
929 TRACE("Filter owning first pin => %p\n", PinInfo
.pFilter
);
930 IBaseFilter_Release(PinInfo
.pFilter
);
932 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
936 TRACE("Filter owning second pin => %p\n", PinInfo
.pFilter
);
937 IBaseFilter_Release(PinInfo
.pFilter
);
940 EnterCriticalSection(&This
->cs
);
941 ++This
->recursioncount
;
942 if (This
->recursioncount
>= 5)
944 WARN("Recursion count has reached %d\n", This
->recursioncount
);
945 hr
= VFW_E_CANNOT_CONNECT
;
949 hr
= IPin_QueryDirection(ppinOut
, &dir
);
953 if (dir
== PINDIR_INPUT
)
962 hr
= CheckCircularConnection(This
, ppinOut
, ppinIn
);
966 /* Try direct connection first */
967 hr
= IPin_Connect(ppinOut
, ppinIn
, NULL
);
971 TRACE("Direct connection failed, trying to render using extra filters\n");
973 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
977 hr
= IBaseFilter_GetClassID(PinInfo
.pFilter
, &FilterCLSID
);
978 IBaseFilter_Release(PinInfo
.pFilter
);
982 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
983 * filter to the minor mediatype of input pin of the renderer */
984 hr
= IPin_EnumMediaTypes(ppinOut
, &penummt
);
987 WARN("EnumMediaTypes (%x)\n", hr
);
991 hr
= IEnumMediaTypes_Next(penummt
, 1, &mt
, &nbmt
);
993 WARN("IEnumMediaTypes_Next (%x)\n", hr
);
999 WARN("No media type found!\n");
1000 hr
= VFW_E_INVALIDMEDIATYPE
;
1003 TRACE("MajorType %s\n", debugstr_guid(&mt
->majortype
));
1004 TRACE("SubType %s\n", debugstr_guid(&mt
->subtype
));
1006 /* Try to find a suitable filter that can connect to the pin to render */
1007 tab
[0] = mt
->majortype
;
1008 tab
[1] = mt
->subtype
;
1009 hr
= IFilterMapper2_EnumMatchingFilters(This
->pFilterMapper2
, &pEnumMoniker
, 0, FALSE
, MERIT_UNLIKELY
, TRUE
, 1, tab
, NULL
, NULL
, FALSE
, FALSE
, 0, NULL
, NULL
, NULL
);
1011 WARN("Unable to enum filters (%x)\n", hr
);
1015 hr
= VFW_E_CANNOT_RENDER
;
1016 while(IEnumMoniker_Next(pEnumMoniker
, 1, &pMoniker
, &nb
) == S_OK
)
1021 IPin
* ppinfilter
= NULL
;
1022 IBaseFilter
* pfilter
= NULL
;
1024 hr
= GetFilterInfo(pMoniker
, &clsid
, &var
);
1025 IMoniker_Release(pMoniker
);
1027 WARN("Unable to retrieve filter info (%x)\n", hr
);
1031 if (IsEqualGUID(&clsid
, &FilterCLSID
)) {
1032 /* Skip filter (same as the one the output pin belongs to) */
1036 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&pfilter
);
1038 WARN("Unable to create filter (%x), trying next one\n", hr
);
1042 hr
= IFilterGraph2_AddFilter(iface
, pfilter
, V_UNION(&var
, bstrVal
));
1044 WARN("Unable to add filter (%x)\n", hr
);
1045 IBaseFilter_Release(pfilter
);
1052 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
1054 WARN("Enumpins (%x)\n", hr
);
1058 hr
= IEnumPins_Next(penumpins
, 1, &ppinfilter
, &pin
);
1059 IEnumPins_Release(penumpins
);
1062 WARN("Obtaining next pin: (%x)\n", hr
);
1066 WARN("Cannot use this filter: no pins\n");
1070 hr
= IPin_Connect(ppinOut
, ppinfilter
, NULL
);
1072 TRACE("Cannot connect to filter (%x), trying next one\n", hr
);
1075 TRACE("Successfully connected to filter, follow chain...\n");
1077 /* Render all output pins of the filter by calling IFilterGraph2_Connect on each of them */
1078 hr
= GetInternalConnections(pfilter
, ppinfilter
, &ppins
, &nb
);
1080 if (SUCCEEDED(hr
)) {
1083 IPin_Disconnect(ppinfilter
);
1084 IPin_Disconnect(ppinOut
);
1087 TRACE("pins to consider: %d\n", nb
);
1088 for(i
= 0; i
< nb
; i
++)
1090 LPWSTR pinname
= NULL
;
1092 TRACE("Processing pin %u\n", i
);
1094 hr
= IPin_QueryId(ppins
[i
], &pinname
);
1097 if (pinname
[0] == '~')
1099 TRACE("Pinname=%s, skipping\n", debugstr_w(pinname
));
1103 hr
= IFilterGraph2_Connect(iface
, ppins
[i
], ppinIn
);
1104 CoTaskMemFree(pinname
);
1108 TRACE("Cannot connect pin %p (%x)\n", ppinfilter
, hr
);
1110 IPin_Release(ppins
[i
]);
1111 if (SUCCEEDED(hr
)) break;
1113 while (++i
< nb
) IPin_Release(ppins
[i
]);
1114 CoTaskMemFree(ppins
);
1115 IPin_Release(ppinfilter
);
1116 IBaseFilter_Release(pfilter
);
1119 IPin_Disconnect(ppinfilter
);
1120 IPin_Disconnect(ppinOut
);
1121 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1129 if (ppinfilter
) IPin_Release(ppinfilter
);
1131 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1132 IBaseFilter_Release(pfilter
);
1138 IEnumMediaTypes_Release(penummt
);
1140 DeleteMediaType(mt
);
1141 --This
->recursioncount
;
1142 LeaveCriticalSection(&This
->cs
);
1143 TRACE("--> %08x\n", hr
);
1144 return SUCCEEDED(hr
) ? S_OK
: hr
;
1147 static HRESULT
FilterGraph2_RenderRecurse(IFilterGraphImpl
*This
, IPin
*ppinOut
)
1149 /* This pin has been connected now, try to call render on all pins that aren't connected */
1152 IEnumPins
*enumpins
= NULL
;
1153 BOOL renderany
= FALSE
;
1154 BOOL renderall
= TRUE
;
1156 IPin_QueryPinInfo(ppinOut
, &info
);
1158 IBaseFilter_EnumPins(info
.pFilter
, &enumpins
);
1159 /* Don't need to hold a reference, IEnumPins does */
1160 IBaseFilter_Release(info
.pFilter
);
1162 IEnumPins_Reset(enumpins
);
1163 while (IEnumPins_Next(enumpins
, 1, &to
, NULL
) == S_OK
)
1165 PIN_DIRECTION dir
= PINDIR_INPUT
;
1167 IPin_QueryDirection(to
, &dir
);
1169 if (dir
== PINDIR_OUTPUT
)
1173 IPin_ConnectedTo(to
, &out
);
1177 hr
= IFilterGraph2_Render(&This
->IFilterGraph2_iface
, to
);
1190 IEnumPins_Release(enumpins
);
1196 return VFW_S_PARTIAL_RENDER
;
1198 return VFW_E_CANNOT_RENDER
;
1201 /* Ogg hates me if I create a direct rendering method
1203 * It can only connect to a pin properly once, so use a recursive method that does
1205 * +----+ --- (PIN 1) (Render is called on this pin)
1207 * +----+ --- (PIN 2)
1209 * Enumerate possible renderers that EXACTLY match the requested type
1211 * If none is available, try to add intermediate filters that can connect to the input pin
1212 * then call Render on that intermediate pin's output pins
1213 * if it succeeds: Render returns success, if it doesn't, the intermediate filter is removed,
1214 * and another filter that can connect to the input pin is tried
1215 * if we run out of filters that can, give up and return VFW_E_CANNOT_RENDER
1216 * It's recursive, but fun!
1219 static HRESULT WINAPI
FilterGraph2_Render(IFilterGraph2
*iface
, IPin
*ppinOut
)
1221 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1222 IEnumMediaTypes
* penummt
;
1227 IEnumMoniker
* pEnumMoniker
;
1233 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppinOut
);
1235 if (TRACE_ON(quartz
))
1239 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
1243 TRACE("Filter owning pin => %p\n", PinInfo
.pFilter
);
1244 IBaseFilter_Release(PinInfo
.pFilter
);
1247 /* Try to find out if there is a renderer for the specified subtype already, and use that
1249 EnterCriticalSection(&This
->cs
);
1250 for (x
= 0; x
< This
->nFilters
; ++x
)
1252 IEnumPins
*enumpins
= NULL
;
1255 hr
= IBaseFilter_EnumPins(This
->ppFiltersInGraph
[x
], &enumpins
);
1257 if (FAILED(hr
) || !enumpins
)
1260 IEnumPins_Reset(enumpins
);
1261 while (IEnumPins_Next(enumpins
, 1, &pin
, NULL
) == S_OK
)
1264 PIN_DIRECTION dir
= PINDIR_OUTPUT
;
1266 IPin_QueryDirection(pin
, &dir
);
1267 if (dir
!= PINDIR_INPUT
)
1272 IPin_ConnectedTo(pin
, &to
);
1276 hr
= FilterGraph2_ConnectDirect(iface
, ppinOut
, pin
, NULL
);
1279 TRACE("Connected successfully %p/%p, %08x look if we should render more!\n", ppinOut
, pin
, hr
);
1282 hr
= FilterGraph2_RenderRecurse(This
, pin
);
1285 IPin_Disconnect(ppinOut
);
1286 IPin_Disconnect(pin
);
1289 IEnumPins_Release(enumpins
);
1290 LeaveCriticalSection(&This
->cs
);
1293 WARN("Could not connect!\n");
1300 IEnumPins_Release(enumpins
);
1303 LeaveCriticalSection(&This
->cs
);
1305 hr
= IPin_EnumMediaTypes(ppinOut
, &penummt
);
1307 WARN("EnumMediaTypes (%x)\n", hr
);
1311 IEnumMediaTypes_Reset(penummt
);
1313 /* Looks like no existing renderer of the kind exists
1314 * Try adding new ones
1316 tab
[0] = tab
[1] = GUID_NULL
;
1317 while (SUCCEEDED(hr
))
1319 hr
= IEnumMediaTypes_Next(penummt
, 1, &mt
, &nbmt
);
1321 WARN("IEnumMediaTypes_Next (%x)\n", hr
);
1326 hr
= VFW_E_CANNOT_RENDER
;
1331 TRACE("MajorType %s\n", debugstr_guid(&mt
->majortype
));
1332 TRACE("SubType %s\n", debugstr_guid(&mt
->subtype
));
1334 /* Only enumerate once, this doesn't account for all previous ones, but this should be enough nonetheless */
1335 if (IsEqualIID(&tab
[0], &mt
->majortype
) && IsEqualIID(&tab
[1], &mt
->subtype
))
1337 DeleteMediaType(mt
);
1341 /* Try to find a suitable renderer with the same media type */
1342 tab
[0] = mt
->majortype
;
1343 tab
[1] = mt
->subtype
;
1344 hr
= IFilterMapper2_EnumMatchingFilters(This
->pFilterMapper2
, &pEnumMoniker
, 0, FALSE
, MERIT_UNLIKELY
, TRUE
, 1, tab
, NULL
, NULL
, FALSE
, FALSE
, 0, NULL
, NULL
, NULL
);
1347 WARN("Unable to enum filters (%x)\n", hr
);
1353 while (IEnumMoniker_Next(pEnumMoniker
, 1, &pMoniker
, &nb
) == S_OK
)
1358 IBaseFilter
* pfilter
= NULL
;
1359 IEnumPins
* penumpins
= NULL
;
1362 hr
= GetFilterInfo(pMoniker
, &clsid
, &var
);
1363 IMoniker_Release(pMoniker
);
1365 WARN("Unable to retrieve filter info (%x)\n", hr
);
1369 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&pfilter
);
1372 WARN("Unable to create filter (%x), trying next one\n", hr
);
1376 hr
= IFilterGraph2_AddFilter(iface
, pfilter
, V_UNION(&var
, bstrVal
));
1378 WARN("Unable to add filter (%x)\n", hr
);
1379 IBaseFilter_Release(pfilter
);
1384 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
1386 WARN("Splitter Enumpins (%x)\n", hr
);
1390 while ((hr
= IEnumPins_Next(penumpins
, 1, &ppinfilter
, &pin
)) == S_OK
)
1400 hr
= IPin_QueryDirection(ppinfilter
, &dir
);
1402 IPin_Release(ppinfilter
);
1403 WARN("QueryDirection failed (%x)\n", hr
);
1406 if (dir
!= PINDIR_INPUT
) {
1407 IPin_Release(ppinfilter
);
1408 continue; /* Wrong direction */
1411 /* Connect the pin to the "Renderer" */
1412 hr
= IPin_Connect(ppinOut
, ppinfilter
, NULL
);
1413 IPin_Release(ppinfilter
);
1416 WARN("Unable to connect %s to renderer (%x)\n", debugstr_w(V_UNION(&var
, bstrVal
)), hr
);
1419 TRACE("Connected, recursing %s\n", debugstr_w(V_UNION(&var
, bstrVal
)));
1423 hr
= FilterGraph2_RenderRecurse(This
, ppinfilter
);
1425 WARN("Unable to connect recursively (%x)\n", hr
);
1428 IBaseFilter_Release(pfilter
);
1431 if (SUCCEEDED(hr
)) {
1432 IEnumPins_Release(penumpins
);
1433 break; /* out of IEnumMoniker_Next loop */
1436 /* IEnumPins_Next failed, all other failure case caught by goto error */
1437 WARN("IEnumPins_Next (%x)\n", hr
);
1443 IEnumPins_Release(penumpins
);
1445 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1446 IBaseFilter_Release(pfilter
);
1448 if (SUCCEEDED(hr
)) DebugBreak();
1451 IEnumMoniker_Release(pEnumMoniker
);
1453 DeleteMediaType(mt
);
1459 IEnumMediaTypes_Release(penummt
);
1463 static HRESULT WINAPI
FilterGraph2_RenderFile(IFilterGraph2
*iface
, LPCWSTR lpcwstrFile
,
1464 LPCWSTR lpcwstrPlayList
)
1466 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1467 static const WCHAR string
[] = {'R','e','a','d','e','r',0};
1468 IBaseFilter
* preader
= NULL
;
1469 IPin
* ppinreader
= NULL
;
1470 IEnumPins
* penumpins
= NULL
;
1472 BOOL partial
= FALSE
;
1473 HRESULT any
= FALSE
;
1475 TRACE("(%p/%p)->(%s, %s)\n", This
, iface
, debugstr_w(lpcwstrFile
), debugstr_w(lpcwstrPlayList
));
1477 if (lpcwstrPlayList
!= NULL
)
1478 return E_INVALIDARG
;
1480 hr
= IFilterGraph2_AddSourceFilter(iface
, lpcwstrFile
, string
, &preader
);
1485 hr
= IBaseFilter_EnumPins(preader
, &penumpins
);
1488 while (IEnumPins_Next(penumpins
, 1, &ppinreader
, NULL
) == S_OK
)
1492 IPin_QueryDirection(ppinreader
, &dir
);
1493 if (dir
== PINDIR_OUTPUT
)
1497 hr
= IFilterGraph2_Render(iface
, ppinreader
);
1498 TRACE("Render %08x\n", hr
);
1500 for (i
= 0; i
< This
->nFilters
; ++i
)
1501 TRACE("Filters in chain: %s\n", debugstr_w(This
->pFilterNames
[i
]));
1508 IPin_Release(ppinreader
);
1510 IEnumPins_Release(penumpins
);
1513 hr
= VFW_E_CANNOT_RENDER
;
1515 hr
= VFW_S_PARTIAL_RENDER
;
1519 IBaseFilter_Release(preader
);
1521 TRACE("--> %08x\n", hr
);
1525 /* Some filters implement their own asynchronous reader (Theoretically they all should, try to load it first */
1526 static HRESULT
GetFileSourceFilter(LPCOLESTR pszFileName
, IBaseFilter
**filter
)
1528 static const WCHAR wszReg
[] = {'M','e','d','i','a',' ','T','y','p','e','\\','E','x','t','e','n','s','i','o','n','s',0};
1533 lRet
= RegOpenKeyExW(HKEY_CLASSES_ROOT
, wszReg
, 0, KEY_READ
, &extkey
);
1534 hr
= HRESULT_FROM_WIN32(lRet
);
1538 static const WCHAR filtersource
[] = {'S','o','u','r','c','e',' ','F','i','l','t','e','r',0};
1539 WCHAR
*ext
= PathFindExtensionW(pszFileName
);
1540 WCHAR clsid_key
[39];
1542 DWORD size
= sizeof(clsid_key
);
1547 CloseHandle(extkey
);
1551 lRet
= RegOpenKeyExW(extkey
, ext
, 0, KEY_READ
, &pathkey
);
1552 hr
= HRESULT_FROM_WIN32(lRet
);
1553 CloseHandle(extkey
);
1557 lRet
= RegQueryValueExW(pathkey
, filtersource
, NULL
, NULL
, (LPBYTE
)clsid_key
, &size
);
1558 hr
= HRESULT_FROM_WIN32(lRet
);
1559 CloseHandle(pathkey
);
1563 CLSIDFromString(clsid_key
, &clsid
);
1565 TRACE("CLSID: %s\n", debugstr_guid(&clsid
));
1566 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)filter
);
1569 IFileSourceFilter
*source
= NULL
;
1570 hr
= IBaseFilter_QueryInterface(*filter
, &IID_IFileSourceFilter
, (LPVOID
*)&source
);
1572 IFileSourceFilter_Release(source
);
1574 IBaseFilter_Release(*filter
);
1582 static HRESULT WINAPI
FilterGraph2_AddSourceFilter(IFilterGraph2
*iface
, LPCWSTR lpcwstrFileName
,
1583 LPCWSTR lpcwstrFilterName
, IBaseFilter
**ppFilter
)
1585 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1587 IBaseFilter
* preader
;
1588 IFileSourceFilter
* pfile
= NULL
;
1592 TRACE("(%p/%p)->(%s, %s, %p)\n", This
, iface
, debugstr_w(lpcwstrFileName
), debugstr_w(lpcwstrFilterName
), ppFilter
);
1594 /* Try from file name first, then fall back to default asynchronous reader */
1595 hr
= GetFileSourceFilter(lpcwstrFileName
, &preader
);
1598 hr
= CoCreateInstance(&CLSID_AsyncReader
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&preader
);
1600 WARN("Unable to create file source filter (%x)\n", hr
);
1604 hr
= IFilterGraph2_AddFilter(iface
, preader
, lpcwstrFilterName
);
1606 WARN("Unable add filter (%x)\n", hr
);
1607 IBaseFilter_Release(preader
);
1611 hr
= IBaseFilter_QueryInterface(preader
, &IID_IFileSourceFilter
, (LPVOID
*)&pfile
);
1613 WARN("Unable to get IFileSourceInterface (%x)\n", hr
);
1617 /* Load the file in the file source filter */
1618 hr
= IFileSourceFilter_Load(pfile
, lpcwstrFileName
, NULL
);
1620 WARN("Load (%x)\n", hr
);
1624 IFileSourceFilter_GetCurFile(pfile
, &filename
, &mt
);
1626 WARN("GetCurFile (%x)\n", hr
);
1630 TRACE("File %s\n", debugstr_w(filename
));
1631 TRACE("MajorType %s\n", debugstr_guid(&mt
.majortype
));
1632 TRACE("SubType %s\n", debugstr_guid(&mt
.subtype
));
1635 *ppFilter
= preader
;
1636 IFileSourceFilter_Release(pfile
);
1642 IFileSourceFilter_Release(pfile
);
1643 IFilterGraph2_RemoveFilter(iface
, preader
);
1644 IBaseFilter_Release(preader
);
1649 static HRESULT WINAPI
FilterGraph2_SetLogFile(IFilterGraph2
*iface
, DWORD_PTR hFile
)
1651 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1653 TRACE("(%p/%p)->(%08x): stub !!!\n", This
, iface
, (DWORD
) hFile
);
1658 static HRESULT WINAPI
FilterGraph2_Abort(IFilterGraph2
*iface
)
1660 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1662 TRACE("(%p/%p)->(): stub !!!\n", This
, iface
);
1667 static HRESULT WINAPI
FilterGraph2_ShouldOperationContinue(IFilterGraph2
*iface
)
1669 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1671 TRACE("(%p/%p)->(): stub !!!\n", This
, iface
);
1676 /*** IFilterGraph2 methods ***/
1677 static HRESULT WINAPI
FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2
*iface
,
1678 IMoniker
*pMoniker
, IBindCtx
*pCtx
, LPCWSTR lpcwstrFilterName
, IBaseFilter
**ppFilter
)
1680 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1682 TRACE("(%p/%p)->(%p %p %s %p): stub !!!\n", This
, iface
, pMoniker
, pCtx
, debugstr_w(lpcwstrFilterName
), ppFilter
);
1687 static HRESULT WINAPI
FilterGraph2_ReconnectEx(IFilterGraph2
*iface
, IPin
*ppin
,
1688 const AM_MEDIA_TYPE
*pmt
)
1690 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1692 TRACE("(%p/%p)->(%p %p): stub !!!\n", This
, iface
, ppin
, pmt
);
1697 static HRESULT WINAPI
FilterGraph2_RenderEx(IFilterGraph2
*iface
, IPin
*pPinOut
, DWORD dwFlags
,
1700 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1702 TRACE("(%p/%p)->(%p %08x %p): stub !!!\n", This
, iface
, pPinOut
, dwFlags
, pvContext
);
1708 static const IFilterGraph2Vtbl IFilterGraph2_VTable
=
1710 FilterGraph2_QueryInterface
,
1711 FilterGraph2_AddRef
,
1712 FilterGraph2_Release
,
1713 FilterGraph2_AddFilter
,
1714 FilterGraph2_RemoveFilter
,
1715 FilterGraph2_EnumFilters
,
1716 FilterGraph2_FindFilterByName
,
1717 FilterGraph2_ConnectDirect
,
1718 FilterGraph2_Reconnect
,
1719 FilterGraph2_Disconnect
,
1720 FilterGraph2_SetDefaultSyncSource
,
1721 FilterGraph2_Connect
,
1722 FilterGraph2_Render
,
1723 FilterGraph2_RenderFile
,
1724 FilterGraph2_AddSourceFilter
,
1725 FilterGraph2_SetLogFile
,
1727 FilterGraph2_ShouldOperationContinue
,
1728 FilterGraph2_AddSourceFilterForMoniker
,
1729 FilterGraph2_ReconnectEx
,
1730 FilterGraph2_RenderEx
1733 static inline IFilterGraphImpl
*impl_from_IMediaControl(IMediaControl
*iface
)
1735 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaControl_iface
);
1738 static HRESULT WINAPI
MediaControl_QueryInterface(IMediaControl
*iface
, REFIID riid
, void **ppvObj
)
1740 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1742 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1744 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
1747 static ULONG WINAPI
MediaControl_AddRef(IMediaControl
*iface
)
1749 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1751 TRACE("(%p/%p)->()\n", This
, iface
);
1753 return Filtergraph_AddRef(This
);
1756 static ULONG WINAPI
MediaControl_Release(IMediaControl
*iface
)
1758 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1760 TRACE("(%p/%p)->()\n", This
, iface
);
1762 return Filtergraph_Release(This
);
1766 /*** IDispatch methods ***/
1767 static HRESULT WINAPI
MediaControl_GetTypeInfoCount(IMediaControl
*iface
, UINT
*pctinfo
)
1769 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1771 TRACE("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1776 static HRESULT WINAPI
MediaControl_GetTypeInfo(IMediaControl
*iface
, UINT iTInfo
, LCID lcid
,
1777 ITypeInfo
**ppTInfo
)
1779 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1781 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1786 static HRESULT WINAPI
MediaControl_GetIDsOfNames(IMediaControl
*iface
, REFIID riid
,
1787 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1789 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1791 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1796 static HRESULT WINAPI
MediaControl_Invoke(IMediaControl
*iface
, DISPID dispIdMember
, REFIID riid
,
1797 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
1800 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1802 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
);
1807 typedef HRESULT(WINAPI
*fnFoundFilter
)(IBaseFilter
*, DWORD_PTR data
);
1809 static HRESULT
ExploreGraph(IFilterGraphImpl
* pGraph
, IPin
* pOutputPin
, fnFoundFilter FoundFilter
, DWORD_PTR data
)
1818 TRACE("%p %p\n", pGraph
, pOutputPin
);
1819 PinInfo
.pFilter
= NULL
;
1821 hr
= IPin_ConnectedTo(pOutputPin
, &pInputPin
);
1825 hr
= IPin_QueryPinInfo(pInputPin
, &PinInfo
);
1827 hr
= GetInternalConnections(PinInfo
.pFilter
, pInputPin
, &ppPins
, &nb
);
1828 IPin_Release(pInputPin
);
1835 TRACE("Reached a renderer\n");
1836 /* Count renderers for end of stream notification */
1837 pGraph
->nRenderers
++;
1841 for(i
= 0; i
< nb
; i
++)
1843 /* Explore the graph downstream from this pin
1844 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1845 * several input pins are connected to the same output (a MUX for instance). */
1846 ExploreGraph(pGraph
, ppPins
[i
], FoundFilter
, data
);
1847 IPin_Release(ppPins
[i
]);
1850 CoTaskMemFree(ppPins
);
1852 TRACE("Doing stuff with filter %p\n", PinInfo
.pFilter
);
1854 FoundFilter(PinInfo
.pFilter
, data
);
1857 if (PinInfo
.pFilter
) IBaseFilter_Release(PinInfo
.pFilter
);
1861 static HRESULT WINAPI
SendRun(IBaseFilter
*pFilter
, DWORD_PTR data
)
1863 REFERENCE_TIME time
= *(REFERENCE_TIME
*)data
;
1864 return IBaseFilter_Run(pFilter
, time
);
1867 static HRESULT WINAPI
SendPause(IBaseFilter
*pFilter
, DWORD_PTR data
)
1869 return IBaseFilter_Pause(pFilter
);
1872 static HRESULT WINAPI
SendStop(IBaseFilter
*pFilter
, DWORD_PTR data
)
1874 return IBaseFilter_Stop(pFilter
);
1877 static HRESULT WINAPI
SendGetState(IBaseFilter
*pFilter
, DWORD_PTR data
)
1880 DWORD time_end
= data
;
1881 DWORD time_now
= GetTickCount();
1884 if (time_end
== INFINITE
)
1888 else if (time_end
> time_now
)
1890 wait
= time_end
- time_now
;
1895 return IBaseFilter_GetState(pFilter
, wait
, &state
);
1899 static HRESULT
SendFilterMessage(IFilterGraphImpl
*This
, fnFoundFilter FoundFilter
, DWORD_PTR data
)
1902 IBaseFilter
* pfilter
;
1909 TRACE("(%p)->()\n", This
);
1911 /* Explorer the graph from source filters to renderers, determine renderers
1912 * number and run filters from renderers to source filters */
1913 This
->nRenderers
= 0;
1914 ResetEvent(This
->hEventCompletion
);
1916 for(i
= 0; i
< This
->nFilters
; i
++)
1919 pfilter
= This
->ppFiltersInGraph
[i
];
1920 hr
= IBaseFilter_EnumPins(pfilter
, &pEnum
);
1923 WARN("Enum pins failed %x\n", hr
);
1926 /* Check if it is a source filter */
1927 while(IEnumPins_Next(pEnum
, 1, &pPin
, &dummy
) == S_OK
)
1929 IPin_QueryDirection(pPin
, &dir
);
1931 if (dir
== PINDIR_INPUT
)
1939 TRACE("Found a source filter %p\n", pfilter
);
1940 IEnumPins_Reset(pEnum
);
1941 while(IEnumPins_Next(pEnum
, 1, &pPin
, &dummy
) == S_OK
)
1943 /* Explore the graph downstream from this pin */
1944 ExploreGraph(This
, pPin
, FoundFilter
, data
);
1947 FoundFilter(pfilter
, data
);
1949 IEnumPins_Release(pEnum
);
1955 /*** IMediaControl methods ***/
1956 static HRESULT WINAPI
MediaControl_Run(IMediaControl
*iface
)
1958 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1960 TRACE("(%p/%p)->()\n", This
, iface
);
1962 EnterCriticalSection(&This
->cs
);
1963 if (This
->state
== State_Running
)
1965 This
->EcCompleteCount
= 0;
1967 if (This
->defaultclock
&& !This
->refClock
)
1968 IFilterGraph2_SetDefaultSyncSource((IFilterGraph2
*)This
);
1973 IReferenceClock_GetTime(This
->refClock
, &now
);
1974 if (This
->state
== State_Stopped
)
1975 This
->start_time
= now
+ 500000;
1976 else if (This
->pause_time
>= 0)
1977 This
->start_time
+= now
- This
->pause_time
;
1979 This
->start_time
= now
;
1981 else This
->start_time
= 0;
1983 SendFilterMessage(This
, SendRun
, (DWORD_PTR
)&This
->start_time
);
1984 This
->state
= State_Running
;
1986 LeaveCriticalSection(&This
->cs
);
1990 static HRESULT WINAPI
MediaControl_Pause(IMediaControl
*iface
)
1992 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1994 TRACE("(%p/%p)->()\n", This
, iface
);
1996 EnterCriticalSection(&This
->cs
);
1997 if (This
->state
== State_Paused
)
2000 if (This
->state
== State_Running
&& This
->refClock
&& This
->start_time
>= 0)
2001 IReferenceClock_GetTime(This
->refClock
, &This
->pause_time
);
2003 This
->pause_time
= -1;
2005 SendFilterMessage(This
, SendPause
, 0);
2006 This
->state
= State_Paused
;
2008 LeaveCriticalSection(&This
->cs
);
2012 static HRESULT WINAPI
MediaControl_Stop(IMediaControl
*iface
)
2014 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2016 TRACE("(%p/%p)->()\n", This
, iface
);
2018 if (This
->state
== State_Stopped
) return S_OK
;
2020 EnterCriticalSection(&This
->cs
);
2021 if (This
->state
== State_Running
) SendFilterMessage(This
, SendPause
, 0);
2022 SendFilterMessage(This
, SendStop
, 0);
2023 This
->state
= State_Stopped
;
2024 LeaveCriticalSection(&This
->cs
);
2028 static HRESULT WINAPI
MediaControl_GetState(IMediaControl
*iface
, LONG msTimeout
,
2031 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2034 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, msTimeout
, pfs
);
2039 EnterCriticalSection(&This
->cs
);
2044 end
= GetTickCount() + msTimeout
;
2046 else if (msTimeout
< 0)
2055 SendFilterMessage(This
, SendGetState
, end
);
2057 LeaveCriticalSection(&This
->cs
);
2062 static HRESULT WINAPI
MediaControl_RenderFile(IMediaControl
*iface
, BSTR strFilename
)
2064 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2066 FIXME("(%p/%p)->(%s (%p)): stub !!!\n", This
, iface
, debugstr_w(strFilename
), strFilename
);
2071 static HRESULT WINAPI
MediaControl_AddSourceFilter(IMediaControl
*iface
, BSTR strFilename
,
2074 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2076 FIXME("(%p/%p)->(%s (%p), %p): stub !!!\n", This
, iface
, debugstr_w(strFilename
), strFilename
, ppUnk
);
2081 static HRESULT WINAPI
MediaControl_get_FilterCollection(IMediaControl
*iface
, IDispatch
**ppUnk
)
2083 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2085 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, ppUnk
);
2090 static HRESULT WINAPI
MediaControl_get_RegFilterCollection(IMediaControl
*iface
, IDispatch
**ppUnk
)
2092 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2094 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, ppUnk
);
2099 static HRESULT WINAPI
MediaControl_StopWhenReady(IMediaControl
*iface
)
2101 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2103 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
2109 static const IMediaControlVtbl IMediaControl_VTable
=
2111 MediaControl_QueryInterface
,
2112 MediaControl_AddRef
,
2113 MediaControl_Release
,
2114 MediaControl_GetTypeInfoCount
,
2115 MediaControl_GetTypeInfo
,
2116 MediaControl_GetIDsOfNames
,
2117 MediaControl_Invoke
,
2121 MediaControl_GetState
,
2122 MediaControl_RenderFile
,
2123 MediaControl_AddSourceFilter
,
2124 MediaControl_get_FilterCollection
,
2125 MediaControl_get_RegFilterCollection
,
2126 MediaControl_StopWhenReady
2129 static inline IFilterGraphImpl
*impl_from_IMediaSeeking(IMediaSeeking
*iface
)
2131 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaSeeking_iface
);
2134 static HRESULT WINAPI
MediaSeeking_QueryInterface(IMediaSeeking
*iface
, REFIID riid
, void **ppvObj
)
2136 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2138 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2140 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2143 static ULONG WINAPI
MediaSeeking_AddRef(IMediaSeeking
*iface
)
2145 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2147 TRACE("(%p/%p)->()\n", This
, iface
);
2149 return Filtergraph_AddRef(This
);
2152 static ULONG WINAPI
MediaSeeking_Release(IMediaSeeking
*iface
)
2154 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2156 TRACE("(%p/%p)->()\n", This
, iface
);
2158 return Filtergraph_Release(This
);
2161 typedef HRESULT (WINAPI
*fnFoundSeek
)(IFilterGraphImpl
*This
, IMediaSeeking
*, DWORD_PTR arg
);
2163 static HRESULT
all_renderers_seek(IFilterGraphImpl
*This
, fnFoundSeek FoundSeek
, DWORD_PTR arg
) {
2164 BOOL allnotimpl
= TRUE
;
2166 HRESULT hr
, hr_return
= S_OK
;
2168 TRACE("(%p)->(%p %08lx)\n", This
, FoundSeek
, arg
);
2169 /* Send a message to all renderers, they are responsible for broadcasting it further */
2171 for(i
= 0; i
< This
->nFilters
; i
++)
2173 IMediaSeeking
*seek
= NULL
;
2174 IBaseFilter
* pfilter
= This
->ppFiltersInGraph
[i
];
2175 IAMFilterMiscFlags
*flags
= NULL
;
2177 IUnknown_QueryInterface(pfilter
, &IID_IAMFilterMiscFlags
, (void**)&flags
);
2180 filterflags
= IAMFilterMiscFlags_GetMiscFlags(flags
);
2181 IUnknown_Release(flags
);
2182 if (filterflags
!= AM_FILTER_MISC_FLAGS_IS_RENDERER
)
2185 IBaseFilter_QueryInterface(pfilter
, &IID_IMediaSeeking
, (void**)&seek
);
2188 hr
= FoundSeek(This
, seek
, arg
);
2189 IMediaSeeking_Release(seek
);
2190 if (hr_return
!= E_NOTIMPL
)
2192 if (hr_return
== S_OK
|| (FAILED(hr
) && hr
!= E_NOTIMPL
&& SUCCEEDED(hr_return
)))
2201 static HRESULT WINAPI
FoundCapabilities(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pcaps
)
2206 hr
= IMediaSeeking_GetCapabilities(seek
, &caps
);
2210 /* Only add common capabilities everything supports */
2211 *(DWORD
*)pcaps
&= caps
;
2216 /*** IMediaSeeking methods ***/
2217 static HRESULT WINAPI
MediaSeeking_GetCapabilities(IMediaSeeking
*iface
, DWORD
*pCapabilities
)
2219 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2222 TRACE("(%p/%p)->(%p)\n", This
, iface
, pCapabilities
);
2227 EnterCriticalSection(&This
->cs
);
2228 *pCapabilities
= 0xffffffff;
2230 hr
= all_renderers_seek(This
, FoundCapabilities
, (DWORD_PTR
)pCapabilities
);
2231 LeaveCriticalSection(&This
->cs
);
2236 static HRESULT WINAPI
MediaSeeking_CheckCapabilities(IMediaSeeking
*iface
, DWORD
*pCapabilities
)
2238 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2242 TRACE("(%p/%p)->(%p)\n", This
, iface
, pCapabilities
);
2247 EnterCriticalSection(&This
->cs
);
2248 originalcaps
= *pCapabilities
;
2249 hr
= all_renderers_seek(This
, FoundCapabilities
, (DWORD_PTR
)pCapabilities
);
2250 LeaveCriticalSection(&This
->cs
);
2255 if (!*pCapabilities
)
2257 if (*pCapabilities
!= originalcaps
)
2262 static HRESULT WINAPI
MediaSeeking_IsFormatSupported(IMediaSeeking
*iface
, const GUID
*pFormat
)
2264 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2269 TRACE("(%p/%p)->(%s)\n", This
, iface
, debugstr_guid(pFormat
));
2271 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, pFormat
))
2273 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat
));
2280 static HRESULT WINAPI
MediaSeeking_QueryPreferredFormat(IMediaSeeking
*iface
, GUID
*pFormat
)
2282 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2287 FIXME("(%p/%p)->(%p): semi-stub !!!\n", This
, iface
, pFormat
);
2288 memcpy(pFormat
, &TIME_FORMAT_MEDIA_TIME
, sizeof(GUID
));
2293 static HRESULT WINAPI
MediaSeeking_GetTimeFormat(IMediaSeeking
*iface
, GUID
*pFormat
)
2295 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2300 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFormat
);
2301 memcpy(pFormat
, &This
->timeformatseek
, sizeof(GUID
));
2306 static HRESULT WINAPI
MediaSeeking_IsUsingTimeFormat(IMediaSeeking
*iface
, const GUID
*pFormat
)
2308 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2310 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFormat
);
2314 if (memcmp(pFormat
, &This
->timeformatseek
, sizeof(GUID
)))
2320 static HRESULT WINAPI
MediaSeeking_SetTimeFormat(IMediaSeeking
*iface
, const GUID
*pFormat
)
2322 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2327 TRACE("(%p/%p)->(%s)\n", This
, iface
, debugstr_guid(pFormat
));
2329 if (This
->state
!= State_Stopped
)
2330 return VFW_E_WRONG_STATE
;
2332 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, pFormat
))
2334 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat
));
2335 return E_INVALIDARG
;
2341 static HRESULT WINAPI
FoundDuration(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pduration
)
2344 LONGLONG duration
= 0, *pdur
= (LONGLONG
*)pduration
;
2346 hr
= IMediaSeeking_GetDuration(seek
, &duration
);
2350 if (*pdur
< duration
)
2355 static HRESULT WINAPI
MediaSeeking_GetDuration(IMediaSeeking
*iface
, LONGLONG
*pDuration
)
2357 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2360 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDuration
);
2365 EnterCriticalSection(&This
->cs
);
2367 hr
= all_renderers_seek(This
, FoundDuration
, (DWORD_PTR
)pDuration
);
2368 LeaveCriticalSection(&This
->cs
);
2370 TRACE("--->%08x\n", hr
);
2374 static HRESULT WINAPI
MediaSeeking_GetStopPosition(IMediaSeeking
*iface
, LONGLONG
*pStop
)
2376 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2379 TRACE("(%p/%p)->(%p)\n", This
, iface
, pStop
);
2384 EnterCriticalSection(&This
->cs
);
2385 if (This
->stop_position
< 0)
2386 /* Stop position not set, use duration instead */
2387 hr
= IMediaSeeking_GetDuration(iface
, pStop
);
2389 *pStop
= This
->stop_position
;
2390 LeaveCriticalSection(&This
->cs
);
2395 static HRESULT WINAPI
FoundCurrentPosition(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pposition
)
2398 LONGLONG pos
= 0, *ppos
= (LONGLONG
*)pposition
;
2400 hr
= IMediaSeeking_GetCurrentPosition(seek
, &pos
);
2404 if (*ppos
< 0 || pos
< *ppos
)
2409 static HRESULT WINAPI
MediaSeeking_GetCurrentPosition(IMediaSeeking
*iface
, LONGLONG
*pCurrent
)
2411 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2417 EnterCriticalSection(&This
->cs
);
2419 hr
= all_renderers_seek(This
, FoundCurrentPosition
, (DWORD_PTR
)pCurrent
);
2420 if (hr
== E_NOTIMPL
) {
2424 LeaveCriticalSection(&This
->cs
);
2426 TRACE("Time: %u.%03u\n", (DWORD
)(*pCurrent
/ 10000000), (DWORD
)((*pCurrent
/ 10000)%1000));
2431 static HRESULT WINAPI
MediaSeeking_ConvertTimeFormat(IMediaSeeking
*iface
, LONGLONG
*pTarget
,
2432 const GUID
*pTargetFormat
, LONGLONG Source
, const GUID
*pSourceFormat
)
2434 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2436 FIXME("(%p/%p)->(%p, %p, 0x%s, %p): stub !!!\n", This
, iface
, pTarget
,
2437 pTargetFormat
, wine_dbgstr_longlong(Source
), pSourceFormat
);
2443 LONGLONG
* current
, *stop
;
2444 DWORD curflags
, stopflags
;
2447 static HRESULT WINAPI
found_setposition(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pargs
)
2449 struct pos_args
*args
= (void*)pargs
;
2451 return IMediaSeeking_SetPositions(seek
, args
->current
, args
->curflags
, args
->stop
, args
->stopflags
);
2454 static HRESULT WINAPI
MediaSeeking_SetPositions(IMediaSeeking
*iface
, LONGLONG
*pCurrent
,
2455 DWORD dwCurrentFlags
, LONGLONG
*pStop
, DWORD dwStopFlags
)
2457 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2460 struct pos_args args
;
2462 TRACE("(%p/%p)->(%p, %08x, %p, %08x)\n", This
, iface
, pCurrent
, dwCurrentFlags
, pStop
, dwStopFlags
);
2464 EnterCriticalSection(&This
->cs
);
2465 state
= This
->state
;
2466 TRACE("State: %s\n", state
== State_Running
? "Running" : (state
== State_Paused
? "Paused" : (state
== State_Stopped
? "Stopped" : "UNKNOWN")));
2468 if ((dwCurrentFlags
& 0x7) != AM_SEEKING_AbsolutePositioning
&&
2469 (dwCurrentFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2470 FIXME("Adjust method %x not handled yet!\n", dwCurrentFlags
& 0x7);
2472 if ((dwStopFlags
& 0x7) == AM_SEEKING_AbsolutePositioning
)
2473 This
->stop_position
= *pStop
;
2474 else if ((dwStopFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2475 FIXME("Stop position not handled yet!\n");
2477 if (state
== State_Running
&& !(dwCurrentFlags
& AM_SEEKING_NoFlush
))
2478 IMediaControl_Pause(&This
->IMediaControl_iface
);
2479 args
.current
= pCurrent
;
2481 args
.curflags
= dwCurrentFlags
;
2482 args
.stopflags
= dwStopFlags
;
2483 hr
= all_renderers_seek(This
, found_setposition
, (DWORD_PTR
)&args
);
2485 if ((dwCurrentFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2486 This
->pause_time
= This
->start_time
= -1;
2487 if (state
== State_Running
&& !(dwCurrentFlags
& AM_SEEKING_NoFlush
))
2488 IMediaControl_Run(&This
->IMediaControl_iface
);
2489 LeaveCriticalSection(&This
->cs
);
2494 static HRESULT WINAPI
MediaSeeking_GetPositions(IMediaSeeking
*iface
, LONGLONG
*pCurrent
,
2497 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2500 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pCurrent
, pStop
);
2501 hr
= IMediaSeeking_GetCurrentPosition(iface
, pCurrent
);
2503 hr
= IMediaSeeking_GetStopPosition(iface
, pStop
);
2508 static HRESULT WINAPI
MediaSeeking_GetAvailable(IMediaSeeking
*iface
, LONGLONG
*pEarliest
,
2511 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2513 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This
, iface
, pEarliest
, pLatest
);
2518 static HRESULT WINAPI
MediaSeeking_SetRate(IMediaSeeking
*iface
, double dRate
)
2520 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2522 FIXME("(%p/%p)->(%f): stub !!!\n", This
, iface
, dRate
);
2527 static HRESULT WINAPI
MediaSeeking_GetRate(IMediaSeeking
*iface
, double *pdRate
)
2529 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2531 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pdRate
);
2536 static HRESULT WINAPI
MediaSeeking_GetPreroll(IMediaSeeking
*iface
, LONGLONG
*pllPreroll
)
2538 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2540 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pllPreroll
);
2546 static const IMediaSeekingVtbl IMediaSeeking_VTable
=
2548 MediaSeeking_QueryInterface
,
2549 MediaSeeking_AddRef
,
2550 MediaSeeking_Release
,
2551 MediaSeeking_GetCapabilities
,
2552 MediaSeeking_CheckCapabilities
,
2553 MediaSeeking_IsFormatSupported
,
2554 MediaSeeking_QueryPreferredFormat
,
2555 MediaSeeking_GetTimeFormat
,
2556 MediaSeeking_IsUsingTimeFormat
,
2557 MediaSeeking_SetTimeFormat
,
2558 MediaSeeking_GetDuration
,
2559 MediaSeeking_GetStopPosition
,
2560 MediaSeeking_GetCurrentPosition
,
2561 MediaSeeking_ConvertTimeFormat
,
2562 MediaSeeking_SetPositions
,
2563 MediaSeeking_GetPositions
,
2564 MediaSeeking_GetAvailable
,
2565 MediaSeeking_SetRate
,
2566 MediaSeeking_GetRate
,
2567 MediaSeeking_GetPreroll
2570 static inline IFilterGraphImpl
*impl_from_IMediaPosition(IMediaPosition
*iface
)
2572 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaPosition_iface
);
2575 /*** IUnknown methods ***/
2576 static HRESULT WINAPI
MediaPosition_QueryInterface(IMediaPosition
* iface
, REFIID riid
, void** ppvObj
)
2578 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2580 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2581 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2584 static ULONG WINAPI
MediaPosition_AddRef(IMediaPosition
*iface
)
2586 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2588 TRACE("(%p/%p)->()\n", This
, iface
);
2589 return Filtergraph_AddRef(This
);
2592 static ULONG WINAPI
MediaPosition_Release(IMediaPosition
*iface
)
2594 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2596 TRACE("(%p/%p)->()\n", This
, iface
);
2597 return Filtergraph_Release(This
);
2600 /*** IDispatch methods ***/
2601 static HRESULT WINAPI
MediaPosition_GetTypeInfoCount(IMediaPosition
*iface
, UINT
* pctinfo
){
2602 FIXME("(%p) stub!\n", iface
);
2606 static HRESULT WINAPI
MediaPosition_GetTypeInfo(IMediaPosition
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
** ppTInfo
){
2607 FIXME("(%p) stub!\n", iface
);
2611 static HRESULT WINAPI
MediaPosition_GetIDsOfNames(IMediaPosition
* iface
, REFIID riid
, LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
){
2612 FIXME("(%p) stub!\n", iface
);
2616 static HRESULT WINAPI
MediaPosition_Invoke(IMediaPosition
* iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
, VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
){
2617 FIXME("(%p) stub!\n", iface
);
2621 static HRESULT
ConvertFromREFTIME(IMediaSeeking
*seek
, REFTIME time_in
, LONGLONG
*time_out
)
2626 hr
= MediaSeeking_GetTimeFormat(seek
, &time_format
);
2629 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, &time_format
))
2631 FIXME("Unsupported time format.\n");
2635 *time_out
= (LONGLONG
) (time_in
* 10000000); /* convert from 1 second intervals to 100 ns intervals */
2639 static HRESULT
ConvertToREFTIME(IMediaSeeking
*seek
, LONGLONG time_in
, REFTIME
*time_out
)
2644 hr
= MediaSeeking_GetTimeFormat(seek
, &time_format
);
2647 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, &time_format
))
2649 FIXME("Unsupported time format.\n");
2653 *time_out
= (REFTIME
)time_in
/ 10000000; /* convert from 100 ns intervals to 1 second intervals */
2657 /*** IMediaPosition methods ***/
2658 static HRESULT WINAPI
MediaPosition_get_Duration(IMediaPosition
* iface
, REFTIME
*plength
)
2661 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2662 HRESULT hr
= IMediaSeeking_GetDuration(&This
->IMediaSeeking_iface
, &duration
);
2665 return ConvertToREFTIME(&This
->IMediaSeeking_iface
, duration
, plength
);
2668 static HRESULT WINAPI
MediaPosition_put_CurrentPosition(IMediaPosition
* iface
, REFTIME llTime
)
2670 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2674 hr
= ConvertFromREFTIME(&This
->IMediaSeeking_iface
, llTime
, &reftime
);
2677 return IMediaSeeking_SetPositions(&This
->IMediaSeeking_iface
, &reftime
,
2678 AM_SEEKING_AbsolutePositioning
, NULL
, AM_SEEKING_NoPositioning
);
2681 static HRESULT WINAPI
MediaPosition_get_CurrentPosition(IMediaPosition
* iface
, REFTIME
*pllTime
)
2683 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2687 hr
= IMediaSeeking_GetCurrentPosition(&This
->IMediaSeeking_iface
, &pos
);
2690 return ConvertToREFTIME(&This
->IMediaSeeking_iface
, pos
, pllTime
);
2693 static HRESULT WINAPI
MediaPosition_get_StopTime(IMediaPosition
* iface
, REFTIME
*pllTime
)
2695 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2697 HRESULT hr
= IMediaSeeking_GetStopPosition(&This
->IMediaSeeking_iface
, &pos
);
2700 return ConvertToREFTIME(&This
->IMediaSeeking_iface
, pos
, pllTime
);
2703 static HRESULT WINAPI
MediaPosition_put_StopTime(IMediaPosition
* iface
, REFTIME llTime
)
2705 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2709 hr
= ConvertFromREFTIME(&This
->IMediaSeeking_iface
, llTime
, &reftime
);
2712 return IMediaSeeking_SetPositions(&This
->IMediaSeeking_iface
, NULL
, AM_SEEKING_NoPositioning
,
2713 &reftime
, AM_SEEKING_AbsolutePositioning
);
2716 static HRESULT WINAPI
MediaPosition_get_PrerollTime(IMediaPosition
* iface
, REFTIME
*pllTime
){
2717 FIXME("(%p)->(%p) stub!\n", iface
, pllTime
);
2721 static HRESULT WINAPI
MediaPosition_put_PrerollTime(IMediaPosition
* iface
, REFTIME llTime
){
2722 FIXME("(%p)->(%f) stub!\n", iface
, llTime
);
2726 static HRESULT WINAPI
MediaPosition_put_Rate(IMediaPosition
* iface
, double dRate
)
2728 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2729 return IMediaSeeking_SetRate(&This
->IMediaSeeking_iface
, dRate
);
2732 static HRESULT WINAPI
MediaPosition_get_Rate(IMediaPosition
* iface
, double *pdRate
)
2734 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2735 return IMediaSeeking_GetRate(&This
->IMediaSeeking_iface
, pdRate
);
2738 static HRESULT WINAPI
MediaPosition_CanSeekForward(IMediaPosition
* iface
, LONG
*pCanSeekForward
){
2739 FIXME("(%p)->(%p) stub!\n", iface
, pCanSeekForward
);
2743 static HRESULT WINAPI
MediaPosition_CanSeekBackward(IMediaPosition
* iface
, LONG
*pCanSeekBackward
){
2744 FIXME("(%p)->(%p) stub!\n", iface
, pCanSeekBackward
);
2749 static const IMediaPositionVtbl IMediaPosition_VTable
=
2751 MediaPosition_QueryInterface
,
2752 MediaPosition_AddRef
,
2753 MediaPosition_Release
,
2754 MediaPosition_GetTypeInfoCount
,
2755 MediaPosition_GetTypeInfo
,
2756 MediaPosition_GetIDsOfNames
,
2757 MediaPosition_Invoke
,
2758 MediaPosition_get_Duration
,
2759 MediaPosition_put_CurrentPosition
,
2760 MediaPosition_get_CurrentPosition
,
2761 MediaPosition_get_StopTime
,
2762 MediaPosition_put_StopTime
,
2763 MediaPosition_get_PrerollTime
,
2764 MediaPosition_put_PrerollTime
,
2765 MediaPosition_put_Rate
,
2766 MediaPosition_get_Rate
,
2767 MediaPosition_CanSeekForward
,
2768 MediaPosition_CanSeekBackward
2771 static HRESULT
GetTargetInterface(IFilterGraphImpl
* pGraph
, REFIID riid
, LPVOID
* ppvObj
)
2773 HRESULT hr
= E_NOINTERFACE
;
2777 /* Check if the interface type is already registered */
2778 for (entry
= 0; entry
< pGraph
->nItfCacheEntries
; entry
++)
2779 if (riid
== pGraph
->ItfCacheEntries
[entry
].riid
)
2781 if (pGraph
->ItfCacheEntries
[entry
].iface
)
2783 /* Return the interface if available */
2784 *ppvObj
= pGraph
->ItfCacheEntries
[entry
].iface
;
2790 if (entry
>= MAX_ITF_CACHE_ENTRIES
)
2792 FIXME("Not enough space to store interface in the cache\n");
2793 return E_OUTOFMEMORY
;
2796 /* Find a filter supporting the requested interface */
2797 for (i
= 0; i
< pGraph
->nFilters
; i
++)
2799 hr
= IBaseFilter_QueryInterface(pGraph
->ppFiltersInGraph
[i
], riid
, ppvObj
);
2802 pGraph
->ItfCacheEntries
[entry
].riid
= riid
;
2803 pGraph
->ItfCacheEntries
[entry
].filter
= pGraph
->ppFiltersInGraph
[i
];
2804 pGraph
->ItfCacheEntries
[entry
].iface
= *ppvObj
;
2805 if (entry
>= pGraph
->nItfCacheEntries
)
2806 pGraph
->nItfCacheEntries
++;
2809 if (hr
!= E_NOINTERFACE
)
2816 static inline IFilterGraphImpl
*impl_from_IBasicAudio(IBasicAudio
*iface
)
2818 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IBasicAudio_iface
);
2821 static HRESULT WINAPI
BasicAudio_QueryInterface(IBasicAudio
*iface
, REFIID riid
, void **ppvObj
)
2823 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2825 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2827 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2830 static ULONG WINAPI
BasicAudio_AddRef(IBasicAudio
*iface
)
2832 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2834 TRACE("(%p/%p)->()\n", This
, iface
);
2836 return Filtergraph_AddRef(This
);
2839 static ULONG WINAPI
BasicAudio_Release(IBasicAudio
*iface
)
2841 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2843 TRACE("(%p/%p)->()\n", This
, iface
);
2845 return Filtergraph_Release(This
);
2848 /*** IDispatch methods ***/
2849 static HRESULT WINAPI
BasicAudio_GetTypeInfoCount(IBasicAudio
*iface
, UINT
*pctinfo
)
2851 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2852 IBasicAudio
* pBasicAudio
;
2855 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
2857 EnterCriticalSection(&This
->cs
);
2859 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2862 hr
= IBasicAudio_GetTypeInfoCount(pBasicAudio
, pctinfo
);
2864 LeaveCriticalSection(&This
->cs
);
2869 static HRESULT WINAPI
BasicAudio_GetTypeInfo(IBasicAudio
*iface
, UINT iTInfo
, LCID lcid
,
2870 ITypeInfo
**ppTInfo
)
2872 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2873 IBasicAudio
* pBasicAudio
;
2876 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
2878 EnterCriticalSection(&This
->cs
);
2880 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2883 hr
= IBasicAudio_GetTypeInfo(pBasicAudio
, iTInfo
, lcid
, ppTInfo
);
2885 LeaveCriticalSection(&This
->cs
);
2890 static HRESULT WINAPI
BasicAudio_GetIDsOfNames(IBasicAudio
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
2891 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2893 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2894 IBasicAudio
* pBasicAudio
;
2897 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2899 EnterCriticalSection(&This
->cs
);
2901 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2904 hr
= IBasicAudio_GetIDsOfNames(pBasicAudio
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2906 LeaveCriticalSection(&This
->cs
);
2911 static HRESULT WINAPI
BasicAudio_Invoke(IBasicAudio
*iface
, DISPID dispIdMember
, REFIID riid
,
2912 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
2915 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2916 IBasicAudio
* pBasicAudio
;
2919 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
);
2921 EnterCriticalSection(&This
->cs
);
2923 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2926 hr
= IBasicAudio_Invoke(pBasicAudio
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
2928 LeaveCriticalSection(&This
->cs
);
2933 /*** IBasicAudio methods ***/
2934 static HRESULT WINAPI
BasicAudio_put_Volume(IBasicAudio
*iface
, LONG lVolume
)
2936 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2937 IBasicAudio
* pBasicAudio
;
2940 TRACE("(%p/%p)->(%d)\n", This
, iface
, lVolume
);
2942 EnterCriticalSection(&This
->cs
);
2944 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2947 hr
= IBasicAudio_put_Volume(pBasicAudio
, lVolume
);
2949 LeaveCriticalSection(&This
->cs
);
2954 static HRESULT WINAPI
BasicAudio_get_Volume(IBasicAudio
*iface
, LONG
*plVolume
)
2956 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2957 IBasicAudio
* pBasicAudio
;
2960 TRACE("(%p/%p)->(%p)\n", This
, iface
, plVolume
);
2962 EnterCriticalSection(&This
->cs
);
2964 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2967 hr
= IBasicAudio_get_Volume(pBasicAudio
, plVolume
);
2969 LeaveCriticalSection(&This
->cs
);
2974 static HRESULT WINAPI
BasicAudio_put_Balance(IBasicAudio
*iface
, LONG lBalance
)
2976 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2977 IBasicAudio
* pBasicAudio
;
2980 TRACE("(%p/%p)->(%d)\n", This
, iface
, lBalance
);
2982 EnterCriticalSection(&This
->cs
);
2984 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2987 hr
= IBasicAudio_put_Balance(pBasicAudio
, lBalance
);
2989 LeaveCriticalSection(&This
->cs
);
2994 static HRESULT WINAPI
BasicAudio_get_Balance(IBasicAudio
*iface
, LONG
*plBalance
)
2996 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2997 IBasicAudio
* pBasicAudio
;
3000 TRACE("(%p/%p)->(%p)\n", This
, iface
, plBalance
);
3002 EnterCriticalSection(&This
->cs
);
3004 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
3007 hr
= IBasicAudio_get_Balance(pBasicAudio
, plBalance
);
3009 LeaveCriticalSection(&This
->cs
);
3014 static const IBasicAudioVtbl IBasicAudio_VTable
=
3016 BasicAudio_QueryInterface
,
3019 BasicAudio_GetTypeInfoCount
,
3020 BasicAudio_GetTypeInfo
,
3021 BasicAudio_GetIDsOfNames
,
3023 BasicAudio_put_Volume
,
3024 BasicAudio_get_Volume
,
3025 BasicAudio_put_Balance
,
3026 BasicAudio_get_Balance
3029 static inline IFilterGraphImpl
*impl_from_IBasicVideo2(IBasicVideo2
*iface
)
3031 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IBasicVideo2_iface
);
3034 static HRESULT WINAPI
BasicVideo_QueryInterface(IBasicVideo2
*iface
, REFIID riid
, void **ppvObj
)
3036 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3038 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
3040 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
3043 static ULONG WINAPI
BasicVideo_AddRef(IBasicVideo2
*iface
)
3045 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3047 TRACE("(%p/%p)->()\n", This
, iface
);
3049 return Filtergraph_AddRef(This
);
3052 static ULONG WINAPI
BasicVideo_Release(IBasicVideo2
*iface
)
3054 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3056 TRACE("(%p/%p)->()\n", This
, iface
);
3058 return Filtergraph_Release(This
);
3061 /*** IDispatch methods ***/
3062 static HRESULT WINAPI
BasicVideo_GetTypeInfoCount(IBasicVideo2
*iface
, UINT
*pctinfo
)
3064 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3065 IBasicVideo
*pBasicVideo
;
3068 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
3070 EnterCriticalSection(&This
->cs
);
3072 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3075 hr
= IBasicVideo_GetTypeInfoCount(pBasicVideo
, pctinfo
);
3077 LeaveCriticalSection(&This
->cs
);
3082 static HRESULT WINAPI
BasicVideo_GetTypeInfo(IBasicVideo2
*iface
, UINT iTInfo
, LCID lcid
,
3083 ITypeInfo
**ppTInfo
)
3085 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3086 IBasicVideo
*pBasicVideo
;
3089 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
3091 EnterCriticalSection(&This
->cs
);
3093 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3096 hr
= IBasicVideo_GetTypeInfo(pBasicVideo
, iTInfo
, lcid
, ppTInfo
);
3098 LeaveCriticalSection(&This
->cs
);
3103 static HRESULT WINAPI
BasicVideo_GetIDsOfNames(IBasicVideo2
*iface
, REFIID riid
,
3104 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3106 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3107 IBasicVideo
*pBasicVideo
;
3110 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3112 EnterCriticalSection(&This
->cs
);
3114 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3117 hr
= IBasicVideo_GetIDsOfNames(pBasicVideo
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3119 LeaveCriticalSection(&This
->cs
);
3124 static HRESULT WINAPI
BasicVideo_Invoke(IBasicVideo2
*iface
, DISPID dispIdMember
, REFIID riid
,
3125 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
3128 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3129 IBasicVideo
*pBasicVideo
;
3132 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
);
3134 EnterCriticalSection(&This
->cs
);
3136 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3139 hr
= IBasicVideo_Invoke(pBasicVideo
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
3141 LeaveCriticalSection(&This
->cs
);
3146 /*** IBasicVideo methods ***/
3147 static HRESULT WINAPI
BasicVideo_get_AvgTimePerFrame(IBasicVideo2
*iface
, REFTIME
*pAvgTimePerFrame
)
3149 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3150 IBasicVideo
*pBasicVideo
;
3153 TRACE("(%p/%p)->(%p)\n", This
, iface
, pAvgTimePerFrame
);
3155 EnterCriticalSection(&This
->cs
);
3157 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3160 hr
= IBasicVideo_get_AvgTimePerFrame(pBasicVideo
, pAvgTimePerFrame
);
3162 LeaveCriticalSection(&This
->cs
);
3167 static HRESULT WINAPI
BasicVideo_get_BitRate(IBasicVideo2
*iface
, LONG
*pBitRate
)
3169 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3170 IBasicVideo
*pBasicVideo
;
3173 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBitRate
);
3175 EnterCriticalSection(&This
->cs
);
3177 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3180 hr
= IBasicVideo_get_BitRate(pBasicVideo
, pBitRate
);
3182 LeaveCriticalSection(&This
->cs
);
3187 static HRESULT WINAPI
BasicVideo_get_BitErrorRate(IBasicVideo2
*iface
, LONG
*pBitErrorRate
)
3189 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3190 IBasicVideo
*pBasicVideo
;
3193 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBitErrorRate
);
3195 EnterCriticalSection(&This
->cs
);
3197 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3200 hr
= IBasicVideo_get_BitErrorRate(pBasicVideo
, pBitErrorRate
);
3202 LeaveCriticalSection(&This
->cs
);
3207 static HRESULT WINAPI
BasicVideo_get_VideoWidth(IBasicVideo2
*iface
, LONG
*pVideoWidth
)
3209 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3210 IBasicVideo
*pBasicVideo
;
3213 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
3215 EnterCriticalSection(&This
->cs
);
3217 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3220 hr
= IBasicVideo_get_VideoWidth(pBasicVideo
, pVideoWidth
);
3222 LeaveCriticalSection(&This
->cs
);
3227 static HRESULT WINAPI
BasicVideo_get_VideoHeight(IBasicVideo2
*iface
, LONG
*pVideoHeight
)
3229 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3230 IBasicVideo
*pBasicVideo
;
3233 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
3235 EnterCriticalSection(&This
->cs
);
3237 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3240 hr
= IBasicVideo_get_VideoHeight(pBasicVideo
, pVideoHeight
);
3242 LeaveCriticalSection(&This
->cs
);
3247 static HRESULT WINAPI
BasicVideo_put_SourceLeft(IBasicVideo2
*iface
, LONG SourceLeft
)
3249 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3250 IBasicVideo
*pBasicVideo
;
3253 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceLeft
);
3255 EnterCriticalSection(&This
->cs
);
3257 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3260 hr
= IBasicVideo_put_SourceLeft(pBasicVideo
, SourceLeft
);
3262 LeaveCriticalSection(&This
->cs
);
3267 static HRESULT WINAPI
BasicVideo_get_SourceLeft(IBasicVideo2
*iface
, LONG
*pSourceLeft
)
3269 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3270 IBasicVideo
*pBasicVideo
;
3273 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
3275 EnterCriticalSection(&This
->cs
);
3277 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3280 hr
= IBasicVideo_get_SourceLeft(pBasicVideo
, pSourceLeft
);
3282 LeaveCriticalSection(&This
->cs
);
3287 static HRESULT WINAPI
BasicVideo_put_SourceWidth(IBasicVideo2
*iface
, LONG SourceWidth
)
3289 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3290 IBasicVideo
*pBasicVideo
;
3293 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceWidth
);
3295 EnterCriticalSection(&This
->cs
);
3297 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3300 hr
= IBasicVideo_put_SourceWidth(pBasicVideo
, SourceWidth
);
3302 LeaveCriticalSection(&This
->cs
);
3307 static HRESULT WINAPI
BasicVideo_get_SourceWidth(IBasicVideo2
*iface
, LONG
*pSourceWidth
)
3309 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3310 IBasicVideo
*pBasicVideo
;
3313 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
3315 EnterCriticalSection(&This
->cs
);
3317 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3320 hr
= IBasicVideo_get_SourceWidth(pBasicVideo
, pSourceWidth
);
3322 LeaveCriticalSection(&This
->cs
);
3327 static HRESULT WINAPI
BasicVideo_put_SourceTop(IBasicVideo2
*iface
, LONG SourceTop
)
3329 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3330 IBasicVideo
*pBasicVideo
;
3333 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceTop
);
3335 EnterCriticalSection(&This
->cs
);
3337 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3340 hr
= IBasicVideo_put_SourceTop(pBasicVideo
, SourceTop
);
3342 LeaveCriticalSection(&This
->cs
);
3347 static HRESULT WINAPI
BasicVideo_get_SourceTop(IBasicVideo2
*iface
, LONG
*pSourceTop
)
3349 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3350 IBasicVideo
*pBasicVideo
;
3353 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
3355 EnterCriticalSection(&This
->cs
);
3357 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3360 hr
= IBasicVideo_get_SourceTop(pBasicVideo
, pSourceTop
);
3362 LeaveCriticalSection(&This
->cs
);
3367 static HRESULT WINAPI
BasicVideo_put_SourceHeight(IBasicVideo2
*iface
, LONG SourceHeight
)
3369 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3370 IBasicVideo
*pBasicVideo
;
3373 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceHeight
);
3375 EnterCriticalSection(&This
->cs
);
3377 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3380 hr
= IBasicVideo_put_SourceHeight(pBasicVideo
, SourceHeight
);
3382 LeaveCriticalSection(&This
->cs
);
3387 static HRESULT WINAPI
BasicVideo_get_SourceHeight(IBasicVideo2
*iface
, LONG
*pSourceHeight
)
3389 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3390 IBasicVideo
*pBasicVideo
;
3393 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
3395 EnterCriticalSection(&This
->cs
);
3397 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3400 hr
= IBasicVideo_get_SourceHeight(pBasicVideo
, pSourceHeight
);
3402 LeaveCriticalSection(&This
->cs
);
3407 static HRESULT WINAPI
BasicVideo_put_DestinationLeft(IBasicVideo2
*iface
, LONG DestinationLeft
)
3409 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3410 IBasicVideo
*pBasicVideo
;
3413 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationLeft
);
3415 EnterCriticalSection(&This
->cs
);
3417 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3420 hr
= IBasicVideo_put_DestinationLeft(pBasicVideo
, DestinationLeft
);
3422 LeaveCriticalSection(&This
->cs
);
3427 static HRESULT WINAPI
BasicVideo_get_DestinationLeft(IBasicVideo2
*iface
, LONG
*pDestinationLeft
)
3429 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3430 IBasicVideo
*pBasicVideo
;
3433 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
3435 EnterCriticalSection(&This
->cs
);
3437 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3440 hr
= IBasicVideo_get_DestinationLeft(pBasicVideo
, pDestinationLeft
);
3442 LeaveCriticalSection(&This
->cs
);
3447 static HRESULT WINAPI
BasicVideo_put_DestinationWidth(IBasicVideo2
*iface
, LONG DestinationWidth
)
3449 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3450 IBasicVideo
*pBasicVideo
;
3453 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationWidth
);
3455 EnterCriticalSection(&This
->cs
);
3457 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3460 hr
= IBasicVideo_put_DestinationWidth(pBasicVideo
, DestinationWidth
);
3462 LeaveCriticalSection(&This
->cs
);
3467 static HRESULT WINAPI
BasicVideo_get_DestinationWidth(IBasicVideo2
*iface
, LONG
*pDestinationWidth
)
3469 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3470 IBasicVideo
*pBasicVideo
;
3473 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
3475 EnterCriticalSection(&This
->cs
);
3477 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3480 hr
= IBasicVideo_get_DestinationWidth(pBasicVideo
, pDestinationWidth
);
3482 LeaveCriticalSection(&This
->cs
);
3487 static HRESULT WINAPI
BasicVideo_put_DestinationTop(IBasicVideo2
*iface
, LONG DestinationTop
)
3489 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3490 IBasicVideo
*pBasicVideo
;
3493 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationTop
);
3495 EnterCriticalSection(&This
->cs
);
3497 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3500 hr
= IBasicVideo_put_DestinationTop(pBasicVideo
, DestinationTop
);
3502 LeaveCriticalSection(&This
->cs
);
3507 static HRESULT WINAPI
BasicVideo_get_DestinationTop(IBasicVideo2
*iface
, LONG
*pDestinationTop
)
3509 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3510 IBasicVideo
*pBasicVideo
;
3513 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
3515 EnterCriticalSection(&This
->cs
);
3517 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3520 hr
= IBasicVideo_get_DestinationTop(pBasicVideo
, pDestinationTop
);
3522 LeaveCriticalSection(&This
->cs
);
3527 static HRESULT WINAPI
BasicVideo_put_DestinationHeight(IBasicVideo2
*iface
, LONG DestinationHeight
)
3529 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3530 IBasicVideo
*pBasicVideo
;
3533 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationHeight
);
3535 EnterCriticalSection(&This
->cs
);
3537 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3540 hr
= IBasicVideo_put_DestinationHeight(pBasicVideo
, DestinationHeight
);
3542 LeaveCriticalSection(&This
->cs
);
3547 static HRESULT WINAPI
BasicVideo_get_DestinationHeight(IBasicVideo2
*iface
,
3548 LONG
*pDestinationHeight
)
3550 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3551 IBasicVideo
*pBasicVideo
;
3554 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
3556 EnterCriticalSection(&This
->cs
);
3558 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3561 hr
= IBasicVideo_get_DestinationHeight(pBasicVideo
, pDestinationHeight
);
3563 LeaveCriticalSection(&This
->cs
);
3568 static HRESULT WINAPI
BasicVideo_SetSourcePosition(IBasicVideo2
*iface
, LONG Left
, LONG Top
,
3569 LONG Width
, LONG Height
)
3571 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3572 IBasicVideo
*pBasicVideo
;
3575 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
3577 EnterCriticalSection(&This
->cs
);
3579 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3582 hr
= IBasicVideo_SetSourcePosition(pBasicVideo
, Left
, Top
, Width
, Height
);
3584 LeaveCriticalSection(&This
->cs
);
3589 static HRESULT WINAPI
BasicVideo_GetSourcePosition(IBasicVideo2
*iface
, LONG
*pLeft
, LONG
*pTop
,
3590 LONG
*pWidth
, LONG
*pHeight
)
3592 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3593 IBasicVideo
*pBasicVideo
;
3596 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
3598 EnterCriticalSection(&This
->cs
);
3600 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3603 hr
= IBasicVideo_GetSourcePosition(pBasicVideo
, pLeft
, pTop
, pWidth
, pHeight
);
3605 LeaveCriticalSection(&This
->cs
);
3610 static HRESULT WINAPI
BasicVideo_SetDefaultSourcePosition(IBasicVideo2
*iface
)
3612 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3613 IBasicVideo
*pBasicVideo
;
3616 TRACE("(%p/%p)->()\n", This
, iface
);
3618 EnterCriticalSection(&This
->cs
);
3620 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3623 hr
= IBasicVideo_SetDefaultSourcePosition(pBasicVideo
);
3625 LeaveCriticalSection(&This
->cs
);
3630 static HRESULT WINAPI
BasicVideo_SetDestinationPosition(IBasicVideo2
*iface
, LONG Left
, LONG Top
,
3631 LONG Width
, LONG Height
)
3633 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3634 IBasicVideo
*pBasicVideo
;
3637 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
3639 EnterCriticalSection(&This
->cs
);
3641 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3644 hr
= IBasicVideo_SetDestinationPosition(pBasicVideo
, Left
, Top
, Width
, Height
);
3646 LeaveCriticalSection(&This
->cs
);
3651 static HRESULT WINAPI
BasicVideo_GetDestinationPosition(IBasicVideo2
*iface
, LONG
*pLeft
,
3652 LONG
*pTop
, LONG
*pWidth
, LONG
*pHeight
)
3654 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3655 IBasicVideo
*pBasicVideo
;
3658 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
3660 EnterCriticalSection(&This
->cs
);
3662 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3665 hr
= IBasicVideo_GetDestinationPosition(pBasicVideo
, pLeft
, pTop
, pWidth
, pHeight
);
3667 LeaveCriticalSection(&This
->cs
);
3672 static HRESULT WINAPI
BasicVideo_SetDefaultDestinationPosition(IBasicVideo2
*iface
)
3674 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3675 IBasicVideo
*pBasicVideo
;
3678 TRACE("(%p/%p)->()\n", This
, iface
);
3680 EnterCriticalSection(&This
->cs
);
3682 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3685 hr
= IBasicVideo_SetDefaultDestinationPosition(pBasicVideo
);
3687 LeaveCriticalSection(&This
->cs
);
3692 static HRESULT WINAPI
BasicVideo_GetVideoSize(IBasicVideo2
*iface
, LONG
*pWidth
, LONG
*pHeight
)
3694 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3695 IBasicVideo
*pBasicVideo
;
3698 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
3700 EnterCriticalSection(&This
->cs
);
3702 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3705 hr
= IBasicVideo_GetVideoSize(pBasicVideo
, pWidth
, pHeight
);
3707 LeaveCriticalSection(&This
->cs
);
3712 static HRESULT WINAPI
BasicVideo_GetVideoPaletteEntries(IBasicVideo2
*iface
, LONG StartIndex
,
3713 LONG Entries
, LONG
*pRetrieved
, LONG
*pPalette
)
3715 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3716 IBasicVideo
*pBasicVideo
;
3719 TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
3721 EnterCriticalSection(&This
->cs
);
3723 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3726 hr
= IBasicVideo_GetVideoPaletteEntries(pBasicVideo
, StartIndex
, Entries
, pRetrieved
, pPalette
);
3728 LeaveCriticalSection(&This
->cs
);
3733 static HRESULT WINAPI
BasicVideo_GetCurrentImage(IBasicVideo2
*iface
, LONG
*pBufferSize
,
3736 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3737 IBasicVideo
*pBasicVideo
;
3740 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pBufferSize
, pDIBImage
);
3742 EnterCriticalSection(&This
->cs
);
3744 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3747 hr
= IBasicVideo_GetCurrentImage(pBasicVideo
, pBufferSize
, pDIBImage
);
3749 LeaveCriticalSection(&This
->cs
);
3754 static HRESULT WINAPI
BasicVideo_IsUsingDefaultSource(IBasicVideo2
*iface
)
3756 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3757 IBasicVideo
*pBasicVideo
;
3760 TRACE("(%p/%p)->()\n", This
, iface
);
3762 EnterCriticalSection(&This
->cs
);
3764 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3767 hr
= IBasicVideo_IsUsingDefaultSource(pBasicVideo
);
3769 LeaveCriticalSection(&This
->cs
);
3774 static HRESULT WINAPI
BasicVideo_IsUsingDefaultDestination(IBasicVideo2
*iface
)
3776 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3777 IBasicVideo
*pBasicVideo
;
3780 TRACE("(%p/%p)->()\n", This
, iface
);
3782 EnterCriticalSection(&This
->cs
);
3784 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3787 hr
= IBasicVideo_IsUsingDefaultDestination(pBasicVideo
);
3789 LeaveCriticalSection(&This
->cs
);
3794 static HRESULT WINAPI
BasicVideo2_GetPreferredAspectRatio(IBasicVideo2
*iface
, LONG
*plAspectX
,
3797 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3798 IBasicVideo2
*pBasicVideo2
;
3801 TRACE("(%p/%p)->()\n", This
, iface
);
3803 EnterCriticalSection(&This
->cs
);
3805 hr
= GetTargetInterface(This
, &IID_IBasicVideo2
, (LPVOID
*)&pBasicVideo2
);
3808 hr
= BasicVideo2_GetPreferredAspectRatio(iface
, plAspectX
, plAspectY
);
3810 LeaveCriticalSection(&This
->cs
);
3815 static const IBasicVideo2Vtbl IBasicVideo_VTable
=
3817 BasicVideo_QueryInterface
,
3820 BasicVideo_GetTypeInfoCount
,
3821 BasicVideo_GetTypeInfo
,
3822 BasicVideo_GetIDsOfNames
,
3824 BasicVideo_get_AvgTimePerFrame
,
3825 BasicVideo_get_BitRate
,
3826 BasicVideo_get_BitErrorRate
,
3827 BasicVideo_get_VideoWidth
,
3828 BasicVideo_get_VideoHeight
,
3829 BasicVideo_put_SourceLeft
,
3830 BasicVideo_get_SourceLeft
,
3831 BasicVideo_put_SourceWidth
,
3832 BasicVideo_get_SourceWidth
,
3833 BasicVideo_put_SourceTop
,
3834 BasicVideo_get_SourceTop
,
3835 BasicVideo_put_SourceHeight
,
3836 BasicVideo_get_SourceHeight
,
3837 BasicVideo_put_DestinationLeft
,
3838 BasicVideo_get_DestinationLeft
,
3839 BasicVideo_put_DestinationWidth
,
3840 BasicVideo_get_DestinationWidth
,
3841 BasicVideo_put_DestinationTop
,
3842 BasicVideo_get_DestinationTop
,
3843 BasicVideo_put_DestinationHeight
,
3844 BasicVideo_get_DestinationHeight
,
3845 BasicVideo_SetSourcePosition
,
3846 BasicVideo_GetSourcePosition
,
3847 BasicVideo_SetDefaultSourcePosition
,
3848 BasicVideo_SetDestinationPosition
,
3849 BasicVideo_GetDestinationPosition
,
3850 BasicVideo_SetDefaultDestinationPosition
,
3851 BasicVideo_GetVideoSize
,
3852 BasicVideo_GetVideoPaletteEntries
,
3853 BasicVideo_GetCurrentImage
,
3854 BasicVideo_IsUsingDefaultSource
,
3855 BasicVideo_IsUsingDefaultDestination
,
3856 BasicVideo2_GetPreferredAspectRatio
3859 static inline IFilterGraphImpl
*impl_from_IVideoWindow(IVideoWindow
*iface
)
3861 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IVideoWindow_iface
);
3864 static HRESULT WINAPI
VideoWindow_QueryInterface(IVideoWindow
*iface
, REFIID riid
, void **ppvObj
)
3866 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3868 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
3870 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
3873 static ULONG WINAPI
VideoWindow_AddRef(IVideoWindow
*iface
)
3875 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3877 TRACE("(%p/%p)->()\n", This
, iface
);
3879 return Filtergraph_AddRef(This
);
3882 static ULONG WINAPI
VideoWindow_Release(IVideoWindow
*iface
)
3884 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3886 TRACE("(%p/%p)->()\n", This
, iface
);
3888 return Filtergraph_Release(This
);
3891 /*** IDispatch methods ***/
3892 static HRESULT WINAPI
VideoWindow_GetTypeInfoCount(IVideoWindow
*iface
, UINT
*pctinfo
)
3894 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3895 IVideoWindow
*pVideoWindow
;
3898 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
3900 EnterCriticalSection(&This
->cs
);
3902 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3905 hr
= IVideoWindow_GetTypeInfoCount(pVideoWindow
, pctinfo
);
3907 LeaveCriticalSection(&This
->cs
);
3912 static HRESULT WINAPI
VideoWindow_GetTypeInfo(IVideoWindow
*iface
, UINT iTInfo
, LCID lcid
,
3913 ITypeInfo
**ppTInfo
)
3915 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3916 IVideoWindow
*pVideoWindow
;
3919 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
3921 EnterCriticalSection(&This
->cs
);
3923 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3926 hr
= IVideoWindow_GetTypeInfo(pVideoWindow
, iTInfo
, lcid
, ppTInfo
);
3928 LeaveCriticalSection(&This
->cs
);
3933 static HRESULT WINAPI
VideoWindow_GetIDsOfNames(IVideoWindow
*iface
, REFIID riid
,
3934 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3936 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3937 IVideoWindow
*pVideoWindow
;
3940 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3942 EnterCriticalSection(&This
->cs
);
3944 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3947 hr
= IVideoWindow_GetIDsOfNames(pVideoWindow
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3949 LeaveCriticalSection(&This
->cs
);
3954 static HRESULT WINAPI
VideoWindow_Invoke(IVideoWindow
*iface
, DISPID dispIdMember
, REFIID riid
,
3955 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
3958 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3959 IVideoWindow
*pVideoWindow
;
3962 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
);
3964 EnterCriticalSection(&This
->cs
);
3966 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3969 hr
= IVideoWindow_Invoke(pVideoWindow
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
3971 LeaveCriticalSection(&This
->cs
);
3977 /*** IVideoWindow methods ***/
3978 static HRESULT WINAPI
VideoWindow_put_Caption(IVideoWindow
*iface
, BSTR strCaption
)
3980 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3981 IVideoWindow
*pVideoWindow
;
3984 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
3986 EnterCriticalSection(&This
->cs
);
3988 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3991 hr
= IVideoWindow_put_Caption(pVideoWindow
, strCaption
);
3993 LeaveCriticalSection(&This
->cs
);
3998 static HRESULT WINAPI
VideoWindow_get_Caption(IVideoWindow
*iface
, BSTR
*strCaption
)
4000 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4001 IVideoWindow
*pVideoWindow
;
4004 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
4006 EnterCriticalSection(&This
->cs
);
4008 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4011 hr
= IVideoWindow_get_Caption(pVideoWindow
, strCaption
);
4013 LeaveCriticalSection(&This
->cs
);
4018 static HRESULT WINAPI
VideoWindow_put_WindowStyle(IVideoWindow
*iface
, LONG WindowStyle
)
4020 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4021 IVideoWindow
*pVideoWindow
;
4024 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyle
);
4026 EnterCriticalSection(&This
->cs
);
4028 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4031 hr
= IVideoWindow_put_WindowStyle(pVideoWindow
, WindowStyle
);
4033 LeaveCriticalSection(&This
->cs
);
4038 static HRESULT WINAPI
VideoWindow_get_WindowStyle(IVideoWindow
*iface
, LONG
*WindowStyle
)
4040 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4041 IVideoWindow
*pVideoWindow
;
4044 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
4046 EnterCriticalSection(&This
->cs
);
4048 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4051 hr
= IVideoWindow_get_WindowStyle(pVideoWindow
, WindowStyle
);
4053 LeaveCriticalSection(&This
->cs
);
4058 static HRESULT WINAPI
VideoWindow_put_WindowStyleEx(IVideoWindow
*iface
, LONG WindowStyleEx
)
4060 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4061 IVideoWindow
*pVideoWindow
;
4064 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyleEx
);
4066 EnterCriticalSection(&This
->cs
);
4068 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4071 hr
= IVideoWindow_put_WindowStyleEx(pVideoWindow
, WindowStyleEx
);
4073 LeaveCriticalSection(&This
->cs
);
4078 static HRESULT WINAPI
VideoWindow_get_WindowStyleEx(IVideoWindow
*iface
, LONG
*WindowStyleEx
)
4080 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4081 IVideoWindow
*pVideoWindow
;
4084 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
4086 EnterCriticalSection(&This
->cs
);
4088 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4091 hr
= IVideoWindow_get_WindowStyleEx(pVideoWindow
, WindowStyleEx
);
4093 LeaveCriticalSection(&This
->cs
);
4098 static HRESULT WINAPI
VideoWindow_put_AutoShow(IVideoWindow
*iface
, LONG AutoShow
)
4100 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4101 IVideoWindow
*pVideoWindow
;
4104 TRACE("(%p/%p)->(%d)\n", This
, iface
, AutoShow
);
4106 EnterCriticalSection(&This
->cs
);
4108 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4111 hr
= IVideoWindow_put_AutoShow(pVideoWindow
, AutoShow
);
4113 LeaveCriticalSection(&This
->cs
);
4118 static HRESULT WINAPI
VideoWindow_get_AutoShow(IVideoWindow
*iface
, LONG
*AutoShow
)
4120 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4121 IVideoWindow
*pVideoWindow
;
4124 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
4126 EnterCriticalSection(&This
->cs
);
4128 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4131 hr
= IVideoWindow_get_AutoShow(pVideoWindow
, AutoShow
);
4133 LeaveCriticalSection(&This
->cs
);
4138 static HRESULT WINAPI
VideoWindow_put_WindowState(IVideoWindow
*iface
, LONG WindowState
)
4140 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4141 IVideoWindow
*pVideoWindow
;
4144 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowState
);
4146 EnterCriticalSection(&This
->cs
);
4148 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4151 hr
= IVideoWindow_put_WindowState(pVideoWindow
, WindowState
);
4153 LeaveCriticalSection(&This
->cs
);
4158 static HRESULT WINAPI
VideoWindow_get_WindowState(IVideoWindow
*iface
, LONG
*WindowState
)
4160 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4161 IVideoWindow
*pVideoWindow
;
4164 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowState
);
4166 EnterCriticalSection(&This
->cs
);
4168 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4171 hr
= IVideoWindow_get_WindowState(pVideoWindow
, WindowState
);
4173 LeaveCriticalSection(&This
->cs
);
4178 static HRESULT WINAPI
VideoWindow_put_BackgroundPalette(IVideoWindow
*iface
, LONG BackgroundPalette
)
4180 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4181 IVideoWindow
*pVideoWindow
;
4184 TRACE("(%p/%p)->(%d)\n", This
, iface
, BackgroundPalette
);
4186 EnterCriticalSection(&This
->cs
);
4188 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4191 hr
= IVideoWindow_put_BackgroundPalette(pVideoWindow
, BackgroundPalette
);
4193 LeaveCriticalSection(&This
->cs
);
4198 static HRESULT WINAPI
VideoWindow_get_BackgroundPalette(IVideoWindow
*iface
,
4199 LONG
*pBackgroundPalette
)
4201 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4202 IVideoWindow
*pVideoWindow
;
4205 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBackgroundPalette
);
4207 EnterCriticalSection(&This
->cs
);
4209 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4212 hr
= IVideoWindow_get_BackgroundPalette(pVideoWindow
, pBackgroundPalette
);
4214 LeaveCriticalSection(&This
->cs
);
4219 static HRESULT WINAPI
VideoWindow_put_Visible(IVideoWindow
*iface
, LONG Visible
)
4221 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4222 IVideoWindow
*pVideoWindow
;
4225 TRACE("(%p/%p)->(%d)\n", This
, iface
, Visible
);
4227 EnterCriticalSection(&This
->cs
);
4229 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4232 hr
= IVideoWindow_put_Visible(pVideoWindow
, Visible
);
4234 LeaveCriticalSection(&This
->cs
);
4239 static HRESULT WINAPI
VideoWindow_get_Visible(IVideoWindow
*iface
, LONG
*pVisible
)
4241 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4242 IVideoWindow
*pVideoWindow
;
4245 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
4247 EnterCriticalSection(&This
->cs
);
4249 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4252 hr
= IVideoWindow_get_Visible(pVideoWindow
, pVisible
);
4254 LeaveCriticalSection(&This
->cs
);
4259 static HRESULT WINAPI
VideoWindow_put_Left(IVideoWindow
*iface
, LONG Left
)
4261 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4262 IVideoWindow
*pVideoWindow
;
4265 TRACE("(%p/%p)->(%d)\n", This
, iface
, Left
);
4267 EnterCriticalSection(&This
->cs
);
4269 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4272 hr
= IVideoWindow_put_Left(pVideoWindow
, Left
);
4274 LeaveCriticalSection(&This
->cs
);
4279 static HRESULT WINAPI
VideoWindow_get_Left(IVideoWindow
*iface
, LONG
*pLeft
)
4281 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4282 IVideoWindow
*pVideoWindow
;
4285 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
4287 EnterCriticalSection(&This
->cs
);
4289 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4292 hr
= IVideoWindow_get_Left(pVideoWindow
, pLeft
);
4294 LeaveCriticalSection(&This
->cs
);
4299 static HRESULT WINAPI
VideoWindow_put_Width(IVideoWindow
*iface
, LONG Width
)
4301 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4302 IVideoWindow
*pVideoWindow
;
4305 TRACE("(%p/%p)->(%d)\n", This
, iface
, Width
);
4307 EnterCriticalSection(&This
->cs
);
4309 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4312 hr
= IVideoWindow_put_Width(pVideoWindow
, Width
);
4314 LeaveCriticalSection(&This
->cs
);
4319 static HRESULT WINAPI
VideoWindow_get_Width(IVideoWindow
*iface
, LONG
*pWidth
)
4321 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4322 IVideoWindow
*pVideoWindow
;
4325 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
4327 EnterCriticalSection(&This
->cs
);
4329 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4332 hr
= IVideoWindow_get_Width(pVideoWindow
, pWidth
);
4334 LeaveCriticalSection(&This
->cs
);
4339 static HRESULT WINAPI
VideoWindow_put_Top(IVideoWindow
*iface
, LONG Top
)
4341 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4342 IVideoWindow
*pVideoWindow
;
4345 TRACE("(%p/%p)->(%d)\n", This
, iface
, Top
);
4347 EnterCriticalSection(&This
->cs
);
4349 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4352 hr
= IVideoWindow_put_Top(pVideoWindow
, Top
);
4354 LeaveCriticalSection(&This
->cs
);
4359 static HRESULT WINAPI
VideoWindow_get_Top(IVideoWindow
*iface
, LONG
*pTop
)
4361 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4362 IVideoWindow
*pVideoWindow
;
4365 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
4367 EnterCriticalSection(&This
->cs
);
4369 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4372 hr
= IVideoWindow_get_Top(pVideoWindow
, pTop
);
4374 LeaveCriticalSection(&This
->cs
);
4379 static HRESULT WINAPI
VideoWindow_put_Height(IVideoWindow
*iface
, LONG Height
)
4381 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4382 IVideoWindow
*pVideoWindow
;
4385 TRACE("(%p/%p)->(%d)\n", This
, iface
, Height
);
4387 EnterCriticalSection(&This
->cs
);
4389 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4392 hr
= IVideoWindow_put_Height(pVideoWindow
, Height
);
4394 LeaveCriticalSection(&This
->cs
);
4399 static HRESULT WINAPI
VideoWindow_get_Height(IVideoWindow
*iface
, LONG
*pHeight
)
4401 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4402 IVideoWindow
*pVideoWindow
;
4405 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
4407 EnterCriticalSection(&This
->cs
);
4409 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4412 hr
= IVideoWindow_get_Height(pVideoWindow
, pHeight
);
4414 LeaveCriticalSection(&This
->cs
);
4419 static HRESULT WINAPI
VideoWindow_put_Owner(IVideoWindow
*iface
, OAHWND Owner
)
4421 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4422 IVideoWindow
*pVideoWindow
;
4425 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
4427 EnterCriticalSection(&This
->cs
);
4429 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4432 hr
= IVideoWindow_put_Owner(pVideoWindow
, Owner
);
4434 LeaveCriticalSection(&This
->cs
);
4439 static HRESULT WINAPI
VideoWindow_get_Owner(IVideoWindow
*iface
, OAHWND
*Owner
)
4441 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4442 IVideoWindow
*pVideoWindow
;
4445 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
4447 EnterCriticalSection(&This
->cs
);
4449 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4452 hr
= IVideoWindow_get_Owner(pVideoWindow
, Owner
);
4454 LeaveCriticalSection(&This
->cs
);
4459 static HRESULT WINAPI
VideoWindow_put_MessageDrain(IVideoWindow
*iface
, OAHWND Drain
)
4461 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4462 IVideoWindow
*pVideoWindow
;
4465 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
4467 EnterCriticalSection(&This
->cs
);
4469 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4472 hr
= IVideoWindow_put_MessageDrain(pVideoWindow
, Drain
);
4474 LeaveCriticalSection(&This
->cs
);
4479 static HRESULT WINAPI
VideoWindow_get_MessageDrain(IVideoWindow
*iface
, OAHWND
*Drain
)
4481 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4482 IVideoWindow
*pVideoWindow
;
4485 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
4487 EnterCriticalSection(&This
->cs
);
4489 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4492 hr
= IVideoWindow_get_MessageDrain(pVideoWindow
, Drain
);
4494 LeaveCriticalSection(&This
->cs
);
4499 static HRESULT WINAPI
VideoWindow_get_BorderColor(IVideoWindow
*iface
, LONG
*Color
)
4501 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4502 IVideoWindow
*pVideoWindow
;
4505 TRACE("(%p/%p)->(%p)\n", This
, iface
, Color
);
4507 EnterCriticalSection(&This
->cs
);
4509 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4512 hr
= IVideoWindow_get_BorderColor(pVideoWindow
, Color
);
4514 LeaveCriticalSection(&This
->cs
);
4519 static HRESULT WINAPI
VideoWindow_put_BorderColor(IVideoWindow
*iface
, LONG Color
)
4521 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4522 IVideoWindow
*pVideoWindow
;
4525 TRACE("(%p/%p)->(%d)\n", This
, iface
, Color
);
4527 EnterCriticalSection(&This
->cs
);
4529 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4532 hr
= IVideoWindow_put_BorderColor(pVideoWindow
, Color
);
4534 LeaveCriticalSection(&This
->cs
);
4539 static HRESULT WINAPI
VideoWindow_get_FullScreenMode(IVideoWindow
*iface
, LONG
*FullScreenMode
)
4541 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4542 IVideoWindow
*pVideoWindow
;
4545 TRACE("(%p/%p)->(%p)\n", This
, iface
, FullScreenMode
);
4547 EnterCriticalSection(&This
->cs
);
4549 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4552 hr
= IVideoWindow_get_FullScreenMode(pVideoWindow
, FullScreenMode
);
4554 LeaveCriticalSection(&This
->cs
);
4559 static HRESULT WINAPI
VideoWindow_put_FullScreenMode(IVideoWindow
*iface
, LONG FullScreenMode
)
4561 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4562 IVideoWindow
*pVideoWindow
;
4565 TRACE("(%p/%p)->(%d)\n", This
, iface
, FullScreenMode
);
4567 EnterCriticalSection(&This
->cs
);
4569 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4572 hr
= IVideoWindow_put_FullScreenMode(pVideoWindow
, FullScreenMode
);
4574 LeaveCriticalSection(&This
->cs
);
4579 static HRESULT WINAPI
VideoWindow_SetWindowForeground(IVideoWindow
*iface
, LONG Focus
)
4581 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4582 IVideoWindow
*pVideoWindow
;
4585 TRACE("(%p/%p)->(%d)\n", This
, iface
, Focus
);
4587 EnterCriticalSection(&This
->cs
);
4589 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4592 hr
= IVideoWindow_SetWindowForeground(pVideoWindow
, Focus
);
4594 LeaveCriticalSection(&This
->cs
);
4599 static HRESULT WINAPI
VideoWindow_NotifyOwnerMessage(IVideoWindow
*iface
, OAHWND hwnd
, LONG uMsg
,
4600 LONG_PTR wParam
, LONG_PTR lParam
)
4602 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4603 IVideoWindow
*pVideoWindow
;
4606 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This
, iface
, hwnd
, uMsg
, wParam
, lParam
);
4608 EnterCriticalSection(&This
->cs
);
4610 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4613 hr
= IVideoWindow_NotifyOwnerMessage(pVideoWindow
, hwnd
, uMsg
, wParam
, lParam
);
4615 LeaveCriticalSection(&This
->cs
);
4620 static HRESULT WINAPI
VideoWindow_SetWindowPosition(IVideoWindow
*iface
, LONG Left
, LONG Top
,
4621 LONG Width
, LONG Height
)
4623 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4624 IVideoWindow
*pVideoWindow
;
4627 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
4629 EnterCriticalSection(&This
->cs
);
4631 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4634 hr
= IVideoWindow_SetWindowPosition(pVideoWindow
, Left
, Top
, Width
, Height
);
4636 LeaveCriticalSection(&This
->cs
);
4641 static HRESULT WINAPI
VideoWindow_GetWindowPosition(IVideoWindow
*iface
, LONG
*pLeft
, LONG
*pTop
,
4642 LONG
*pWidth
, LONG
*pHeight
)
4644 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4645 IVideoWindow
*pVideoWindow
;
4648 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
4650 EnterCriticalSection(&This
->cs
);
4652 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4655 hr
= IVideoWindow_GetWindowPosition(pVideoWindow
, pLeft
, pTop
, pWidth
, pHeight
);
4657 LeaveCriticalSection(&This
->cs
);
4662 static HRESULT WINAPI
VideoWindow_GetMinIdealImageSize(IVideoWindow
*iface
, LONG
*pWidth
,
4665 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4666 IVideoWindow
*pVideoWindow
;
4669 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
4671 EnterCriticalSection(&This
->cs
);
4673 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4676 hr
= IVideoWindow_GetMinIdealImageSize(pVideoWindow
, pWidth
, pHeight
);
4678 LeaveCriticalSection(&This
->cs
);
4683 static HRESULT WINAPI
VideoWindow_GetMaxIdealImageSize(IVideoWindow
*iface
, LONG
*pWidth
,
4686 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4687 IVideoWindow
*pVideoWindow
;
4690 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
4692 EnterCriticalSection(&This
->cs
);
4694 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4697 hr
= IVideoWindow_GetMaxIdealImageSize(pVideoWindow
, pWidth
, pHeight
);
4699 LeaveCriticalSection(&This
->cs
);
4704 static HRESULT WINAPI
VideoWindow_GetRestorePosition(IVideoWindow
*iface
, LONG
*pLeft
, LONG
*pTop
,
4705 LONG
*pWidth
, LONG
*pHeight
)
4707 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4708 IVideoWindow
*pVideoWindow
;
4711 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
4713 EnterCriticalSection(&This
->cs
);
4715 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4718 hr
= IVideoWindow_GetRestorePosition(pVideoWindow
, pLeft
, pTop
, pWidth
, pHeight
);
4720 LeaveCriticalSection(&This
->cs
);
4725 static HRESULT WINAPI
VideoWindow_HideCursor(IVideoWindow
*iface
, LONG HideCursor
)
4727 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4728 IVideoWindow
*pVideoWindow
;
4731 TRACE("(%p/%p)->(%d)\n", This
, iface
, HideCursor
);
4733 EnterCriticalSection(&This
->cs
);
4735 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4738 hr
= IVideoWindow_HideCursor(pVideoWindow
, HideCursor
);
4740 LeaveCriticalSection(&This
->cs
);
4745 static HRESULT WINAPI
VideoWindow_IsCursorHidden(IVideoWindow
*iface
, LONG
*CursorHidden
)
4747 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4748 IVideoWindow
*pVideoWindow
;
4751 TRACE("(%p/%p)->(%p)\n", This
, iface
, CursorHidden
);
4753 EnterCriticalSection(&This
->cs
);
4755 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4758 hr
= IVideoWindow_IsCursorHidden(pVideoWindow
, CursorHidden
);
4760 LeaveCriticalSection(&This
->cs
);
4766 static const IVideoWindowVtbl IVideoWindow_VTable
=
4768 VideoWindow_QueryInterface
,
4770 VideoWindow_Release
,
4771 VideoWindow_GetTypeInfoCount
,
4772 VideoWindow_GetTypeInfo
,
4773 VideoWindow_GetIDsOfNames
,
4775 VideoWindow_put_Caption
,
4776 VideoWindow_get_Caption
,
4777 VideoWindow_put_WindowStyle
,
4778 VideoWindow_get_WindowStyle
,
4779 VideoWindow_put_WindowStyleEx
,
4780 VideoWindow_get_WindowStyleEx
,
4781 VideoWindow_put_AutoShow
,
4782 VideoWindow_get_AutoShow
,
4783 VideoWindow_put_WindowState
,
4784 VideoWindow_get_WindowState
,
4785 VideoWindow_put_BackgroundPalette
,
4786 VideoWindow_get_BackgroundPalette
,
4787 VideoWindow_put_Visible
,
4788 VideoWindow_get_Visible
,
4789 VideoWindow_put_Left
,
4790 VideoWindow_get_Left
,
4791 VideoWindow_put_Width
,
4792 VideoWindow_get_Width
,
4793 VideoWindow_put_Top
,
4794 VideoWindow_get_Top
,
4795 VideoWindow_put_Height
,
4796 VideoWindow_get_Height
,
4797 VideoWindow_put_Owner
,
4798 VideoWindow_get_Owner
,
4799 VideoWindow_put_MessageDrain
,
4800 VideoWindow_get_MessageDrain
,
4801 VideoWindow_get_BorderColor
,
4802 VideoWindow_put_BorderColor
,
4803 VideoWindow_get_FullScreenMode
,
4804 VideoWindow_put_FullScreenMode
,
4805 VideoWindow_SetWindowForeground
,
4806 VideoWindow_NotifyOwnerMessage
,
4807 VideoWindow_SetWindowPosition
,
4808 VideoWindow_GetWindowPosition
,
4809 VideoWindow_GetMinIdealImageSize
,
4810 VideoWindow_GetMaxIdealImageSize
,
4811 VideoWindow_GetRestorePosition
,
4812 VideoWindow_HideCursor
,
4813 VideoWindow_IsCursorHidden
4816 static inline IFilterGraphImpl
*impl_from_IMediaEventEx(IMediaEventEx
*iface
)
4818 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaEventEx_iface
);
4821 static HRESULT WINAPI
MediaEvent_QueryInterface(IMediaEventEx
*iface
, REFIID riid
, void **ppvObj
)
4823 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4825 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
4827 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
4830 static ULONG WINAPI
MediaEvent_AddRef(IMediaEventEx
*iface
)
4832 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4834 TRACE("(%p/%p)->()\n", This
, iface
);
4836 return Filtergraph_AddRef(This
);
4839 static ULONG WINAPI
MediaEvent_Release(IMediaEventEx
*iface
)
4841 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4843 TRACE("(%p/%p)->()\n", This
, iface
);
4845 return Filtergraph_Release(This
);
4848 /*** IDispatch methods ***/
4849 static HRESULT WINAPI
MediaEvent_GetTypeInfoCount(IMediaEventEx
*iface
, UINT
*pctinfo
)
4851 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4853 TRACE("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
4858 static HRESULT WINAPI
MediaEvent_GetTypeInfo(IMediaEventEx
*iface
, UINT iTInfo
, LCID lcid
,
4859 ITypeInfo
**ppTInfo
)
4861 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4863 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
4868 static HRESULT WINAPI
MediaEvent_GetIDsOfNames(IMediaEventEx
*iface
, REFIID riid
,
4869 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4871 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4873 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
4878 static HRESULT WINAPI
MediaEvent_Invoke(IMediaEventEx
*iface
, DISPID dispIdMember
, REFIID riid
,
4879 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
4882 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4884 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
);
4889 /*** IMediaEvent methods ***/
4890 static HRESULT WINAPI
MediaEvent_GetEventHandle(IMediaEventEx
*iface
, OAEVENT
*hEvent
)
4892 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4894 TRACE("(%p/%p)->(%p)\n", This
, iface
, hEvent
);
4896 *hEvent
= (OAEVENT
)This
->evqueue
.msg_event
;
4901 static HRESULT WINAPI
MediaEvent_GetEvent(IMediaEventEx
*iface
, LONG
*lEventCode
, LONG_PTR
*lParam1
,
4902 LONG_PTR
*lParam2
, LONG msTimeout
)
4904 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4907 TRACE("(%p/%p)->(%p, %p, %p, %d)\n", This
, iface
, lEventCode
, lParam1
, lParam2
, msTimeout
);
4909 if (EventsQueue_GetEvent(&This
->evqueue
, &evt
, msTimeout
))
4911 *lEventCode
= evt
.lEventCode
;
4912 *lParam1
= evt
.lParam1
;
4913 *lParam2
= evt
.lParam2
;
4921 static HRESULT WINAPI
MediaEvent_WaitForCompletion(IMediaEventEx
*iface
, LONG msTimeout
,
4924 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4926 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, msTimeout
, pEvCode
);
4928 if (This
->state
!= State_Running
)
4929 return VFW_E_WRONG_STATE
;
4931 if (WaitForSingleObject(This
->hEventCompletion
, msTimeout
) == WAIT_OBJECT_0
)
4933 *pEvCode
= This
->CompletionStatus
;
4941 static HRESULT WINAPI
MediaEvent_CancelDefaultHandling(IMediaEventEx
*iface
, LONG lEvCode
)
4943 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4945 TRACE("(%p/%p)->(%d)\n", This
, iface
, lEvCode
);
4947 if (lEvCode
== EC_COMPLETE
)
4948 This
->HandleEcComplete
= FALSE
;
4949 else if (lEvCode
== EC_REPAINT
)
4950 This
->HandleEcRepaint
= FALSE
;
4951 else if (lEvCode
== EC_CLOCK_CHANGED
)
4952 This
->HandleEcClockChanged
= FALSE
;
4959 static HRESULT WINAPI
MediaEvent_RestoreDefaultHandling(IMediaEventEx
*iface
, LONG lEvCode
)
4961 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4963 TRACE("(%p/%p)->(%d)\n", This
, iface
, lEvCode
);
4965 if (lEvCode
== EC_COMPLETE
)
4966 This
->HandleEcComplete
= TRUE
;
4967 else if (lEvCode
== EC_REPAINT
)
4968 This
->HandleEcRepaint
= TRUE
;
4969 else if (lEvCode
== EC_CLOCK_CHANGED
)
4970 This
->HandleEcClockChanged
= TRUE
;
4977 static HRESULT WINAPI
MediaEvent_FreeEventParams(IMediaEventEx
*iface
, LONG lEvCode
,
4978 LONG_PTR lParam1
, LONG_PTR lParam2
)
4980 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4982 TRACE("(%p/%p)->(%d, %08lx, %08lx): stub !!!\n", This
, iface
, lEvCode
, lParam1
, lParam2
);
4987 /*** IMediaEventEx methods ***/
4988 static HRESULT WINAPI
MediaEvent_SetNotifyWindow(IMediaEventEx
*iface
, OAHWND hwnd
, LONG lMsg
,
4989 LONG_PTR lInstanceData
)
4991 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4993 TRACE("(%p/%p)->(%08lx, %d, %08lx)\n", This
, iface
, hwnd
, lMsg
, lInstanceData
);
4995 This
->notif
.hWnd
= (HWND
)hwnd
;
4996 This
->notif
.msg
= lMsg
;
4997 This
->notif
.instance
= lInstanceData
;
5002 static HRESULT WINAPI
MediaEvent_SetNotifyFlags(IMediaEventEx
*iface
, LONG lNoNotifyFlags
)
5004 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
5006 TRACE("(%p/%p)->(%d)\n", This
, iface
, lNoNotifyFlags
);
5008 if ((lNoNotifyFlags
!= 0) && (lNoNotifyFlags
!= 1))
5009 return E_INVALIDARG
;
5011 This
->notif
.disabled
= lNoNotifyFlags
;
5016 static HRESULT WINAPI
MediaEvent_GetNotifyFlags(IMediaEventEx
*iface
, LONG
*lplNoNotifyFlags
)
5018 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
5020 TRACE("(%p/%p)->(%p)\n", This
, iface
, lplNoNotifyFlags
);
5022 if (!lplNoNotifyFlags
)
5025 *lplNoNotifyFlags
= This
->notif
.disabled
;
5031 static const IMediaEventExVtbl IMediaEventEx_VTable
=
5033 MediaEvent_QueryInterface
,
5036 MediaEvent_GetTypeInfoCount
,
5037 MediaEvent_GetTypeInfo
,
5038 MediaEvent_GetIDsOfNames
,
5040 MediaEvent_GetEventHandle
,
5041 MediaEvent_GetEvent
,
5042 MediaEvent_WaitForCompletion
,
5043 MediaEvent_CancelDefaultHandling
,
5044 MediaEvent_RestoreDefaultHandling
,
5045 MediaEvent_FreeEventParams
,
5046 MediaEvent_SetNotifyWindow
,
5047 MediaEvent_SetNotifyFlags
,
5048 MediaEvent_GetNotifyFlags
5052 static inline IFilterGraphImpl
*impl_from_IMediaFilter(IMediaFilter
*iface
)
5054 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaFilter_iface
);
5057 static HRESULT WINAPI
MediaFilter_QueryInterface(IMediaFilter
*iface
, REFIID riid
, void **ppv
)
5059 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5061 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5064 static ULONG WINAPI
MediaFilter_AddRef(IMediaFilter
*iface
)
5066 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5068 return Filtergraph_AddRef(This
);
5071 static ULONG WINAPI
MediaFilter_Release(IMediaFilter
*iface
)
5073 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5075 return Filtergraph_Release(This
);
5078 static HRESULT WINAPI
MediaFilter_GetClassID(IMediaFilter
*iface
, CLSID
* pClassID
)
5080 FIXME("(%p): stub\n", pClassID
);
5085 static HRESULT WINAPI
MediaFilter_Stop(IMediaFilter
*iface
)
5087 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5089 return MediaControl_Stop(&This
->IMediaControl_iface
);
5092 static HRESULT WINAPI
MediaFilter_Pause(IMediaFilter
*iface
)
5094 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5096 return MediaControl_Pause(&This
->IMediaControl_iface
);
5099 static HRESULT WINAPI
MediaFilter_Run(IMediaFilter
*iface
, REFERENCE_TIME tStart
)
5101 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5104 FIXME("Run called with non-null tStart: %x%08x\n",
5105 (int)(tStart
>>32), (int)tStart
);
5107 return MediaControl_Run(&This
->IMediaControl_iface
);
5110 static HRESULT WINAPI
MediaFilter_GetState(IMediaFilter
*iface
, DWORD dwMsTimeout
,
5111 FILTER_STATE
*pState
)
5113 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5115 return MediaControl_GetState(&This
->IMediaControl_iface
, dwMsTimeout
, (OAFilterState
*)pState
);
5118 static HRESULT WINAPI
MediaFilter_SetSyncSource(IMediaFilter
*iface
, IReferenceClock
*pClock
)
5120 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5124 TRACE("(%p/%p)->(%p)\n", iface
, This
, pClock
);
5126 EnterCriticalSection(&This
->cs
);
5128 for (i
= 0;i
< This
->nFilters
;i
++)
5130 hr
= IBaseFilter_SetSyncSource(This
->ppFiltersInGraph
[i
], pClock
);
5138 IBaseFilter_SetSyncSource(This
->ppFiltersInGraph
[i
], This
->refClock
);
5143 IReferenceClock_Release(This
->refClock
);
5144 This
->refClock
= pClock
;
5146 IReferenceClock_AddRef(This
->refClock
);
5147 This
->defaultclock
= FALSE
;
5149 if (This
->HandleEcClockChanged
)
5151 IMediaEventSink
*pEventSink
;
5154 eshr
= IMediaFilter_QueryInterface(iface
, &IID_IMediaEventSink
, (LPVOID
)&pEventSink
);
5155 if (SUCCEEDED(eshr
))
5157 IMediaEventSink_Notify(pEventSink
, EC_CLOCK_CHANGED
, 0, 0);
5158 IMediaEventSink_Release(pEventSink
);
5163 LeaveCriticalSection(&This
->cs
);
5168 static HRESULT WINAPI
MediaFilter_GetSyncSource(IMediaFilter
*iface
, IReferenceClock
**ppClock
)
5170 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5172 TRACE("(%p/%p)->(%p)\n", iface
, This
, ppClock
);
5177 EnterCriticalSection(&This
->cs
);
5179 *ppClock
= This
->refClock
;
5181 IReferenceClock_AddRef(*ppClock
);
5183 LeaveCriticalSection(&This
->cs
);
5188 static const IMediaFilterVtbl IMediaFilter_VTable
=
5190 MediaFilter_QueryInterface
,
5192 MediaFilter_Release
,
5193 MediaFilter_GetClassID
,
5197 MediaFilter_GetState
,
5198 MediaFilter_SetSyncSource
,
5199 MediaFilter_GetSyncSource
5202 static inline IFilterGraphImpl
*impl_from_IMediaEventSink(IMediaEventSink
*iface
)
5204 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaEventSink_iface
);
5207 static HRESULT WINAPI
MediaEventSink_QueryInterface(IMediaEventSink
*iface
, REFIID riid
, void **ppv
)
5209 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5211 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5214 static ULONG WINAPI
MediaEventSink_AddRef(IMediaEventSink
*iface
)
5216 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5218 return Filtergraph_AddRef(This
);
5221 static ULONG WINAPI
MediaEventSink_Release(IMediaEventSink
*iface
)
5223 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5225 return Filtergraph_Release(This
);
5228 static HRESULT WINAPI
MediaEventSink_Notify(IMediaEventSink
*iface
, LONG EventCode
,
5229 LONG_PTR EventParam1
, LONG_PTR EventParam2
)
5231 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5234 TRACE("(%p/%p)->(%d, %ld, %ld)\n", This
, iface
, EventCode
, EventParam1
, EventParam2
);
5236 /* We need thread safety here, let's use the events queue's one */
5237 EnterCriticalSection(&This
->evqueue
.msg_crst
);
5239 if ((EventCode
== EC_COMPLETE
) && This
->HandleEcComplete
)
5241 TRACE("Process EC_COMPLETE notification\n");
5242 if (++This
->EcCompleteCount
== This
->nRenderers
)
5244 evt
.lEventCode
= EC_COMPLETE
;
5247 TRACE("Send EC_COMPLETE to app\n");
5248 EventsQueue_PutEvent(&This
->evqueue
, &evt
);
5249 if (!This
->notif
.disabled
&& This
->notif
.hWnd
)
5251 TRACE("Send Window message\n");
5252 PostMessageW(This
->notif
.hWnd
, This
->notif
.msg
, 0, This
->notif
.instance
);
5254 This
->CompletionStatus
= EC_COMPLETE
;
5255 SetEvent(This
->hEventCompletion
);
5258 else if ((EventCode
== EC_REPAINT
) && This
->HandleEcRepaint
)
5260 /* FIXME: Not handled yet */
5264 evt
.lEventCode
= EventCode
;
5265 evt
.lParam1
= EventParam1
;
5266 evt
.lParam2
= EventParam2
;
5267 EventsQueue_PutEvent(&This
->evqueue
, &evt
);
5268 if (!This
->notif
.disabled
&& This
->notif
.hWnd
)
5269 PostMessageW(This
->notif
.hWnd
, This
->notif
.msg
, 0, This
->notif
.instance
);
5272 LeaveCriticalSection(&This
->evqueue
.msg_crst
);
5276 static const IMediaEventSinkVtbl IMediaEventSink_VTable
=
5278 MediaEventSink_QueryInterface
,
5279 MediaEventSink_AddRef
,
5280 MediaEventSink_Release
,
5281 MediaEventSink_Notify
5284 static inline IFilterGraphImpl
*impl_from_IGraphConfig(IGraphConfig
*iface
)
5286 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IGraphConfig_iface
);
5289 static HRESULT WINAPI
GraphConfig_QueryInterface(IGraphConfig
*iface
, REFIID riid
, void **ppv
)
5291 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5293 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5296 static ULONG WINAPI
GraphConfig_AddRef(IGraphConfig
*iface
)
5298 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5300 return Filtergraph_AddRef(This
);
5303 static ULONG WINAPI
GraphConfig_Release(IGraphConfig
*iface
)
5305 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5307 return Filtergraph_Release(This
);
5310 static HRESULT WINAPI
GraphConfig_Reconnect(IGraphConfig
*iface
, IPin
*pOutputPin
, IPin
*pInputPin
,
5311 const AM_MEDIA_TYPE
*pmtFirstConnection
, IBaseFilter
*pUsingFilter
, HANDLE hAbortEvent
,
5314 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5316 FIXME("(%p)->(%p, %p, %p, %p, %p, %x): stub!\n", This
, pOutputPin
, pInputPin
, pmtFirstConnection
, pUsingFilter
, hAbortEvent
, dwFlags
);
5321 static HRESULT WINAPI
GraphConfig_Reconfigure(IGraphConfig
*iface
, IGraphConfigCallback
*pCallback
,
5322 void *pvContext
, DWORD dwFlags
, HANDLE hAbortEvent
)
5324 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5327 WARN("(%p)->(%p, %p, %x, %p): partial stub!\n", This
, pCallback
, pvContext
, dwFlags
, hAbortEvent
);
5330 FIXME("The parameter hAbortEvent is not handled!\n");
5332 EnterCriticalSection(&This
->cs
);
5334 hr
= IGraphConfigCallback_Reconfigure(pCallback
, pvContext
, dwFlags
);
5336 LeaveCriticalSection(&This
->cs
);
5341 static HRESULT WINAPI
GraphConfig_AddFilterToCache(IGraphConfig
*iface
, IBaseFilter
*pFilter
)
5343 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5345 FIXME("(%p)->(%p): stub!\n", This
, pFilter
);
5350 static HRESULT WINAPI
GraphConfig_EnumCacheFilter(IGraphConfig
*iface
, IEnumFilters
**pEnum
)
5352 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5354 FIXME("(%p)->(%p): stub!\n", This
, pEnum
);
5359 static HRESULT WINAPI
GraphConfig_RemoveFilterFromCache(IGraphConfig
*iface
, IBaseFilter
*pFilter
)
5361 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5363 FIXME("(%p)->(%p): stub!\n", This
, pFilter
);
5368 static HRESULT WINAPI
GraphConfig_GetStartTime(IGraphConfig
*iface
, REFERENCE_TIME
*prtStart
)
5370 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5372 FIXME("(%p)->(%p): stub!\n", This
, prtStart
);
5377 static HRESULT WINAPI
GraphConfig_PushThroughData(IGraphConfig
*iface
, IPin
*pOutputPin
,
5378 IPinConnection
*pConnection
, HANDLE hEventAbort
)
5380 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5382 FIXME("(%p)->(%p, %p, %p): stub!\n", This
, pOutputPin
, pConnection
, hEventAbort
);
5387 static HRESULT WINAPI
GraphConfig_SetFilterFlags(IGraphConfig
*iface
, IBaseFilter
*pFilter
,
5390 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5392 FIXME("(%p)->(%p, %x): stub!\n", This
, pFilter
, dwFlags
);
5397 static HRESULT WINAPI
GraphConfig_GetFilterFlags(IGraphConfig
*iface
, IBaseFilter
*pFilter
,
5400 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5402 FIXME("(%p)->(%p, %p): stub!\n", This
, pFilter
, dwFlags
);
5407 static HRESULT WINAPI
GraphConfig_RemoveFilterEx(IGraphConfig
*iface
, IBaseFilter
*pFilter
,
5410 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5412 FIXME("(%p)->(%p, %x): stub!\n", This
, pFilter
, dwFlags
);
5417 static const IGraphConfigVtbl IGraphConfig_VTable
=
5419 GraphConfig_QueryInterface
,
5421 GraphConfig_Release
,
5422 GraphConfig_Reconnect
,
5423 GraphConfig_Reconfigure
,
5424 GraphConfig_AddFilterToCache
,
5425 GraphConfig_EnumCacheFilter
,
5426 GraphConfig_RemoveFilterFromCache
,
5427 GraphConfig_GetStartTime
,
5428 GraphConfig_PushThroughData
,
5429 GraphConfig_SetFilterFlags
,
5430 GraphConfig_GetFilterFlags
,
5431 GraphConfig_RemoveFilterEx
5434 static const IUnknownVtbl IInner_VTable
=
5436 FilterGraphInner_QueryInterface
,
5437 FilterGraphInner_AddRef
,
5438 FilterGraphInner_Release
5441 static HRESULT
Filtergraph_QueryInterface(IFilterGraphImpl
*This
,
5444 if (This
->bAggregatable
)
5445 This
->bUnkOuterValid
= TRUE
;
5447 if (This
->pUnkOuter
)
5449 if (This
->bAggregatable
)
5450 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
5452 if (IsEqualIID(riid
, &IID_IUnknown
))
5456 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
5457 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
5458 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
5459 This
->bAggregatable
= TRUE
;
5464 return E_NOINTERFACE
;
5467 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
5470 static ULONG
Filtergraph_AddRef(IFilterGraphImpl
*This
) {
5471 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
5472 return IUnknown_AddRef(This
->pUnkOuter
);
5473 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
5476 static ULONG
Filtergraph_Release(IFilterGraphImpl
*This
) {
5477 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
5478 return IUnknown_Release(This
->pUnkOuter
);
5479 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
5482 /* This is the only function that actually creates a FilterGraph class... */
5483 HRESULT
FilterGraph_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
5485 IFilterGraphImpl
*fimpl
;
5488 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
5492 fimpl
= CoTaskMemAlloc(sizeof(*fimpl
));
5493 fimpl
->pUnkOuter
= pUnkOuter
;
5494 fimpl
->bUnkOuterValid
= FALSE
;
5495 fimpl
->bAggregatable
= FALSE
;
5496 fimpl
->defaultclock
= TRUE
;
5497 fimpl
->IInner_vtbl
= &IInner_VTable
;
5498 fimpl
->IFilterGraph2_iface
.lpVtbl
= &IFilterGraph2_VTable
;
5499 fimpl
->IMediaControl_iface
.lpVtbl
= &IMediaControl_VTable
;
5500 fimpl
->IMediaSeeking_iface
.lpVtbl
= &IMediaSeeking_VTable
;
5501 fimpl
->IBasicAudio_iface
.lpVtbl
= &IBasicAudio_VTable
;
5502 fimpl
->IBasicVideo2_iface
.lpVtbl
= &IBasicVideo_VTable
;
5503 fimpl
->IVideoWindow_iface
.lpVtbl
= &IVideoWindow_VTable
;
5504 fimpl
->IMediaEventEx_iface
.lpVtbl
= &IMediaEventEx_VTable
;
5505 fimpl
->IMediaFilter_iface
.lpVtbl
= &IMediaFilter_VTable
;
5506 fimpl
->IMediaEventSink_iface
.lpVtbl
= &IMediaEventSink_VTable
;
5507 fimpl
->IGraphConfig_iface
.lpVtbl
= &IGraphConfig_VTable
;
5508 fimpl
->IMediaPosition_iface
.lpVtbl
= &IMediaPosition_VTable
;
5510 fimpl
->ppFiltersInGraph
= NULL
;
5511 fimpl
->pFilterNames
= NULL
;
5512 fimpl
->nFilters
= 0;
5513 fimpl
->filterCapacity
= 0;
5514 fimpl
->nameIndex
= 1;
5515 fimpl
->refClock
= NULL
;
5516 fimpl
->hEventCompletion
= CreateEventW(0, TRUE
, FALSE
, 0);
5517 fimpl
->HandleEcComplete
= TRUE
;
5518 fimpl
->HandleEcRepaint
= TRUE
;
5519 fimpl
->HandleEcClockChanged
= TRUE
;
5520 fimpl
->notif
.hWnd
= 0;
5521 fimpl
->notif
.disabled
= FALSE
;
5522 fimpl
->nRenderers
= 0;
5523 fimpl
->EcCompleteCount
= 0;
5524 fimpl
->refClockProvider
= NULL
;
5525 fimpl
->state
= State_Stopped
;
5526 EventsQueue_Init(&fimpl
->evqueue
);
5527 InitializeCriticalSection(&fimpl
->cs
);
5528 fimpl
->cs
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": IFilterGraphImpl.cs");
5529 fimpl
->nItfCacheEntries
= 0;
5530 memcpy(&fimpl
->timeformatseek
, &TIME_FORMAT_MEDIA_TIME
, sizeof(GUID
));
5531 fimpl
->start_time
= fimpl
->pause_time
= 0;
5532 fimpl
->stop_position
= -1;
5533 fimpl
->punkFilterMapper2
= NULL
;
5534 fimpl
->recursioncount
= 0;
5536 /* create Filtermapper aggregated. */
5537 hr
= CoCreateInstance(&CLSID_FilterMapper2
, pUnkOuter
? pUnkOuter
: (IUnknown
*)&fimpl
->IInner_vtbl
, CLSCTX_INPROC_SERVER
,
5538 &IID_IUnknown
, (LPVOID
*)&fimpl
->punkFilterMapper2
);
5540 if (SUCCEEDED(hr
)) {
5541 hr
= IUnknown_QueryInterface(fimpl
->punkFilterMapper2
, &IID_IFilterMapper2
, (LPVOID
*)&fimpl
->pFilterMapper2
);
5544 if (SUCCEEDED(hr
)) {
5545 /* Release controlling IUnknown - compensate refcount increase from caching IFilterMapper2 interface. */
5546 if (pUnkOuter
) IUnknown_Release(pUnkOuter
);
5547 else IUnknown_Release((IUnknown
*)&fimpl
->IInner_vtbl
);
5551 ERR("Unable to create filter mapper (%x)\n", hr
);
5552 if (fimpl
->punkFilterMapper2
) IUnknown_Release(fimpl
->punkFilterMapper2
);
5553 CloseHandle(fimpl
->hEventCompletion
);
5554 EventsQueue_Destroy(&fimpl
->evqueue
);
5555 fimpl
->cs
.DebugInfo
->Spare
[0] = 0;
5556 DeleteCriticalSection(&fimpl
->cs
);
5557 CoTaskMemFree(fimpl
);
5565 HRESULT
FilterGraphNoThread_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
5567 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
5568 return FilterGraph_create(pUnkOuter
, ppObj
);