1 /* DirectShow FilterGraph object (QUARTZ.DLL)
3 * Copyright 2002 Lionel Ulmer
4 * Copyright 2004 Christian Costa
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
35 #include "wine/debug.h"
36 #include "quartz_private.h"
42 #include "wine/unicode.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
48 HWND hWnd
; /* Target window */
49 UINT msg
; /* User window message */
50 LONG_PTR instance
; /* User data */
51 int disabled
; /* Disabled messages posting */
55 LONG lEventCode
; /* Event code */
56 LONG_PTR lParam1
; /* Param1 */
57 LONG_PTR lParam2
; /* Param2 */
60 /* messages ring implementation for queuing events (taken from winmm) */
61 #define EVENTS_RING_BUFFER_INCREMENT 64
67 CRITICAL_SECTION msg_crst
;
68 HANDLE msg_event
; /* Signaled for no empty queue */
71 static int EventsQueue_Init(EventsQueue
* omr
)
75 omr
->msg_event
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
76 omr
->ring_buffer_size
= EVENTS_RING_BUFFER_INCREMENT
;
77 omr
->messages
= CoTaskMemAlloc(omr
->ring_buffer_size
* sizeof(Event
));
78 ZeroMemory(omr
->messages
, omr
->ring_buffer_size
* sizeof(Event
));
80 InitializeCriticalSection(&omr
->msg_crst
);
81 omr
->msg_crst
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": EventsQueue.msg_crst");
85 static int EventsQueue_Destroy(EventsQueue
* omr
)
87 CloseHandle(omr
->msg_event
);
88 CoTaskMemFree(omr
->messages
);
89 omr
->msg_crst
.DebugInfo
->Spare
[0] = 0;
90 DeleteCriticalSection(&omr
->msg_crst
);
94 static int EventsQueue_PutEvent(EventsQueue
* omr
, const Event
* evt
)
96 EnterCriticalSection(&omr
->msg_crst
);
97 if (omr
->msg_toget
== ((omr
->msg_tosave
+ 1) % omr
->ring_buffer_size
))
99 int old_ring_buffer_size
= omr
->ring_buffer_size
;
100 omr
->ring_buffer_size
+= EVENTS_RING_BUFFER_INCREMENT
;
101 TRACE("omr->ring_buffer_size=%d\n",omr
->ring_buffer_size
);
102 omr
->messages
= CoTaskMemRealloc(omr
->messages
, omr
->ring_buffer_size
* sizeof(Event
));
103 /* Now we need to rearrange the ring buffer so that the new
104 buffers just allocated are in between omr->msg_tosave and
107 if (omr
->msg_tosave
< omr
->msg_toget
)
109 memmove(&(omr
->messages
[omr
->msg_toget
+ EVENTS_RING_BUFFER_INCREMENT
]),
110 &(omr
->messages
[omr
->msg_toget
]),
111 sizeof(Event
)*(old_ring_buffer_size
- omr
->msg_toget
)
113 omr
->msg_toget
+= EVENTS_RING_BUFFER_INCREMENT
;
116 omr
->messages
[omr
->msg_tosave
] = *evt
;
117 SetEvent(omr
->msg_event
);
118 omr
->msg_tosave
= (omr
->msg_tosave
+ 1) % omr
->ring_buffer_size
;
119 LeaveCriticalSection(&omr
->msg_crst
);
123 static int EventsQueue_GetEvent(EventsQueue
* omr
, Event
* evt
, LONG msTimeOut
)
125 if (WaitForSingleObject(omr
->msg_event
, msTimeOut
) != WAIT_OBJECT_0
)
128 EnterCriticalSection(&omr
->msg_crst
);
130 if (omr
->msg_toget
== omr
->msg_tosave
) /* buffer empty ? */
132 LeaveCriticalSection(&omr
->msg_crst
);
136 *evt
= omr
->messages
[omr
->msg_toget
];
137 omr
->msg_toget
= (omr
->msg_toget
+ 1) % omr
->ring_buffer_size
;
139 /* Mark the buffer as empty if needed */
140 if (omr
->msg_toget
== omr
->msg_tosave
) /* buffer empty ? */
141 ResetEvent(omr
->msg_event
);
143 LeaveCriticalSection(&omr
->msg_crst
);
147 #define MAX_ITF_CACHE_ENTRIES 3
148 typedef struct _ITF_CACHE_ENTRY
{
154 typedef struct _IFilterGraphImpl
{
155 IFilterGraph2 IFilterGraph2_iface
;
156 IMediaControl IMediaControl_iface
;
157 IMediaSeeking IMediaSeeking_iface
;
158 IBasicAudio IBasicAudio_iface
;
159 IBasicVideo2 IBasicVideo2_iface
;
160 IVideoWindow IVideoWindow_iface
;
161 IMediaEventEx IMediaEventEx_iface
;
162 IMediaFilter IMediaFilter_iface
;
163 IMediaEventSink IMediaEventSink_iface
;
164 IGraphConfig IGraphConfig_iface
;
165 IMediaPosition IMediaPosition_iface
;
166 const IUnknownVtbl
* IInner_vtbl
;
167 /* IAMGraphStreams */
173 /* IRegisterServiceProvider */
174 /* IResourceMananger */
175 /* IServiceProvider */
176 /* IVideoFrameStep */
179 IUnknown
*punkFilterMapper2
;
180 IFilterMapper2
* pFilterMapper2
;
181 IBaseFilter
** ppFiltersInGraph
;
182 LPWSTR
* pFilterNames
;
186 IReferenceClock
*refClock
;
187 IBaseFilter
*refClockProvider
;
189 HANDLE hEventCompletion
;
190 int CompletionStatus
;
194 int HandleEcComplete
;
196 int HandleEcClockChanged
;
199 ITF_CACHE_ENTRY ItfCacheEntries
[MAX_ITF_CACHE_ENTRIES
];
200 int nItfCacheEntries
;
201 IUnknown
* pUnkOuter
;
206 REFERENCE_TIME start_time
;
207 REFERENCE_TIME pause_time
;
208 LONGLONG stop_position
;
212 static HRESULT
Filtergraph_QueryInterface(IFilterGraphImpl
*This
,
213 REFIID riid
, LPVOID
* ppv
);
214 static ULONG
Filtergraph_AddRef(IFilterGraphImpl
*This
);
215 static ULONG
Filtergraph_Release(IFilterGraphImpl
*This
);
217 static HRESULT WINAPI
FilterGraphInner_QueryInterface(IUnknown
* iface
,
220 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
221 TRACE("(%p)->(%s (%p), %p)\n", This
, debugstr_guid(riid
), riid
, ppvObj
);
223 if (This
->bAggregatable
)
224 This
->bUnkOuterValid
= TRUE
;
226 if (IsEqualGUID(&IID_IUnknown
, riid
)) {
227 *ppvObj
= &(This
->IInner_vtbl
);
228 TRACE(" returning IUnknown interface (%p)\n", *ppvObj
);
229 } else if (IsEqualGUID(&IID_IFilterGraph
, riid
) ||
230 IsEqualGUID(&IID_IFilterGraph2
, riid
) ||
231 IsEqualGUID(&IID_IGraphBuilder
, riid
)) {
232 *ppvObj
= &This
->IFilterGraph2_iface
;
233 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj
);
234 } else if (IsEqualGUID(&IID_IMediaControl
, riid
)) {
235 *ppvObj
= &This
->IMediaControl_iface
;
236 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj
);
237 } else if (IsEqualGUID(&IID_IMediaSeeking
, riid
)) {
238 *ppvObj
= &This
->IMediaSeeking_iface
;
239 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj
);
240 } else if (IsEqualGUID(&IID_IBasicAudio
, riid
)) {
241 *ppvObj
= &This
->IBasicAudio_iface
;
242 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj
);
243 } else if (IsEqualGUID(&IID_IBasicVideo
, riid
) ||
244 IsEqualGUID(&IID_IBasicVideo2
, riid
)) {
245 *ppvObj
= &This
->IBasicVideo2_iface
;
246 TRACE(" returning IBasicVideo2 interface (%p)\n", *ppvObj
);
247 } else if (IsEqualGUID(&IID_IVideoWindow
, riid
)) {
248 *ppvObj
= &This
->IVideoWindow_iface
;
249 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj
);
250 } else if (IsEqualGUID(&IID_IMediaEvent
, riid
) ||
251 IsEqualGUID(&IID_IMediaEventEx
, riid
)) {
252 *ppvObj
= &This
->IMediaEventEx_iface
;
253 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj
);
254 } else if (IsEqualGUID(&IID_IMediaFilter
, riid
) ||
255 IsEqualGUID(&IID_IPersist
, riid
)) {
256 *ppvObj
= &This
->IMediaFilter_iface
;
257 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj
);
258 } else if (IsEqualGUID(&IID_IMediaEventSink
, riid
)) {
259 *ppvObj
= &This
->IMediaEventSink_iface
;
260 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj
);
261 } else if (IsEqualGUID(&IID_IGraphConfig
, riid
)) {
262 *ppvObj
= &This
->IGraphConfig_iface
;
263 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj
);
264 } else if (IsEqualGUID(&IID_IMediaPosition
, riid
)) {
265 *ppvObj
= &This
->IMediaPosition_iface
;
266 TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj
);
267 } else if (IsEqualGUID(&IID_IFilterMapper
, riid
)) {
268 TRACE(" requesting IFilterMapper interface from aggregated filtermapper (%p)\n", *ppvObj
);
269 return IUnknown_QueryInterface(This
->punkFilterMapper2
, riid
, ppvObj
);
270 } else if (IsEqualGUID(&IID_IFilterMapper2
, riid
)) {
271 *ppvObj
= This
->pFilterMapper2
;
272 TRACE(" returning IFilterMapper2 interface from aggregated filtermapper (%p)\n", *ppvObj
);
273 } else if (IsEqualGUID(&IID_IFilterMapper3
, riid
)) {
274 *ppvObj
= This
->pFilterMapper2
;
275 TRACE(" returning IFilterMapper3 interface from aggregated filtermapper (%p)\n", *ppvObj
);
278 FIXME("unknown interface %s\n", debugstr_guid(riid
));
279 return E_NOINTERFACE
;
282 IUnknown_AddRef((IUnknown
*)(*ppvObj
));
286 static ULONG WINAPI
FilterGraphInner_AddRef(IUnknown
* iface
) {
287 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
288 ULONG ref
= InterlockedIncrement(&This
->ref
);
290 TRACE("(%p)->(): new ref = %d\n", This
, ref
);
295 static ULONG WINAPI
FilterGraphInner_Release(IUnknown
* iface
)
297 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
298 ULONG ref
= InterlockedDecrement(&This
->ref
);
300 TRACE("(%p)->(): new ref = %d\n", This
, ref
);
305 This
->ref
= 1; /* guard against reentrancy (aggregation). */
307 IMediaControl_Stop(&This
->IMediaControl_iface
);
309 while (This
->nFilters
)
310 IFilterGraph2_RemoveFilter((IFilterGraph2
*)This
, This
->ppFiltersInGraph
[0]);
313 IReferenceClock_Release(This
->refClock
);
315 for (i
= 0; i
< This
->nItfCacheEntries
; i
++)
317 if (This
->ItfCacheEntries
[i
].iface
)
318 IUnknown_Release(This
->ItfCacheEntries
[i
].iface
);
321 /* AddRef on controlling IUnknown, to compensate for Release of cached IFilterMapper2 interface below.
323 * NOTE: Filtergraph_AddRef isn't suitable, because bUnkOuterValid may be FALSE but punkOuter non-NULL
324 * and already passed as punkOuter to filtermapper in FilterGraph_create - this will happen in case of
325 * CoCreateInstance of filtergraph with non-null pUnkOuter and REFIID other than IID_Unknown that is
326 * cleaning up after error. */
327 if (This
->pUnkOuter
) IUnknown_AddRef(This
->pUnkOuter
);
328 else IUnknown_AddRef((IUnknown
*)&This
->IInner_vtbl
);
330 IFilterMapper2_Release(This
->pFilterMapper2
);
331 IUnknown_Release(This
->punkFilterMapper2
);
333 CloseHandle(This
->hEventCompletion
);
334 EventsQueue_Destroy(&This
->evqueue
);
335 This
->cs
.DebugInfo
->Spare
[0] = 0;
336 DeleteCriticalSection(&This
->cs
);
337 CoTaskMemFree(This
->ppFiltersInGraph
);
338 CoTaskMemFree(This
->pFilterNames
);
344 static inline IFilterGraphImpl
*impl_from_IFilterGraph2(IFilterGraph2
*iface
)
346 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IFilterGraph2_iface
);
349 static HRESULT WINAPI
FilterGraph2_QueryInterface(IFilterGraph2
*iface
, REFIID riid
, void **ppvObj
)
351 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
353 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
355 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
358 static ULONG WINAPI
FilterGraph2_AddRef(IFilterGraph2
*iface
)
360 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
362 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This
, iface
);
364 return Filtergraph_AddRef(This
);
367 static ULONG WINAPI
FilterGraph2_Release(IFilterGraph2
*iface
)
369 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
371 TRACE("(%p/%p)->() calling FilterGraph Release\n", This
, iface
);
373 return Filtergraph_Release(This
);
376 /*** IFilterGraph methods ***/
377 static HRESULT WINAPI
FilterGraph2_AddFilter(IFilterGraph2
*iface
, IBaseFilter
*pFilter
,
380 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
383 WCHAR
* wszFilterName
= NULL
;
384 int duplicate_name
= FALSE
;
386 TRACE("(%p/%p)->(%p, %s (%p))\n", This
, iface
, pFilter
, debugstr_w(pName
), pName
);
391 wszFilterName
= CoTaskMemAlloc( (pName
? strlenW(pName
) + 6 : 5) * sizeof(WCHAR
) );
395 /* Check if name already exists */
396 for(i
= 0; i
< This
->nFilters
; i
++)
397 if (!strcmpW(This
->pFilterNames
[i
], pName
))
399 duplicate_name
= TRUE
;
404 /* If no name given or name already existing, generate one */
405 if (!pName
|| duplicate_name
)
407 static const WCHAR wszFmt1
[] = {'%','s',' ','%','0','4','d',0};
408 static const WCHAR wszFmt2
[] = {'%','0','4','d',0};
410 for (j
= 0; j
< 10000 ; j
++)
414 sprintfW(wszFilterName
, wszFmt1
, pName
, This
->nameIndex
);
416 sprintfW(wszFilterName
, wszFmt2
, This
->nameIndex
);
417 TRACE("Generated name %s\n", debugstr_w(wszFilterName
));
419 /* Check if the generated name already exists */
420 for(i
= 0; i
< This
->nFilters
; i
++)
421 if (!strcmpW(This
->pFilterNames
[i
], wszFilterName
))
424 /* Compute next index and exit if generated name is suitable */
425 if (This
->nameIndex
++ == 10000)
427 if (i
== This
->nFilters
)
430 /* Unable to find a suitable name */
433 CoTaskMemFree(wszFilterName
);
434 return VFW_E_DUPLICATE_NAME
;
438 memcpy(wszFilterName
, pName
, (strlenW(pName
) + 1) * sizeof(WCHAR
));
440 if (This
->nFilters
+ 1 > This
->filterCapacity
)
442 int newCapacity
= This
->filterCapacity
? 2 * This
->filterCapacity
: 1;
443 IBaseFilter
** ppNewFilters
= CoTaskMemAlloc(newCapacity
* sizeof(IBaseFilter
*));
444 LPWSTR
* pNewNames
= CoTaskMemAlloc(newCapacity
* sizeof(LPWSTR
));
445 memcpy(ppNewFilters
, This
->ppFiltersInGraph
, This
->nFilters
* sizeof(IBaseFilter
*));
446 memcpy(pNewNames
, This
->pFilterNames
, This
->nFilters
* sizeof(LPWSTR
));
447 if (This
->filterCapacity
)
449 CoTaskMemFree(This
->ppFiltersInGraph
);
450 CoTaskMemFree(This
->pFilterNames
);
452 This
->ppFiltersInGraph
= ppNewFilters
;
453 This
->pFilterNames
= pNewNames
;
454 This
->filterCapacity
= newCapacity
;
457 hr
= IBaseFilter_JoinFilterGraph(pFilter
, (IFilterGraph
*)This
, wszFilterName
);
461 IBaseFilter_AddRef(pFilter
);
462 This
->ppFiltersInGraph
[This
->nFilters
] = pFilter
;
463 This
->pFilterNames
[This
->nFilters
] = wszFilterName
;
465 IBaseFilter_SetSyncSource(pFilter
, This
->refClock
);
468 CoTaskMemFree(wszFilterName
);
470 if (SUCCEEDED(hr
) && duplicate_name
)
471 return VFW_S_DUPLICATE_NAME
;
476 static HRESULT WINAPI
FilterGraph2_RemoveFilter(IFilterGraph2
*iface
, IBaseFilter
*pFilter
)
478 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
482 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFilter
);
484 /* FIXME: check graph is stopped */
486 for (i
= 0; i
< This
->nFilters
; i
++)
488 if (This
->ppFiltersInGraph
[i
] == pFilter
)
490 IEnumPins
*penumpins
= NULL
;
493 if (This
->defaultclock
&& This
->refClockProvider
== pFilter
)
495 IMediaFilter_SetSyncSource(&This
->IMediaFilter_iface
, NULL
);
496 This
->defaultclock
= 1;
499 TRACE("Removing filter %s\n", debugstr_w(This
->pFilterNames
[i
]));
500 IBaseFilter_GetState(pFilter
, 0, &state
);
501 if (state
== State_Running
)
502 IBaseFilter_Pause(pFilter
);
503 if (state
!= State_Stopped
)
504 IBaseFilter_Stop(pFilter
);
506 hr
= IBaseFilter_EnumPins(pFilter
, &penumpins
);
509 while(IEnumPins_Next(penumpins
, 1, &ppin
, NULL
) == S_OK
)
513 IPin_ConnectedTo(ppin
, &victim
);
516 h
= IPin_Disconnect(victim
);
517 TRACE("Disconnect other side: %08x\n", h
);
518 if (h
== VFW_E_NOT_STOPPED
)
521 IPin_QueryPinInfo(victim
, &pinfo
);
523 IBaseFilter_GetState(pinfo
.pFilter
, 0, &state
);
524 if (state
== State_Running
)
525 IBaseFilter_Pause(pinfo
.pFilter
);
526 IBaseFilter_Stop(pinfo
.pFilter
);
527 IBaseFilter_Release(pinfo
.pFilter
);
528 h
= IPin_Disconnect(victim
);
529 TRACE("Disconnect retry: %08x\n", h
);
531 IPin_Release(victim
);
533 h
= IPin_Disconnect(ppin
);
534 TRACE("Disconnect 2: %08x\n", h
);
538 IEnumPins_Release(penumpins
);
541 hr
= IBaseFilter_JoinFilterGraph(pFilter
, NULL
, This
->pFilterNames
[i
]);
544 IBaseFilter_SetSyncSource(pFilter
, NULL
);
545 IBaseFilter_Release(pFilter
);
546 CoTaskMemFree(This
->pFilterNames
[i
]);
547 memmove(This
->ppFiltersInGraph
+i
, This
->ppFiltersInGraph
+i
+1, sizeof(IBaseFilter
*)*(This
->nFilters
- 1 - i
));
548 memmove(This
->pFilterNames
+i
, This
->pFilterNames
+i
+1, sizeof(LPWSTR
)*(This
->nFilters
- 1 - i
));
550 /* Invalidate interfaces in the cache */
551 for (i
= 0; i
< This
->nItfCacheEntries
; i
++)
552 if (pFilter
== This
->ItfCacheEntries
[i
].filter
)
554 IUnknown_Release(This
->ItfCacheEntries
[i
].iface
);
555 This
->ItfCacheEntries
[i
].iface
= NULL
;
556 This
->ItfCacheEntries
[i
].filter
= NULL
;
564 return hr
; /* FIXME: check this error code */
567 static HRESULT WINAPI
FilterGraph2_EnumFilters(IFilterGraph2
*iface
, IEnumFilters
**ppEnum
)
569 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
571 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
573 return IEnumFiltersImpl_Construct(This
->ppFiltersInGraph
, This
->nFilters
, ppEnum
);
576 static HRESULT WINAPI
FilterGraph2_FindFilterByName(IFilterGraph2
*iface
, LPCWSTR pName
,
577 IBaseFilter
**ppFilter
)
579 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
582 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_w(pName
), pName
, ppFilter
);
587 for (i
= 0; i
< This
->nFilters
; i
++)
589 if (!strcmpW(pName
, This
->pFilterNames
[i
]))
591 *ppFilter
= This
->ppFiltersInGraph
[i
];
592 IBaseFilter_AddRef(*ppFilter
);
598 return VFW_E_NOT_FOUND
;
601 /* Don't allow a circular connection to form, return VFW_E_CIRCULAR_GRAPH if this would be the case.
602 * A circular connection will be formed if from the filter of the output pin, the input pin can be reached
604 static HRESULT
CheckCircularConnection(IFilterGraphImpl
*This
, IPin
*out
, IPin
*in
)
608 PIN_INFO info_out
, info_in
;
610 hr
= IPin_QueryPinInfo(out
, &info_out
);
613 if (info_out
.dir
!= PINDIR_OUTPUT
)
615 IBaseFilter_Release(info_out
.pFilter
);
619 hr
= IPin_QueryPinInfo(in
, &info_in
);
621 IBaseFilter_Release(info_in
.pFilter
);
624 if (info_in
.dir
!= PINDIR_INPUT
)
630 if (info_out
.pFilter
== info_in
.pFilter
)
631 hr
= VFW_E_CIRCULAR_GRAPH
;
637 hr
= IBaseFilter_EnumPins(info_out
.pFilter
, &enumpins
);
641 IEnumPins_Reset(enumpins
);
642 while ((hr
= IEnumPins_Next(enumpins
, 1, &test
, NULL
)) == S_OK
)
644 PIN_DIRECTION dir
= PINDIR_OUTPUT
;
645 IPin_QueryDirection(test
, &dir
);
646 if (dir
== PINDIR_INPUT
)
649 IPin_ConnectedTo(test
, &victim
);
652 hr
= CheckCircularConnection(This
, victim
, in
);
653 IPin_Release(victim
);
663 IEnumPins_Release(enumpins
);
667 IBaseFilter_Release(info_out
.pFilter
);
669 ERR("Checking filtergraph returned %08x, something's not right!\n", hr
);
672 /* Debugging filtergraphs not enabled */
678 /* NOTE: despite the implication, it doesn't matter which
679 * way round you put in the input and output pins */
680 static HRESULT WINAPI
FilterGraph2_ConnectDirect(IFilterGraph2
*iface
, IPin
*ppinIn
, IPin
*ppinOut
,
681 const AM_MEDIA_TYPE
*pmt
)
683 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
687 TRACE("(%p/%p)->(%p, %p, %p)\n", This
, iface
, ppinIn
, ppinOut
, pmt
);
689 /* FIXME: check pins are in graph */
691 if (TRACE_ON(quartz
))
695 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
699 TRACE("Filter owning first pin => %p\n", PinInfo
.pFilter
);
700 IBaseFilter_Release(PinInfo
.pFilter
);
702 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
706 TRACE("Filter owning second pin => %p\n", PinInfo
.pFilter
);
707 IBaseFilter_Release(PinInfo
.pFilter
);
710 hr
= IPin_QueryDirection(ppinIn
, &dir
);
713 if (dir
== PINDIR_INPUT
)
715 hr
= CheckCircularConnection(This
, ppinOut
, ppinIn
);
717 hr
= IPin_Connect(ppinOut
, ppinIn
, pmt
);
721 hr
= CheckCircularConnection(This
, ppinIn
, ppinOut
);
723 hr
= IPin_Connect(ppinIn
, ppinOut
, pmt
);
730 static HRESULT WINAPI
FilterGraph2_Reconnect(IFilterGraph2
*iface
, IPin
*ppin
)
732 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
733 IPin
*pConnectedTo
= NULL
;
735 PIN_DIRECTION pindir
;
737 IPin_QueryDirection(ppin
, &pindir
);
738 hr
= IPin_ConnectedTo(ppin
, &pConnectedTo
);
740 TRACE("Querying connected to failed: %x\n", hr
);
743 IPin_Disconnect(ppin
);
744 IPin_Disconnect(pConnectedTo
);
745 if (pindir
== PINDIR_INPUT
)
746 hr
= IPin_Connect(pConnectedTo
, ppin
, NULL
);
748 hr
= IPin_Connect(ppin
, pConnectedTo
, NULL
);
749 IPin_Release(pConnectedTo
);
751 WARN("Reconnecting pins failed, pins are not connected now..\n");
752 TRACE("(%p->%p) -- %p %p -> %x\n", iface
, This
, ppin
, pConnectedTo
, hr
);
756 static HRESULT WINAPI
FilterGraph2_Disconnect(IFilterGraph2
*iface
, IPin
*ppin
)
758 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
760 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppin
);
765 return IPin_Disconnect(ppin
);
768 static HRESULT WINAPI
FilterGraph2_SetDefaultSyncSource(IFilterGraph2
*iface
)
770 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
771 IReferenceClock
*pClock
= NULL
;
775 TRACE("(%p/%p)->() live sources not handled properly!\n", iface
, This
);
777 EnterCriticalSection(&This
->cs
);
779 for (i
= 0; i
< This
->nFilters
; ++i
)
782 IAMFilterMiscFlags
*flags
= NULL
;
783 IUnknown_QueryInterface(This
->ppFiltersInGraph
[i
], &IID_IAMFilterMiscFlags
, (void**)&flags
);
786 miscflags
= IAMFilterMiscFlags_GetMiscFlags(flags
);
787 IUnknown_Release(flags
);
788 if (miscflags
== AM_FILTER_MISC_FLAGS_IS_RENDERER
)
789 IUnknown_QueryInterface(This
->ppFiltersInGraph
[i
], &IID_IReferenceClock
, (void**)&pClock
);
796 hr
= CoCreateInstance(&CLSID_SystemClock
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IReferenceClock
, (LPVOID
*)&pClock
);
797 This
->refClockProvider
= NULL
;
800 This
->refClockProvider
= This
->ppFiltersInGraph
[i
];
804 hr
= IMediaFilter_SetSyncSource(&This
->IMediaFilter_iface
, pClock
);
805 This
->defaultclock
= TRUE
;
806 IReferenceClock_Release(pClock
);
808 LeaveCriticalSection(&This
->cs
);
813 static HRESULT
GetFilterInfo(IMoniker
* pMoniker
, GUID
* pclsid
, VARIANT
* pvar
)
815 static const WCHAR wszClsidName
[] = {'C','L','S','I','D',0};
816 static const WCHAR wszFriendlyName
[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
817 IPropertyBag
* pPropBagCat
= NULL
;
822 hr
= IMoniker_BindToStorage(pMoniker
, NULL
, NULL
, &IID_IPropertyBag
, (LPVOID
*)&pPropBagCat
);
825 hr
= IPropertyBag_Read(pPropBagCat
, wszClsidName
, pvar
, NULL
);
828 hr
= CLSIDFromString(V_UNION(pvar
, bstrVal
), pclsid
);
833 hr
= IPropertyBag_Read(pPropBagCat
, wszFriendlyName
, pvar
, NULL
);
836 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid
), debugstr_w(V_UNION(pvar
, bstrVal
)));
839 IPropertyBag_Release(pPropBagCat
);
844 static HRESULT
GetInternalConnections(IBaseFilter
* pfilter
, IPin
* pinputpin
, IPin
*** pppins
, ULONG
* pnb
)
849 TRACE("(%p, %p, %p, %p)\n", pfilter
, pinputpin
, pppins
, pnb
);
850 hr
= IPin_QueryInternalConnections(pinputpin
, NULL
, &nb
);
853 } else if (hr
== S_FALSE
) {
854 *pppins
= CoTaskMemAlloc(sizeof(IPin
*)*nb
);
855 hr
= IPin_QueryInternalConnections(pinputpin
, *pppins
, &nb
);
857 WARN("Error (%x)\n", hr
);
859 } else if (hr
== E_NOTIMPL
) {
860 /* Input connected to all outputs */
861 IEnumPins
* penumpins
;
864 TRACE("E_NOTIMPL\n");
865 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
867 WARN("filter Enumpins failed (%x)\n", hr
);
871 /* Count output pins */
872 while(IEnumPins_Next(penumpins
, 1, &ppin
, &nb
) == S_OK
) {
873 PIN_DIRECTION pindir
;
874 IPin_QueryDirection(ppin
, &pindir
);
875 if (pindir
== PINDIR_OUTPUT
)
879 *pppins
= CoTaskMemAlloc(sizeof(IPin
*)*i
);
880 /* Retrieve output pins */
881 IEnumPins_Reset(penumpins
);
883 while(IEnumPins_Next(penumpins
, 1, &ppin
, &nb
) == S_OK
) {
884 PIN_DIRECTION pindir
;
885 IPin_QueryDirection(ppin
, &pindir
);
886 if (pindir
== PINDIR_OUTPUT
)
887 (*pppins
)[i
++] = ppin
;
891 IEnumPins_Release(penumpins
);
894 WARN("Next failed (%x)\n", hr
);
897 } else if (FAILED(hr
)) {
898 WARN("Cannot get internal connection (%x)\n", hr
);
906 /*** IGraphBuilder methods ***/
907 static HRESULT WINAPI
FilterGraph2_Connect(IFilterGraph2
*iface
, IPin
*ppinOut
, IPin
*ppinIn
)
909 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
911 AM_MEDIA_TYPE
* mt
= NULL
;
912 IEnumMediaTypes
* penummt
= NULL
;
914 IEnumPins
* penumpins
;
915 IEnumMoniker
* pEnumMoniker
;
924 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, ppinOut
, ppinIn
);
926 if (TRACE_ON(quartz
))
928 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
932 TRACE("Filter owning first pin => %p\n", PinInfo
.pFilter
);
933 IBaseFilter_Release(PinInfo
.pFilter
);
935 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
939 TRACE("Filter owning second pin => %p\n", PinInfo
.pFilter
);
940 IBaseFilter_Release(PinInfo
.pFilter
);
943 EnterCriticalSection(&This
->cs
);
944 ++This
->recursioncount
;
945 if (This
->recursioncount
>= 5)
947 WARN("Recursion count has reached %d\n", This
->recursioncount
);
948 hr
= VFW_E_CANNOT_CONNECT
;
952 hr
= IPin_QueryDirection(ppinOut
, &dir
);
956 if (dir
== PINDIR_INPUT
)
965 hr
= CheckCircularConnection(This
, ppinOut
, ppinIn
);
969 /* Try direct connection first */
970 hr
= IPin_Connect(ppinOut
, ppinIn
, NULL
);
974 TRACE("Direct connection failed, trying to render using extra filters\n");
976 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
980 hr
= IBaseFilter_GetClassID(PinInfo
.pFilter
, &FilterCLSID
);
981 IBaseFilter_Release(PinInfo
.pFilter
);
985 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
986 * filter to the minor mediatype of input pin of the renderer */
987 hr
= IPin_EnumMediaTypes(ppinOut
, &penummt
);
990 WARN("EnumMediaTypes (%x)\n", hr
);
994 hr
= IEnumMediaTypes_Next(penummt
, 1, &mt
, &nbmt
);
996 WARN("IEnumMediaTypes_Next (%x)\n", hr
);
1002 WARN("No media type found!\n");
1003 hr
= VFW_E_INVALIDMEDIATYPE
;
1006 TRACE("MajorType %s\n", debugstr_guid(&mt
->majortype
));
1007 TRACE("SubType %s\n", debugstr_guid(&mt
->subtype
));
1009 /* Try to find a suitable filter that can connect to the pin to render */
1010 tab
[0] = mt
->majortype
;
1011 tab
[1] = mt
->subtype
;
1012 hr
= IFilterMapper2_EnumMatchingFilters(This
->pFilterMapper2
, &pEnumMoniker
, 0, FALSE
, MERIT_UNLIKELY
, TRUE
, 1, tab
, NULL
, NULL
, FALSE
, FALSE
, 0, NULL
, NULL
, NULL
);
1014 WARN("Unable to enum filters (%x)\n", hr
);
1018 hr
= VFW_E_CANNOT_RENDER
;
1019 while(IEnumMoniker_Next(pEnumMoniker
, 1, &pMoniker
, &nb
) == S_OK
)
1024 IPin
* ppinfilter
= NULL
;
1025 IBaseFilter
* pfilter
= NULL
;
1027 hr
= GetFilterInfo(pMoniker
, &clsid
, &var
);
1028 IMoniker_Release(pMoniker
);
1030 WARN("Unable to retrieve filter info (%x)\n", hr
);
1034 if (IsEqualGUID(&clsid
, &FilterCLSID
)) {
1035 /* Skip filter (same as the one the output pin belongs to) */
1039 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&pfilter
);
1041 WARN("Unable to create filter (%x), trying next one\n", hr
);
1045 hr
= IFilterGraph2_AddFilter(iface
, pfilter
, V_UNION(&var
, bstrVal
));
1047 WARN("Unable to add filter (%x)\n", hr
);
1048 IBaseFilter_Release(pfilter
);
1055 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
1057 WARN("Enumpins (%x)\n", hr
);
1061 hr
= IEnumPins_Next(penumpins
, 1, &ppinfilter
, &pin
);
1062 IEnumPins_Release(penumpins
);
1065 WARN("Obtaining next pin: (%x)\n", hr
);
1069 WARN("Cannot use this filter: no pins\n");
1073 hr
= IPin_Connect(ppinOut
, ppinfilter
, NULL
);
1075 TRACE("Cannot connect to filter (%x), trying next one\n", hr
);
1078 TRACE("Successfully connected to filter, follow chain...\n");
1080 /* Render all output pins of the filter by calling IFilterGraph2_Connect on each of them */
1081 hr
= GetInternalConnections(pfilter
, ppinfilter
, &ppins
, &nb
);
1083 if (SUCCEEDED(hr
)) {
1086 IPin_Disconnect(ppinfilter
);
1087 IPin_Disconnect(ppinOut
);
1090 TRACE("pins to consider: %d\n", nb
);
1091 for(i
= 0; i
< nb
; i
++)
1093 LPWSTR pinname
= NULL
;
1095 TRACE("Processing pin %u\n", i
);
1097 hr
= IPin_QueryId(ppins
[i
], &pinname
);
1100 if (pinname
[0] == '~')
1102 TRACE("Pinname=%s, skipping\n", debugstr_w(pinname
));
1106 hr
= IFilterGraph2_Connect(iface
, ppins
[i
], ppinIn
);
1107 CoTaskMemFree(pinname
);
1111 TRACE("Cannot connect pin %p (%x)\n", ppinfilter
, hr
);
1113 IPin_Release(ppins
[i
]);
1114 if (SUCCEEDED(hr
)) break;
1116 while (++i
< nb
) IPin_Release(ppins
[i
]);
1117 CoTaskMemFree(ppins
);
1118 IPin_Release(ppinfilter
);
1119 IBaseFilter_Release(pfilter
);
1122 IPin_Disconnect(ppinfilter
);
1123 IPin_Disconnect(ppinOut
);
1124 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1132 if (ppinfilter
) IPin_Release(ppinfilter
);
1134 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1135 IBaseFilter_Release(pfilter
);
1141 IEnumMediaTypes_Release(penummt
);
1143 DeleteMediaType(mt
);
1144 --This
->recursioncount
;
1145 LeaveCriticalSection(&This
->cs
);
1146 TRACE("--> %08x\n", hr
);
1147 return SUCCEEDED(hr
) ? S_OK
: hr
;
1150 static HRESULT
FilterGraph2_RenderRecurse(IFilterGraphImpl
*This
, IPin
*ppinOut
)
1152 /* This pin has been connected now, try to call render on all pins that aren't connected */
1155 IEnumPins
*enumpins
= NULL
;
1156 BOOL renderany
= FALSE
;
1157 BOOL renderall
= TRUE
;
1159 IPin_QueryPinInfo(ppinOut
, &info
);
1161 IBaseFilter_EnumPins(info
.pFilter
, &enumpins
);
1162 /* Don't need to hold a reference, IEnumPins does */
1163 IBaseFilter_Release(info
.pFilter
);
1165 IEnumPins_Reset(enumpins
);
1166 while (IEnumPins_Next(enumpins
, 1, &to
, NULL
) == S_OK
)
1168 PIN_DIRECTION dir
= PINDIR_INPUT
;
1170 IPin_QueryDirection(to
, &dir
);
1172 if (dir
== PINDIR_OUTPUT
)
1176 IPin_ConnectedTo(to
, &out
);
1180 hr
= IFilterGraph2_Render(&This
->IFilterGraph2_iface
, to
);
1193 IEnumPins_Release(enumpins
);
1199 return VFW_S_PARTIAL_RENDER
;
1201 return VFW_E_CANNOT_RENDER
;
1204 /* Ogg hates me if I create a direct rendering method
1206 * It can only connect to a pin properly once, so use a recursive method that does
1208 * +----+ --- (PIN 1) (Render is called on this pin)
1210 * +----+ --- (PIN 2)
1212 * Enumerate possible renderers that EXACTLY match the requested type
1214 * If none is available, try to add intermediate filters that can connect to the input pin
1215 * then call Render on that intermediate pin's output pins
1216 * if it succeeds: Render returns success, if it doesn't, the intermediate filter is removed,
1217 * and another filter that can connect to the input pin is tried
1218 * if we run out of filters that can, give up and return VFW_E_CANNOT_RENDER
1219 * It's recursive, but fun!
1222 static HRESULT WINAPI
FilterGraph2_Render(IFilterGraph2
*iface
, IPin
*ppinOut
)
1224 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1225 IEnumMediaTypes
* penummt
;
1230 IEnumMoniker
* pEnumMoniker
;
1236 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppinOut
);
1238 if (TRACE_ON(quartz
))
1242 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
1246 TRACE("Filter owning pin => %p\n", PinInfo
.pFilter
);
1247 IBaseFilter_Release(PinInfo
.pFilter
);
1250 /* Try to find out if there is a renderer for the specified subtype already, and use that
1252 EnterCriticalSection(&This
->cs
);
1253 for (x
= 0; x
< This
->nFilters
; ++x
)
1255 IEnumPins
*enumpins
= NULL
;
1258 hr
= IBaseFilter_EnumPins(This
->ppFiltersInGraph
[x
], &enumpins
);
1260 if (FAILED(hr
) || !enumpins
)
1263 IEnumPins_Reset(enumpins
);
1264 while (IEnumPins_Next(enumpins
, 1, &pin
, NULL
) == S_OK
)
1267 PIN_DIRECTION dir
= PINDIR_OUTPUT
;
1269 IPin_QueryDirection(pin
, &dir
);
1270 if (dir
!= PINDIR_INPUT
)
1275 IPin_ConnectedTo(pin
, &to
);
1279 hr
= FilterGraph2_ConnectDirect(iface
, ppinOut
, pin
, NULL
);
1282 TRACE("Connected successfully %p/%p, %08x look if we should render more!\n", ppinOut
, pin
, hr
);
1285 hr
= FilterGraph2_RenderRecurse(This
, pin
);
1288 IPin_Disconnect(ppinOut
);
1289 IPin_Disconnect(pin
);
1292 IEnumPins_Release(enumpins
);
1293 LeaveCriticalSection(&This
->cs
);
1296 WARN("Could not connect!\n");
1303 IEnumPins_Release(enumpins
);
1306 LeaveCriticalSection(&This
->cs
);
1308 hr
= IPin_EnumMediaTypes(ppinOut
, &penummt
);
1310 WARN("EnumMediaTypes (%x)\n", hr
);
1314 IEnumMediaTypes_Reset(penummt
);
1316 /* Looks like no existing renderer of the kind exists
1317 * Try adding new ones
1319 tab
[0] = tab
[1] = GUID_NULL
;
1320 while (SUCCEEDED(hr
))
1322 hr
= IEnumMediaTypes_Next(penummt
, 1, &mt
, &nbmt
);
1324 WARN("IEnumMediaTypes_Next (%x)\n", hr
);
1329 hr
= VFW_E_CANNOT_RENDER
;
1334 TRACE("MajorType %s\n", debugstr_guid(&mt
->majortype
));
1335 TRACE("SubType %s\n", debugstr_guid(&mt
->subtype
));
1337 /* Only enumerate once, this doesn't account for all previous ones, but this should be enough nonetheless */
1338 if (IsEqualIID(&tab
[0], &mt
->majortype
) && IsEqualIID(&tab
[1], &mt
->subtype
))
1340 DeleteMediaType(mt
);
1344 /* Try to find a suitable renderer with the same media type */
1345 tab
[0] = mt
->majortype
;
1346 tab
[1] = mt
->subtype
;
1347 hr
= IFilterMapper2_EnumMatchingFilters(This
->pFilterMapper2
, &pEnumMoniker
, 0, FALSE
, MERIT_UNLIKELY
, TRUE
, 1, tab
, NULL
, NULL
, FALSE
, FALSE
, 0, NULL
, NULL
, NULL
);
1350 WARN("Unable to enum filters (%x)\n", hr
);
1356 while (IEnumMoniker_Next(pEnumMoniker
, 1, &pMoniker
, &nb
) == S_OK
)
1361 IBaseFilter
* pfilter
= NULL
;
1362 IEnumPins
* penumpins
= NULL
;
1365 hr
= GetFilterInfo(pMoniker
, &clsid
, &var
);
1366 IMoniker_Release(pMoniker
);
1368 WARN("Unable to retrieve filter info (%x)\n", hr
);
1372 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&pfilter
);
1375 WARN("Unable to create filter (%x), trying next one\n", hr
);
1379 hr
= IFilterGraph2_AddFilter(iface
, pfilter
, V_UNION(&var
, bstrVal
));
1381 WARN("Unable to add filter (%x)\n", hr
);
1382 IBaseFilter_Release(pfilter
);
1387 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
1389 WARN("Splitter Enumpins (%x)\n", hr
);
1393 while ((hr
= IEnumPins_Next(penumpins
, 1, &ppinfilter
, &pin
)) == S_OK
)
1403 hr
= IPin_QueryDirection(ppinfilter
, &dir
);
1405 IPin_Release(ppinfilter
);
1406 WARN("QueryDirection failed (%x)\n", hr
);
1409 if (dir
!= PINDIR_INPUT
) {
1410 IPin_Release(ppinfilter
);
1411 continue; /* Wrong direction */
1414 /* Connect the pin to the "Renderer" */
1415 hr
= IPin_Connect(ppinOut
, ppinfilter
, NULL
);
1416 IPin_Release(ppinfilter
);
1419 WARN("Unable to connect %s to renderer (%x)\n", debugstr_w(V_UNION(&var
, bstrVal
)), hr
);
1422 TRACE("Connected, recursing %s\n", debugstr_w(V_UNION(&var
, bstrVal
)));
1426 hr
= FilterGraph2_RenderRecurse(This
, ppinfilter
);
1428 WARN("Unable to connect recursively (%x)\n", hr
);
1431 IBaseFilter_Release(pfilter
);
1434 if (SUCCEEDED(hr
)) {
1435 IEnumPins_Release(penumpins
);
1436 break; /* out of IEnumMoniker_Next loop */
1439 /* IEnumPins_Next failed, all other failure case caught by goto error */
1440 WARN("IEnumPins_Next (%x)\n", hr
);
1446 IEnumPins_Release(penumpins
);
1448 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1449 IBaseFilter_Release(pfilter
);
1451 if (SUCCEEDED(hr
)) DebugBreak();
1454 IEnumMoniker_Release(pEnumMoniker
);
1456 DeleteMediaType(mt
);
1462 IEnumMediaTypes_Release(penummt
);
1466 static HRESULT WINAPI
FilterGraph2_RenderFile(IFilterGraph2
*iface
, LPCWSTR lpcwstrFile
,
1467 LPCWSTR lpcwstrPlayList
)
1469 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1470 static const WCHAR string
[] = {'R','e','a','d','e','r',0};
1471 IBaseFilter
* preader
= NULL
;
1472 IPin
* ppinreader
= NULL
;
1473 IEnumPins
* penumpins
= NULL
;
1475 BOOL partial
= FALSE
;
1476 HRESULT any
= FALSE
;
1478 TRACE("(%p/%p)->(%s, %s)\n", This
, iface
, debugstr_w(lpcwstrFile
), debugstr_w(lpcwstrPlayList
));
1480 if (lpcwstrPlayList
!= NULL
)
1481 return E_INVALIDARG
;
1483 hr
= IFilterGraph2_AddSourceFilter(iface
, lpcwstrFile
, string
, &preader
);
1488 hr
= IBaseFilter_EnumPins(preader
, &penumpins
);
1491 while (IEnumPins_Next(penumpins
, 1, &ppinreader
, NULL
) == S_OK
)
1495 IPin_QueryDirection(ppinreader
, &dir
);
1496 if (dir
== PINDIR_OUTPUT
)
1500 hr
= IFilterGraph2_Render(iface
, ppinreader
);
1501 TRACE("Render %08x\n", hr
);
1503 for (i
= 0; i
< This
->nFilters
; ++i
)
1504 TRACE("Filters in chain: %s\n", debugstr_w(This
->pFilterNames
[i
]));
1511 IPin_Release(ppinreader
);
1513 IEnumPins_Release(penumpins
);
1516 hr
= VFW_E_CANNOT_RENDER
;
1518 hr
= VFW_S_PARTIAL_RENDER
;
1522 IBaseFilter_Release(preader
);
1524 TRACE("--> %08x\n", hr
);
1528 /* Some filters implement their own asynchronous reader (Theoretically they all should, try to load it first */
1529 static HRESULT
GetFileSourceFilter(LPCOLESTR pszFileName
, IBaseFilter
**filter
)
1531 static const WCHAR wszReg
[] = {'M','e','d','i','a',' ','T','y','p','e','\\','E','x','t','e','n','s','i','o','n','s',0};
1536 lRet
= RegOpenKeyExW(HKEY_CLASSES_ROOT
, wszReg
, 0, KEY_READ
, &extkey
);
1537 hr
= HRESULT_FROM_WIN32(lRet
);
1541 static const WCHAR filtersource
[] = {'S','o','u','r','c','e',' ','F','i','l','t','e','r',0};
1542 WCHAR
*ext
= PathFindExtensionW(pszFileName
);
1543 WCHAR clsid_key
[39];
1545 DWORD size
= sizeof(clsid_key
);
1550 CloseHandle(extkey
);
1554 lRet
= RegOpenKeyExW(extkey
, ext
, 0, KEY_READ
, &pathkey
);
1555 hr
= HRESULT_FROM_WIN32(lRet
);
1556 CloseHandle(extkey
);
1560 lRet
= RegQueryValueExW(pathkey
, filtersource
, NULL
, NULL
, (LPBYTE
)clsid_key
, &size
);
1561 hr
= HRESULT_FROM_WIN32(lRet
);
1562 CloseHandle(pathkey
);
1566 CLSIDFromString(clsid_key
, &clsid
);
1568 TRACE("CLSID: %s\n", debugstr_guid(&clsid
));
1569 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)filter
);
1572 IFileSourceFilter
*source
= NULL
;
1573 hr
= IBaseFilter_QueryInterface(*filter
, &IID_IFileSourceFilter
, (LPVOID
*)&source
);
1575 IFileSourceFilter_Release(source
);
1577 IBaseFilter_Release(*filter
);
1585 static HRESULT WINAPI
FilterGraph2_AddSourceFilter(IFilterGraph2
*iface
, LPCWSTR lpcwstrFileName
,
1586 LPCWSTR lpcwstrFilterName
, IBaseFilter
**ppFilter
)
1588 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1590 IBaseFilter
* preader
;
1591 IFileSourceFilter
* pfile
= NULL
;
1595 TRACE("(%p/%p)->(%s, %s, %p)\n", This
, iface
, debugstr_w(lpcwstrFileName
), debugstr_w(lpcwstrFilterName
), ppFilter
);
1597 /* Try from file name first, then fall back to default asynchronous reader */
1598 hr
= GetFileSourceFilter(lpcwstrFileName
, &preader
);
1601 hr
= CoCreateInstance(&CLSID_AsyncReader
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&preader
);
1603 WARN("Unable to create file source filter (%x)\n", hr
);
1607 hr
= IFilterGraph2_AddFilter(iface
, preader
, lpcwstrFilterName
);
1609 WARN("Unable add filter (%x)\n", hr
);
1610 IBaseFilter_Release(preader
);
1614 hr
= IBaseFilter_QueryInterface(preader
, &IID_IFileSourceFilter
, (LPVOID
*)&pfile
);
1616 WARN("Unable to get IFileSourceInterface (%x)\n", hr
);
1620 /* Load the file in the file source filter */
1621 hr
= IFileSourceFilter_Load(pfile
, lpcwstrFileName
, NULL
);
1623 WARN("Load (%x)\n", hr
);
1627 IFileSourceFilter_GetCurFile(pfile
, &filename
, &mt
);
1629 WARN("GetCurFile (%x)\n", hr
);
1633 TRACE("File %s\n", debugstr_w(filename
));
1634 TRACE("MajorType %s\n", debugstr_guid(&mt
.majortype
));
1635 TRACE("SubType %s\n", debugstr_guid(&mt
.subtype
));
1638 *ppFilter
= preader
;
1639 IFileSourceFilter_Release(pfile
);
1645 IFileSourceFilter_Release(pfile
);
1646 IFilterGraph2_RemoveFilter(iface
, preader
);
1647 IBaseFilter_Release(preader
);
1652 static HRESULT WINAPI
FilterGraph2_SetLogFile(IFilterGraph2
*iface
, DWORD_PTR hFile
)
1654 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1656 TRACE("(%p/%p)->(%08x): stub !!!\n", This
, iface
, (DWORD
) hFile
);
1661 static HRESULT WINAPI
FilterGraph2_Abort(IFilterGraph2
*iface
)
1663 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1665 TRACE("(%p/%p)->(): stub !!!\n", This
, iface
);
1670 static HRESULT WINAPI
FilterGraph2_ShouldOperationContinue(IFilterGraph2
*iface
)
1672 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1674 TRACE("(%p/%p)->(): stub !!!\n", This
, iface
);
1679 /*** IFilterGraph2 methods ***/
1680 static HRESULT WINAPI
FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2
*iface
,
1681 IMoniker
*pMoniker
, IBindCtx
*pCtx
, LPCWSTR lpcwstrFilterName
, IBaseFilter
**ppFilter
)
1683 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1685 TRACE("(%p/%p)->(%p %p %s %p): stub !!!\n", This
, iface
, pMoniker
, pCtx
, debugstr_w(lpcwstrFilterName
), ppFilter
);
1690 static HRESULT WINAPI
FilterGraph2_ReconnectEx(IFilterGraph2
*iface
, IPin
*ppin
,
1691 const AM_MEDIA_TYPE
*pmt
)
1693 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1695 TRACE("(%p/%p)->(%p %p): stub !!!\n", This
, iface
, ppin
, pmt
);
1700 static HRESULT WINAPI
FilterGraph2_RenderEx(IFilterGraph2
*iface
, IPin
*pPinOut
, DWORD dwFlags
,
1703 IFilterGraphImpl
*This
= impl_from_IFilterGraph2(iface
);
1705 TRACE("(%p/%p)->(%p %08x %p): stub !!!\n", This
, iface
, pPinOut
, dwFlags
, pvContext
);
1711 static const IFilterGraph2Vtbl IFilterGraph2_VTable
=
1713 FilterGraph2_QueryInterface
,
1714 FilterGraph2_AddRef
,
1715 FilterGraph2_Release
,
1716 FilterGraph2_AddFilter
,
1717 FilterGraph2_RemoveFilter
,
1718 FilterGraph2_EnumFilters
,
1719 FilterGraph2_FindFilterByName
,
1720 FilterGraph2_ConnectDirect
,
1721 FilterGraph2_Reconnect
,
1722 FilterGraph2_Disconnect
,
1723 FilterGraph2_SetDefaultSyncSource
,
1724 FilterGraph2_Connect
,
1725 FilterGraph2_Render
,
1726 FilterGraph2_RenderFile
,
1727 FilterGraph2_AddSourceFilter
,
1728 FilterGraph2_SetLogFile
,
1730 FilterGraph2_ShouldOperationContinue
,
1731 FilterGraph2_AddSourceFilterForMoniker
,
1732 FilterGraph2_ReconnectEx
,
1733 FilterGraph2_RenderEx
1736 static inline IFilterGraphImpl
*impl_from_IMediaControl(IMediaControl
*iface
)
1738 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaControl_iface
);
1741 static HRESULT WINAPI
MediaControl_QueryInterface(IMediaControl
*iface
, REFIID riid
, void **ppvObj
)
1743 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1745 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1747 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
1750 static ULONG WINAPI
MediaControl_AddRef(IMediaControl
*iface
)
1752 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1754 TRACE("(%p/%p)->()\n", This
, iface
);
1756 return Filtergraph_AddRef(This
);
1759 static ULONG WINAPI
MediaControl_Release(IMediaControl
*iface
)
1761 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1763 TRACE("(%p/%p)->()\n", This
, iface
);
1765 return Filtergraph_Release(This
);
1769 /*** IDispatch methods ***/
1770 static HRESULT WINAPI
MediaControl_GetTypeInfoCount(IMediaControl
*iface
, UINT
*pctinfo
)
1772 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1774 TRACE("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1779 static HRESULT WINAPI
MediaControl_GetTypeInfo(IMediaControl
*iface
, UINT iTInfo
, LCID lcid
,
1780 ITypeInfo
**ppTInfo
)
1782 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1784 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1789 static HRESULT WINAPI
MediaControl_GetIDsOfNames(IMediaControl
*iface
, REFIID riid
,
1790 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1792 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1794 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1799 static HRESULT WINAPI
MediaControl_Invoke(IMediaControl
*iface
, DISPID dispIdMember
, REFIID riid
,
1800 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
1803 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1805 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
1810 typedef HRESULT(WINAPI
*fnFoundFilter
)(IBaseFilter
*, DWORD_PTR data
);
1812 static HRESULT
ExploreGraph(IFilterGraphImpl
* pGraph
, IPin
* pOutputPin
, fnFoundFilter FoundFilter
, DWORD_PTR data
)
1821 TRACE("%p %p\n", pGraph
, pOutputPin
);
1822 PinInfo
.pFilter
= NULL
;
1824 hr
= IPin_ConnectedTo(pOutputPin
, &pInputPin
);
1828 hr
= IPin_QueryPinInfo(pInputPin
, &PinInfo
);
1830 hr
= GetInternalConnections(PinInfo
.pFilter
, pInputPin
, &ppPins
, &nb
);
1831 IPin_Release(pInputPin
);
1838 TRACE("Reached a renderer\n");
1839 /* Count renderers for end of stream notification */
1840 pGraph
->nRenderers
++;
1844 for(i
= 0; i
< nb
; i
++)
1846 /* Explore the graph downstream from this pin
1847 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1848 * several input pins are connected to the same output (a MUX for instance). */
1849 ExploreGraph(pGraph
, ppPins
[i
], FoundFilter
, data
);
1850 IPin_Release(ppPins
[i
]);
1853 CoTaskMemFree(ppPins
);
1855 TRACE("Doing stuff with filter %p\n", PinInfo
.pFilter
);
1857 FoundFilter(PinInfo
.pFilter
, data
);
1860 if (PinInfo
.pFilter
) IBaseFilter_Release(PinInfo
.pFilter
);
1864 static HRESULT WINAPI
SendRun(IBaseFilter
*pFilter
, DWORD_PTR data
)
1866 REFERENCE_TIME time
= *(REFERENCE_TIME
*)data
;
1867 return IBaseFilter_Run(pFilter
, time
);
1870 static HRESULT WINAPI
SendPause(IBaseFilter
*pFilter
, DWORD_PTR data
)
1872 return IBaseFilter_Pause(pFilter
);
1875 static HRESULT WINAPI
SendStop(IBaseFilter
*pFilter
, DWORD_PTR data
)
1877 return IBaseFilter_Stop(pFilter
);
1880 static HRESULT WINAPI
SendGetState(IBaseFilter
*pFilter
, DWORD_PTR data
)
1883 DWORD time_end
= data
;
1884 DWORD time_now
= GetTickCount();
1887 if (time_end
== INFINITE
)
1891 else if (time_end
> time_now
)
1893 wait
= time_end
- time_now
;
1898 return IBaseFilter_GetState(pFilter
, wait
, &state
);
1902 static HRESULT
SendFilterMessage(IFilterGraphImpl
*This
, fnFoundFilter FoundFilter
, DWORD_PTR data
)
1905 IBaseFilter
* pfilter
;
1912 TRACE("(%p)->()\n", This
);
1914 /* Explorer the graph from source filters to renderers, determine renderers
1915 * number and run filters from renderers to source filters */
1916 This
->nRenderers
= 0;
1917 ResetEvent(This
->hEventCompletion
);
1919 for(i
= 0; i
< This
->nFilters
; i
++)
1922 pfilter
= This
->ppFiltersInGraph
[i
];
1923 hr
= IBaseFilter_EnumPins(pfilter
, &pEnum
);
1926 WARN("Enum pins failed %x\n", hr
);
1929 /* Check if it is a source filter */
1930 while(IEnumPins_Next(pEnum
, 1, &pPin
, &dummy
) == S_OK
)
1932 IPin_QueryDirection(pPin
, &dir
);
1934 if (dir
== PINDIR_INPUT
)
1942 TRACE("Found a source filter %p\n", pfilter
);
1943 IEnumPins_Reset(pEnum
);
1944 while(IEnumPins_Next(pEnum
, 1, &pPin
, &dummy
) == S_OK
)
1946 /* Explore the graph downstream from this pin */
1947 ExploreGraph(This
, pPin
, FoundFilter
, data
);
1950 FoundFilter(pfilter
, data
);
1952 IEnumPins_Release(pEnum
);
1958 /*** IMediaControl methods ***/
1959 static HRESULT WINAPI
MediaControl_Run(IMediaControl
*iface
)
1961 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1963 TRACE("(%p/%p)->()\n", This
, iface
);
1965 EnterCriticalSection(&This
->cs
);
1966 if (This
->state
== State_Running
)
1968 This
->EcCompleteCount
= 0;
1970 if (This
->defaultclock
&& !This
->refClock
)
1971 IFilterGraph2_SetDefaultSyncSource((IFilterGraph2
*)This
);
1976 IReferenceClock_GetTime(This
->refClock
, &now
);
1977 if (This
->state
== State_Stopped
)
1978 This
->start_time
= now
+ 500000;
1979 else if (This
->pause_time
>= 0)
1980 This
->start_time
+= now
- This
->pause_time
;
1982 This
->start_time
= now
;
1984 else This
->start_time
= 0;
1986 SendFilterMessage(This
, SendRun
, (DWORD_PTR
)&This
->start_time
);
1987 This
->state
= State_Running
;
1989 LeaveCriticalSection(&This
->cs
);
1993 static HRESULT WINAPI
MediaControl_Pause(IMediaControl
*iface
)
1995 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
1997 TRACE("(%p/%p)->()\n", This
, iface
);
1999 EnterCriticalSection(&This
->cs
);
2000 if (This
->state
== State_Paused
)
2003 if (This
->state
== State_Running
&& This
->refClock
&& This
->start_time
>= 0)
2004 IReferenceClock_GetTime(This
->refClock
, &This
->pause_time
);
2006 This
->pause_time
= -1;
2008 SendFilterMessage(This
, SendPause
, 0);
2009 This
->state
= State_Paused
;
2011 LeaveCriticalSection(&This
->cs
);
2015 static HRESULT WINAPI
MediaControl_Stop(IMediaControl
*iface
)
2017 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2019 TRACE("(%p/%p)->()\n", This
, iface
);
2021 if (This
->state
== State_Stopped
) return S_OK
;
2023 EnterCriticalSection(&This
->cs
);
2024 if (This
->state
== State_Running
) SendFilterMessage(This
, SendPause
, 0);
2025 SendFilterMessage(This
, SendStop
, 0);
2026 This
->state
= State_Stopped
;
2027 LeaveCriticalSection(&This
->cs
);
2031 static HRESULT WINAPI
MediaControl_GetState(IMediaControl
*iface
, LONG msTimeout
,
2034 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2037 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, msTimeout
, pfs
);
2042 EnterCriticalSection(&This
->cs
);
2047 end
= GetTickCount() + msTimeout
;
2049 else if (msTimeout
< 0)
2058 SendFilterMessage(This
, SendGetState
, end
);
2060 LeaveCriticalSection(&This
->cs
);
2065 static HRESULT WINAPI
MediaControl_RenderFile(IMediaControl
*iface
, BSTR strFilename
)
2067 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2069 FIXME("(%p/%p)->(%s (%p)): stub !!!\n", This
, iface
, debugstr_w(strFilename
), strFilename
);
2074 static HRESULT WINAPI
MediaControl_AddSourceFilter(IMediaControl
*iface
, BSTR strFilename
,
2077 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2079 FIXME("(%p/%p)->(%s (%p), %p): stub !!!\n", This
, iface
, debugstr_w(strFilename
), strFilename
, ppUnk
);
2084 static HRESULT WINAPI
MediaControl_get_FilterCollection(IMediaControl
*iface
, IDispatch
**ppUnk
)
2086 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2088 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, ppUnk
);
2093 static HRESULT WINAPI
MediaControl_get_RegFilterCollection(IMediaControl
*iface
, IDispatch
**ppUnk
)
2095 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2097 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, ppUnk
);
2102 static HRESULT WINAPI
MediaControl_StopWhenReady(IMediaControl
*iface
)
2104 IFilterGraphImpl
*This
= impl_from_IMediaControl(iface
);
2106 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
2112 static const IMediaControlVtbl IMediaControl_VTable
=
2114 MediaControl_QueryInterface
,
2115 MediaControl_AddRef
,
2116 MediaControl_Release
,
2117 MediaControl_GetTypeInfoCount
,
2118 MediaControl_GetTypeInfo
,
2119 MediaControl_GetIDsOfNames
,
2120 MediaControl_Invoke
,
2124 MediaControl_GetState
,
2125 MediaControl_RenderFile
,
2126 MediaControl_AddSourceFilter
,
2127 MediaControl_get_FilterCollection
,
2128 MediaControl_get_RegFilterCollection
,
2129 MediaControl_StopWhenReady
2132 static inline IFilterGraphImpl
*impl_from_IMediaSeeking(IMediaSeeking
*iface
)
2134 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaSeeking_iface
);
2137 static HRESULT WINAPI
MediaSeeking_QueryInterface(IMediaSeeking
*iface
, REFIID riid
, void **ppvObj
)
2139 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2141 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2143 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2146 static ULONG WINAPI
MediaSeeking_AddRef(IMediaSeeking
*iface
)
2148 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2150 TRACE("(%p/%p)->()\n", This
, iface
);
2152 return Filtergraph_AddRef(This
);
2155 static ULONG WINAPI
MediaSeeking_Release(IMediaSeeking
*iface
)
2157 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2159 TRACE("(%p/%p)->()\n", This
, iface
);
2161 return Filtergraph_Release(This
);
2164 typedef HRESULT (WINAPI
*fnFoundSeek
)(IFilterGraphImpl
*This
, IMediaSeeking
*, DWORD_PTR arg
);
2166 static HRESULT
all_renderers_seek(IFilterGraphImpl
*This
, fnFoundSeek FoundSeek
, DWORD_PTR arg
) {
2167 BOOL allnotimpl
= TRUE
;
2169 HRESULT hr
, hr_return
= S_OK
;
2171 TRACE("(%p)->(%p %08lx)\n", This
, FoundSeek
, arg
);
2172 /* Send a message to all renderers, they are responsible for broadcasting it further */
2174 for(i
= 0; i
< This
->nFilters
; i
++)
2176 IMediaSeeking
*seek
= NULL
;
2177 IBaseFilter
* pfilter
= This
->ppFiltersInGraph
[i
];
2178 IAMFilterMiscFlags
*flags
= NULL
;
2180 IUnknown_QueryInterface(pfilter
, &IID_IAMFilterMiscFlags
, (void**)&flags
);
2183 filterflags
= IAMFilterMiscFlags_GetMiscFlags(flags
);
2184 IUnknown_Release(flags
);
2185 if (filterflags
!= AM_FILTER_MISC_FLAGS_IS_RENDERER
)
2188 IBaseFilter_QueryInterface(pfilter
, &IID_IMediaSeeking
, (void**)&seek
);
2191 hr
= FoundSeek(This
, seek
, arg
);
2192 IMediaSeeking_Release(seek
);
2193 if (hr_return
!= E_NOTIMPL
)
2195 if (hr_return
== S_OK
|| (FAILED(hr
) && hr
!= E_NOTIMPL
&& SUCCEEDED(hr_return
)))
2204 static HRESULT WINAPI
FoundCapabilities(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pcaps
)
2209 hr
= IMediaSeeking_GetCapabilities(seek
, &caps
);
2213 /* Only add common capabilities everything supports */
2214 *(DWORD
*)pcaps
&= caps
;
2219 /*** IMediaSeeking methods ***/
2220 static HRESULT WINAPI
MediaSeeking_GetCapabilities(IMediaSeeking
*iface
, DWORD
*pCapabilities
)
2222 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2225 TRACE("(%p/%p)->(%p)\n", This
, iface
, pCapabilities
);
2230 EnterCriticalSection(&This
->cs
);
2231 *pCapabilities
= 0xffffffff;
2233 hr
= all_renderers_seek(This
, FoundCapabilities
, (DWORD_PTR
)pCapabilities
);
2234 LeaveCriticalSection(&This
->cs
);
2239 static HRESULT WINAPI
MediaSeeking_CheckCapabilities(IMediaSeeking
*iface
, DWORD
*pCapabilities
)
2241 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2245 TRACE("(%p/%p)->(%p)\n", This
, iface
, pCapabilities
);
2250 EnterCriticalSection(&This
->cs
);
2251 originalcaps
= *pCapabilities
;
2252 hr
= all_renderers_seek(This
, FoundCapabilities
, (DWORD_PTR
)pCapabilities
);
2253 LeaveCriticalSection(&This
->cs
);
2258 if (!*pCapabilities
)
2260 if (*pCapabilities
!= originalcaps
)
2265 static HRESULT WINAPI
MediaSeeking_IsFormatSupported(IMediaSeeking
*iface
, const GUID
*pFormat
)
2267 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2272 TRACE("(%p/%p)->(%s)\n", This
, iface
, debugstr_guid(pFormat
));
2274 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, pFormat
))
2276 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat
));
2283 static HRESULT WINAPI
MediaSeeking_QueryPreferredFormat(IMediaSeeking
*iface
, GUID
*pFormat
)
2285 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2290 FIXME("(%p/%p)->(%p): semi-stub !!!\n", This
, iface
, pFormat
);
2291 memcpy(pFormat
, &TIME_FORMAT_MEDIA_TIME
, sizeof(GUID
));
2296 static HRESULT WINAPI
MediaSeeking_GetTimeFormat(IMediaSeeking
*iface
, GUID
*pFormat
)
2298 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2303 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFormat
);
2304 memcpy(pFormat
, &This
->timeformatseek
, sizeof(GUID
));
2309 static HRESULT WINAPI
MediaSeeking_IsUsingTimeFormat(IMediaSeeking
*iface
, const GUID
*pFormat
)
2311 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2313 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFormat
);
2317 if (memcmp(pFormat
, &This
->timeformatseek
, sizeof(GUID
)))
2323 static HRESULT WINAPI
MediaSeeking_SetTimeFormat(IMediaSeeking
*iface
, const GUID
*pFormat
)
2325 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2330 TRACE("(%p/%p)->(%s)\n", This
, iface
, debugstr_guid(pFormat
));
2332 if (This
->state
!= State_Stopped
)
2333 return VFW_E_WRONG_STATE
;
2335 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, pFormat
))
2337 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat
));
2338 return E_INVALIDARG
;
2344 static HRESULT WINAPI
FoundDuration(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pduration
)
2347 LONGLONG duration
= 0, *pdur
= (LONGLONG
*)pduration
;
2349 hr
= IMediaSeeking_GetDuration(seek
, &duration
);
2353 if (*pdur
< duration
)
2358 static HRESULT WINAPI
MediaSeeking_GetDuration(IMediaSeeking
*iface
, LONGLONG
*pDuration
)
2360 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2363 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDuration
);
2368 EnterCriticalSection(&This
->cs
);
2370 hr
= all_renderers_seek(This
, FoundDuration
, (DWORD_PTR
)pDuration
);
2371 LeaveCriticalSection(&This
->cs
);
2373 TRACE("--->%08x\n", hr
);
2377 static HRESULT WINAPI
MediaSeeking_GetStopPosition(IMediaSeeking
*iface
, LONGLONG
*pStop
)
2379 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2382 TRACE("(%p/%p)->(%p)\n", This
, iface
, pStop
);
2387 EnterCriticalSection(&This
->cs
);
2388 if (This
->stop_position
< 0)
2389 /* Stop position not set, use duration instead */
2390 hr
= IMediaSeeking_GetDuration(iface
, pStop
);
2392 *pStop
= This
->stop_position
;
2393 LeaveCriticalSection(&This
->cs
);
2398 static HRESULT WINAPI
FoundCurrentPosition(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pposition
)
2401 LONGLONG pos
= 0, *ppos
= (LONGLONG
*)pposition
;
2403 hr
= IMediaSeeking_GetCurrentPosition(seek
, &pos
);
2407 if (*ppos
< 0 || pos
< *ppos
)
2412 static HRESULT WINAPI
MediaSeeking_GetCurrentPosition(IMediaSeeking
*iface
, LONGLONG
*pCurrent
)
2414 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2420 EnterCriticalSection(&This
->cs
);
2422 hr
= all_renderers_seek(This
, FoundCurrentPosition
, (DWORD_PTR
)pCurrent
);
2423 if (hr
== E_NOTIMPL
) {
2427 LeaveCriticalSection(&This
->cs
);
2429 TRACE("Time: %u.%03u\n", (DWORD
)(*pCurrent
/ 10000000), (DWORD
)((*pCurrent
/ 10000)%1000));
2434 static HRESULT WINAPI
MediaSeeking_ConvertTimeFormat(IMediaSeeking
*iface
, LONGLONG
*pTarget
,
2435 const GUID
*pTargetFormat
, LONGLONG Source
, const GUID
*pSourceFormat
)
2437 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2439 FIXME("(%p/%p)->(%p, %p, 0x%s, %p): stub !!!\n", This
, iface
, pTarget
,
2440 pTargetFormat
, wine_dbgstr_longlong(Source
), pSourceFormat
);
2446 LONGLONG
* current
, *stop
;
2447 DWORD curflags
, stopflags
;
2450 static HRESULT WINAPI
found_setposition(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pargs
)
2452 struct pos_args
*args
= (void*)pargs
;
2454 return IMediaSeeking_SetPositions(seek
, args
->current
, args
->curflags
, args
->stop
, args
->stopflags
);
2457 static HRESULT WINAPI
MediaSeeking_SetPositions(IMediaSeeking
*iface
, LONGLONG
*pCurrent
,
2458 DWORD dwCurrentFlags
, LONGLONG
*pStop
, DWORD dwStopFlags
)
2460 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2463 struct pos_args args
;
2465 TRACE("(%p/%p)->(%p, %08x, %p, %08x)\n", This
, iface
, pCurrent
, dwCurrentFlags
, pStop
, dwStopFlags
);
2467 EnterCriticalSection(&This
->cs
);
2468 state
= This
->state
;
2469 TRACE("State: %s\n", state
== State_Running
? "Running" : (state
== State_Paused
? "Paused" : (state
== State_Stopped
? "Stopped" : "UNKNOWN")));
2471 if ((dwCurrentFlags
& 0x7) != AM_SEEKING_AbsolutePositioning
&&
2472 (dwCurrentFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2473 FIXME("Adjust method %x not handled yet!\n", dwCurrentFlags
& 0x7);
2475 if ((dwStopFlags
& 0x7) == AM_SEEKING_AbsolutePositioning
)
2476 This
->stop_position
= *pStop
;
2477 else if ((dwStopFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2478 FIXME("Stop position not handled yet!\n");
2480 if (state
== State_Running
&& !(dwCurrentFlags
& AM_SEEKING_NoFlush
))
2481 IMediaControl_Pause(&This
->IMediaControl_iface
);
2482 args
.current
= pCurrent
;
2484 args
.curflags
= dwCurrentFlags
;
2485 args
.stopflags
= dwStopFlags
;
2486 hr
= all_renderers_seek(This
, found_setposition
, (DWORD_PTR
)&args
);
2488 if ((dwCurrentFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2489 This
->pause_time
= This
->start_time
= -1;
2490 if (state
== State_Running
&& !(dwCurrentFlags
& AM_SEEKING_NoFlush
))
2491 IMediaControl_Run(&This
->IMediaControl_iface
);
2492 LeaveCriticalSection(&This
->cs
);
2497 static HRESULT WINAPI
MediaSeeking_GetPositions(IMediaSeeking
*iface
, LONGLONG
*pCurrent
,
2500 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2503 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pCurrent
, pStop
);
2504 hr
= IMediaSeeking_GetCurrentPosition(iface
, pCurrent
);
2506 hr
= IMediaSeeking_GetStopPosition(iface
, pStop
);
2511 static HRESULT WINAPI
MediaSeeking_GetAvailable(IMediaSeeking
*iface
, LONGLONG
*pEarliest
,
2514 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2516 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This
, iface
, pEarliest
, pLatest
);
2521 static HRESULT WINAPI
MediaSeeking_SetRate(IMediaSeeking
*iface
, double dRate
)
2523 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2525 FIXME("(%p/%p)->(%f): stub !!!\n", This
, iface
, dRate
);
2530 static HRESULT WINAPI
MediaSeeking_GetRate(IMediaSeeking
*iface
, double *pdRate
)
2532 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2534 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pdRate
);
2539 static HRESULT WINAPI
MediaSeeking_GetPreroll(IMediaSeeking
*iface
, LONGLONG
*pllPreroll
)
2541 IFilterGraphImpl
*This
= impl_from_IMediaSeeking(iface
);
2543 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pllPreroll
);
2549 static const IMediaSeekingVtbl IMediaSeeking_VTable
=
2551 MediaSeeking_QueryInterface
,
2552 MediaSeeking_AddRef
,
2553 MediaSeeking_Release
,
2554 MediaSeeking_GetCapabilities
,
2555 MediaSeeking_CheckCapabilities
,
2556 MediaSeeking_IsFormatSupported
,
2557 MediaSeeking_QueryPreferredFormat
,
2558 MediaSeeking_GetTimeFormat
,
2559 MediaSeeking_IsUsingTimeFormat
,
2560 MediaSeeking_SetTimeFormat
,
2561 MediaSeeking_GetDuration
,
2562 MediaSeeking_GetStopPosition
,
2563 MediaSeeking_GetCurrentPosition
,
2564 MediaSeeking_ConvertTimeFormat
,
2565 MediaSeeking_SetPositions
,
2566 MediaSeeking_GetPositions
,
2567 MediaSeeking_GetAvailable
,
2568 MediaSeeking_SetRate
,
2569 MediaSeeking_GetRate
,
2570 MediaSeeking_GetPreroll
2573 static inline IFilterGraphImpl
*impl_from_IMediaPosition(IMediaPosition
*iface
)
2575 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaPosition_iface
);
2578 /*** IUnknown methods ***/
2579 static HRESULT WINAPI
MediaPosition_QueryInterface(IMediaPosition
* iface
, REFIID riid
, void** ppvObj
)
2581 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2583 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2584 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2587 static ULONG WINAPI
MediaPosition_AddRef(IMediaPosition
*iface
)
2589 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2591 TRACE("(%p/%p)->()\n", This
, iface
);
2592 return Filtergraph_AddRef(This
);
2595 static ULONG WINAPI
MediaPosition_Release(IMediaPosition
*iface
)
2597 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2599 TRACE("(%p/%p)->()\n", This
, iface
);
2600 return Filtergraph_Release(This
);
2603 /*** IDispatch methods ***/
2604 static HRESULT WINAPI
MediaPosition_GetTypeInfoCount(IMediaPosition
*iface
, UINT
* pctinfo
){
2605 FIXME("(%p) stub!\n", iface
);
2609 static HRESULT WINAPI
MediaPosition_GetTypeInfo(IMediaPosition
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
** ppTInfo
){
2610 FIXME("(%p) stub!\n", iface
);
2614 static HRESULT WINAPI
MediaPosition_GetIDsOfNames(IMediaPosition
* iface
, REFIID riid
, LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
){
2615 FIXME("(%p) stub!\n", iface
);
2619 static HRESULT WINAPI
MediaPosition_Invoke(IMediaPosition
* iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
, VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
){
2620 FIXME("(%p) stub!\n", iface
);
2624 /*** IMediaPosition methods ***/
2625 static HRESULT WINAPI
MediaPosition_get_Duration(IMediaPosition
* iface
, REFTIME
*plength
)
2628 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2629 HRESULT hr
= IMediaSeeking_GetDuration(&This
->IMediaSeeking_iface
, &duration
);
2630 if (SUCCEEDED(hr
)) *plength
= duration
;
2634 static HRESULT WINAPI
MediaPosition_put_CurrentPosition(IMediaPosition
* iface
, REFTIME llTime
)
2636 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2637 LONGLONG reftime
= llTime
;
2639 return IMediaSeeking_SetPositions(&This
->IMediaSeeking_iface
, &reftime
,
2640 AM_SEEKING_AbsolutePositioning
, NULL
, AM_SEEKING_NoPositioning
);
2643 static HRESULT WINAPI
MediaPosition_get_CurrentPosition(IMediaPosition
* iface
, REFTIME
*pllTime
)
2645 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2647 HRESULT hr
= IMediaSeeking_GetCurrentPosition(&This
->IMediaSeeking_iface
, &pos
);
2648 if (SUCCEEDED(hr
)) *pllTime
= pos
;
2652 static HRESULT WINAPI
MediaPosition_get_StopTime(IMediaPosition
* iface
, REFTIME
*pllTime
)
2654 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2656 HRESULT hr
= IMediaSeeking_GetStopPosition(&This
->IMediaSeeking_iface
, &pos
);
2657 if (SUCCEEDED(hr
)) *pllTime
= pos
;
2661 static HRESULT WINAPI
MediaPosition_put_StopTime(IMediaPosition
* iface
, REFTIME llTime
)
2663 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2664 LONGLONG reftime
= llTime
;
2666 return IMediaSeeking_SetPositions(&This
->IMediaSeeking_iface
, NULL
, AM_SEEKING_NoPositioning
,
2667 &reftime
, AM_SEEKING_AbsolutePositioning
);
2670 static HRESULT WINAPI
MediaPosition_get_PrerollTime(IMediaPosition
* iface
, REFTIME
*pllTime
){
2671 FIXME("(%p)->(%p) stub!\n", iface
, pllTime
);
2675 static HRESULT WINAPI
MediaPosition_put_PrerollTime(IMediaPosition
* iface
, REFTIME llTime
){
2676 FIXME("(%p)->(%f) stub!\n", iface
, llTime
);
2680 static HRESULT WINAPI
MediaPosition_put_Rate(IMediaPosition
* iface
, double dRate
)
2682 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2683 return IMediaSeeking_SetRate(&This
->IMediaSeeking_iface
, dRate
);
2686 static HRESULT WINAPI
MediaPosition_get_Rate(IMediaPosition
* iface
, double *pdRate
)
2688 IFilterGraphImpl
*This
= impl_from_IMediaPosition( iface
);
2689 return IMediaSeeking_GetRate(&This
->IMediaSeeking_iface
, pdRate
);
2692 static HRESULT WINAPI
MediaPosition_CanSeekForward(IMediaPosition
* iface
, LONG
*pCanSeekForward
){
2693 FIXME("(%p)->(%p) stub!\n", iface
, pCanSeekForward
);
2697 static HRESULT WINAPI
MediaPosition_CanSeekBackward(IMediaPosition
* iface
, LONG
*pCanSeekBackward
){
2698 FIXME("(%p)->(%p) stub!\n", iface
, pCanSeekBackward
);
2703 static const IMediaPositionVtbl IMediaPosition_VTable
=
2705 MediaPosition_QueryInterface
,
2706 MediaPosition_AddRef
,
2707 MediaPosition_Release
,
2708 MediaPosition_GetTypeInfoCount
,
2709 MediaPosition_GetTypeInfo
,
2710 MediaPosition_GetIDsOfNames
,
2711 MediaPosition_Invoke
,
2712 MediaPosition_get_Duration
,
2713 MediaPosition_put_CurrentPosition
,
2714 MediaPosition_get_CurrentPosition
,
2715 MediaPosition_get_StopTime
,
2716 MediaPosition_put_StopTime
,
2717 MediaPosition_get_PrerollTime
,
2718 MediaPosition_put_PrerollTime
,
2719 MediaPosition_put_Rate
,
2720 MediaPosition_get_Rate
,
2721 MediaPosition_CanSeekForward
,
2722 MediaPosition_CanSeekBackward
2725 static HRESULT
GetTargetInterface(IFilterGraphImpl
* pGraph
, REFIID riid
, LPVOID
* ppvObj
)
2727 HRESULT hr
= E_NOINTERFACE
;
2731 /* Check if the interface type is already registered */
2732 for (entry
= 0; entry
< pGraph
->nItfCacheEntries
; entry
++)
2733 if (riid
== pGraph
->ItfCacheEntries
[entry
].riid
)
2735 if (pGraph
->ItfCacheEntries
[entry
].iface
)
2737 /* Return the interface if available */
2738 *ppvObj
= pGraph
->ItfCacheEntries
[entry
].iface
;
2744 if (entry
>= MAX_ITF_CACHE_ENTRIES
)
2746 FIXME("Not enough space to store interface in the cache\n");
2747 return E_OUTOFMEMORY
;
2750 /* Find a filter supporting the requested interface */
2751 for (i
= 0; i
< pGraph
->nFilters
; i
++)
2753 hr
= IBaseFilter_QueryInterface(pGraph
->ppFiltersInGraph
[i
], riid
, ppvObj
);
2756 pGraph
->ItfCacheEntries
[entry
].riid
= riid
;
2757 pGraph
->ItfCacheEntries
[entry
].filter
= pGraph
->ppFiltersInGraph
[i
];
2758 pGraph
->ItfCacheEntries
[entry
].iface
= *ppvObj
;
2759 if (entry
>= pGraph
->nItfCacheEntries
)
2760 pGraph
->nItfCacheEntries
++;
2763 if (hr
!= E_NOINTERFACE
)
2770 static inline IFilterGraphImpl
*impl_from_IBasicAudio(IBasicAudio
*iface
)
2772 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IBasicAudio_iface
);
2775 static HRESULT WINAPI
BasicAudio_QueryInterface(IBasicAudio
*iface
, REFIID riid
, void **ppvObj
)
2777 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2779 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2781 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2784 static ULONG WINAPI
BasicAudio_AddRef(IBasicAudio
*iface
)
2786 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2788 TRACE("(%p/%p)->()\n", This
, iface
);
2790 return Filtergraph_AddRef(This
);
2793 static ULONG WINAPI
BasicAudio_Release(IBasicAudio
*iface
)
2795 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2797 TRACE("(%p/%p)->()\n", This
, iface
);
2799 return Filtergraph_Release(This
);
2802 /*** IDispatch methods ***/
2803 static HRESULT WINAPI
BasicAudio_GetTypeInfoCount(IBasicAudio
*iface
, UINT
*pctinfo
)
2805 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2806 IBasicAudio
* pBasicAudio
;
2809 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
2811 EnterCriticalSection(&This
->cs
);
2813 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2816 hr
= IBasicAudio_GetTypeInfoCount(pBasicAudio
, pctinfo
);
2818 LeaveCriticalSection(&This
->cs
);
2823 static HRESULT WINAPI
BasicAudio_GetTypeInfo(IBasicAudio
*iface
, UINT iTInfo
, LCID lcid
,
2824 ITypeInfo
**ppTInfo
)
2826 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2827 IBasicAudio
* pBasicAudio
;
2830 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
2832 EnterCriticalSection(&This
->cs
);
2834 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2837 hr
= IBasicAudio_GetTypeInfo(pBasicAudio
, iTInfo
, lcid
, ppTInfo
);
2839 LeaveCriticalSection(&This
->cs
);
2844 static HRESULT WINAPI
BasicAudio_GetIDsOfNames(IBasicAudio
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
2845 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2847 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2848 IBasicAudio
* pBasicAudio
;
2851 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2853 EnterCriticalSection(&This
->cs
);
2855 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2858 hr
= IBasicAudio_GetIDsOfNames(pBasicAudio
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2860 LeaveCriticalSection(&This
->cs
);
2865 static HRESULT WINAPI
BasicAudio_Invoke(IBasicAudio
*iface
, DISPID dispIdMember
, REFIID riid
,
2866 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
2869 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2870 IBasicAudio
* pBasicAudio
;
2873 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
);
2875 EnterCriticalSection(&This
->cs
);
2877 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2880 hr
= IBasicAudio_Invoke(pBasicAudio
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
2882 LeaveCriticalSection(&This
->cs
);
2887 /*** IBasicAudio methods ***/
2888 static HRESULT WINAPI
BasicAudio_put_Volume(IBasicAudio
*iface
, LONG lVolume
)
2890 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2891 IBasicAudio
* pBasicAudio
;
2894 TRACE("(%p/%p)->(%d)\n", This
, iface
, lVolume
);
2896 EnterCriticalSection(&This
->cs
);
2898 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2901 hr
= IBasicAudio_put_Volume(pBasicAudio
, lVolume
);
2903 LeaveCriticalSection(&This
->cs
);
2908 static HRESULT WINAPI
BasicAudio_get_Volume(IBasicAudio
*iface
, LONG
*plVolume
)
2910 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2911 IBasicAudio
* pBasicAudio
;
2914 TRACE("(%p/%p)->(%p)\n", This
, iface
, plVolume
);
2916 EnterCriticalSection(&This
->cs
);
2918 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2921 hr
= IBasicAudio_get_Volume(pBasicAudio
, plVolume
);
2923 LeaveCriticalSection(&This
->cs
);
2928 static HRESULT WINAPI
BasicAudio_put_Balance(IBasicAudio
*iface
, LONG lBalance
)
2930 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2931 IBasicAudio
* pBasicAudio
;
2934 TRACE("(%p/%p)->(%d)\n", This
, iface
, lBalance
);
2936 EnterCriticalSection(&This
->cs
);
2938 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2941 hr
= IBasicAudio_put_Balance(pBasicAudio
, lBalance
);
2943 LeaveCriticalSection(&This
->cs
);
2948 static HRESULT WINAPI
BasicAudio_get_Balance(IBasicAudio
*iface
, LONG
*plBalance
)
2950 IFilterGraphImpl
*This
= impl_from_IBasicAudio(iface
);
2951 IBasicAudio
* pBasicAudio
;
2954 TRACE("(%p/%p)->(%p)\n", This
, iface
, plBalance
);
2956 EnterCriticalSection(&This
->cs
);
2958 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2961 hr
= IBasicAudio_get_Balance(pBasicAudio
, plBalance
);
2963 LeaveCriticalSection(&This
->cs
);
2968 static const IBasicAudioVtbl IBasicAudio_VTable
=
2970 BasicAudio_QueryInterface
,
2973 BasicAudio_GetTypeInfoCount
,
2974 BasicAudio_GetTypeInfo
,
2975 BasicAudio_GetIDsOfNames
,
2977 BasicAudio_put_Volume
,
2978 BasicAudio_get_Volume
,
2979 BasicAudio_put_Balance
,
2980 BasicAudio_get_Balance
2983 static inline IFilterGraphImpl
*impl_from_IBasicVideo2(IBasicVideo2
*iface
)
2985 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IBasicVideo2_iface
);
2988 static HRESULT WINAPI
BasicVideo_QueryInterface(IBasicVideo2
*iface
, REFIID riid
, void **ppvObj
)
2990 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
2992 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2994 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2997 static ULONG WINAPI
BasicVideo_AddRef(IBasicVideo2
*iface
)
2999 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3001 TRACE("(%p/%p)->()\n", This
, iface
);
3003 return Filtergraph_AddRef(This
);
3006 static ULONG WINAPI
BasicVideo_Release(IBasicVideo2
*iface
)
3008 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3010 TRACE("(%p/%p)->()\n", This
, iface
);
3012 return Filtergraph_Release(This
);
3015 /*** IDispatch methods ***/
3016 static HRESULT WINAPI
BasicVideo_GetTypeInfoCount(IBasicVideo2
*iface
, UINT
*pctinfo
)
3018 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3019 IBasicVideo
*pBasicVideo
;
3022 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
3024 EnterCriticalSection(&This
->cs
);
3026 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3029 hr
= IBasicVideo_GetTypeInfoCount(pBasicVideo
, pctinfo
);
3031 LeaveCriticalSection(&This
->cs
);
3036 static HRESULT WINAPI
BasicVideo_GetTypeInfo(IBasicVideo2
*iface
, UINT iTInfo
, LCID lcid
,
3037 ITypeInfo
**ppTInfo
)
3039 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3040 IBasicVideo
*pBasicVideo
;
3043 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
3045 EnterCriticalSection(&This
->cs
);
3047 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3050 hr
= IBasicVideo_GetTypeInfo(pBasicVideo
, iTInfo
, lcid
, ppTInfo
);
3052 LeaveCriticalSection(&This
->cs
);
3057 static HRESULT WINAPI
BasicVideo_GetIDsOfNames(IBasicVideo2
*iface
, REFIID riid
,
3058 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3060 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3061 IBasicVideo
*pBasicVideo
;
3064 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3066 EnterCriticalSection(&This
->cs
);
3068 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3071 hr
= IBasicVideo_GetIDsOfNames(pBasicVideo
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3073 LeaveCriticalSection(&This
->cs
);
3078 static HRESULT WINAPI
BasicVideo_Invoke(IBasicVideo2
*iface
, DISPID dispIdMember
, REFIID riid
,
3079 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
3082 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3083 IBasicVideo
*pBasicVideo
;
3086 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
);
3088 EnterCriticalSection(&This
->cs
);
3090 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3093 hr
= IBasicVideo_Invoke(pBasicVideo
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
3095 LeaveCriticalSection(&This
->cs
);
3100 /*** IBasicVideo methods ***/
3101 static HRESULT WINAPI
BasicVideo_get_AvgTimePerFrame(IBasicVideo2
*iface
, REFTIME
*pAvgTimePerFrame
)
3103 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3104 IBasicVideo
*pBasicVideo
;
3107 TRACE("(%p/%p)->(%p)\n", This
, iface
, pAvgTimePerFrame
);
3109 EnterCriticalSection(&This
->cs
);
3111 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3114 hr
= IBasicVideo_get_AvgTimePerFrame(pBasicVideo
, pAvgTimePerFrame
);
3116 LeaveCriticalSection(&This
->cs
);
3121 static HRESULT WINAPI
BasicVideo_get_BitRate(IBasicVideo2
*iface
, LONG
*pBitRate
)
3123 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3124 IBasicVideo
*pBasicVideo
;
3127 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBitRate
);
3129 EnterCriticalSection(&This
->cs
);
3131 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3134 hr
= IBasicVideo_get_BitRate(pBasicVideo
, pBitRate
);
3136 LeaveCriticalSection(&This
->cs
);
3141 static HRESULT WINAPI
BasicVideo_get_BitErrorRate(IBasicVideo2
*iface
, LONG
*pBitErrorRate
)
3143 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3144 IBasicVideo
*pBasicVideo
;
3147 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBitErrorRate
);
3149 EnterCriticalSection(&This
->cs
);
3151 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3154 hr
= IBasicVideo_get_BitErrorRate(pBasicVideo
, pBitErrorRate
);
3156 LeaveCriticalSection(&This
->cs
);
3161 static HRESULT WINAPI
BasicVideo_get_VideoWidth(IBasicVideo2
*iface
, LONG
*pVideoWidth
)
3163 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3164 IBasicVideo
*pBasicVideo
;
3167 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
3169 EnterCriticalSection(&This
->cs
);
3171 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3174 hr
= IBasicVideo_get_VideoWidth(pBasicVideo
, pVideoWidth
);
3176 LeaveCriticalSection(&This
->cs
);
3181 static HRESULT WINAPI
BasicVideo_get_VideoHeight(IBasicVideo2
*iface
, LONG
*pVideoHeight
)
3183 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3184 IBasicVideo
*pBasicVideo
;
3187 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
3189 EnterCriticalSection(&This
->cs
);
3191 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3194 hr
= IBasicVideo_get_VideoHeight(pBasicVideo
, pVideoHeight
);
3196 LeaveCriticalSection(&This
->cs
);
3201 static HRESULT WINAPI
BasicVideo_put_SourceLeft(IBasicVideo2
*iface
, LONG SourceLeft
)
3203 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3204 IBasicVideo
*pBasicVideo
;
3207 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceLeft
);
3209 EnterCriticalSection(&This
->cs
);
3211 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3214 hr
= IBasicVideo_put_SourceLeft(pBasicVideo
, SourceLeft
);
3216 LeaveCriticalSection(&This
->cs
);
3221 static HRESULT WINAPI
BasicVideo_get_SourceLeft(IBasicVideo2
*iface
, LONG
*pSourceLeft
)
3223 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3224 IBasicVideo
*pBasicVideo
;
3227 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
3229 EnterCriticalSection(&This
->cs
);
3231 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3234 hr
= IBasicVideo_get_SourceLeft(pBasicVideo
, pSourceLeft
);
3236 LeaveCriticalSection(&This
->cs
);
3241 static HRESULT WINAPI
BasicVideo_put_SourceWidth(IBasicVideo2
*iface
, LONG SourceWidth
)
3243 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3244 IBasicVideo
*pBasicVideo
;
3247 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceWidth
);
3249 EnterCriticalSection(&This
->cs
);
3251 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3254 hr
= IBasicVideo_put_SourceWidth(pBasicVideo
, SourceWidth
);
3256 LeaveCriticalSection(&This
->cs
);
3261 static HRESULT WINAPI
BasicVideo_get_SourceWidth(IBasicVideo2
*iface
, LONG
*pSourceWidth
)
3263 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3264 IBasicVideo
*pBasicVideo
;
3267 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
3269 EnterCriticalSection(&This
->cs
);
3271 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3274 hr
= IBasicVideo_get_SourceWidth(pBasicVideo
, pSourceWidth
);
3276 LeaveCriticalSection(&This
->cs
);
3281 static HRESULT WINAPI
BasicVideo_put_SourceTop(IBasicVideo2
*iface
, LONG SourceTop
)
3283 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3284 IBasicVideo
*pBasicVideo
;
3287 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceTop
);
3289 EnterCriticalSection(&This
->cs
);
3291 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3294 hr
= IBasicVideo_put_SourceTop(pBasicVideo
, SourceTop
);
3296 LeaveCriticalSection(&This
->cs
);
3301 static HRESULT WINAPI
BasicVideo_get_SourceTop(IBasicVideo2
*iface
, LONG
*pSourceTop
)
3303 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3304 IBasicVideo
*pBasicVideo
;
3307 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
3309 EnterCriticalSection(&This
->cs
);
3311 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3314 hr
= IBasicVideo_get_SourceTop(pBasicVideo
, pSourceTop
);
3316 LeaveCriticalSection(&This
->cs
);
3321 static HRESULT WINAPI
BasicVideo_put_SourceHeight(IBasicVideo2
*iface
, LONG SourceHeight
)
3323 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3324 IBasicVideo
*pBasicVideo
;
3327 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceHeight
);
3329 EnterCriticalSection(&This
->cs
);
3331 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3334 hr
= IBasicVideo_put_SourceHeight(pBasicVideo
, SourceHeight
);
3336 LeaveCriticalSection(&This
->cs
);
3341 static HRESULT WINAPI
BasicVideo_get_SourceHeight(IBasicVideo2
*iface
, LONG
*pSourceHeight
)
3343 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3344 IBasicVideo
*pBasicVideo
;
3347 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
3349 EnterCriticalSection(&This
->cs
);
3351 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3354 hr
= IBasicVideo_get_SourceHeight(pBasicVideo
, pSourceHeight
);
3356 LeaveCriticalSection(&This
->cs
);
3361 static HRESULT WINAPI
BasicVideo_put_DestinationLeft(IBasicVideo2
*iface
, LONG DestinationLeft
)
3363 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3364 IBasicVideo
*pBasicVideo
;
3367 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationLeft
);
3369 EnterCriticalSection(&This
->cs
);
3371 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3374 hr
= IBasicVideo_put_DestinationLeft(pBasicVideo
, DestinationLeft
);
3376 LeaveCriticalSection(&This
->cs
);
3381 static HRESULT WINAPI
BasicVideo_get_DestinationLeft(IBasicVideo2
*iface
, LONG
*pDestinationLeft
)
3383 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3384 IBasicVideo
*pBasicVideo
;
3387 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
3389 EnterCriticalSection(&This
->cs
);
3391 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3394 hr
= IBasicVideo_get_DestinationLeft(pBasicVideo
, pDestinationLeft
);
3396 LeaveCriticalSection(&This
->cs
);
3401 static HRESULT WINAPI
BasicVideo_put_DestinationWidth(IBasicVideo2
*iface
, LONG DestinationWidth
)
3403 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3404 IBasicVideo
*pBasicVideo
;
3407 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationWidth
);
3409 EnterCriticalSection(&This
->cs
);
3411 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3414 hr
= IBasicVideo_put_DestinationWidth(pBasicVideo
, DestinationWidth
);
3416 LeaveCriticalSection(&This
->cs
);
3421 static HRESULT WINAPI
BasicVideo_get_DestinationWidth(IBasicVideo2
*iface
, LONG
*pDestinationWidth
)
3423 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3424 IBasicVideo
*pBasicVideo
;
3427 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
3429 EnterCriticalSection(&This
->cs
);
3431 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3434 hr
= IBasicVideo_get_DestinationWidth(pBasicVideo
, pDestinationWidth
);
3436 LeaveCriticalSection(&This
->cs
);
3441 static HRESULT WINAPI
BasicVideo_put_DestinationTop(IBasicVideo2
*iface
, LONG DestinationTop
)
3443 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3444 IBasicVideo
*pBasicVideo
;
3447 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationTop
);
3449 EnterCriticalSection(&This
->cs
);
3451 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3454 hr
= IBasicVideo_put_DestinationTop(pBasicVideo
, DestinationTop
);
3456 LeaveCriticalSection(&This
->cs
);
3461 static HRESULT WINAPI
BasicVideo_get_DestinationTop(IBasicVideo2
*iface
, LONG
*pDestinationTop
)
3463 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3464 IBasicVideo
*pBasicVideo
;
3467 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
3469 EnterCriticalSection(&This
->cs
);
3471 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3474 hr
= IBasicVideo_get_DestinationTop(pBasicVideo
, pDestinationTop
);
3476 LeaveCriticalSection(&This
->cs
);
3481 static HRESULT WINAPI
BasicVideo_put_DestinationHeight(IBasicVideo2
*iface
, LONG DestinationHeight
)
3483 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3484 IBasicVideo
*pBasicVideo
;
3487 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationHeight
);
3489 EnterCriticalSection(&This
->cs
);
3491 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3494 hr
= IBasicVideo_put_DestinationHeight(pBasicVideo
, DestinationHeight
);
3496 LeaveCriticalSection(&This
->cs
);
3501 static HRESULT WINAPI
BasicVideo_get_DestinationHeight(IBasicVideo2
*iface
,
3502 LONG
*pDestinationHeight
)
3504 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3505 IBasicVideo
*pBasicVideo
;
3508 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
3510 EnterCriticalSection(&This
->cs
);
3512 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3515 hr
= IBasicVideo_get_DestinationHeight(pBasicVideo
, pDestinationHeight
);
3517 LeaveCriticalSection(&This
->cs
);
3522 static HRESULT WINAPI
BasicVideo_SetSourcePosition(IBasicVideo2
*iface
, LONG Left
, LONG Top
,
3523 LONG Width
, LONG Height
)
3525 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3526 IBasicVideo
*pBasicVideo
;
3529 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
3531 EnterCriticalSection(&This
->cs
);
3533 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3536 hr
= IBasicVideo_SetSourcePosition(pBasicVideo
, Left
, Top
, Width
, Height
);
3538 LeaveCriticalSection(&This
->cs
);
3543 static HRESULT WINAPI
BasicVideo_GetSourcePosition(IBasicVideo2
*iface
, LONG
*pLeft
, LONG
*pTop
,
3544 LONG
*pWidth
, LONG
*pHeight
)
3546 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3547 IBasicVideo
*pBasicVideo
;
3550 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
3552 EnterCriticalSection(&This
->cs
);
3554 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3557 hr
= IBasicVideo_GetSourcePosition(pBasicVideo
, pLeft
, pTop
, pWidth
, pHeight
);
3559 LeaveCriticalSection(&This
->cs
);
3564 static HRESULT WINAPI
BasicVideo_SetDefaultSourcePosition(IBasicVideo2
*iface
)
3566 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3567 IBasicVideo
*pBasicVideo
;
3570 TRACE("(%p/%p)->()\n", This
, iface
);
3572 EnterCriticalSection(&This
->cs
);
3574 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3577 hr
= IBasicVideo_SetDefaultSourcePosition(pBasicVideo
);
3579 LeaveCriticalSection(&This
->cs
);
3584 static HRESULT WINAPI
BasicVideo_SetDestinationPosition(IBasicVideo2
*iface
, LONG Left
, LONG Top
,
3585 LONG Width
, LONG Height
)
3587 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3588 IBasicVideo
*pBasicVideo
;
3591 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
3593 EnterCriticalSection(&This
->cs
);
3595 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3598 hr
= IBasicVideo_SetDestinationPosition(pBasicVideo
, Left
, Top
, Width
, Height
);
3600 LeaveCriticalSection(&This
->cs
);
3605 static HRESULT WINAPI
BasicVideo_GetDestinationPosition(IBasicVideo2
*iface
, LONG
*pLeft
,
3606 LONG
*pTop
, LONG
*pWidth
, LONG
*pHeight
)
3608 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3609 IBasicVideo
*pBasicVideo
;
3612 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
3614 EnterCriticalSection(&This
->cs
);
3616 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3619 hr
= IBasicVideo_GetDestinationPosition(pBasicVideo
, pLeft
, pTop
, pWidth
, pHeight
);
3621 LeaveCriticalSection(&This
->cs
);
3626 static HRESULT WINAPI
BasicVideo_SetDefaultDestinationPosition(IBasicVideo2
*iface
)
3628 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3629 IBasicVideo
*pBasicVideo
;
3632 TRACE("(%p/%p)->()\n", This
, iface
);
3634 EnterCriticalSection(&This
->cs
);
3636 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3639 hr
= IBasicVideo_SetDefaultDestinationPosition(pBasicVideo
);
3641 LeaveCriticalSection(&This
->cs
);
3646 static HRESULT WINAPI
BasicVideo_GetVideoSize(IBasicVideo2
*iface
, LONG
*pWidth
, LONG
*pHeight
)
3648 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3649 IBasicVideo
*pBasicVideo
;
3652 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
3654 EnterCriticalSection(&This
->cs
);
3656 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3659 hr
= IBasicVideo_GetVideoSize(pBasicVideo
, pWidth
, pHeight
);
3661 LeaveCriticalSection(&This
->cs
);
3666 static HRESULT WINAPI
BasicVideo_GetVideoPaletteEntries(IBasicVideo2
*iface
, LONG StartIndex
,
3667 LONG Entries
, LONG
*pRetrieved
, LONG
*pPalette
)
3669 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3670 IBasicVideo
*pBasicVideo
;
3673 TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
3675 EnterCriticalSection(&This
->cs
);
3677 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3680 hr
= IBasicVideo_GetVideoPaletteEntries(pBasicVideo
, StartIndex
, Entries
, pRetrieved
, pPalette
);
3682 LeaveCriticalSection(&This
->cs
);
3687 static HRESULT WINAPI
BasicVideo_GetCurrentImage(IBasicVideo2
*iface
, LONG
*pBufferSize
,
3690 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3691 IBasicVideo
*pBasicVideo
;
3694 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pBufferSize
, pDIBImage
);
3696 EnterCriticalSection(&This
->cs
);
3698 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3701 hr
= IBasicVideo_GetCurrentImage(pBasicVideo
, pBufferSize
, pDIBImage
);
3703 LeaveCriticalSection(&This
->cs
);
3708 static HRESULT WINAPI
BasicVideo_IsUsingDefaultSource(IBasicVideo2
*iface
)
3710 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3711 IBasicVideo
*pBasicVideo
;
3714 TRACE("(%p/%p)->()\n", This
, iface
);
3716 EnterCriticalSection(&This
->cs
);
3718 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3721 hr
= IBasicVideo_IsUsingDefaultSource(pBasicVideo
);
3723 LeaveCriticalSection(&This
->cs
);
3728 static HRESULT WINAPI
BasicVideo_IsUsingDefaultDestination(IBasicVideo2
*iface
)
3730 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3731 IBasicVideo
*pBasicVideo
;
3734 TRACE("(%p/%p)->()\n", This
, iface
);
3736 EnterCriticalSection(&This
->cs
);
3738 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3741 hr
= IBasicVideo_IsUsingDefaultDestination(pBasicVideo
);
3743 LeaveCriticalSection(&This
->cs
);
3748 static HRESULT WINAPI
BasicVideo2_GetPreferredAspectRatio(IBasicVideo2
*iface
, LONG
*plAspectX
,
3751 IFilterGraphImpl
*This
= impl_from_IBasicVideo2(iface
);
3752 IBasicVideo2
*pBasicVideo2
;
3755 TRACE("(%p/%p)->()\n", This
, iface
);
3757 EnterCriticalSection(&This
->cs
);
3759 hr
= GetTargetInterface(This
, &IID_IBasicVideo2
, (LPVOID
*)&pBasicVideo2
);
3762 hr
= BasicVideo2_GetPreferredAspectRatio(iface
, plAspectX
, plAspectY
);
3764 LeaveCriticalSection(&This
->cs
);
3769 static const IBasicVideo2Vtbl IBasicVideo_VTable
=
3771 BasicVideo_QueryInterface
,
3774 BasicVideo_GetTypeInfoCount
,
3775 BasicVideo_GetTypeInfo
,
3776 BasicVideo_GetIDsOfNames
,
3778 BasicVideo_get_AvgTimePerFrame
,
3779 BasicVideo_get_BitRate
,
3780 BasicVideo_get_BitErrorRate
,
3781 BasicVideo_get_VideoWidth
,
3782 BasicVideo_get_VideoHeight
,
3783 BasicVideo_put_SourceLeft
,
3784 BasicVideo_get_SourceLeft
,
3785 BasicVideo_put_SourceWidth
,
3786 BasicVideo_get_SourceWidth
,
3787 BasicVideo_put_SourceTop
,
3788 BasicVideo_get_SourceTop
,
3789 BasicVideo_put_SourceHeight
,
3790 BasicVideo_get_SourceHeight
,
3791 BasicVideo_put_DestinationLeft
,
3792 BasicVideo_get_DestinationLeft
,
3793 BasicVideo_put_DestinationWidth
,
3794 BasicVideo_get_DestinationWidth
,
3795 BasicVideo_put_DestinationTop
,
3796 BasicVideo_get_DestinationTop
,
3797 BasicVideo_put_DestinationHeight
,
3798 BasicVideo_get_DestinationHeight
,
3799 BasicVideo_SetSourcePosition
,
3800 BasicVideo_GetSourcePosition
,
3801 BasicVideo_SetDefaultSourcePosition
,
3802 BasicVideo_SetDestinationPosition
,
3803 BasicVideo_GetDestinationPosition
,
3804 BasicVideo_SetDefaultDestinationPosition
,
3805 BasicVideo_GetVideoSize
,
3806 BasicVideo_GetVideoPaletteEntries
,
3807 BasicVideo_GetCurrentImage
,
3808 BasicVideo_IsUsingDefaultSource
,
3809 BasicVideo_IsUsingDefaultDestination
,
3810 BasicVideo2_GetPreferredAspectRatio
3813 static inline IFilterGraphImpl
*impl_from_IVideoWindow(IVideoWindow
*iface
)
3815 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IVideoWindow_iface
);
3818 static HRESULT WINAPI
VideoWindow_QueryInterface(IVideoWindow
*iface
, REFIID riid
, void **ppvObj
)
3820 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3822 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
3824 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
3827 static ULONG WINAPI
VideoWindow_AddRef(IVideoWindow
*iface
)
3829 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3831 TRACE("(%p/%p)->()\n", This
, iface
);
3833 return Filtergraph_AddRef(This
);
3836 static ULONG WINAPI
VideoWindow_Release(IVideoWindow
*iface
)
3838 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3840 TRACE("(%p/%p)->()\n", This
, iface
);
3842 return Filtergraph_Release(This
);
3845 /*** IDispatch methods ***/
3846 static HRESULT WINAPI
VideoWindow_GetTypeInfoCount(IVideoWindow
*iface
, UINT
*pctinfo
)
3848 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3849 IVideoWindow
*pVideoWindow
;
3852 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
3854 EnterCriticalSection(&This
->cs
);
3856 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3859 hr
= IVideoWindow_GetTypeInfoCount(pVideoWindow
, pctinfo
);
3861 LeaveCriticalSection(&This
->cs
);
3866 static HRESULT WINAPI
VideoWindow_GetTypeInfo(IVideoWindow
*iface
, UINT iTInfo
, LCID lcid
,
3867 ITypeInfo
**ppTInfo
)
3869 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3870 IVideoWindow
*pVideoWindow
;
3873 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
3875 EnterCriticalSection(&This
->cs
);
3877 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3880 hr
= IVideoWindow_GetTypeInfo(pVideoWindow
, iTInfo
, lcid
, ppTInfo
);
3882 LeaveCriticalSection(&This
->cs
);
3887 static HRESULT WINAPI
VideoWindow_GetIDsOfNames(IVideoWindow
*iface
, REFIID riid
,
3888 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3890 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3891 IVideoWindow
*pVideoWindow
;
3894 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3896 EnterCriticalSection(&This
->cs
);
3898 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3901 hr
= IVideoWindow_GetIDsOfNames(pVideoWindow
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3903 LeaveCriticalSection(&This
->cs
);
3908 static HRESULT WINAPI
VideoWindow_Invoke(IVideoWindow
*iface
, DISPID dispIdMember
, REFIID riid
,
3909 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
3912 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3913 IVideoWindow
*pVideoWindow
;
3916 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
);
3918 EnterCriticalSection(&This
->cs
);
3920 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3923 hr
= IVideoWindow_Invoke(pVideoWindow
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
3925 LeaveCriticalSection(&This
->cs
);
3931 /*** IVideoWindow methods ***/
3932 static HRESULT WINAPI
VideoWindow_put_Caption(IVideoWindow
*iface
, BSTR strCaption
)
3934 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3935 IVideoWindow
*pVideoWindow
;
3938 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
3940 EnterCriticalSection(&This
->cs
);
3942 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3945 hr
= IVideoWindow_put_Caption(pVideoWindow
, strCaption
);
3947 LeaveCriticalSection(&This
->cs
);
3952 static HRESULT WINAPI
VideoWindow_get_Caption(IVideoWindow
*iface
, BSTR
*strCaption
)
3954 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3955 IVideoWindow
*pVideoWindow
;
3958 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
3960 EnterCriticalSection(&This
->cs
);
3962 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3965 hr
= IVideoWindow_get_Caption(pVideoWindow
, strCaption
);
3967 LeaveCriticalSection(&This
->cs
);
3972 static HRESULT WINAPI
VideoWindow_put_WindowStyle(IVideoWindow
*iface
, LONG WindowStyle
)
3974 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3975 IVideoWindow
*pVideoWindow
;
3978 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyle
);
3980 EnterCriticalSection(&This
->cs
);
3982 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3985 hr
= IVideoWindow_put_WindowStyle(pVideoWindow
, WindowStyle
);
3987 LeaveCriticalSection(&This
->cs
);
3992 static HRESULT WINAPI
VideoWindow_get_WindowStyle(IVideoWindow
*iface
, LONG
*WindowStyle
)
3994 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
3995 IVideoWindow
*pVideoWindow
;
3998 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
4000 EnterCriticalSection(&This
->cs
);
4002 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4005 hr
= IVideoWindow_get_WindowStyle(pVideoWindow
, WindowStyle
);
4007 LeaveCriticalSection(&This
->cs
);
4012 static HRESULT WINAPI
VideoWindow_put_WindowStyleEx(IVideoWindow
*iface
, LONG WindowStyleEx
)
4014 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4015 IVideoWindow
*pVideoWindow
;
4018 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyleEx
);
4020 EnterCriticalSection(&This
->cs
);
4022 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4025 hr
= IVideoWindow_put_WindowStyleEx(pVideoWindow
, WindowStyleEx
);
4027 LeaveCriticalSection(&This
->cs
);
4032 static HRESULT WINAPI
VideoWindow_get_WindowStyleEx(IVideoWindow
*iface
, LONG
*WindowStyleEx
)
4034 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4035 IVideoWindow
*pVideoWindow
;
4038 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
4040 EnterCriticalSection(&This
->cs
);
4042 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4045 hr
= IVideoWindow_get_WindowStyleEx(pVideoWindow
, WindowStyleEx
);
4047 LeaveCriticalSection(&This
->cs
);
4052 static HRESULT WINAPI
VideoWindow_put_AutoShow(IVideoWindow
*iface
, LONG AutoShow
)
4054 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4055 IVideoWindow
*pVideoWindow
;
4058 TRACE("(%p/%p)->(%d)\n", This
, iface
, AutoShow
);
4060 EnterCriticalSection(&This
->cs
);
4062 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4065 hr
= IVideoWindow_put_AutoShow(pVideoWindow
, AutoShow
);
4067 LeaveCriticalSection(&This
->cs
);
4072 static HRESULT WINAPI
VideoWindow_get_AutoShow(IVideoWindow
*iface
, LONG
*AutoShow
)
4074 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4075 IVideoWindow
*pVideoWindow
;
4078 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
4080 EnterCriticalSection(&This
->cs
);
4082 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4085 hr
= IVideoWindow_get_AutoShow(pVideoWindow
, AutoShow
);
4087 LeaveCriticalSection(&This
->cs
);
4092 static HRESULT WINAPI
VideoWindow_put_WindowState(IVideoWindow
*iface
, LONG WindowState
)
4094 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4095 IVideoWindow
*pVideoWindow
;
4098 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowState
);
4100 EnterCriticalSection(&This
->cs
);
4102 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4105 hr
= IVideoWindow_put_WindowState(pVideoWindow
, WindowState
);
4107 LeaveCriticalSection(&This
->cs
);
4112 static HRESULT WINAPI
VideoWindow_get_WindowState(IVideoWindow
*iface
, LONG
*WindowState
)
4114 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4115 IVideoWindow
*pVideoWindow
;
4118 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowState
);
4120 EnterCriticalSection(&This
->cs
);
4122 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4125 hr
= IVideoWindow_get_WindowState(pVideoWindow
, WindowState
);
4127 LeaveCriticalSection(&This
->cs
);
4132 static HRESULT WINAPI
VideoWindow_put_BackgroundPalette(IVideoWindow
*iface
, LONG BackgroundPalette
)
4134 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4135 IVideoWindow
*pVideoWindow
;
4138 TRACE("(%p/%p)->(%d)\n", This
, iface
, BackgroundPalette
);
4140 EnterCriticalSection(&This
->cs
);
4142 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4145 hr
= IVideoWindow_put_BackgroundPalette(pVideoWindow
, BackgroundPalette
);
4147 LeaveCriticalSection(&This
->cs
);
4152 static HRESULT WINAPI
VideoWindow_get_BackgroundPalette(IVideoWindow
*iface
,
4153 LONG
*pBackgroundPalette
)
4155 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4156 IVideoWindow
*pVideoWindow
;
4159 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBackgroundPalette
);
4161 EnterCriticalSection(&This
->cs
);
4163 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4166 hr
= IVideoWindow_get_BackgroundPalette(pVideoWindow
, pBackgroundPalette
);
4168 LeaveCriticalSection(&This
->cs
);
4173 static HRESULT WINAPI
VideoWindow_put_Visible(IVideoWindow
*iface
, LONG Visible
)
4175 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4176 IVideoWindow
*pVideoWindow
;
4179 TRACE("(%p/%p)->(%d)\n", This
, iface
, Visible
);
4181 EnterCriticalSection(&This
->cs
);
4183 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4186 hr
= IVideoWindow_put_Visible(pVideoWindow
, Visible
);
4188 LeaveCriticalSection(&This
->cs
);
4193 static HRESULT WINAPI
VideoWindow_get_Visible(IVideoWindow
*iface
, LONG
*pVisible
)
4195 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4196 IVideoWindow
*pVideoWindow
;
4199 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
4201 EnterCriticalSection(&This
->cs
);
4203 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4206 hr
= IVideoWindow_get_Visible(pVideoWindow
, pVisible
);
4208 LeaveCriticalSection(&This
->cs
);
4213 static HRESULT WINAPI
VideoWindow_put_Left(IVideoWindow
*iface
, LONG Left
)
4215 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4216 IVideoWindow
*pVideoWindow
;
4219 TRACE("(%p/%p)->(%d)\n", This
, iface
, Left
);
4221 EnterCriticalSection(&This
->cs
);
4223 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4226 hr
= IVideoWindow_put_Left(pVideoWindow
, Left
);
4228 LeaveCriticalSection(&This
->cs
);
4233 static HRESULT WINAPI
VideoWindow_get_Left(IVideoWindow
*iface
, LONG
*pLeft
)
4235 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4236 IVideoWindow
*pVideoWindow
;
4239 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
4241 EnterCriticalSection(&This
->cs
);
4243 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4246 hr
= IVideoWindow_get_Left(pVideoWindow
, pLeft
);
4248 LeaveCriticalSection(&This
->cs
);
4253 static HRESULT WINAPI
VideoWindow_put_Width(IVideoWindow
*iface
, LONG Width
)
4255 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4256 IVideoWindow
*pVideoWindow
;
4259 TRACE("(%p/%p)->(%d)\n", This
, iface
, Width
);
4261 EnterCriticalSection(&This
->cs
);
4263 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4266 hr
= IVideoWindow_put_Width(pVideoWindow
, Width
);
4268 LeaveCriticalSection(&This
->cs
);
4273 static HRESULT WINAPI
VideoWindow_get_Width(IVideoWindow
*iface
, LONG
*pWidth
)
4275 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4276 IVideoWindow
*pVideoWindow
;
4279 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
4281 EnterCriticalSection(&This
->cs
);
4283 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4286 hr
= IVideoWindow_get_Width(pVideoWindow
, pWidth
);
4288 LeaveCriticalSection(&This
->cs
);
4293 static HRESULT WINAPI
VideoWindow_put_Top(IVideoWindow
*iface
, LONG Top
)
4295 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4296 IVideoWindow
*pVideoWindow
;
4299 TRACE("(%p/%p)->(%d)\n", This
, iface
, Top
);
4301 EnterCriticalSection(&This
->cs
);
4303 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4306 hr
= IVideoWindow_put_Top(pVideoWindow
, Top
);
4308 LeaveCriticalSection(&This
->cs
);
4313 static HRESULT WINAPI
VideoWindow_get_Top(IVideoWindow
*iface
, LONG
*pTop
)
4315 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4316 IVideoWindow
*pVideoWindow
;
4319 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
4321 EnterCriticalSection(&This
->cs
);
4323 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4326 hr
= IVideoWindow_get_Top(pVideoWindow
, pTop
);
4328 LeaveCriticalSection(&This
->cs
);
4333 static HRESULT WINAPI
VideoWindow_put_Height(IVideoWindow
*iface
, LONG Height
)
4335 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4336 IVideoWindow
*pVideoWindow
;
4339 TRACE("(%p/%p)->(%d)\n", This
, iface
, Height
);
4341 EnterCriticalSection(&This
->cs
);
4343 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4346 hr
= IVideoWindow_put_Height(pVideoWindow
, Height
);
4348 LeaveCriticalSection(&This
->cs
);
4353 static HRESULT WINAPI
VideoWindow_get_Height(IVideoWindow
*iface
, LONG
*pHeight
)
4355 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4356 IVideoWindow
*pVideoWindow
;
4359 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
4361 EnterCriticalSection(&This
->cs
);
4363 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4366 hr
= IVideoWindow_get_Height(pVideoWindow
, pHeight
);
4368 LeaveCriticalSection(&This
->cs
);
4373 static HRESULT WINAPI
VideoWindow_put_Owner(IVideoWindow
*iface
, OAHWND Owner
)
4375 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4376 IVideoWindow
*pVideoWindow
;
4379 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
4381 EnterCriticalSection(&This
->cs
);
4383 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4386 hr
= IVideoWindow_put_Owner(pVideoWindow
, Owner
);
4388 LeaveCriticalSection(&This
->cs
);
4393 static HRESULT WINAPI
VideoWindow_get_Owner(IVideoWindow
*iface
, OAHWND
*Owner
)
4395 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4396 IVideoWindow
*pVideoWindow
;
4399 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
4401 EnterCriticalSection(&This
->cs
);
4403 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4406 hr
= IVideoWindow_get_Owner(pVideoWindow
, Owner
);
4408 LeaveCriticalSection(&This
->cs
);
4413 static HRESULT WINAPI
VideoWindow_put_MessageDrain(IVideoWindow
*iface
, OAHWND Drain
)
4415 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4416 IVideoWindow
*pVideoWindow
;
4419 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
4421 EnterCriticalSection(&This
->cs
);
4423 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4426 hr
= IVideoWindow_put_MessageDrain(pVideoWindow
, Drain
);
4428 LeaveCriticalSection(&This
->cs
);
4433 static HRESULT WINAPI
VideoWindow_get_MessageDrain(IVideoWindow
*iface
, OAHWND
*Drain
)
4435 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4436 IVideoWindow
*pVideoWindow
;
4439 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
4441 EnterCriticalSection(&This
->cs
);
4443 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4446 hr
= IVideoWindow_get_MessageDrain(pVideoWindow
, Drain
);
4448 LeaveCriticalSection(&This
->cs
);
4453 static HRESULT WINAPI
VideoWindow_get_BorderColor(IVideoWindow
*iface
, LONG
*Color
)
4455 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4456 IVideoWindow
*pVideoWindow
;
4459 TRACE("(%p/%p)->(%p)\n", This
, iface
, Color
);
4461 EnterCriticalSection(&This
->cs
);
4463 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4466 hr
= IVideoWindow_get_BorderColor(pVideoWindow
, Color
);
4468 LeaveCriticalSection(&This
->cs
);
4473 static HRESULT WINAPI
VideoWindow_put_BorderColor(IVideoWindow
*iface
, LONG Color
)
4475 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4476 IVideoWindow
*pVideoWindow
;
4479 TRACE("(%p/%p)->(%d)\n", This
, iface
, Color
);
4481 EnterCriticalSection(&This
->cs
);
4483 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4486 hr
= IVideoWindow_put_BorderColor(pVideoWindow
, Color
);
4488 LeaveCriticalSection(&This
->cs
);
4493 static HRESULT WINAPI
VideoWindow_get_FullScreenMode(IVideoWindow
*iface
, LONG
*FullScreenMode
)
4495 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4496 IVideoWindow
*pVideoWindow
;
4499 TRACE("(%p/%p)->(%p)\n", This
, iface
, FullScreenMode
);
4501 EnterCriticalSection(&This
->cs
);
4503 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4506 hr
= IVideoWindow_get_FullScreenMode(pVideoWindow
, FullScreenMode
);
4508 LeaveCriticalSection(&This
->cs
);
4513 static HRESULT WINAPI
VideoWindow_put_FullScreenMode(IVideoWindow
*iface
, LONG FullScreenMode
)
4515 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4516 IVideoWindow
*pVideoWindow
;
4519 TRACE("(%p/%p)->(%d)\n", This
, iface
, FullScreenMode
);
4521 EnterCriticalSection(&This
->cs
);
4523 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4526 hr
= IVideoWindow_put_FullScreenMode(pVideoWindow
, FullScreenMode
);
4528 LeaveCriticalSection(&This
->cs
);
4533 static HRESULT WINAPI
VideoWindow_SetWindowForeground(IVideoWindow
*iface
, LONG Focus
)
4535 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4536 IVideoWindow
*pVideoWindow
;
4539 TRACE("(%p/%p)->(%d)\n", This
, iface
, Focus
);
4541 EnterCriticalSection(&This
->cs
);
4543 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4546 hr
= IVideoWindow_SetWindowForeground(pVideoWindow
, Focus
);
4548 LeaveCriticalSection(&This
->cs
);
4553 static HRESULT WINAPI
VideoWindow_NotifyOwnerMessage(IVideoWindow
*iface
, OAHWND hwnd
, LONG uMsg
,
4554 LONG_PTR wParam
, LONG_PTR lParam
)
4556 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4557 IVideoWindow
*pVideoWindow
;
4560 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This
, iface
, hwnd
, uMsg
, wParam
, lParam
);
4562 EnterCriticalSection(&This
->cs
);
4564 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4567 hr
= IVideoWindow_NotifyOwnerMessage(pVideoWindow
, hwnd
, uMsg
, wParam
, lParam
);
4569 LeaveCriticalSection(&This
->cs
);
4574 static HRESULT WINAPI
VideoWindow_SetWindowPosition(IVideoWindow
*iface
, LONG Left
, LONG Top
,
4575 LONG Width
, LONG Height
)
4577 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4578 IVideoWindow
*pVideoWindow
;
4581 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
4583 EnterCriticalSection(&This
->cs
);
4585 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4588 hr
= IVideoWindow_SetWindowPosition(pVideoWindow
, Left
, Top
, Width
, Height
);
4590 LeaveCriticalSection(&This
->cs
);
4595 static HRESULT WINAPI
VideoWindow_GetWindowPosition(IVideoWindow
*iface
, LONG
*pLeft
, LONG
*pTop
,
4596 LONG
*pWidth
, LONG
*pHeight
)
4598 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4599 IVideoWindow
*pVideoWindow
;
4602 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
4604 EnterCriticalSection(&This
->cs
);
4606 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4609 hr
= IVideoWindow_GetWindowPosition(pVideoWindow
, pLeft
, pTop
, pWidth
, pHeight
);
4611 LeaveCriticalSection(&This
->cs
);
4616 static HRESULT WINAPI
VideoWindow_GetMinIdealImageSize(IVideoWindow
*iface
, LONG
*pWidth
,
4619 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4620 IVideoWindow
*pVideoWindow
;
4623 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
4625 EnterCriticalSection(&This
->cs
);
4627 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4630 hr
= IVideoWindow_GetMinIdealImageSize(pVideoWindow
, pWidth
, pHeight
);
4632 LeaveCriticalSection(&This
->cs
);
4637 static HRESULT WINAPI
VideoWindow_GetMaxIdealImageSize(IVideoWindow
*iface
, LONG
*pWidth
,
4640 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4641 IVideoWindow
*pVideoWindow
;
4644 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
4646 EnterCriticalSection(&This
->cs
);
4648 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4651 hr
= IVideoWindow_GetMaxIdealImageSize(pVideoWindow
, pWidth
, pHeight
);
4653 LeaveCriticalSection(&This
->cs
);
4658 static HRESULT WINAPI
VideoWindow_GetRestorePosition(IVideoWindow
*iface
, LONG
*pLeft
, LONG
*pTop
,
4659 LONG
*pWidth
, LONG
*pHeight
)
4661 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4662 IVideoWindow
*pVideoWindow
;
4665 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
4667 EnterCriticalSection(&This
->cs
);
4669 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4672 hr
= IVideoWindow_GetRestorePosition(pVideoWindow
, pLeft
, pTop
, pWidth
, pHeight
);
4674 LeaveCriticalSection(&This
->cs
);
4679 static HRESULT WINAPI
VideoWindow_HideCursor(IVideoWindow
*iface
, LONG HideCursor
)
4681 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4682 IVideoWindow
*pVideoWindow
;
4685 TRACE("(%p/%p)->(%d)\n", This
, iface
, HideCursor
);
4687 EnterCriticalSection(&This
->cs
);
4689 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4692 hr
= IVideoWindow_HideCursor(pVideoWindow
, HideCursor
);
4694 LeaveCriticalSection(&This
->cs
);
4699 static HRESULT WINAPI
VideoWindow_IsCursorHidden(IVideoWindow
*iface
, LONG
*CursorHidden
)
4701 IFilterGraphImpl
*This
= impl_from_IVideoWindow(iface
);
4702 IVideoWindow
*pVideoWindow
;
4705 TRACE("(%p/%p)->(%p)\n", This
, iface
, CursorHidden
);
4707 EnterCriticalSection(&This
->cs
);
4709 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4712 hr
= IVideoWindow_IsCursorHidden(pVideoWindow
, CursorHidden
);
4714 LeaveCriticalSection(&This
->cs
);
4720 static const IVideoWindowVtbl IVideoWindow_VTable
=
4722 VideoWindow_QueryInterface
,
4724 VideoWindow_Release
,
4725 VideoWindow_GetTypeInfoCount
,
4726 VideoWindow_GetTypeInfo
,
4727 VideoWindow_GetIDsOfNames
,
4729 VideoWindow_put_Caption
,
4730 VideoWindow_get_Caption
,
4731 VideoWindow_put_WindowStyle
,
4732 VideoWindow_get_WindowStyle
,
4733 VideoWindow_put_WindowStyleEx
,
4734 VideoWindow_get_WindowStyleEx
,
4735 VideoWindow_put_AutoShow
,
4736 VideoWindow_get_AutoShow
,
4737 VideoWindow_put_WindowState
,
4738 VideoWindow_get_WindowState
,
4739 VideoWindow_put_BackgroundPalette
,
4740 VideoWindow_get_BackgroundPalette
,
4741 VideoWindow_put_Visible
,
4742 VideoWindow_get_Visible
,
4743 VideoWindow_put_Left
,
4744 VideoWindow_get_Left
,
4745 VideoWindow_put_Width
,
4746 VideoWindow_get_Width
,
4747 VideoWindow_put_Top
,
4748 VideoWindow_get_Top
,
4749 VideoWindow_put_Height
,
4750 VideoWindow_get_Height
,
4751 VideoWindow_put_Owner
,
4752 VideoWindow_get_Owner
,
4753 VideoWindow_put_MessageDrain
,
4754 VideoWindow_get_MessageDrain
,
4755 VideoWindow_get_BorderColor
,
4756 VideoWindow_put_BorderColor
,
4757 VideoWindow_get_FullScreenMode
,
4758 VideoWindow_put_FullScreenMode
,
4759 VideoWindow_SetWindowForeground
,
4760 VideoWindow_NotifyOwnerMessage
,
4761 VideoWindow_SetWindowPosition
,
4762 VideoWindow_GetWindowPosition
,
4763 VideoWindow_GetMinIdealImageSize
,
4764 VideoWindow_GetMaxIdealImageSize
,
4765 VideoWindow_GetRestorePosition
,
4766 VideoWindow_HideCursor
,
4767 VideoWindow_IsCursorHidden
4770 static inline IFilterGraphImpl
*impl_from_IMediaEventEx(IMediaEventEx
*iface
)
4772 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaEventEx_iface
);
4775 static HRESULT WINAPI
MediaEvent_QueryInterface(IMediaEventEx
*iface
, REFIID riid
, void **ppvObj
)
4777 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4779 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
4781 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
4784 static ULONG WINAPI
MediaEvent_AddRef(IMediaEventEx
*iface
)
4786 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4788 TRACE("(%p/%p)->()\n", This
, iface
);
4790 return Filtergraph_AddRef(This
);
4793 static ULONG WINAPI
MediaEvent_Release(IMediaEventEx
*iface
)
4795 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4797 TRACE("(%p/%p)->()\n", This
, iface
);
4799 return Filtergraph_Release(This
);
4802 /*** IDispatch methods ***/
4803 static HRESULT WINAPI
MediaEvent_GetTypeInfoCount(IMediaEventEx
*iface
, UINT
*pctinfo
)
4805 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4807 TRACE("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
4812 static HRESULT WINAPI
MediaEvent_GetTypeInfo(IMediaEventEx
*iface
, UINT iTInfo
, LCID lcid
,
4813 ITypeInfo
**ppTInfo
)
4815 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4817 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
4822 static HRESULT WINAPI
MediaEvent_GetIDsOfNames(IMediaEventEx
*iface
, REFIID riid
,
4823 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4825 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4827 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
4832 static HRESULT WINAPI
MediaEvent_Invoke(IMediaEventEx
*iface
, DISPID dispIdMember
, REFIID riid
,
4833 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExepInfo
,
4836 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4838 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
);
4843 /*** IMediaEvent methods ***/
4844 static HRESULT WINAPI
MediaEvent_GetEventHandle(IMediaEventEx
*iface
, OAEVENT
*hEvent
)
4846 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4848 TRACE("(%p/%p)->(%p)\n", This
, iface
, hEvent
);
4850 *hEvent
= (OAEVENT
)This
->evqueue
.msg_event
;
4855 static HRESULT WINAPI
MediaEvent_GetEvent(IMediaEventEx
*iface
, LONG
*lEventCode
, LONG_PTR
*lParam1
,
4856 LONG_PTR
*lParam2
, LONG msTimeout
)
4858 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4861 TRACE("(%p/%p)->(%p, %p, %p, %d)\n", This
, iface
, lEventCode
, lParam1
, lParam2
, msTimeout
);
4863 if (EventsQueue_GetEvent(&This
->evqueue
, &evt
, msTimeout
))
4865 *lEventCode
= evt
.lEventCode
;
4866 *lParam1
= evt
.lParam1
;
4867 *lParam2
= evt
.lParam2
;
4875 static HRESULT WINAPI
MediaEvent_WaitForCompletion(IMediaEventEx
*iface
, LONG msTimeout
,
4878 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4880 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, msTimeout
, pEvCode
);
4882 if (This
->state
!= State_Running
)
4883 return VFW_E_WRONG_STATE
;
4885 if (WaitForSingleObject(This
->hEventCompletion
, msTimeout
) == WAIT_OBJECT_0
)
4887 *pEvCode
= This
->CompletionStatus
;
4895 static HRESULT WINAPI
MediaEvent_CancelDefaultHandling(IMediaEventEx
*iface
, LONG lEvCode
)
4897 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4899 TRACE("(%p/%p)->(%d)\n", This
, iface
, lEvCode
);
4901 if (lEvCode
== EC_COMPLETE
)
4902 This
->HandleEcComplete
= FALSE
;
4903 else if (lEvCode
== EC_REPAINT
)
4904 This
->HandleEcRepaint
= FALSE
;
4905 else if (lEvCode
== EC_CLOCK_CHANGED
)
4906 This
->HandleEcClockChanged
= FALSE
;
4913 static HRESULT WINAPI
MediaEvent_RestoreDefaultHandling(IMediaEventEx
*iface
, LONG lEvCode
)
4915 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4917 TRACE("(%p/%p)->(%d)\n", This
, iface
, lEvCode
);
4919 if (lEvCode
== EC_COMPLETE
)
4920 This
->HandleEcComplete
= TRUE
;
4921 else if (lEvCode
== EC_REPAINT
)
4922 This
->HandleEcRepaint
= TRUE
;
4923 else if (lEvCode
== EC_CLOCK_CHANGED
)
4924 This
->HandleEcClockChanged
= TRUE
;
4931 static HRESULT WINAPI
MediaEvent_FreeEventParams(IMediaEventEx
*iface
, LONG lEvCode
,
4932 LONG_PTR lParam1
, LONG_PTR lParam2
)
4934 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4936 TRACE("(%p/%p)->(%d, %08lx, %08lx): stub !!!\n", This
, iface
, lEvCode
, lParam1
, lParam2
);
4941 /*** IMediaEventEx methods ***/
4942 static HRESULT WINAPI
MediaEvent_SetNotifyWindow(IMediaEventEx
*iface
, OAHWND hwnd
, LONG lMsg
,
4943 LONG_PTR lInstanceData
)
4945 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4947 TRACE("(%p/%p)->(%08lx, %d, %08lx)\n", This
, iface
, hwnd
, lMsg
, lInstanceData
);
4949 This
->notif
.hWnd
= (HWND
)hwnd
;
4950 This
->notif
.msg
= lMsg
;
4951 This
->notif
.instance
= lInstanceData
;
4956 static HRESULT WINAPI
MediaEvent_SetNotifyFlags(IMediaEventEx
*iface
, LONG lNoNotifyFlags
)
4958 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4960 TRACE("(%p/%p)->(%d)\n", This
, iface
, lNoNotifyFlags
);
4962 if ((lNoNotifyFlags
!= 0) && (lNoNotifyFlags
!= 1))
4963 return E_INVALIDARG
;
4965 This
->notif
.disabled
= lNoNotifyFlags
;
4970 static HRESULT WINAPI
MediaEvent_GetNotifyFlags(IMediaEventEx
*iface
, LONG
*lplNoNotifyFlags
)
4972 IFilterGraphImpl
*This
= impl_from_IMediaEventEx(iface
);
4974 TRACE("(%p/%p)->(%p)\n", This
, iface
, lplNoNotifyFlags
);
4976 if (!lplNoNotifyFlags
)
4979 *lplNoNotifyFlags
= This
->notif
.disabled
;
4985 static const IMediaEventExVtbl IMediaEventEx_VTable
=
4987 MediaEvent_QueryInterface
,
4990 MediaEvent_GetTypeInfoCount
,
4991 MediaEvent_GetTypeInfo
,
4992 MediaEvent_GetIDsOfNames
,
4994 MediaEvent_GetEventHandle
,
4995 MediaEvent_GetEvent
,
4996 MediaEvent_WaitForCompletion
,
4997 MediaEvent_CancelDefaultHandling
,
4998 MediaEvent_RestoreDefaultHandling
,
4999 MediaEvent_FreeEventParams
,
5000 MediaEvent_SetNotifyWindow
,
5001 MediaEvent_SetNotifyFlags
,
5002 MediaEvent_GetNotifyFlags
5006 static inline IFilterGraphImpl
*impl_from_IMediaFilter(IMediaFilter
*iface
)
5008 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaFilter_iface
);
5011 static HRESULT WINAPI
MediaFilter_QueryInterface(IMediaFilter
*iface
, REFIID riid
, void **ppv
)
5013 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5015 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5018 static ULONG WINAPI
MediaFilter_AddRef(IMediaFilter
*iface
)
5020 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5022 return Filtergraph_AddRef(This
);
5025 static ULONG WINAPI
MediaFilter_Release(IMediaFilter
*iface
)
5027 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5029 return Filtergraph_Release(This
);
5032 static HRESULT WINAPI
MediaFilter_GetClassID(IMediaFilter
*iface
, CLSID
* pClassID
)
5034 FIXME("(%p): stub\n", pClassID
);
5039 static HRESULT WINAPI
MediaFilter_Stop(IMediaFilter
*iface
)
5041 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5043 return MediaControl_Stop(&This
->IMediaControl_iface
);
5046 static HRESULT WINAPI
MediaFilter_Pause(IMediaFilter
*iface
)
5048 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5050 return MediaControl_Pause(&This
->IMediaControl_iface
);
5053 static HRESULT WINAPI
MediaFilter_Run(IMediaFilter
*iface
, REFERENCE_TIME tStart
)
5055 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5058 FIXME("Run called with non-null tStart: %x%08x\n",
5059 (int)(tStart
>>32), (int)tStart
);
5061 return MediaControl_Run(&This
->IMediaControl_iface
);
5064 static HRESULT WINAPI
MediaFilter_GetState(IMediaFilter
*iface
, DWORD dwMsTimeout
,
5065 FILTER_STATE
*pState
)
5067 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5069 return MediaControl_GetState(&This
->IMediaControl_iface
, dwMsTimeout
, (OAFilterState
*)pState
);
5072 static HRESULT WINAPI
MediaFilter_SetSyncSource(IMediaFilter
*iface
, IReferenceClock
*pClock
)
5074 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5078 TRACE("(%p/%p)->(%p)\n", iface
, This
, pClock
);
5080 EnterCriticalSection(&This
->cs
);
5082 for (i
= 0;i
< This
->nFilters
;i
++)
5084 hr
= IBaseFilter_SetSyncSource(This
->ppFiltersInGraph
[i
], pClock
);
5092 IBaseFilter_SetSyncSource(This
->ppFiltersInGraph
[i
], This
->refClock
);
5097 IReferenceClock_Release(This
->refClock
);
5098 This
->refClock
= pClock
;
5100 IReferenceClock_AddRef(This
->refClock
);
5101 This
->defaultclock
= FALSE
;
5103 if (This
->HandleEcClockChanged
)
5105 IMediaEventSink
*pEventSink
;
5108 eshr
= IMediaFilter_QueryInterface(iface
, &IID_IMediaEventSink
, (LPVOID
)&pEventSink
);
5109 if (SUCCEEDED(eshr
))
5111 IMediaEventSink_Notify(pEventSink
, EC_CLOCK_CHANGED
, 0, 0);
5112 IMediaEventSink_Release(pEventSink
);
5117 LeaveCriticalSection(&This
->cs
);
5122 static HRESULT WINAPI
MediaFilter_GetSyncSource(IMediaFilter
*iface
, IReferenceClock
**ppClock
)
5124 IFilterGraphImpl
*This
= impl_from_IMediaFilter(iface
);
5126 TRACE("(%p/%p)->(%p)\n", iface
, This
, ppClock
);
5131 EnterCriticalSection(&This
->cs
);
5133 *ppClock
= This
->refClock
;
5135 IReferenceClock_AddRef(*ppClock
);
5137 LeaveCriticalSection(&This
->cs
);
5142 static const IMediaFilterVtbl IMediaFilter_VTable
=
5144 MediaFilter_QueryInterface
,
5146 MediaFilter_Release
,
5147 MediaFilter_GetClassID
,
5151 MediaFilter_GetState
,
5152 MediaFilter_SetSyncSource
,
5153 MediaFilter_GetSyncSource
5156 static inline IFilterGraphImpl
*impl_from_IMediaEventSink(IMediaEventSink
*iface
)
5158 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IMediaEventSink_iface
);
5161 static HRESULT WINAPI
MediaEventSink_QueryInterface(IMediaEventSink
*iface
, REFIID riid
, void **ppv
)
5163 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5165 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5168 static ULONG WINAPI
MediaEventSink_AddRef(IMediaEventSink
*iface
)
5170 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5172 return Filtergraph_AddRef(This
);
5175 static ULONG WINAPI
MediaEventSink_Release(IMediaEventSink
*iface
)
5177 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5179 return Filtergraph_Release(This
);
5182 static HRESULT WINAPI
MediaEventSink_Notify(IMediaEventSink
*iface
, LONG EventCode
,
5183 LONG_PTR EventParam1
, LONG_PTR EventParam2
)
5185 IFilterGraphImpl
*This
= impl_from_IMediaEventSink(iface
);
5188 TRACE("(%p/%p)->(%d, %ld, %ld)\n", This
, iface
, EventCode
, EventParam1
, EventParam2
);
5190 /* We need thread safety here, let's use the events queue's one */
5191 EnterCriticalSection(&This
->evqueue
.msg_crst
);
5193 if ((EventCode
== EC_COMPLETE
) && This
->HandleEcComplete
)
5195 TRACE("Process EC_COMPLETE notification\n");
5196 if (++This
->EcCompleteCount
== This
->nRenderers
)
5198 evt
.lEventCode
= EC_COMPLETE
;
5201 TRACE("Send EC_COMPLETE to app\n");
5202 EventsQueue_PutEvent(&This
->evqueue
, &evt
);
5203 if (!This
->notif
.disabled
&& This
->notif
.hWnd
)
5205 TRACE("Send Window message\n");
5206 PostMessageW(This
->notif
.hWnd
, This
->notif
.msg
, 0, This
->notif
.instance
);
5208 This
->CompletionStatus
= EC_COMPLETE
;
5209 SetEvent(This
->hEventCompletion
);
5212 else if ((EventCode
== EC_REPAINT
) && This
->HandleEcRepaint
)
5214 /* FIXME: Not handled yet */
5218 evt
.lEventCode
= EventCode
;
5219 evt
.lParam1
= EventParam1
;
5220 evt
.lParam2
= EventParam2
;
5221 EventsQueue_PutEvent(&This
->evqueue
, &evt
);
5222 if (!This
->notif
.disabled
&& This
->notif
.hWnd
)
5223 PostMessageW(This
->notif
.hWnd
, This
->notif
.msg
, 0, This
->notif
.instance
);
5226 LeaveCriticalSection(&This
->evqueue
.msg_crst
);
5230 static const IMediaEventSinkVtbl IMediaEventSink_VTable
=
5232 MediaEventSink_QueryInterface
,
5233 MediaEventSink_AddRef
,
5234 MediaEventSink_Release
,
5235 MediaEventSink_Notify
5238 static inline IFilterGraphImpl
*impl_from_IGraphConfig(IGraphConfig
*iface
)
5240 return CONTAINING_RECORD(iface
, IFilterGraphImpl
, IGraphConfig_iface
);
5243 static HRESULT WINAPI
GraphConfig_QueryInterface(IGraphConfig
*iface
, REFIID riid
, void **ppv
)
5245 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5247 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5250 static ULONG WINAPI
GraphConfig_AddRef(IGraphConfig
*iface
)
5252 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5254 return Filtergraph_AddRef(This
);
5257 static ULONG WINAPI
GraphConfig_Release(IGraphConfig
*iface
)
5259 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5261 return Filtergraph_Release(This
);
5264 static HRESULT WINAPI
GraphConfig_Reconnect(IGraphConfig
*iface
, IPin
*pOutputPin
, IPin
*pInputPin
,
5265 const AM_MEDIA_TYPE
*pmtFirstConnection
, IBaseFilter
*pUsingFilter
, HANDLE hAbortEvent
,
5268 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5270 FIXME("(%p)->(%p, %p, %p, %p, %p, %x): stub!\n", This
, pOutputPin
, pInputPin
, pmtFirstConnection
, pUsingFilter
, hAbortEvent
, dwFlags
);
5275 static HRESULT WINAPI
GraphConfig_Reconfigure(IGraphConfig
*iface
, IGraphConfigCallback
*pCallback
,
5276 void *pvContext
, DWORD dwFlags
, HANDLE hAbortEvent
)
5278 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5281 WARN("(%p)->(%p, %p, %x, %p): partial stub!\n", This
, pCallback
, pvContext
, dwFlags
, hAbortEvent
);
5284 FIXME("The parameter hAbortEvent is not handled!\n");
5286 EnterCriticalSection(&This
->cs
);
5288 hr
= IGraphConfigCallback_Reconfigure(pCallback
, pvContext
, dwFlags
);
5290 LeaveCriticalSection(&This
->cs
);
5295 static HRESULT WINAPI
GraphConfig_AddFilterToCache(IGraphConfig
*iface
, IBaseFilter
*pFilter
)
5297 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5299 FIXME("(%p)->(%p): stub!\n", This
, pFilter
);
5304 static HRESULT WINAPI
GraphConfig_EnumCacheFilter(IGraphConfig
*iface
, IEnumFilters
**pEnum
)
5306 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5308 FIXME("(%p)->(%p): stub!\n", This
, pEnum
);
5313 static HRESULT WINAPI
GraphConfig_RemoveFilterFromCache(IGraphConfig
*iface
, IBaseFilter
*pFilter
)
5315 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5317 FIXME("(%p)->(%p): stub!\n", This
, pFilter
);
5322 static HRESULT WINAPI
GraphConfig_GetStartTime(IGraphConfig
*iface
, REFERENCE_TIME
*prtStart
)
5324 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5326 FIXME("(%p)->(%p): stub!\n", This
, prtStart
);
5331 static HRESULT WINAPI
GraphConfig_PushThroughData(IGraphConfig
*iface
, IPin
*pOutputPin
,
5332 IPinConnection
*pConnection
, HANDLE hEventAbort
)
5334 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5336 FIXME("(%p)->(%p, %p, %p): stub!\n", This
, pOutputPin
, pConnection
, hEventAbort
);
5341 static HRESULT WINAPI
GraphConfig_SetFilterFlags(IGraphConfig
*iface
, IBaseFilter
*pFilter
,
5344 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5346 FIXME("(%p)->(%p, %x): stub!\n", This
, pFilter
, dwFlags
);
5351 static HRESULT WINAPI
GraphConfig_GetFilterFlags(IGraphConfig
*iface
, IBaseFilter
*pFilter
,
5354 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5356 FIXME("(%p)->(%p, %p): stub!\n", This
, pFilter
, dwFlags
);
5361 static HRESULT WINAPI
GraphConfig_RemoveFilterEx(IGraphConfig
*iface
, IBaseFilter
*pFilter
,
5364 IFilterGraphImpl
*This
= impl_from_IGraphConfig(iface
);
5366 FIXME("(%p)->(%p, %x): stub!\n", This
, pFilter
, dwFlags
);
5371 static const IGraphConfigVtbl IGraphConfig_VTable
=
5373 GraphConfig_QueryInterface
,
5375 GraphConfig_Release
,
5376 GraphConfig_Reconnect
,
5377 GraphConfig_Reconfigure
,
5378 GraphConfig_AddFilterToCache
,
5379 GraphConfig_EnumCacheFilter
,
5380 GraphConfig_RemoveFilterFromCache
,
5381 GraphConfig_GetStartTime
,
5382 GraphConfig_PushThroughData
,
5383 GraphConfig_SetFilterFlags
,
5384 GraphConfig_GetFilterFlags
,
5385 GraphConfig_RemoveFilterEx
5388 static const IUnknownVtbl IInner_VTable
=
5390 FilterGraphInner_QueryInterface
,
5391 FilterGraphInner_AddRef
,
5392 FilterGraphInner_Release
5395 static HRESULT
Filtergraph_QueryInterface(IFilterGraphImpl
*This
,
5398 if (This
->bAggregatable
)
5399 This
->bUnkOuterValid
= TRUE
;
5401 if (This
->pUnkOuter
)
5403 if (This
->bAggregatable
)
5404 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
5406 if (IsEqualIID(riid
, &IID_IUnknown
))
5410 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
5411 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
5412 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
5413 This
->bAggregatable
= TRUE
;
5418 return E_NOINTERFACE
;
5421 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
5424 static ULONG
Filtergraph_AddRef(IFilterGraphImpl
*This
) {
5425 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
5426 return IUnknown_AddRef(This
->pUnkOuter
);
5427 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
5430 static ULONG
Filtergraph_Release(IFilterGraphImpl
*This
) {
5431 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
5432 return IUnknown_Release(This
->pUnkOuter
);
5433 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
5436 /* This is the only function that actually creates a FilterGraph class... */
5437 HRESULT
FilterGraph_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
5439 IFilterGraphImpl
*fimpl
;
5442 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
5446 fimpl
= CoTaskMemAlloc(sizeof(*fimpl
));
5447 fimpl
->pUnkOuter
= pUnkOuter
;
5448 fimpl
->bUnkOuterValid
= FALSE
;
5449 fimpl
->bAggregatable
= FALSE
;
5450 fimpl
->defaultclock
= TRUE
;
5451 fimpl
->IInner_vtbl
= &IInner_VTable
;
5452 fimpl
->IFilterGraph2_iface
.lpVtbl
= &IFilterGraph2_VTable
;
5453 fimpl
->IMediaControl_iface
.lpVtbl
= &IMediaControl_VTable
;
5454 fimpl
->IMediaSeeking_iface
.lpVtbl
= &IMediaSeeking_VTable
;
5455 fimpl
->IBasicAudio_iface
.lpVtbl
= &IBasicAudio_VTable
;
5456 fimpl
->IBasicVideo2_iface
.lpVtbl
= &IBasicVideo_VTable
;
5457 fimpl
->IVideoWindow_iface
.lpVtbl
= &IVideoWindow_VTable
;
5458 fimpl
->IMediaEventEx_iface
.lpVtbl
= &IMediaEventEx_VTable
;
5459 fimpl
->IMediaFilter_iface
.lpVtbl
= &IMediaFilter_VTable
;
5460 fimpl
->IMediaEventSink_iface
.lpVtbl
= &IMediaEventSink_VTable
;
5461 fimpl
->IGraphConfig_iface
.lpVtbl
= &IGraphConfig_VTable
;
5462 fimpl
->IMediaPosition_iface
.lpVtbl
= &IMediaPosition_VTable
;
5464 fimpl
->ppFiltersInGraph
= NULL
;
5465 fimpl
->pFilterNames
= NULL
;
5466 fimpl
->nFilters
= 0;
5467 fimpl
->filterCapacity
= 0;
5468 fimpl
->nameIndex
= 1;
5469 fimpl
->refClock
= NULL
;
5470 fimpl
->hEventCompletion
= CreateEventW(0, TRUE
, FALSE
, 0);
5471 fimpl
->HandleEcComplete
= TRUE
;
5472 fimpl
->HandleEcRepaint
= TRUE
;
5473 fimpl
->HandleEcClockChanged
= TRUE
;
5474 fimpl
->notif
.hWnd
= 0;
5475 fimpl
->notif
.disabled
= FALSE
;
5476 fimpl
->nRenderers
= 0;
5477 fimpl
->EcCompleteCount
= 0;
5478 fimpl
->refClockProvider
= NULL
;
5479 fimpl
->state
= State_Stopped
;
5480 EventsQueue_Init(&fimpl
->evqueue
);
5481 InitializeCriticalSection(&fimpl
->cs
);
5482 fimpl
->cs
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": IFilterGraphImpl.cs");
5483 fimpl
->nItfCacheEntries
= 0;
5484 memcpy(&fimpl
->timeformatseek
, &TIME_FORMAT_MEDIA_TIME
, sizeof(GUID
));
5485 fimpl
->start_time
= fimpl
->pause_time
= 0;
5486 fimpl
->stop_position
= -1;
5487 fimpl
->punkFilterMapper2
= NULL
;
5488 fimpl
->recursioncount
= 0;
5490 /* create Filtermapper aggregated. */
5491 hr
= CoCreateInstance(&CLSID_FilterMapper2
, pUnkOuter
? pUnkOuter
: (IUnknown
*)&fimpl
->IInner_vtbl
, CLSCTX_INPROC_SERVER
,
5492 &IID_IUnknown
, (LPVOID
*)&fimpl
->punkFilterMapper2
);
5494 if (SUCCEEDED(hr
)) {
5495 hr
= IUnknown_QueryInterface(fimpl
->punkFilterMapper2
, &IID_IFilterMapper2
, (LPVOID
*)&fimpl
->pFilterMapper2
);
5498 if (SUCCEEDED(hr
)) {
5499 /* Release controlling IUnknown - compensate refcount increase from caching IFilterMapper2 interface. */
5500 if (pUnkOuter
) IUnknown_Release(pUnkOuter
);
5501 else IUnknown_Release((IUnknown
*)&fimpl
->IInner_vtbl
);
5505 ERR("Unable to create filter mapper (%x)\n", hr
);
5506 if (fimpl
->punkFilterMapper2
) IUnknown_Release(fimpl
->punkFilterMapper2
);
5507 CloseHandle(fimpl
->hEventCompletion
);
5508 EventsQueue_Destroy(&fimpl
->evqueue
);
5509 fimpl
->cs
.DebugInfo
->Spare
[0] = 0;
5510 DeleteCriticalSection(&fimpl
->cs
);
5511 CoTaskMemFree(fimpl
);
5519 HRESULT
FilterGraphNoThread_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
5521 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
5522 return FilterGraph_create(pUnkOuter
, ppObj
);