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 long msg; /* User window message */
50 long 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 = HeapReAlloc(GetProcessHeap(),0,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 const IFilterGraph2Vtbl *IFilterGraph2_vtbl;
156 const IMediaControlVtbl *IMediaControl_vtbl;
157 const IMediaSeekingVtbl *IMediaSeeking_vtbl;
158 const IBasicAudioVtbl *IBasicAudio_vtbl;
159 const IBasicVideoVtbl *IBasicVideo_vtbl;
160 const IVideoWindowVtbl *IVideoWindow_vtbl;
161 const IMediaEventExVtbl *IMediaEventEx_vtbl;
162 const IMediaFilterVtbl *IMediaFilter_vtbl;
163 const IMediaEventSinkVtbl *IMediaEventSink_vtbl;
164 const IGraphConfigVtbl *IGraphConfig_vtbl;
165 const IMediaPositionVtbl *IMediaPosition_vtbl;
166 const IUnknownVtbl * IInner_vtbl;
167 /* IAMGraphStreams */
174 /* IRegisterServiceProvider */
175 /* IResourceMananger */
176 /* IServiceProvider */
177 /* IVideoFrameStep */
180 IFilterMapper2 * pFilterMapper2;
181 IBaseFilter ** ppFiltersInGraph;
182 LPWSTR * pFilterNames;
186 IReferenceClock *refClock;
188 HANDLE hEventCompletion;
189 int CompletionStatus;
193 int HandleEcComplete;
195 int HandleEcClockChanged;
198 ITF_CACHE_ENTRY ItfCacheEntries[MAX_ITF_CACHE_ENTRIES];
199 int nItfCacheEntries;
200 IUnknown * pUnkOuter;
206 LONGLONG stop_position;
209 static HRESULT WINAPI Filtergraph_QueryInterface(IFilterGraphImpl *This,
210 REFIID riid, LPVOID * ppv);
211 static ULONG WINAPI Filtergraph_AddRef(IFilterGraphImpl *This);
212 static ULONG WINAPI Filtergraph_Release(IFilterGraphImpl *This);
214 static HRESULT WINAPI FilterGraphInner_QueryInterface(IUnknown * iface,
217 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
218 TRACE("(%p)->(%s (%p), %p)\n", This, debugstr_guid(riid), riid, ppvObj);
220 if (This->bAggregatable)
221 This->bUnkOuterValid = TRUE;
223 if (IsEqualGUID(&IID_IUnknown, riid)) {
224 *ppvObj = &(This->IInner_vtbl);
225 TRACE(" returning IUnknown interface (%p)\n", *ppvObj);
226 } else if (IsEqualGUID(&IID_IFilterGraph, riid) ||
227 IsEqualGUID(&IID_IFilterGraph2, riid) ||
228 IsEqualGUID(&IID_IGraphBuilder, riid)) {
229 *ppvObj = &(This->IFilterGraph2_vtbl);
230 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj);
231 } else if (IsEqualGUID(&IID_IMediaControl, riid)) {
232 *ppvObj = &(This->IMediaControl_vtbl);
233 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj);
234 } else if (IsEqualGUID(&IID_IMediaSeeking, riid)) {
235 *ppvObj = &(This->IMediaSeeking_vtbl);
236 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj);
237 } else if (IsEqualGUID(&IID_IBasicAudio, riid)) {
238 *ppvObj = &(This->IBasicAudio_vtbl);
239 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj);
240 } else if (IsEqualGUID(&IID_IBasicVideo, riid)) {
241 *ppvObj = &(This->IBasicVideo_vtbl);
242 TRACE(" returning IBasicVideo interface (%p)\n", *ppvObj);
243 } else if (IsEqualGUID(&IID_IVideoWindow, riid)) {
244 *ppvObj = &(This->IVideoWindow_vtbl);
245 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj);
246 } else if (IsEqualGUID(&IID_IMediaEvent, riid) ||
247 IsEqualGUID(&IID_IMediaEventEx, riid)) {
248 *ppvObj = &(This->IMediaEventEx_vtbl);
249 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj);
250 } else if (IsEqualGUID(&IID_IMediaFilter, riid) ||
251 IsEqualGUID(&IID_IPersist, riid)) {
252 *ppvObj = &(This->IMediaFilter_vtbl);
253 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj);
254 } else if (IsEqualGUID(&IID_IMediaEventSink, riid)) {
255 *ppvObj = &(This->IMediaEventSink_vtbl);
256 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj);
257 } else if (IsEqualGUID(&IID_IGraphConfig, riid)) {
258 *ppvObj = &(This->IGraphConfig_vtbl);
259 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj);
260 } else if (IsEqualGUID(&IID_IMediaPosition, riid)) {
261 *ppvObj = &(This->IMediaPosition_vtbl);
262 TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj);
265 FIXME("unknown interface %s\n", debugstr_guid(riid));
266 return E_NOINTERFACE;
269 IUnknown_AddRef((IUnknown *)(*ppvObj));
273 static ULONG WINAPI FilterGraphInner_AddRef(IUnknown * iface) {
274 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
275 ULONG ref = InterlockedIncrement(&This->ref);
277 TRACE("(%p)->(): new ref = %d\n", This, ref);
282 static ULONG WINAPI FilterGraphInner_Release(IUnknown * iface) {
283 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
284 ULONG ref = InterlockedDecrement(&This->ref);
286 TRACE("(%p)->(): new ref = %d\n", This, ref);
291 IMediaControl_Stop((IMediaControl*)&(This->IMediaControl_vtbl));
293 IReferenceClock_Release(This->refClock);
295 while (This->nFilters)
296 IFilterGraph2_RemoveFilter((IFilterGraph2*)This, This->ppFiltersInGraph[0]);
298 for (i = 0; i < This->nItfCacheEntries; i++)
300 if (This->ItfCacheEntries[i].iface)
301 IUnknown_Release(This->ItfCacheEntries[i].iface);
303 IFilterMapper2_Release(This->pFilterMapper2);
304 CloseHandle(This->hEventCompletion);
305 EventsQueue_Destroy(&This->evqueue);
306 This->cs.DebugInfo->Spare[0] = 0;
307 DeleteCriticalSection(&This->cs);
308 CoTaskMemFree(This->ppFiltersInGraph);
309 CoTaskMemFree(This->pFilterNames);
316 /*** IUnknown methods ***/
317 static HRESULT WINAPI FilterGraph2_QueryInterface(IFilterGraph2 *iface,
320 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
322 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
323 return Filtergraph_QueryInterface(This, riid, ppvObj);
326 static ULONG WINAPI FilterGraph2_AddRef(IFilterGraph2 *iface) {
327 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
329 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This, iface);
331 return Filtergraph_AddRef(This);
334 static ULONG WINAPI FilterGraph2_Release(IFilterGraph2 *iface) {
335 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
337 TRACE("(%p/%p)->() calling FilterGraph Release\n", This, iface);
339 return Filtergraph_Release(This);
342 /*** IFilterGraph methods ***/
343 static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface,
344 IBaseFilter *pFilter,
346 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
349 WCHAR* wszFilterName = NULL;
350 int duplicate_name = FALSE;
352 TRACE("(%p/%p)->(%p, %s (%p))\n", This, iface, pFilter, debugstr_w(pName), pName);
357 wszFilterName = CoTaskMemAlloc( (pName ? strlenW(pName) + 6 : 5) * sizeof(WCHAR) );
361 /* Check if name already exists */
362 for(i = 0; i < This->nFilters; i++)
363 if (!strcmpW(This->pFilterNames[i], pName))
365 duplicate_name = TRUE;
370 /* If no name given or name already existing, generate one */
371 if (!pName || duplicate_name)
373 static const WCHAR wszFmt1[] = {'%','s',' ','%','0','4','d',0};
374 static const WCHAR wszFmt2[] = {'%','0','4','d',0};
376 for (j = 0; j < 10000 ; j++)
380 sprintfW(wszFilterName, wszFmt1, pName, This->nameIndex);
382 sprintfW(wszFilterName, wszFmt2, This->nameIndex);
383 TRACE("Generated name %s\n", debugstr_w(wszFilterName));
385 /* Check if the generated name already exists */
386 for(i = 0; i < This->nFilters; i++)
387 if (!strcmpW(This->pFilterNames[i], wszFilterName))
390 /* Compute next index and exit if generated name is suitable */
391 if (This->nameIndex++ == 10000)
393 if (i == This->nFilters)
396 /* Unable to find a suitable name */
399 CoTaskMemFree(wszFilterName);
400 return VFW_E_DUPLICATE_NAME;
404 memcpy(wszFilterName, pName, (strlenW(pName) + 1) * sizeof(WCHAR));
406 if (This->nFilters + 1 > This->filterCapacity)
408 int newCapacity = This->filterCapacity ? 2 * This->filterCapacity : 1;
409 IBaseFilter ** ppNewFilters = CoTaskMemAlloc(newCapacity * sizeof(IBaseFilter*));
410 LPWSTR * pNewNames = CoTaskMemAlloc(newCapacity * sizeof(LPWSTR));
411 memcpy(ppNewFilters, This->ppFiltersInGraph, This->nFilters * sizeof(IBaseFilter*));
412 memcpy(pNewNames, This->pFilterNames, This->nFilters * sizeof(LPWSTR));
413 if (This->filterCapacity)
415 CoTaskMemFree(This->ppFiltersInGraph);
416 CoTaskMemFree(This->pFilterNames);
418 This->ppFiltersInGraph = ppNewFilters;
419 This->pFilterNames = pNewNames;
420 This->filterCapacity = newCapacity;
423 hr = IBaseFilter_JoinFilterGraph(pFilter, (IFilterGraph *)This, wszFilterName);
427 IBaseFilter_AddRef(pFilter);
428 This->ppFiltersInGraph[This->nFilters] = pFilter;
429 This->pFilterNames[This->nFilters] = wszFilterName;
431 IBaseFilter_SetSyncSource(pFilter, This->refClock);
434 CoTaskMemFree(wszFilterName);
436 if (SUCCEEDED(hr) && duplicate_name)
437 return VFW_S_DUPLICATE_NAME;
442 static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface,
443 IBaseFilter *pFilter) {
444 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
448 TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
450 /* FIXME: check graph is stopped */
452 for (i = 0; i < This->nFilters; i++)
454 if (This->ppFiltersInGraph[i] == pFilter)
456 IEnumPins *penumpins;
457 IBaseFilter_Stop(pFilter);
458 hr = IBaseFilter_EnumPins(pFilter, &penumpins);
461 while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK) {
464 IPin_ConnectedTo(ppin, &victim);
467 h = IPin_Disconnect(victim);
468 TRACE("Disconnect other side: %08x\n", h);
469 if (h == VFW_E_NOT_STOPPED)
472 IPin_QueryPinInfo(victim, &pinfo);
473 IBaseFilter_Stop(pinfo.pFilter);
474 IBaseFilter_Release(pinfo.pFilter);
475 h = IPin_Disconnect(victim);
476 TRACE("Disconnect retry: %08x\n", h);
478 IPin_Release(victim);
480 h = IPin_Disconnect(ppin);
481 TRACE("Disconnect 2: %08x\n", h);
483 IEnumPins_Release(penumpins);
486 hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, This->pFilterNames[i]);
489 IBaseFilter_SetSyncSource(pFilter, NULL);
490 IBaseFilter_Release(pFilter);
491 CoTaskMemFree(This->pFilterNames[i]);
492 memmove(This->ppFiltersInGraph+i, This->ppFiltersInGraph+i+1, sizeof(IBaseFilter*)*(This->nFilters - 1 - i));
493 memmove(This->pFilterNames+i, This->pFilterNames+i+1, sizeof(LPWSTR)*(This->nFilters - 1 - i));
495 /* Invalidate interfaces in the cache */
496 for (i = 0; i < This->nItfCacheEntries; i++)
497 if (pFilter == This->ItfCacheEntries[i].filter)
499 IUnknown_Release(This->ItfCacheEntries[i].iface);
500 This->ItfCacheEntries[i].iface = NULL;
501 This->ItfCacheEntries[i].filter = NULL;
509 return hr; /* FIXME: check this error code */
512 static HRESULT WINAPI FilterGraph2_EnumFilters(IFilterGraph2 *iface,
513 IEnumFilters **ppEnum) {
514 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
516 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
518 return IEnumFiltersImpl_Construct(This->ppFiltersInGraph, This->nFilters, ppEnum);
521 static HRESULT WINAPI FilterGraph2_FindFilterByName(IFilterGraph2 *iface,
523 IBaseFilter **ppFilter) {
524 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
527 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_w(pName), pName, ppFilter);
532 for (i = 0; i < This->nFilters; i++)
534 if (!strcmpW(pName, This->pFilterNames[i]))
536 *ppFilter = This->ppFiltersInGraph[i];
537 IBaseFilter_AddRef(*ppFilter);
543 return VFW_E_NOT_FOUND;
546 /* NOTE: despite the implication, it doesn't matter which
547 * way round you put in the input and output pins */
548 static HRESULT WINAPI FilterGraph2_ConnectDirect(IFilterGraph2 *iface,
551 const AM_MEDIA_TYPE *pmt) {
555 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
557 TRACE("(%p/%p)->(%p, %p, %p)\n", This, iface, ppinIn, ppinOut, pmt);
559 /* FIXME: check pins are in graph */
561 if (TRACE_ON(quartz))
565 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
569 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
570 IBaseFilter_Release(PinInfo.pFilter);
572 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
576 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
577 IBaseFilter_Release(PinInfo.pFilter);
580 hr = IPin_QueryDirection(ppinIn, &dir);
583 if (dir == PINDIR_INPUT)
584 hr = IPin_Connect(ppinOut, ppinIn, pmt);
586 hr = IPin_Connect(ppinIn, ppinOut, pmt);
592 static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface,
594 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
595 IPin *pConnectedTo = NULL;
597 PIN_DIRECTION pindir;
599 IPin_QueryDirection(ppin, &pindir);
600 hr = IPin_ConnectedTo(ppin, &pConnectedTo);
602 TRACE("Querying connected to failed: %x\n", hr);
605 IPin_Disconnect(ppin);
606 IPin_Disconnect(pConnectedTo);
607 if (pindir == PINDIR_INPUT)
608 hr = IPin_Connect(pConnectedTo, ppin, NULL);
610 hr = IPin_Connect(ppin, pConnectedTo, NULL);
611 IPin_Release(pConnectedTo);
613 ERR("Reconnecting pins failed, pins are not connected now..\n");
614 TRACE("(%p->%p) -- %p %p -> %x\n", iface, This, ppin, pConnectedTo, hr);
618 static HRESULT WINAPI FilterGraph2_Disconnect(IFilterGraph2 *iface,
620 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
622 TRACE("(%p/%p)->(%p)\n", This, iface, ppin);
624 return IPin_Disconnect(ppin);
627 static HRESULT WINAPI FilterGraph2_SetDefaultSyncSource(IFilterGraph2 *iface) {
628 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
629 IReferenceClock *pClock = NULL;
632 TRACE("(%p/%p)->() semi-stub\n", iface, This);
634 hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, &IID_IReferenceClock, (LPVOID*)&pClock);
638 hr = IMediaFilter_SetSyncSource((IMediaFilter*)&(This->IMediaFilter_vtbl), pClock);
639 IReferenceClock_Release(pClock);
645 static HRESULT GetFilterInfo(IMoniker* pMoniker, GUID* pclsid, VARIANT* pvar)
647 static const WCHAR wszClsidName[] = {'C','L','S','I','D',0};
648 static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
649 IPropertyBag * pPropBagCat = NULL;
653 V_VT(pvar) = VT_BSTR;
655 hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
658 hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL);
661 hr = CLSIDFromString(V_UNION(pvar, bstrVal), pclsid);
664 hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL);
667 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid), debugstr_w(V_UNION(pvar, bstrVal)));
670 IPropertyBag_Release(pPropBagCat);
675 static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPin*** pppins, ULONG* pnb)
680 TRACE("(%p, %p, %p, %p)\n", pfilter, pinputpin, pppins, pnb);
681 hr = IPin_QueryInternalConnections(pinputpin, NULL, &nb);
684 } else if (hr == S_FALSE) {
685 *pppins = CoTaskMemAlloc(sizeof(IPin*)*nb);
686 hr = IPin_QueryInternalConnections(pinputpin, *pppins, &nb);
688 ERR("Error (%x)\n", hr);
690 } else if (hr == E_NOTIMPL) {
691 /* Input connected to all outputs */
692 IEnumPins* penumpins;
695 TRACE("E_NOTIMPL\n");
696 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
698 ERR("filter Enumpins failed (%x)\n", hr);
702 /* Count output pins */
703 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
704 PIN_DIRECTION pindir;
705 IPin_QueryDirection(ppin, &pindir);
706 if (pindir == PINDIR_OUTPUT)
710 *pppins = CoTaskMemAlloc(sizeof(IPin*)*i);
711 /* Retrieve output pins */
712 IEnumPins_Reset(penumpins);
714 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
715 PIN_DIRECTION pindir;
716 IPin_QueryDirection(ppin, &pindir);
717 if (pindir == PINDIR_OUTPUT)
718 (*pppins)[i++] = ppin;
722 IEnumPins_Release(penumpins);
725 ERR("Next failed (%x)\n", hr);
728 } else if (FAILED(hr)) {
729 ERR("Cannot get internal connection (%x)\n", hr);
737 /*** IGraphBuilder methods ***/
738 static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface,
741 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
744 IEnumMediaTypes* penummt;
746 IEnumPins* penumpins;
747 IEnumMoniker* pEnumMoniker;
755 TRACE("(%p/%p)->(%p, %p)\n", This, iface, ppinOut, ppinIn);
757 if (TRACE_ON(quartz))
759 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
763 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
764 IBaseFilter_Release(PinInfo.pFilter);
766 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
770 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
771 IBaseFilter_Release(PinInfo.pFilter);
774 /* Try direct connection first */
775 hr = IPin_Connect(ppinOut, ppinIn, NULL);
779 TRACE("Direct connection failed, trying to insert other filters\n");
781 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
785 hr = IBaseFilter_GetClassID(PinInfo.pFilter, &FilterCLSID);
786 IBaseFilter_Release(PinInfo.pFilter);
790 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
791 * filter to the minor mediatype of input pin of the renderer */
792 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
794 ERR("EnumMediaTypes (%x)\n", hr);
798 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
800 ERR("IEnumMediaTypes_Next (%x)\n", hr);
805 ERR("No media type found!\n");
808 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
809 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
811 /* Try to find a suitable filter that can connect to the pin to render */
812 tab[0] = mt->majortype;
813 tab[1] = mt->subtype;
814 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
816 ERR("Unable to enum filters (%x)\n", hr);
820 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
825 IPin* ppinfilter = NULL;
826 IBaseFilter* pfilter = NULL;
828 hr = GetFilterInfo(pMoniker, &clsid, &var);
829 IMoniker_Release(pMoniker);
831 ERR("Unable to retrieve filter info (%x)\n", hr);
835 if (IsEqualGUID(&clsid, &FilterCLSID)) {
836 /* Skip filter (same as the one the output pin belongs to) */
840 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
842 ERR("Unable to create filter (%x), trying next one\n", hr);
846 hr = IFilterGraph2_AddFilter(iface, pfilter, V_UNION(&var, bstrVal));
848 ERR("Unable to add filter (%x)\n", hr);
849 IBaseFilter_Release(pfilter);
854 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
856 ERR("Enumpins (%x)\n", hr);
860 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
861 IEnumPins_Release(penumpins);
864 ERR("Next (%x)\n", hr);
872 hr = IPin_Connect(ppinOut, ppinfilter, NULL);
874 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
877 TRACE("Successfully connected to filter, follow chain...\n");
879 /* Render all output pins of the filter by calling IFilterGraph2_Render on each of them */
880 hr = GetInternalConnections(pfilter, ppinfilter, &ppins, &nb);
885 IPin_Disconnect(ppinOut);
888 TRACE("pins to consider: %d\n", nb);
889 for(i = 0; i < nb; i++) {
890 TRACE("Processing pin %d\n", i);
891 hr = IFilterGraph2_Connect(iface, ppins[i], ppinIn);
893 TRACE("Cannot render pin %p (%x)\n", ppinfilter, hr);
895 IPin_Release(ppins[i]);
896 if (SUCCEEDED(hr)) break;
898 while (++i < nb) IPin_Release(ppins[i]);
899 CoTaskMemFree(ppins);
900 IPin_Release(ppinfilter);
901 IBaseFilter_Release(pfilter);
906 if (ppinfilter) IPin_Release(ppinfilter);
908 IFilterGraph2_RemoveFilter(iface, pfilter);
909 IBaseFilter_Release(pfilter);
913 IEnumMediaTypes_Release(penummt);
919 static HRESULT WINAPI FilterGraph2_Render(IFilterGraph2 *iface,
921 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
922 IEnumMediaTypes* penummt;
927 IEnumMoniker* pEnumMoniker;
932 TRACE("(%p/%p)->(%p)\n", This, iface, ppinOut);
934 if (TRACE_ON(quartz))
938 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
942 TRACE("Filter owning pin => %p\n", PinInfo.pFilter);
943 IBaseFilter_Release(PinInfo.pFilter);
946 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
948 ERR("EnumMediaTypes (%x)\n", hr);
954 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
956 ERR("IEnumMediaTypes_Next (%x)\n", hr);
961 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
962 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
964 /* Try to find a suitable renderer with the same media type */
965 tab[0] = mt->majortype;
967 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL);
969 ERR("Unable to enum filters (%x)\n", hr);
973 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
978 IBaseFilter* pfilter = NULL;
979 IEnumPins* penumpins;
982 hr = GetFilterInfo(pMoniker, &clsid, &var);
983 IMoniker_Release(pMoniker);
985 ERR("Unable to retrieve filter info (%x)\n", hr);
989 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
991 ERR("Unable to create filter (%x), trying next one\n", hr);
995 hr = IFilterGraph2_AddFilter(iface, pfilter, V_UNION(&var, bstrVal));
997 ERR("Unable to add filter (%x)\n", hr);
998 IBaseFilter_Release(pfilter);
1003 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
1005 ERR("Splitter Enumpins (%x)\n", hr);
1008 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
1009 IEnumPins_Release(penumpins);
1011 ERR("Next (%x)\n", hr);
1019 /* Connect the pin to render to the renderer */
1020 hr = IFilterGraph2_Connect(iface, ppinOut, ppinfilter);
1022 TRACE("Unable to connect to renderer (%x)\n", hr);
1023 IPin_Release(ppinfilter);
1026 IPin_Release(ppinfilter);
1027 IBaseFilter_Release(pfilter);
1033 IFilterGraph2_RemoveFilter(iface, pfilter);
1034 IBaseFilter_Release(pfilter);
1038 DeleteMediaType(mt);
1042 IEnumMediaTypes_Release(penummt);
1047 static HRESULT WINAPI FilterGraph2_RenderFile(IFilterGraph2 *iface,
1048 LPCWSTR lpcwstrFile,
1049 LPCWSTR lpcwstrPlayList) {
1050 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1051 static const WCHAR string[] = {'R','e','a','d','e','r',0};
1052 IBaseFilter* preader = NULL;
1053 IBaseFilter* psplitter = NULL;
1054 IPin* ppinreader = NULL;
1055 IPin* ppinsplitter = NULL;
1056 IEnumPins* penumpins;
1059 IEnumMoniker* pEnumMoniker = NULL;
1061 IPin** ppins = NULL;
1064 IFileSourceFilter* pfile = NULL;
1068 TRACE("(%p/%p)->(%s, %s)\n", This, iface, debugstr_w(lpcwstrFile), debugstr_w(lpcwstrPlayList));
1070 if (lpcwstrPlayList != NULL)
1071 return E_INVALIDARG;
1073 hr = IFilterGraph2_AddSourceFilter(iface, lpcwstrFile, string, &preader);
1075 /* Retrieve file media type */
1077 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1078 if (SUCCEEDED(hr)) {
1079 hr = IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1080 IFileSourceFilter_Release(pfile);
1084 hr = IBaseFilter_EnumPins(preader, &penumpins);
1085 if (SUCCEEDED(hr)) {
1086 hr = IEnumPins_Next(penumpins, 1, &ppinreader, &pin);
1087 IEnumPins_Release(penumpins);
1090 if (SUCCEEDED(hr)) {
1091 tab[0] = mt.majortype;
1092 tab[1] = mt.subtype;
1093 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
1099 IPin_Release(ppinreader);
1101 IEnumMoniker_Release(pEnumMoniker);
1103 IFilterGraph2_RemoveFilter(iface, preader);
1104 IBaseFilter_Release(preader);
1109 hr = VFW_E_CANNOT_RENDER;
1110 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
1115 hr = GetFilterInfo(pMoniker, &clsid, &var);
1116 IMoniker_Release(pMoniker);
1118 ERR("Unable to retrieve filter info (%x)\n", hr);
1122 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&psplitter);
1124 ERR("Unable to create filter (%x), trying next one\n", hr);
1128 hr = IFilterGraph2_AddFilter(iface, psplitter, V_UNION(&var, bstrVal));
1130 ERR("Unable add filter (%x)\n", hr);
1131 IBaseFilter_Release(psplitter);
1135 /* Connect file source and splitter filters together */
1136 /* Make the splitter analyze incoming data */
1138 hr = IBaseFilter_EnumPins(psplitter, &penumpins);
1139 if (SUCCEEDED(hr)) {
1140 hr = IEnumPins_Next(penumpins, 1, &ppinsplitter, &pin);
1141 IEnumPins_Release(penumpins);
1145 hr = IPin_Connect(ppinreader, ppinsplitter, NULL);
1147 /* Make sure there's some output pins in the filter */
1149 hr = GetInternalConnections(psplitter, ppinsplitter, &ppins, &nb);
1150 if (SUCCEEDED(hr)) {
1152 IPin_Disconnect(ppinreader);
1153 TRACE("No output pins found in filter\n");
1154 hr = VFW_E_CANNOT_RENDER;
1159 IPin_Release(ppinsplitter);
1160 ppinsplitter = NULL;
1162 if (SUCCEEDED(hr)) {
1163 TRACE("Successfully connected to filter\n");
1167 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
1170 CoTaskMemFree(ppins);
1173 IFilterGraph2_RemoveFilter(iface, psplitter);
1174 IBaseFilter_Release(psplitter);
1178 /* Render all output pin of the splitter by calling IFilterGraph2_Render on each of them */
1179 if (SUCCEEDED(hr)) {
1182 TRACE("pins to consider: %d\n", nb);
1183 for(i = 0; i < nb; i++) {
1184 TRACE("Processing pin %d\n", i);
1185 hr = IFilterGraph2_Render(iface, ppins[i]);
1187 ERR("Cannot render pin %p (%x)\n", ppins[i], hr);
1190 IPin_Release(ppins[i]);
1192 CoTaskMemFree(ppins);
1194 hr = (partial ? VFW_S_PARTIAL_RENDER : S_OK);
1197 IPin_Release(ppinreader);
1198 IBaseFilter_Release(preader);
1200 IBaseFilter_Release(psplitter);
1205 /* Some filters implement their own asynchronous reader (Theoretically they all should, try to load it first */
1206 static HRESULT GetFileSourceFilter(LPCOLESTR pszFileName, IBaseFilter **filter)
1208 static const WCHAR wszReg[] = {'M','e','d','i','a',' ','T','y','p','e','\\','E','x','t','e','n','s','i','o','n','s',0};
1213 lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszReg, 0, KEY_READ, &extkey);
1214 hr = HRESULT_FROM_WIN32(lRet);
1218 static const WCHAR filtersource[] = {'S','o','u','r','c','e',' ','F','i','l','t','e','r',0};
1219 WCHAR *ext = PathFindExtensionW(pszFileName);
1220 WCHAR clsid_key[39];
1222 DWORD size = sizeof(clsid_key);
1227 CloseHandle(extkey);
1231 lRet = RegOpenKeyExW(extkey, ext, 0, KEY_READ, &pathkey);
1232 hr = HRESULT_FROM_WIN32(lRet);
1233 CloseHandle(extkey);
1237 lRet = RegQueryValueExW(pathkey, filtersource, NULL, NULL, (LPBYTE)clsid_key, &size);
1238 hr = HRESULT_FROM_WIN32(lRet);
1239 CloseHandle(pathkey);
1243 CLSIDFromString(clsid_key, &clsid);
1245 TRACE("CLSID: %s\n", debugstr_guid(&clsid));
1246 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)filter);
1249 IFileSourceFilter *source = NULL;
1250 hr = IBaseFilter_QueryInterface(*filter, &IID_IFileSourceFilter, (LPVOID*)&source);
1252 IFileSourceFilter_Release(source);
1254 IBaseFilter_Release(*filter);
1262 static HRESULT WINAPI FilterGraph2_AddSourceFilter(IFilterGraph2 *iface,
1263 LPCWSTR lpcwstrFileName,
1264 LPCWSTR lpcwstrFilterName,
1265 IBaseFilter **ppFilter) {
1266 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1268 IBaseFilter* preader;
1269 IFileSourceFilter* pfile = NULL;
1273 TRACE("(%p/%p)->(%s, %s, %p)\n", This, iface, debugstr_w(lpcwstrFileName), debugstr_w(lpcwstrFilterName), ppFilter);
1275 /* Try from file name first, then fall back to default asynchronous reader */
1276 hr = GetFileSourceFilter(lpcwstrFileName, &preader);
1279 hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&preader);
1281 ERR("Unable to create file source filter (%x)\n", hr);
1285 hr = IFilterGraph2_AddFilter(iface, preader, lpcwstrFilterName);
1287 ERR("Unable add filter (%x)\n", hr);
1288 IBaseFilter_Release(preader);
1292 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1294 ERR("Unable to get IFileSourceInterface (%x)\n", hr);
1298 /* Load the file in the file source filter */
1299 hr = IFileSourceFilter_Load(pfile, lpcwstrFileName, NULL);
1301 ERR("Load (%x)\n", hr);
1305 IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1307 ERR("GetCurFile (%x)\n", hr);
1311 TRACE("File %s\n", debugstr_w(filename));
1312 TRACE("MajorType %s\n", debugstr_guid(&mt.majortype));
1313 TRACE("SubType %s\n", debugstr_guid(&mt.subtype));
1316 *ppFilter = preader;
1317 IFileSourceFilter_Release(pfile);
1323 IFileSourceFilter_Release(pfile);
1324 IFilterGraph2_RemoveFilter(iface, preader);
1325 IBaseFilter_Release(preader);
1330 static HRESULT WINAPI FilterGraph2_SetLogFile(IFilterGraph2 *iface,
1332 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1334 TRACE("(%p/%p)->(%08x): stub !!!\n", This, iface, (DWORD) hFile);
1339 static HRESULT WINAPI FilterGraph2_Abort(IFilterGraph2 *iface) {
1340 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1342 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1347 static HRESULT WINAPI FilterGraph2_ShouldOperationContinue(IFilterGraph2 *iface) {
1348 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1350 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1355 /*** IFilterGraph2 methods ***/
1356 static HRESULT WINAPI FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2 *iface,
1359 LPCWSTR lpcwstrFilterName,
1360 IBaseFilter **ppFilter) {
1361 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1363 TRACE("(%p/%p)->(%p %p %s %p): stub !!!\n", This, iface, pMoniker, pCtx, debugstr_w(lpcwstrFilterName), ppFilter);
1368 static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface,
1370 const AM_MEDIA_TYPE *pmt) {
1371 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1373 TRACE("(%p/%p)->(%p %p): stub !!!\n", This, iface, ppin, pmt);
1378 static HRESULT WINAPI FilterGraph2_RenderEx(IFilterGraph2 *iface,
1382 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1384 TRACE("(%p/%p)->(%p %08x %p): stub !!!\n", This, iface, pPinOut, dwFlags, pvContext);
1390 static const IFilterGraph2Vtbl IFilterGraph2_VTable =
1392 FilterGraph2_QueryInterface,
1393 FilterGraph2_AddRef,
1394 FilterGraph2_Release,
1395 FilterGraph2_AddFilter,
1396 FilterGraph2_RemoveFilter,
1397 FilterGraph2_EnumFilters,
1398 FilterGraph2_FindFilterByName,
1399 FilterGraph2_ConnectDirect,
1400 FilterGraph2_Reconnect,
1401 FilterGraph2_Disconnect,
1402 FilterGraph2_SetDefaultSyncSource,
1403 FilterGraph2_Connect,
1404 FilterGraph2_Render,
1405 FilterGraph2_RenderFile,
1406 FilterGraph2_AddSourceFilter,
1407 FilterGraph2_SetLogFile,
1409 FilterGraph2_ShouldOperationContinue,
1410 FilterGraph2_AddSourceFilterForMoniker,
1411 FilterGraph2_ReconnectEx,
1412 FilterGraph2_RenderEx
1415 /*** IUnknown methods ***/
1416 static HRESULT WINAPI MediaControl_QueryInterface(IMediaControl *iface,
1419 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1421 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1423 return Filtergraph_QueryInterface(This, riid, ppvObj);
1426 static ULONG WINAPI MediaControl_AddRef(IMediaControl *iface) {
1427 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1429 TRACE("(%p/%p)->()\n", This, iface);
1431 return Filtergraph_AddRef(This);
1434 static ULONG WINAPI MediaControl_Release(IMediaControl *iface) {
1435 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1437 TRACE("(%p/%p)->()\n", This, iface);
1439 return Filtergraph_Release(This);
1443 /*** IDispatch methods ***/
1444 static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface,
1446 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1448 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1453 static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface,
1456 ITypeInfo**ppTInfo) {
1457 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1459 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1464 static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface,
1470 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1472 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1477 static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface,
1478 DISPID dispIdMember,
1482 DISPPARAMS*pDispParams,
1484 EXCEPINFO*pExepInfo,
1486 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1488 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);
1493 typedef HRESULT(WINAPI *fnFoundFilter)(IBaseFilter *);
1495 static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundFilter FoundFilter)
1504 TRACE("%p %p\n", pGraph, pOutputPin);
1505 PinInfo.pFilter = NULL;
1507 hr = IPin_ConnectedTo(pOutputPin, &pInputPin);
1511 hr = IPin_QueryPinInfo(pInputPin, &PinInfo);
1513 hr = GetInternalConnections(PinInfo.pFilter, pInputPin, &ppPins, &nb);
1514 IPin_Release(pInputPin);
1521 TRACE("Reached a renderer\n");
1522 /* Count renderers for end of stream notification */
1523 pGraph->nRenderers++;
1527 for(i = 0; i < nb; i++)
1529 /* Explore the graph downstream from this pin
1530 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1531 * several input pins are connected to the same output (a MUX for instance). */
1532 ExploreGraph(pGraph, ppPins[i], FoundFilter);
1533 IPin_Release(ppPins[i]);
1536 CoTaskMemFree(ppPins);
1538 TRACE("Doing stuff with filter %p\n", PinInfo.pFilter);
1540 FoundFilter(PinInfo.pFilter);
1543 if (PinInfo.pFilter) IBaseFilter_Release(PinInfo.pFilter);
1547 static HRESULT WINAPI SendRun(IBaseFilter *pFilter) {
1549 IReferenceClock *clock = NULL;
1551 IBaseFilter_GetSyncSource(pFilter, &clock);
1554 IReferenceClock_GetTime(clock, &time);
1560 IReferenceClock_Release(clock);
1563 return IBaseFilter_Run(pFilter, time);
1566 static HRESULT WINAPI SendPause(IBaseFilter *pFilter) {
1567 return IBaseFilter_Pause(pFilter);
1570 static HRESULT WINAPI SendStop(IBaseFilter *pFilter) {
1571 return IBaseFilter_Stop(pFilter);
1574 static HRESULT SendFilterMessage(IMediaControl *iface, fnFoundFilter FoundFilter) {
1575 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1577 IBaseFilter* pfilter;
1583 TRACE("(%p/%p)->()\n", This, iface);
1585 /* Explorer the graph from source filters to renderers, determine renderers
1586 * number and run filters from renderers to source filters */
1587 This->nRenderers = 0;
1588 ResetEvent(This->hEventCompletion);
1590 for(i = 0; i < This->nFilters; i++)
1593 pfilter = This->ppFiltersInGraph[i];
1594 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
1597 ERR("Enum pins failed %x\n", hr);
1600 /* Check if it is a source filter */
1601 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1603 IPin_QueryDirection(pPin, &dir);
1605 if (dir == PINDIR_INPUT)
1613 TRACE("Found a source filter %p\n", pfilter);
1614 IEnumPins_Reset(pEnum);
1615 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1617 /* Explore the graph downstream from this pin */
1618 ExploreGraph(This, pPin, FoundFilter);
1621 FoundFilter(pfilter);
1623 IEnumPins_Release(pEnum);
1629 /*** IMediaControl methods ***/
1630 static HRESULT WINAPI MediaControl_Run(IMediaControl *iface) {
1631 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1632 TRACE("(%p/%p)->()\n", This, iface);
1634 if (This->state == State_Running) return S_OK;
1636 EnterCriticalSection(&This->cs);
1637 if (This->state == State_Stopped)
1638 This->EcCompleteCount = 0;
1642 IReferenceClock_GetTime(This->refClock, &This->start_time);
1643 This->start_time += 500000;
1645 else This->position = This->start_time = 0;
1647 SendFilterMessage(iface, SendRun);
1648 This->state = State_Running;
1649 LeaveCriticalSection(&This->cs);
1653 static HRESULT WINAPI MediaControl_Pause(IMediaControl *iface) {
1654 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1655 TRACE("(%p/%p)->()\n", This, iface);
1657 if (This->state == State_Paused) return S_OK;
1659 EnterCriticalSection(&This->cs);
1660 if (This->state == State_Stopped)
1661 This->EcCompleteCount = 0;
1663 if (This->state == State_Running && This->refClock)
1665 LONGLONG time = This->start_time;
1666 IReferenceClock_GetTime(This->refClock, &time);
1667 This->position += time - This->start_time;
1670 SendFilterMessage(iface, SendPause);
1671 This->state = State_Paused;
1672 LeaveCriticalSection(&This->cs);
1676 static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface) {
1677 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1678 TRACE("(%p/%p)->()\n", This, iface);
1680 if (This->state == State_Stopped) return S_OK;
1682 EnterCriticalSection(&This->cs);
1683 if (This->state == State_Running && This->refClock)
1685 LONGLONG time = This->start_time;
1686 IReferenceClock_GetTime(This->refClock, &time);
1687 This->position += time - This->start_time;
1690 if (This->state == State_Running) SendFilterMessage(iface, SendPause);
1691 SendFilterMessage(iface, SendStop);
1692 This->state = State_Stopped;
1693 LeaveCriticalSection(&This->cs);
1697 static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface,
1699 OAFilterState *pfs) {
1700 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1702 TRACE("(%p/%p)->(%d, %p): semi-stub !!!\n", This, iface, msTimeout, pfs);
1704 EnterCriticalSection(&This->cs);
1708 LeaveCriticalSection(&This->cs);
1713 static HRESULT WINAPI MediaControl_RenderFile(IMediaControl *iface,
1715 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1717 FIXME("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename);
1722 static HRESULT WINAPI MediaControl_AddSourceFilter(IMediaControl *iface,
1724 IDispatch **ppUnk) {
1725 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1727 FIXME("(%p/%p)->(%s (%p), %p): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename, ppUnk);
1732 static HRESULT WINAPI MediaControl_get_FilterCollection(IMediaControl *iface,
1733 IDispatch **ppUnk) {
1734 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1736 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1741 static HRESULT WINAPI MediaControl_get_RegFilterCollection(IMediaControl *iface,
1742 IDispatch **ppUnk) {
1743 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1745 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1750 static HRESULT WINAPI MediaControl_StopWhenReady(IMediaControl *iface) {
1751 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1753 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1759 static const IMediaControlVtbl IMediaControl_VTable =
1761 MediaControl_QueryInterface,
1762 MediaControl_AddRef,
1763 MediaControl_Release,
1764 MediaControl_GetTypeInfoCount,
1765 MediaControl_GetTypeInfo,
1766 MediaControl_GetIDsOfNames,
1767 MediaControl_Invoke,
1771 MediaControl_GetState,
1772 MediaControl_RenderFile,
1773 MediaControl_AddSourceFilter,
1774 MediaControl_get_FilterCollection,
1775 MediaControl_get_RegFilterCollection,
1776 MediaControl_StopWhenReady
1780 /*** IUnknown methods ***/
1781 static HRESULT WINAPI MediaSeeking_QueryInterface(IMediaSeeking *iface,
1784 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1786 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1788 return Filtergraph_QueryInterface(This, riid, ppvObj);
1791 static ULONG WINAPI MediaSeeking_AddRef(IMediaSeeking *iface) {
1792 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1794 TRACE("(%p/%p)->()\n", This, iface);
1796 return Filtergraph_AddRef(This);
1799 static ULONG WINAPI MediaSeeking_Release(IMediaSeeking *iface) {
1800 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1802 TRACE("(%p/%p)->()\n", This, iface);
1804 return Filtergraph_Release(This);
1807 typedef HRESULT WINAPI (*fnFoundSeek)(IFilterGraphImpl *This, IMediaSeeking*, DWORD_PTR arg);
1809 static HRESULT all_renderers_seek(IFilterGraphImpl *This, fnFoundSeek FoundSeek, DWORD_PTR arg) {
1810 BOOL allnotimpl = TRUE;
1812 IBaseFilter* pfilter;
1814 HRESULT hr, hr_return = S_OK;
1819 TRACE("(%p)->(%p %08lx)\n", This, FoundSeek, arg);
1820 /* Send a message to all renderers, they are responsible for broadcasting it further */
1822 for(i = 0; i < This->nFilters; i++)
1824 BOOL renderer = TRUE;
1825 pfilter = This->ppFiltersInGraph[i];
1826 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
1829 ERR("Enum pins failed %x\n", hr);
1832 /* Check if it is a source filter */
1833 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1835 IPin_QueryDirection(pPin, &dir);
1837 if (dir != PINDIR_INPUT)
1843 IEnumPins_Release(pEnum);
1846 IMediaSeeking *seek = NULL;
1847 IBaseFilter_QueryInterface(pfilter, &IID_IMediaSeeking, (void**)&seek);
1851 hr = FoundSeek(This, seek, arg);
1853 IMediaSeeking_Release(seek);
1854 if (hr_return != E_NOTIMPL)
1856 if (hr_return == S_OK || (FAILED(hr) && hr != E_NOTIMPL && !FAILED(hr_return)))
1866 static HRESULT WINAPI FoundCapabilities(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pcaps)
1871 hr = IMediaSeeking_GetCapabilities(seek, &caps);
1875 /* Only add common capabilities everything supports */
1876 *(DWORD*)pcaps &= caps;
1881 /*** IMediaSeeking methods ***/
1882 static HRESULT WINAPI MediaSeeking_GetCapabilities(IMediaSeeking *iface,
1883 DWORD *pCapabilities) {
1884 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1886 TRACE("(%p/%p)->(%p)\n", This, iface, pCapabilities);
1891 EnterCriticalSection(&This->cs);
1892 *pCapabilities = 0xffffffff;
1894 hr = all_renderers_seek(This, FoundCapabilities, (DWORD_PTR)pCapabilities);
1895 LeaveCriticalSection(&This->cs);
1900 static HRESULT WINAPI MediaSeeking_CheckCapabilities(IMediaSeeking *iface,
1901 DWORD *pCapabilities) {
1902 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1905 TRACE("(%p/%p)->(%p)\n", This, iface, pCapabilities);
1910 EnterCriticalSection(&This->cs);
1911 originalcaps = *pCapabilities;
1912 hr = all_renderers_seek(This, FoundCapabilities, (DWORD_PTR)pCapabilities);
1913 LeaveCriticalSection(&This->cs);
1918 if (!*pCapabilities)
1920 if (*pCapabilities != originalcaps)
1925 static HRESULT WINAPI MediaSeeking_IsFormatSupported(IMediaSeeking *iface,
1926 const GUID *pFormat) {
1927 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1932 TRACE("(%p/%p)->(%s)\n", This, iface, debugstr_guid(pFormat));
1934 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
1936 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat));
1943 static HRESULT WINAPI MediaSeeking_QueryPreferredFormat(IMediaSeeking *iface,
1945 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1950 FIXME("(%p/%p)->(%p): semi-stub !!!\n", This, iface, pFormat);
1951 memcpy(pFormat, &TIME_FORMAT_MEDIA_TIME, sizeof(GUID));
1956 static HRESULT WINAPI MediaSeeking_GetTimeFormat(IMediaSeeking *iface,
1958 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1963 TRACE("(%p/%p)->(%p)\n", This, iface, pFormat);
1964 memcpy(pFormat, &This->timeformatseek, sizeof(GUID));
1969 static HRESULT WINAPI MediaSeeking_IsUsingTimeFormat(IMediaSeeking *iface,
1970 const GUID *pFormat) {
1971 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1973 TRACE("(%p/%p)->(%p)\n", This, iface, pFormat);
1977 if (memcmp(pFormat, &This->timeformatseek, sizeof(GUID)))
1983 static HRESULT WINAPI MediaSeeking_SetTimeFormat(IMediaSeeking *iface,
1984 const GUID *pFormat) {
1985 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1990 TRACE("(%p/%p)->(%s)\n", This, iface, debugstr_guid(pFormat));
1992 if (This->state != State_Stopped)
1993 return VFW_E_WRONG_STATE;
1995 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
1997 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat));
1998 return E_INVALIDARG;
2004 static HRESULT WINAPI FoundDuration(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pduration)
2007 LONGLONG duration = 0, *pdur = (LONGLONG*)pduration;
2009 hr = IMediaSeeking_GetDuration(seek, &duration);
2013 /* FIXME: Minimum or maximum duration? Assuming minimum */
2014 if (duration > 0 && *pdur < duration)
2020 static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface,
2021 LONGLONG *pDuration) {
2022 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2025 TRACE("(%p/%p)->(%p)\n", This, iface, pDuration);
2030 EnterCriticalSection(&This->cs);
2032 hr = all_renderers_seek(This, FoundDuration, (DWORD_PTR)pDuration);
2033 LeaveCriticalSection(&This->cs);
2035 TRACE("--->%08x\n", hr);
2039 static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface,
2041 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2044 TRACE("(%p/%p)->(%p)\n", This, iface, pStop);
2049 EnterCriticalSection(&This->cs);
2050 if (This->stop_position < 0)
2051 /* Stop position not set, use duration instead */
2052 hr = IMediaSeeking_GetDuration(iface, pStop);
2054 *pStop = This->stop_position;
2056 LeaveCriticalSection(&This->cs);
2061 static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface,
2062 LONGLONG *pCurrent) {
2063 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2069 EnterCriticalSection(&This->cs);
2070 if (This->state == State_Running && This->refClock)
2072 IReferenceClock_GetTime(This->refClock, &time);
2074 time += This->position - This->start_time;
2075 if (time < This->position)
2076 time = This->position;
2080 *pCurrent = This->position;
2081 LeaveCriticalSection(&This->cs);
2083 TRACE("Time: %u.%03u\n", (DWORD)(*pCurrent / 10000000), (DWORD)((*pCurrent / 10000)%1000));
2088 static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface,
2090 const GUID *pTargetFormat,
2092 const GUID *pSourceFormat) {
2093 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2095 FIXME("(%p/%p)->(%p, %p, 0x%s, %p): stub !!!\n", This, iface, pTarget,
2096 pTargetFormat, wine_dbgstr_longlong(Source), pSourceFormat);
2102 LONGLONG* current, *stop;
2103 DWORD curflags, stopflags;
2106 static HRESULT WINAPI found_setposition(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pargs)
2108 struct pos_args *args = (void*)pargs;
2110 return IMediaSeeking_SetPositions(seek, args->current, args->curflags, args->stop, args->stopflags);
2113 static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface,
2115 DWORD dwCurrentFlags,
2117 DWORD dwStopFlags) {
2118 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2121 struct pos_args args;
2123 TRACE("(%p/%p)->(%p, %08x, %p, %08x)\n", This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
2125 EnterCriticalSection(&This->cs);
2126 state = This->state;
2127 TRACE("State: %s\n", state == State_Running ? "Running" : (state == State_Paused ? "Paused" : (state == State_Stopped ? "Stopped" : "UNKNOWN")));
2129 if ((dwCurrentFlags & 0x7) == AM_SEEKING_AbsolutePositioning)
2131 This->position = *pCurrent;
2133 else if ((dwCurrentFlags & 0x7) != AM_SEEKING_NoPositioning)
2134 FIXME("Adjust method %x not handled yet!\n", dwCurrentFlags & 0x7);
2136 if ((dwStopFlags & 0x7) == AM_SEEKING_AbsolutePositioning)
2137 This->stop_position = *pStop;
2138 else if ((dwStopFlags & 0x7) != AM_SEEKING_NoPositioning)
2139 FIXME("Stop position not handled yet!\n");
2141 args.current = pCurrent;
2143 args.curflags = dwCurrentFlags;
2144 args.stopflags = dwStopFlags;
2145 hr = all_renderers_seek(This, found_setposition, (DWORD_PTR)&args);
2147 if (This->refClock && ((dwCurrentFlags & 0x7) != AM_SEEKING_NoPositioning))
2149 /* Update start time, prevents weird jumps */
2150 IReferenceClock_GetTime(This->refClock, &This->start_time);
2152 LeaveCriticalSection(&This->cs);
2157 static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface,
2160 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2163 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pCurrent, pStop);
2164 hr = IMediaSeeking_GetCurrentPosition(iface, pCurrent);
2166 hr = IMediaSeeking_GetStopPosition(iface, pStop);
2171 static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface,
2172 LONGLONG *pEarliest,
2173 LONGLONG *pLatest) {
2174 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2176 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
2181 static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface,
2183 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2185 FIXME("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
2190 static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface,
2192 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2194 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
2199 static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface,
2200 LONGLONG *pllPreroll) {
2201 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2203 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
2209 static const IMediaSeekingVtbl IMediaSeeking_VTable =
2211 MediaSeeking_QueryInterface,
2212 MediaSeeking_AddRef,
2213 MediaSeeking_Release,
2214 MediaSeeking_GetCapabilities,
2215 MediaSeeking_CheckCapabilities,
2216 MediaSeeking_IsFormatSupported,
2217 MediaSeeking_QueryPreferredFormat,
2218 MediaSeeking_GetTimeFormat,
2219 MediaSeeking_IsUsingTimeFormat,
2220 MediaSeeking_SetTimeFormat,
2221 MediaSeeking_GetDuration,
2222 MediaSeeking_GetStopPosition,
2223 MediaSeeking_GetCurrentPosition,
2224 MediaSeeking_ConvertTimeFormat,
2225 MediaSeeking_SetPositions,
2226 MediaSeeking_GetPositions,
2227 MediaSeeking_GetAvailable,
2228 MediaSeeking_SetRate,
2229 MediaSeeking_GetRate,
2230 MediaSeeking_GetPreroll
2233 /*** IUnknown methods ***/
2234 static HRESULT WINAPI MediaPosition_QueryInterface(IMediaPosition* iface, REFIID riid, void** ppvObj){
2235 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
2237 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2239 return Filtergraph_QueryInterface(This, riid, ppvObj);
2242 static ULONG WINAPI MediaPosition_AddRef(IMediaPosition *iface){
2243 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
2245 TRACE("(%p/%p)->()\n", This, iface);
2247 return Filtergraph_AddRef(This);
2250 static ULONG WINAPI MediaPosition_Release(IMediaPosition *iface){
2251 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
2253 TRACE("(%p/%p)->()\n", This, iface);
2255 return Filtergraph_Release(This);
2258 /*** IDispatch methods ***/
2259 static HRESULT WINAPI MediaPosition_GetTypeInfoCount(IMediaPosition *iface, UINT* pctinfo){
2260 FIXME("(%p) stub!\n", iface);
2264 static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo){
2265 FIXME("(%p) stub!\n", iface);
2269 static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition* iface, REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId){
2270 FIXME("(%p) stub!\n", iface);
2274 static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition* iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr){
2275 FIXME("(%p) stub!\n", iface);
2279 /*** IMediaPosition methods ***/
2280 static HRESULT WINAPI MediaPosition_get_Duration(IMediaPosition * iface, REFTIME *plength){
2281 FIXME("(%p)->(%p) stub!\n", iface, plength);
2285 static HRESULT WINAPI MediaPosition_put_CurrentPosition(IMediaPosition * iface, REFTIME llTime){
2286 FIXME("(%p)->(%f) stub!\n", iface, llTime);
2290 static HRESULT WINAPI MediaPosition_get_CurrentPosition(IMediaPosition * iface, REFTIME *pllTime){
2291 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
2295 static HRESULT WINAPI MediaPosition_get_StopTime(IMediaPosition * iface, REFTIME *pllTime){
2296 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
2300 static HRESULT WINAPI MediaPosition_put_StopTime(IMediaPosition * iface, REFTIME llTime){
2301 FIXME("(%p)->(%f) stub!\n", iface, llTime);
2305 static HRESULT WINAPI MediaPosition_get_PrerollTime(IMediaPosition * iface, REFTIME *pllTime){
2306 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
2310 static HRESULT WINAPI MediaPosition_put_PrerollTime(IMediaPosition * iface, REFTIME llTime){
2311 FIXME("(%p)->(%f) stub!\n", iface, llTime);
2315 static HRESULT WINAPI MediaPosition_put_Rate(IMediaPosition * iface, double dRate){
2316 FIXME("(%p)->(%f) stub!\n", iface, dRate);
2320 static HRESULT WINAPI MediaPosition_get_Rate(IMediaPosition * iface, double *pdRate){
2321 FIXME("(%p)->(%p) stub!\n", iface, pdRate);
2325 static HRESULT WINAPI MediaPosition_CanSeekForward(IMediaPosition * iface, LONG *pCanSeekForward){
2326 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekForward);
2330 static HRESULT WINAPI MediaPosition_CanSeekBackward(IMediaPosition * iface, LONG *pCanSeekBackward){
2331 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekBackward);
2336 static const IMediaPositionVtbl IMediaPosition_VTable =
2338 MediaPosition_QueryInterface,
2339 MediaPosition_AddRef,
2340 MediaPosition_Release,
2341 MediaPosition_GetTypeInfoCount,
2342 MediaPosition_GetTypeInfo,
2343 MediaPosition_GetIDsOfNames,
2344 MediaPosition_Invoke,
2345 MediaPosition_get_Duration,
2346 MediaPosition_put_CurrentPosition,
2347 MediaPosition_get_CurrentPosition,
2348 MediaPosition_get_StopTime,
2349 MediaPosition_put_StopTime,
2350 MediaPosition_get_PrerollTime,
2351 MediaPosition_put_PrerollTime,
2352 MediaPosition_put_Rate,
2353 MediaPosition_get_Rate,
2354 MediaPosition_CanSeekForward,
2355 MediaPosition_CanSeekBackward
2358 static HRESULT GetTargetInterface(IFilterGraphImpl* pGraph, REFIID riid, LPVOID* ppvObj)
2360 HRESULT hr = E_NOINTERFACE;
2364 /* Check if the interface type is already registered */
2365 for (entry = 0; entry < pGraph->nItfCacheEntries; entry++)
2366 if (riid == pGraph->ItfCacheEntries[entry].riid)
2368 if (pGraph->ItfCacheEntries[entry].iface)
2370 /* Return the interface if available */
2371 *ppvObj = pGraph->ItfCacheEntries[entry].iface;
2377 if (entry >= MAX_ITF_CACHE_ENTRIES)
2379 FIXME("Not enough space to store interface in the cache\n");
2380 return E_OUTOFMEMORY;
2383 /* Find a filter supporting the requested interface */
2384 for (i = 0; i < pGraph->nFilters; i++)
2386 hr = IBaseFilter_QueryInterface(pGraph->ppFiltersInGraph[i], riid, ppvObj);
2389 pGraph->ItfCacheEntries[entry].riid = riid;
2390 pGraph->ItfCacheEntries[entry].filter = pGraph->ppFiltersInGraph[i];
2391 pGraph->ItfCacheEntries[entry].iface = (IUnknown*)*ppvObj;
2392 if (entry >= pGraph->nItfCacheEntries)
2393 pGraph->nItfCacheEntries++;
2396 if (hr != E_NOINTERFACE)
2403 /*** IUnknown methods ***/
2404 static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface,
2407 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2409 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2411 return Filtergraph_QueryInterface(This, riid, ppvObj);
2414 static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface) {
2415 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2417 TRACE("(%p/%p)->()\n", This, iface);
2419 return Filtergraph_AddRef(This);
2422 static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface) {
2423 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2425 TRACE("(%p/%p)->()\n", This, iface);
2427 return Filtergraph_Release(This);
2430 /*** IDispatch methods ***/
2431 static HRESULT WINAPI BasicAudio_GetTypeInfoCount(IBasicAudio *iface,
2433 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2434 IBasicAudio* pBasicAudio;
2437 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2439 EnterCriticalSection(&This->cs);
2441 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2444 hr = IBasicAudio_GetTypeInfoCount(pBasicAudio, pctinfo);
2446 LeaveCriticalSection(&This->cs);
2451 static HRESULT WINAPI BasicAudio_GetTypeInfo(IBasicAudio *iface,
2454 ITypeInfo**ppTInfo) {
2455 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2456 IBasicAudio* pBasicAudio;
2459 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2461 EnterCriticalSection(&This->cs);
2463 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2466 hr = IBasicAudio_GetTypeInfo(pBasicAudio, iTInfo, lcid, ppTInfo);
2468 LeaveCriticalSection(&This->cs);
2473 static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface,
2479 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2480 IBasicAudio* pBasicAudio;
2483 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2485 EnterCriticalSection(&This->cs);
2487 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2490 hr = IBasicAudio_GetIDsOfNames(pBasicAudio, riid, rgszNames, cNames, lcid, rgDispId);
2492 LeaveCriticalSection(&This->cs);
2497 static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface,
2498 DISPID dispIdMember,
2502 DISPPARAMS*pDispParams,
2504 EXCEPINFO*pExepInfo,
2506 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2507 IBasicAudio* pBasicAudio;
2510 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);
2512 EnterCriticalSection(&This->cs);
2514 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2517 hr = IBasicAudio_Invoke(pBasicAudio, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2519 LeaveCriticalSection(&This->cs);
2524 /*** IBasicAudio methods ***/
2525 static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface,
2527 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2528 IBasicAudio* pBasicAudio;
2531 TRACE("(%p/%p)->(%ld)\n", This, iface, lVolume);
2533 EnterCriticalSection(&This->cs);
2535 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2538 hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
2540 LeaveCriticalSection(&This->cs);
2545 static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface,
2547 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2548 IBasicAudio* pBasicAudio;
2551 TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
2553 EnterCriticalSection(&This->cs);
2555 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2558 hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
2560 LeaveCriticalSection(&This->cs);
2565 static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface,
2567 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2568 IBasicAudio* pBasicAudio;
2571 TRACE("(%p/%p)->(%ld)\n", This, iface, lBalance);
2573 EnterCriticalSection(&This->cs);
2575 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2578 hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
2580 LeaveCriticalSection(&This->cs);
2585 static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface,
2587 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2588 IBasicAudio* pBasicAudio;
2591 TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
2593 EnterCriticalSection(&This->cs);
2595 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2598 hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
2600 LeaveCriticalSection(&This->cs);
2605 static const IBasicAudioVtbl IBasicAudio_VTable =
2607 BasicAudio_QueryInterface,
2610 BasicAudio_GetTypeInfoCount,
2611 BasicAudio_GetTypeInfo,
2612 BasicAudio_GetIDsOfNames,
2614 BasicAudio_put_Volume,
2615 BasicAudio_get_Volume,
2616 BasicAudio_put_Balance,
2617 BasicAudio_get_Balance
2620 /*** IUnknown methods ***/
2621 static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo *iface,
2624 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2626 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2628 return Filtergraph_QueryInterface(This, riid, ppvObj);
2631 static ULONG WINAPI BasicVideo_AddRef(IBasicVideo *iface) {
2632 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2634 TRACE("(%p/%p)->()\n", This, iface);
2636 return Filtergraph_AddRef(This);
2639 static ULONG WINAPI BasicVideo_Release(IBasicVideo *iface) {
2640 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2642 TRACE("(%p/%p)->()\n", This, iface);
2644 return Filtergraph_Release(This);
2647 /*** IDispatch methods ***/
2648 static HRESULT WINAPI BasicVideo_GetTypeInfoCount(IBasicVideo *iface,
2650 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2651 IBasicVideo* pBasicVideo;
2654 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2656 EnterCriticalSection(&This->cs);
2658 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2661 hr = IBasicVideo_GetTypeInfoCount(pBasicVideo, pctinfo);
2663 LeaveCriticalSection(&This->cs);
2668 static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo *iface,
2671 ITypeInfo**ppTInfo) {
2672 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2673 IBasicVideo* pBasicVideo;
2676 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2678 EnterCriticalSection(&This->cs);
2680 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2683 hr = IBasicVideo_GetTypeInfo(pBasicVideo, iTInfo, lcid, ppTInfo);
2685 LeaveCriticalSection(&This->cs);
2690 static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo *iface,
2696 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2697 IBasicVideo* pBasicVideo;
2700 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2702 EnterCriticalSection(&This->cs);
2704 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2707 hr = IBasicVideo_GetIDsOfNames(pBasicVideo, riid, rgszNames, cNames, lcid, rgDispId);
2709 LeaveCriticalSection(&This->cs);
2714 static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo *iface,
2715 DISPID dispIdMember,
2719 DISPPARAMS*pDispParams,
2721 EXCEPINFO*pExepInfo,
2723 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2724 IBasicVideo* pBasicVideo;
2727 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);
2729 EnterCriticalSection(&This->cs);
2731 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2734 hr = IBasicVideo_Invoke(pBasicVideo, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2736 LeaveCriticalSection(&This->cs);
2741 /*** IBasicVideo methods ***/
2742 static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo *iface,
2743 REFTIME *pAvgTimePerFrame) {
2744 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2745 IBasicVideo* pBasicVideo;
2748 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
2750 EnterCriticalSection(&This->cs);
2752 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2755 hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
2757 LeaveCriticalSection(&This->cs);
2762 static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo *iface,
2764 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2765 IBasicVideo* pBasicVideo;
2768 TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
2770 EnterCriticalSection(&This->cs);
2772 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2775 hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
2777 LeaveCriticalSection(&This->cs);
2782 static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo *iface,
2783 long *pBitErrorRate) {
2784 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2785 IBasicVideo* pBasicVideo;
2788 TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
2790 EnterCriticalSection(&This->cs);
2792 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2795 hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
2797 LeaveCriticalSection(&This->cs);
2802 static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo *iface,
2803 long *pVideoWidth) {
2804 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2805 IBasicVideo* pBasicVideo;
2808 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
2810 EnterCriticalSection(&This->cs);
2812 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2815 hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
2817 LeaveCriticalSection(&This->cs);
2822 static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo *iface,
2823 long *pVideoHeight) {
2824 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2825 IBasicVideo* pBasicVideo;
2828 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
2830 EnterCriticalSection(&This->cs);
2832 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2835 hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
2837 LeaveCriticalSection(&This->cs);
2842 static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo *iface,
2844 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2845 IBasicVideo* pBasicVideo;
2848 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
2850 EnterCriticalSection(&This->cs);
2852 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2855 hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
2857 LeaveCriticalSection(&This->cs);
2862 static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo *iface,
2863 long *pSourceLeft) {
2864 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2865 IBasicVideo* pBasicVideo;
2868 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
2870 EnterCriticalSection(&This->cs);
2872 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2875 hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
2877 LeaveCriticalSection(&This->cs);
2882 static HRESULT WINAPI BasicVideo_put_SourceWidth(IBasicVideo *iface,
2884 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2885 IBasicVideo* pBasicVideo;
2888 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
2890 EnterCriticalSection(&This->cs);
2892 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2895 hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
2897 LeaveCriticalSection(&This->cs);
2902 static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo *iface,
2903 long *pSourceWidth) {
2904 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2905 IBasicVideo* pBasicVideo;
2908 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
2910 EnterCriticalSection(&This->cs);
2912 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2915 hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
2917 LeaveCriticalSection(&This->cs);
2922 static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo *iface,
2924 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2925 IBasicVideo* pBasicVideo;
2928 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
2930 EnterCriticalSection(&This->cs);
2932 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2935 hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
2937 LeaveCriticalSection(&This->cs);
2942 static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo *iface,
2944 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2945 IBasicVideo* pBasicVideo;
2948 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
2950 EnterCriticalSection(&This->cs);
2952 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2955 hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
2957 LeaveCriticalSection(&This->cs);
2962 static HRESULT WINAPI BasicVideo_put_SourceHeight(IBasicVideo *iface,
2963 long SourceHeight) {
2964 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2965 IBasicVideo* pBasicVideo;
2968 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
2970 EnterCriticalSection(&This->cs);
2972 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2975 hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
2977 LeaveCriticalSection(&This->cs);
2982 static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo *iface,
2983 long *pSourceHeight) {
2984 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2985 IBasicVideo* pBasicVideo;
2988 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
2990 EnterCriticalSection(&This->cs);
2992 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2995 hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
2997 LeaveCriticalSection(&This->cs);
3002 static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo *iface,
3003 long DestinationLeft) {
3004 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3005 IBasicVideo* pBasicVideo;
3008 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
3010 EnterCriticalSection(&This->cs);
3012 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3015 hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
3017 LeaveCriticalSection(&This->cs);
3022 static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo *iface,
3023 long *pDestinationLeft) {
3024 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3025 IBasicVideo* pBasicVideo;
3028 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
3030 EnterCriticalSection(&This->cs);
3032 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3035 hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
3037 LeaveCriticalSection(&This->cs);
3042 static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo *iface,
3043 long DestinationWidth) {
3044 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3045 IBasicVideo* pBasicVideo;
3048 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
3050 EnterCriticalSection(&This->cs);
3052 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3055 hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
3057 LeaveCriticalSection(&This->cs);
3062 static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo *iface,
3063 long *pDestinationWidth) {
3064 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3065 IBasicVideo* pBasicVideo;
3068 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
3070 EnterCriticalSection(&This->cs);
3072 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3075 hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
3077 LeaveCriticalSection(&This->cs);
3082 static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo *iface,
3083 long DestinationTop) {
3084 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3085 IBasicVideo* pBasicVideo;
3088 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
3090 EnterCriticalSection(&This->cs);
3092 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3095 hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
3097 LeaveCriticalSection(&This->cs);
3102 static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo *iface,
3103 long *pDestinationTop) {
3104 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3105 IBasicVideo* pBasicVideo;
3108 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
3110 EnterCriticalSection(&This->cs);
3112 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3115 hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
3117 LeaveCriticalSection(&This->cs);
3122 static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo *iface,
3123 long DestinationHeight) {
3124 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3125 IBasicVideo* pBasicVideo;
3128 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
3130 EnterCriticalSection(&This->cs);
3132 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3135 hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
3137 LeaveCriticalSection(&This->cs);
3142 static HRESULT WINAPI BasicVideo_get_DestinationHeight(IBasicVideo *iface,
3143 long *pDestinationHeight) {
3144 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3145 IBasicVideo* pBasicVideo;
3148 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
3150 EnterCriticalSection(&This->cs);
3152 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3155 hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
3157 LeaveCriticalSection(&This->cs);
3162 static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo *iface,
3167 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3168 IBasicVideo* pBasicVideo;
3171 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
3173 EnterCriticalSection(&This->cs);
3175 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3178 hr = IBasicVideo_SetSourcePosition(pBasicVideo, Left, Top, Width, Height);
3180 LeaveCriticalSection(&This->cs);
3185 static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo *iface,
3190 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3191 IBasicVideo* pBasicVideo;
3194 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3196 EnterCriticalSection(&This->cs);
3198 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3201 hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
3203 LeaveCriticalSection(&This->cs);
3208 static HRESULT WINAPI BasicVideo_SetDefaultSourcePosition(IBasicVideo *iface) {
3209 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3210 IBasicVideo* pBasicVideo;
3213 TRACE("(%p/%p)->()\n", This, iface);
3215 EnterCriticalSection(&This->cs);
3217 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3220 hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
3222 LeaveCriticalSection(&This->cs);
3227 static HRESULT WINAPI BasicVideo_SetDestinationPosition(IBasicVideo *iface,
3232 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3233 IBasicVideo* pBasicVideo;
3236 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
3238 EnterCriticalSection(&This->cs);
3240 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3243 hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left, Top, Width, Height);
3245 LeaveCriticalSection(&This->cs);
3250 static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo *iface,
3255 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3256 IBasicVideo* pBasicVideo;
3259 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3261 EnterCriticalSection(&This->cs);
3263 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3266 hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
3268 LeaveCriticalSection(&This->cs);
3273 static HRESULT WINAPI BasicVideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
3274 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3275 IBasicVideo* pBasicVideo;
3278 TRACE("(%p/%p)->()\n", This, iface);
3280 EnterCriticalSection(&This->cs);
3282 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3285 hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
3287 LeaveCriticalSection(&This->cs);
3292 static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo *iface,
3295 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3296 IBasicVideo* pBasicVideo;
3299 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3301 EnterCriticalSection(&This->cs);
3303 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3306 hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
3308 LeaveCriticalSection(&This->cs);
3313 static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo *iface,
3318 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3319 IBasicVideo* pBasicVideo;
3322 TRACE("(%p/%p)->(%ld, %ld, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
3324 EnterCriticalSection(&This->cs);
3326 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3329 hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex, Entries, pRetrieved, pPalette);
3331 LeaveCriticalSection(&This->cs);
3336 static HRESULT WINAPI BasicVideo_GetCurrentImage(IBasicVideo *iface,
3339 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3340 IBasicVideo* pBasicVideo;
3343 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pBufferSize, pDIBImage);
3345 EnterCriticalSection(&This->cs);
3347 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3350 hr = IBasicVideo_GetCurrentImage(pBasicVideo, pBufferSize, pDIBImage);
3352 LeaveCriticalSection(&This->cs);
3357 static HRESULT WINAPI BasicVideo_IsUsingDefaultSource(IBasicVideo *iface) {
3358 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3359 IBasicVideo* pBasicVideo;
3362 TRACE("(%p/%p)->()\n", This, iface);
3364 EnterCriticalSection(&This->cs);
3366 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3369 hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
3371 LeaveCriticalSection(&This->cs);
3376 static HRESULT WINAPI BasicVideo_IsUsingDefaultDestination(IBasicVideo *iface) {
3377 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3378 IBasicVideo* pBasicVideo;
3381 TRACE("(%p/%p)->()\n", This, iface);
3383 EnterCriticalSection(&This->cs);
3385 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3388 hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
3390 LeaveCriticalSection(&This->cs);
3396 static const IBasicVideoVtbl IBasicVideo_VTable =
3398 BasicVideo_QueryInterface,
3401 BasicVideo_GetTypeInfoCount,
3402 BasicVideo_GetTypeInfo,
3403 BasicVideo_GetIDsOfNames,
3405 BasicVideo_get_AvgTimePerFrame,
3406 BasicVideo_get_BitRate,
3407 BasicVideo_get_BitErrorRate,
3408 BasicVideo_get_VideoWidth,
3409 BasicVideo_get_VideoHeight,
3410 BasicVideo_put_SourceLeft,
3411 BasicVideo_get_SourceLeft,
3412 BasicVideo_put_SourceWidth,
3413 BasicVideo_get_SourceWidth,
3414 BasicVideo_put_SourceTop,
3415 BasicVideo_get_SourceTop,
3416 BasicVideo_put_SourceHeight,
3417 BasicVideo_get_SourceHeight,
3418 BasicVideo_put_DestinationLeft,
3419 BasicVideo_get_DestinationLeft,
3420 BasicVideo_put_DestinationWidth,
3421 BasicVideo_get_DestinationWidth,
3422 BasicVideo_put_DestinationTop,
3423 BasicVideo_get_DestinationTop,
3424 BasicVideo_put_DestinationHeight,
3425 BasicVideo_get_DestinationHeight,
3426 BasicVideo_SetSourcePosition,
3427 BasicVideo_GetSourcePosition,
3428 BasicVideo_SetDefaultSourcePosition,
3429 BasicVideo_SetDestinationPosition,
3430 BasicVideo_GetDestinationPosition,
3431 BasicVideo_SetDefaultDestinationPosition,
3432 BasicVideo_GetVideoSize,
3433 BasicVideo_GetVideoPaletteEntries,
3434 BasicVideo_GetCurrentImage,
3435 BasicVideo_IsUsingDefaultSource,
3436 BasicVideo_IsUsingDefaultDestination
3440 /*** IUnknown methods ***/
3441 static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface,
3444 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3446 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
3448 return Filtergraph_QueryInterface(This, riid, ppvObj);
3451 static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface) {
3452 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3454 TRACE("(%p/%p)->()\n", This, iface);
3456 return Filtergraph_AddRef(This);
3459 static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface) {
3460 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3462 TRACE("(%p/%p)->()\n", This, iface);
3464 return Filtergraph_Release(This);
3467 /*** IDispatch methods ***/
3468 static HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface,
3470 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3471 IVideoWindow* pVideoWindow;
3474 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
3476 EnterCriticalSection(&This->cs);
3478 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3481 hr = IVideoWindow_GetTypeInfoCount(pVideoWindow, pctinfo);
3483 LeaveCriticalSection(&This->cs);
3488 static HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface,
3491 ITypeInfo**ppTInfo) {
3492 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3493 IVideoWindow* pVideoWindow;
3496 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
3498 EnterCriticalSection(&This->cs);
3500 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3503 hr = IVideoWindow_GetTypeInfo(pVideoWindow, iTInfo, lcid, ppTInfo);
3505 LeaveCriticalSection(&This->cs);
3510 static HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface,
3516 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3517 IVideoWindow* pVideoWindow;
3520 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
3522 EnterCriticalSection(&This->cs);
3524 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3527 hr = IVideoWindow_GetIDsOfNames(pVideoWindow, riid, rgszNames, cNames, lcid, rgDispId);
3529 LeaveCriticalSection(&This->cs);
3534 static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface,
3535 DISPID dispIdMember,
3539 DISPPARAMS*pDispParams,
3541 EXCEPINFO*pExepInfo,
3543 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3544 IVideoWindow* pVideoWindow;
3547 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);
3549 EnterCriticalSection(&This->cs);
3551 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3554 hr = IVideoWindow_Invoke(pVideoWindow, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
3556 LeaveCriticalSection(&This->cs);
3562 /*** IVideoWindow methods ***/
3563 static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface,
3565 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3566 IVideoWindow* pVideoWindow;
3569 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
3571 EnterCriticalSection(&This->cs);
3573 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3576 hr = IVideoWindow_put_Caption(pVideoWindow, strCaption);
3578 LeaveCriticalSection(&This->cs);
3583 static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface,
3585 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3586 IVideoWindow* pVideoWindow;
3589 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
3591 EnterCriticalSection(&This->cs);
3593 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3596 hr = IVideoWindow_get_Caption(pVideoWindow, strCaption);
3598 LeaveCriticalSection(&This->cs);
3603 static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface,
3605 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3606 IVideoWindow* pVideoWindow;
3609 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyle);
3611 EnterCriticalSection(&This->cs);
3613 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3616 hr = IVideoWindow_put_WindowStyle(pVideoWindow, WindowStyle);
3618 LeaveCriticalSection(&This->cs);
3623 static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface,
3624 long *WindowStyle) {
3625 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3626 IVideoWindow* pVideoWindow;
3629 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
3631 EnterCriticalSection(&This->cs);
3633 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3636 hr = IVideoWindow_get_WindowStyle(pVideoWindow, WindowStyle);
3638 LeaveCriticalSection(&This->cs);
3643 static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface,
3644 long WindowStyleEx) {
3645 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3646 IVideoWindow* pVideoWindow;
3649 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
3651 EnterCriticalSection(&This->cs);
3653 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3656 hr = IVideoWindow_put_WindowStyleEx(pVideoWindow, WindowStyleEx);
3658 LeaveCriticalSection(&This->cs);
3663 static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface,
3664 long *WindowStyleEx) {
3665 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3666 IVideoWindow* pVideoWindow;
3669 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
3671 EnterCriticalSection(&This->cs);
3673 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3676 hr = IVideoWindow_get_WindowStyleEx(pVideoWindow, WindowStyleEx);
3678 LeaveCriticalSection(&This->cs);
3683 static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface,
3685 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3686 IVideoWindow* pVideoWindow;
3689 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
3691 EnterCriticalSection(&This->cs);
3693 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3696 hr = IVideoWindow_put_AutoShow(pVideoWindow, AutoShow);
3698 LeaveCriticalSection(&This->cs);
3703 static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface,
3705 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3706 IVideoWindow* pVideoWindow;
3709 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
3711 EnterCriticalSection(&This->cs);
3713 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3716 hr = IVideoWindow_get_AutoShow(pVideoWindow, AutoShow);
3718 LeaveCriticalSection(&This->cs);
3723 static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface,
3725 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3726 IVideoWindow* pVideoWindow;
3729 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowState);
3731 EnterCriticalSection(&This->cs);
3733 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3736 hr = IVideoWindow_put_WindowState(pVideoWindow, WindowState);
3738 LeaveCriticalSection(&This->cs);
3743 static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface,
3744 long *WindowState) {
3745 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3746 IVideoWindow* pVideoWindow;
3749 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
3751 EnterCriticalSection(&This->cs);
3753 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3756 hr = IVideoWindow_get_WindowState(pVideoWindow, WindowState);
3758 LeaveCriticalSection(&This->cs);
3763 static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface,
3764 long BackgroundPalette) {
3765 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3766 IVideoWindow* pVideoWindow;
3769 TRACE("(%p/%p)->(%ld)\n", This, iface, BackgroundPalette);
3771 EnterCriticalSection(&This->cs);
3773 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3776 hr = IVideoWindow_put_BackgroundPalette(pVideoWindow, BackgroundPalette);
3778 LeaveCriticalSection(&This->cs);
3783 static HRESULT WINAPI VideoWindow_get_BackgroundPalette(IVideoWindow *iface,
3784 long *pBackgroundPalette) {
3785 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3786 IVideoWindow* pVideoWindow;
3789 TRACE("(%p/%p)->(%p)\n", This, iface, pBackgroundPalette);
3791 EnterCriticalSection(&This->cs);
3793 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3796 hr = IVideoWindow_get_BackgroundPalette(pVideoWindow, pBackgroundPalette);
3798 LeaveCriticalSection(&This->cs);
3803 static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface,
3805 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3806 IVideoWindow* pVideoWindow;
3809 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
3811 EnterCriticalSection(&This->cs);
3813 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3816 hr = IVideoWindow_put_Visible(pVideoWindow, Visible);
3818 LeaveCriticalSection(&This->cs);
3823 static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface,
3825 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3826 IVideoWindow* pVideoWindow;
3829 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
3831 EnterCriticalSection(&This->cs);
3833 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3836 hr = IVideoWindow_get_Visible(pVideoWindow, pVisible);
3838 LeaveCriticalSection(&This->cs);
3843 static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface,
3845 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3846 IVideoWindow* pVideoWindow;
3849 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
3851 EnterCriticalSection(&This->cs);
3853 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3856 hr = IVideoWindow_put_Left(pVideoWindow, Left);
3858 LeaveCriticalSection(&This->cs);
3863 static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface,
3865 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3866 IVideoWindow* pVideoWindow;
3869 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
3871 EnterCriticalSection(&This->cs);
3873 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3876 hr = IVideoWindow_get_Left(pVideoWindow, pLeft);
3878 LeaveCriticalSection(&This->cs);
3883 static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface,
3885 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3886 IVideoWindow* pVideoWindow;
3889 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
3891 EnterCriticalSection(&This->cs);
3893 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3896 hr = IVideoWindow_put_Width(pVideoWindow, Width);
3898 LeaveCriticalSection(&This->cs);
3903 static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface,
3905 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3906 IVideoWindow* pVideoWindow;
3909 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
3911 EnterCriticalSection(&This->cs);
3913 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3916 hr = IVideoWindow_get_Width(pVideoWindow, pWidth);
3918 LeaveCriticalSection(&This->cs);
3923 static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface,
3925 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3926 IVideoWindow* pVideoWindow;
3929 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
3931 EnterCriticalSection(&This->cs);
3933 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3936 hr = IVideoWindow_put_Top(pVideoWindow, Top);
3938 LeaveCriticalSection(&This->cs);
3943 static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface,
3945 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3946 IVideoWindow* pVideoWindow;
3949 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
3951 EnterCriticalSection(&This->cs);
3953 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3956 hr = IVideoWindow_get_Top(pVideoWindow, pTop);
3958 LeaveCriticalSection(&This->cs);
3963 static HRESULT WINAPI VideoWindow_put_Height(IVideoWindow *iface,
3965 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3966 IVideoWindow* pVideoWindow;
3969 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
3971 EnterCriticalSection(&This->cs);
3973 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3976 hr = IVideoWindow_put_Height(pVideoWindow, Height);
3978 LeaveCriticalSection(&This->cs);
3983 static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface,
3985 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3986 IVideoWindow* pVideoWindow;
3989 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
3991 EnterCriticalSection(&This->cs);
3993 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3996 hr = IVideoWindow_get_Height(pVideoWindow, pHeight);
3998 LeaveCriticalSection(&This->cs);
4003 static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface,
4005 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4006 IVideoWindow* pVideoWindow;
4009 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
4011 EnterCriticalSection(&This->cs);
4013 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4016 hr = IVideoWindow_put_Owner(pVideoWindow, Owner);
4018 LeaveCriticalSection(&This->cs);
4023 static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface,
4025 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4026 IVideoWindow* pVideoWindow;
4029 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
4031 EnterCriticalSection(&This->cs);
4033 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4036 hr = IVideoWindow_get_Owner(pVideoWindow, Owner);
4038 LeaveCriticalSection(&This->cs);
4043 static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface,
4045 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4046 IVideoWindow* pVideoWindow;
4049 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
4051 EnterCriticalSection(&This->cs);
4053 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4056 hr = IVideoWindow_put_MessageDrain(pVideoWindow, Drain);
4058 LeaveCriticalSection(&This->cs);
4063 static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface,
4065 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4066 IVideoWindow* pVideoWindow;
4069 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
4071 EnterCriticalSection(&This->cs);
4073 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4076 hr = IVideoWindow_get_MessageDrain(pVideoWindow, Drain);
4078 LeaveCriticalSection(&This->cs);
4083 static HRESULT WINAPI VideoWindow_get_BorderColor(IVideoWindow *iface,
4085 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4086 IVideoWindow* pVideoWindow;
4089 TRACE("(%p/%p)->(%p)\n", This, iface, Color);
4091 EnterCriticalSection(&This->cs);
4093 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4096 hr = IVideoWindow_get_BorderColor(pVideoWindow, Color);
4098 LeaveCriticalSection(&This->cs);
4103 static HRESULT WINAPI VideoWindow_put_BorderColor(IVideoWindow *iface,
4105 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4106 IVideoWindow* pVideoWindow;
4109 TRACE("(%p/%p)->(%ld)\n", This, iface, Color);
4111 EnterCriticalSection(&This->cs);
4113 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4116 hr = IVideoWindow_put_BorderColor(pVideoWindow, Color);
4118 LeaveCriticalSection(&This->cs);
4123 static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
4124 long *FullScreenMode) {
4125 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4126 IVideoWindow* pVideoWindow;
4129 TRACE("(%p/%p)->(%p)\n", This, iface, FullScreenMode);
4131 EnterCriticalSection(&This->cs);
4133 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4136 hr = IVideoWindow_get_FullScreenMode(pVideoWindow, FullScreenMode);
4138 LeaveCriticalSection(&This->cs);
4143 static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface,
4144 long FullScreenMode) {
4145 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4146 IVideoWindow* pVideoWindow;
4149 TRACE("(%p/%p)->(%ld)\n", This, iface, FullScreenMode);
4151 EnterCriticalSection(&This->cs);
4153 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4156 hr = IVideoWindow_put_FullScreenMode(pVideoWindow, FullScreenMode);
4158 LeaveCriticalSection(&This->cs);
4163 static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface,
4165 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4166 IVideoWindow* pVideoWindow;
4169 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
4171 EnterCriticalSection(&This->cs);
4173 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4176 hr = IVideoWindow_SetWindowForeground(pVideoWindow, Focus);
4178 LeaveCriticalSection(&This->cs);
4183 static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface,
4188 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4189 IVideoWindow* pVideoWindow;
4192 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
4194 EnterCriticalSection(&This->cs);
4196 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4199 hr = IVideoWindow_NotifyOwnerMessage(pVideoWindow, hwnd, uMsg, wParam, lParam);
4201 LeaveCriticalSection(&This->cs);
4206 static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface,
4211 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4212 IVideoWindow* pVideoWindow;
4215 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
4217 EnterCriticalSection(&This->cs);
4219 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4222 hr = IVideoWindow_SetWindowPosition(pVideoWindow, Left, Top, Width, Height);
4224 LeaveCriticalSection(&This->cs);
4229 static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface,
4234 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4235 IVideoWindow* pVideoWindow;
4238 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
4240 EnterCriticalSection(&This->cs);
4242 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4245 hr = IVideoWindow_GetWindowPosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
4247 LeaveCriticalSection(&This->cs);
4252 static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface,
4255 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4256 IVideoWindow* pVideoWindow;
4259 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
4261 EnterCriticalSection(&This->cs);
4263 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4266 hr = IVideoWindow_GetMinIdealImageSize(pVideoWindow, pWidth, pHeight);
4268 LeaveCriticalSection(&This->cs);
4273 static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface,
4276 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4277 IVideoWindow* pVideoWindow;
4280 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
4282 EnterCriticalSection(&This->cs);
4284 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4287 hr = IVideoWindow_GetMaxIdealImageSize(pVideoWindow, pWidth, pHeight);
4289 LeaveCriticalSection(&This->cs);
4294 static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface,
4299 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4300 IVideoWindow* pVideoWindow;
4303 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
4305 EnterCriticalSection(&This->cs);
4307 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4310 hr = IVideoWindow_GetRestorePosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
4312 LeaveCriticalSection(&This->cs);
4317 static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface,
4319 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4320 IVideoWindow* pVideoWindow;
4323 TRACE("(%p/%p)->(%ld)\n", This, iface, HideCursor);
4325 EnterCriticalSection(&This->cs);
4327 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4330 hr = IVideoWindow_HideCursor(pVideoWindow, HideCursor);
4332 LeaveCriticalSection(&This->cs);
4337 static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface,
4338 long *CursorHidden) {
4339 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4340 IVideoWindow* pVideoWindow;
4343 TRACE("(%p/%p)->(%p)\n", This, iface, CursorHidden);
4345 EnterCriticalSection(&This->cs);
4347 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4350 hr = IVideoWindow_IsCursorHidden(pVideoWindow, CursorHidden);
4352 LeaveCriticalSection(&This->cs);
4358 static const IVideoWindowVtbl IVideoWindow_VTable =
4360 VideoWindow_QueryInterface,
4362 VideoWindow_Release,
4363 VideoWindow_GetTypeInfoCount,
4364 VideoWindow_GetTypeInfo,
4365 VideoWindow_GetIDsOfNames,
4367 VideoWindow_put_Caption,
4368 VideoWindow_get_Caption,
4369 VideoWindow_put_WindowStyle,
4370 VideoWindow_get_WindowStyle,
4371 VideoWindow_put_WindowStyleEx,
4372 VideoWindow_get_WindowStyleEx,
4373 VideoWindow_put_AutoShow,
4374 VideoWindow_get_AutoShow,
4375 VideoWindow_put_WindowState,
4376 VideoWindow_get_WindowState,
4377 VideoWindow_put_BackgroundPalette,
4378 VideoWindow_get_BackgroundPalette,
4379 VideoWindow_put_Visible,
4380 VideoWindow_get_Visible,
4381 VideoWindow_put_Left,
4382 VideoWindow_get_Left,
4383 VideoWindow_put_Width,
4384 VideoWindow_get_Width,
4385 VideoWindow_put_Top,
4386 VideoWindow_get_Top,
4387 VideoWindow_put_Height,
4388 VideoWindow_get_Height,
4389 VideoWindow_put_Owner,
4390 VideoWindow_get_Owner,
4391 VideoWindow_put_MessageDrain,
4392 VideoWindow_get_MessageDrain,
4393 VideoWindow_get_BorderColor,
4394 VideoWindow_put_BorderColor,
4395 VideoWindow_get_FullScreenMode,
4396 VideoWindow_put_FullScreenMode,
4397 VideoWindow_SetWindowForeground,
4398 VideoWindow_NotifyOwnerMessage,
4399 VideoWindow_SetWindowPosition,
4400 VideoWindow_GetWindowPosition,
4401 VideoWindow_GetMinIdealImageSize,
4402 VideoWindow_GetMaxIdealImageSize,
4403 VideoWindow_GetRestorePosition,
4404 VideoWindow_HideCursor,
4405 VideoWindow_IsCursorHidden
4409 /*** IUnknown methods ***/
4410 static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface,
4413 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4415 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
4417 return Filtergraph_QueryInterface(This, riid, ppvObj);
4420 static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface) {
4421 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4423 TRACE("(%p/%p)->()\n", This, iface);
4425 return Filtergraph_AddRef(This);
4428 static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface) {
4429 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4431 TRACE("(%p/%p)->()\n", This, iface);
4433 return Filtergraph_Release(This);
4436 /*** IDispatch methods ***/
4437 static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface,
4439 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4441 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
4446 static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface,
4449 ITypeInfo**ppTInfo) {
4450 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4452 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
4457 static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface,
4463 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4465 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
4470 static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface,
4471 DISPID dispIdMember,
4475 DISPPARAMS*pDispParams,
4477 EXCEPINFO*pExepInfo,
4479 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4481 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);
4486 /*** IMediaEvent methods ***/
4487 static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface,
4489 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4491 TRACE("(%p/%p)->(%p)\n", This, iface, hEvent);
4493 *hEvent = (OAEVENT)This->evqueue.msg_event;
4498 static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface,
4503 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4506 TRACE("(%p/%p)->(%p, %p, %p, %ld)\n", This, iface, lEventCode, lParam1, lParam2, msTimeout);
4508 if (EventsQueue_GetEvent(&This->evqueue, &evt, msTimeout))
4510 *lEventCode = evt.lEventCode;
4511 *lParam1 = evt.lParam1;
4512 *lParam2 = evt.lParam2;
4520 static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface,
4523 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4525 TRACE("(%p/%p)->(%ld, %p)\n", This, iface, msTimeout, pEvCode);
4527 if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
4529 *pEvCode = This->CompletionStatus;
4537 static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface,
4539 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4541 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4543 if (lEvCode == EC_COMPLETE)
4544 This->HandleEcComplete = FALSE;
4545 else if (lEvCode == EC_REPAINT)
4546 This->HandleEcRepaint = FALSE;
4547 else if (lEvCode == EC_CLOCK_CHANGED)
4548 This->HandleEcClockChanged = FALSE;
4555 static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(IMediaEventEx *iface,
4557 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4559 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4561 if (lEvCode == EC_COMPLETE)
4562 This->HandleEcComplete = TRUE;
4563 else if (lEvCode == EC_REPAINT)
4564 This->HandleEcRepaint = TRUE;
4565 else if (lEvCode == EC_CLOCK_CHANGED)
4566 This->HandleEcClockChanged = TRUE;
4573 static HRESULT WINAPI MediaEvent_FreeEventParams(IMediaEventEx *iface,
4577 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4579 TRACE("(%p/%p)->(%ld, %08lx, %08lx): stub !!!\n", This, iface, lEvCode, lParam1, lParam2);
4584 /*** IMediaEventEx methods ***/
4585 static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
4588 LONG_PTR lInstanceData) {
4589 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4591 TRACE("(%p/%p)->(%08x, %ld, %08lx)\n", This, iface, (DWORD) hwnd, lMsg, lInstanceData);
4593 This->notif.hWnd = (HWND)hwnd;
4594 This->notif.msg = lMsg;
4595 This->notif.instance = (long) lInstanceData;
4600 static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface,
4601 long lNoNotifyFlags) {
4602 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4604 TRACE("(%p/%p)->(%ld)\n", This, iface, lNoNotifyFlags);
4606 if ((lNoNotifyFlags != 0) && (lNoNotifyFlags != 1))
4607 return E_INVALIDARG;
4609 This->notif.disabled = lNoNotifyFlags;
4614 static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface,
4615 long *lplNoNotifyFlags) {
4616 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4618 TRACE("(%p/%p)->(%p)\n", This, iface, lplNoNotifyFlags);
4620 if (!lplNoNotifyFlags)
4623 *lplNoNotifyFlags = This->notif.disabled;
4629 static const IMediaEventExVtbl IMediaEventEx_VTable =
4631 MediaEvent_QueryInterface,
4634 MediaEvent_GetTypeInfoCount,
4635 MediaEvent_GetTypeInfo,
4636 MediaEvent_GetIDsOfNames,
4638 MediaEvent_GetEventHandle,
4639 MediaEvent_GetEvent,
4640 MediaEvent_WaitForCompletion,
4641 MediaEvent_CancelDefaultHandling,
4642 MediaEvent_RestoreDefaultHandling,
4643 MediaEvent_FreeEventParams,
4644 MediaEvent_SetNotifyWindow,
4645 MediaEvent_SetNotifyFlags,
4646 MediaEvent_GetNotifyFlags
4650 static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID riid, LPVOID *ppv)
4652 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4654 return Filtergraph_QueryInterface(This, riid, ppv);
4657 static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
4659 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4661 return Filtergraph_AddRef(This);
4664 static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
4666 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4668 return Filtergraph_Release(This);
4671 static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClassID)
4673 FIXME("(%p): stub\n", pClassID);
4678 static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
4680 FIXME("(): stub\n");
4685 static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
4687 FIXME("(): stub\n");
4692 static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME tStart)
4694 FIXME("(0x%s): stub\n", wine_dbgstr_longlong(tStart));
4699 static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD dwMsTimeout, FILTER_STATE * pState)
4701 FIXME("(%d, %p): stub\n", dwMsTimeout, pState);
4706 static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
4708 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4712 TRACE("(%p/%p)->(%p)\n", iface, This, pClock);
4714 EnterCriticalSection(&This->cs);
4716 for (i = 0;i < This->nFilters;i++)
4718 hr = IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], pClock);
4726 IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], This->refClock);
4731 IReferenceClock_Release(This->refClock);
4732 This->refClock = pClock;
4734 IReferenceClock_AddRef(This->refClock);
4736 if (This->HandleEcClockChanged)
4738 IMediaEventSink *pEventSink;
4741 eshr = IMediaFilter_QueryInterface(iface, &IID_IMediaEventSink, (LPVOID)&pEventSink);
4742 if (SUCCEEDED(eshr))
4744 IMediaEventSink_Notify(pEventSink, EC_CLOCK_CHANGED, 0, 0);
4745 IMediaEventSink_Release(pEventSink);
4750 LeaveCriticalSection(&This->cs);
4755 static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
4757 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4759 TRACE("(%p/%p)->(%p)\n", iface, This, ppClock);
4764 EnterCriticalSection(&This->cs);
4766 *ppClock = This->refClock;
4768 IReferenceClock_AddRef(*ppClock);
4770 LeaveCriticalSection(&This->cs);
4775 static const IMediaFilterVtbl IMediaFilter_VTable =
4777 MediaFilter_QueryInterface,
4779 MediaFilter_Release,
4780 MediaFilter_GetClassID,
4784 MediaFilter_GetState,
4785 MediaFilter_SetSyncSource,
4786 MediaFilter_GetSyncSource
4789 static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID riid, LPVOID *ppv)
4791 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4793 return Filtergraph_QueryInterface(This, riid, ppv);
4796 static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
4798 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4800 return Filtergraph_AddRef(This);
4803 static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
4805 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4807 return Filtergraph_Release(This);
4810 static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, long EventCode, LONG_PTR EventParam1, LONG_PTR EventParam2)
4812 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4815 TRACE("(%p/%p)->(%ld, %ld, %ld)\n", This, iface, EventCode, EventParam1, EventParam2);
4817 /* We need thread safety here, let's use the events queue's one */
4818 EnterCriticalSection(&This->evqueue.msg_crst);
4820 if ((EventCode == EC_COMPLETE) && This->HandleEcComplete)
4822 TRACE("Process EC_COMPLETE notification\n");
4823 if (++This->EcCompleteCount == This->nRenderers)
4825 evt.lEventCode = EC_COMPLETE;
4828 TRACE("Send EC_COMPLETE to app\n");
4829 EventsQueue_PutEvent(&This->evqueue, &evt);
4830 if (!This->notif.disabled && This->notif.hWnd)
4832 TRACE("Send Window message\n");
4833 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4835 This->CompletionStatus = EC_COMPLETE;
4836 SetEvent(This->hEventCompletion);
4839 else if ((EventCode == EC_REPAINT) && This->HandleEcRepaint)
4841 /* FIXME: Not handled yet */
4845 evt.lEventCode = EventCode;
4846 evt.lParam1 = EventParam1;
4847 evt.lParam2 = EventParam2;
4848 EventsQueue_PutEvent(&This->evqueue, &evt);
4849 if (!This->notif.disabled && This->notif.hWnd)
4850 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4853 LeaveCriticalSection(&This->evqueue.msg_crst);
4857 static const IMediaEventSinkVtbl IMediaEventSink_VTable =
4859 MediaEventSink_QueryInterface,
4860 MediaEventSink_AddRef,
4861 MediaEventSink_Release,
4862 MediaEventSink_Notify
4865 static HRESULT WINAPI GraphConfig_QueryInterface(IGraphConfig *iface, REFIID riid, LPVOID *ppv)
4867 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4869 return Filtergraph_QueryInterface(This, riid, ppv);
4872 static ULONG WINAPI GraphConfig_AddRef(IGraphConfig *iface)
4874 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4876 return Filtergraph_AddRef(This);
4879 static ULONG WINAPI GraphConfig_Release(IGraphConfig *iface)
4881 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4883 return Filtergraph_Release(This);
4886 static HRESULT WINAPI GraphConfig_Reconnect(IGraphConfig *iface,
4889 const AM_MEDIA_TYPE* pmtFirstConnection,
4890 IBaseFilter* pUsingFilter,
4894 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4896 FIXME("(%p)->(%p, %p, %p, %p, %p, %x): stub!\n", This, pOutputPin, pInputPin, pmtFirstConnection, pUsingFilter, hAbortEvent, dwFlags);
4901 static HRESULT WINAPI GraphConfig_Reconfigure(IGraphConfig *iface,
4902 IGraphConfigCallback* pCallback,
4907 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4909 FIXME("(%p)->(%p, %p, %x, %p): stub!\n", This, pCallback, pvContext, dwFlags, hAbortEvent);
4914 static HRESULT WINAPI GraphConfig_AddFilterToCache(IGraphConfig *iface,
4915 IBaseFilter* pFilter)
4917 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4919 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4924 static HRESULT WINAPI GraphConfig_EnumCacheFilter(IGraphConfig *iface,
4925 IEnumFilters** pEnum)
4927 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4929 FIXME("(%p)->(%p): stub!\n", This, pEnum);
4934 static HRESULT WINAPI GraphConfig_RemoveFilterFromCache(IGraphConfig *iface,
4935 IBaseFilter* pFilter)
4937 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4939 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4944 static HRESULT WINAPI GraphConfig_GetStartTime(IGraphConfig *iface,
4945 REFERENCE_TIME* prtStart)
4947 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4949 FIXME("(%p)->(%p): stub!\n", This, prtStart);
4954 static HRESULT WINAPI GraphConfig_PushThroughData(IGraphConfig *iface,
4956 IPinConnection* pConnection,
4959 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4961 FIXME("(%p)->(%p, %p, %p): stub!\n", This, pOutputPin, pConnection, hEventAbort);
4966 static HRESULT WINAPI GraphConfig_SetFilterFlags(IGraphConfig *iface,
4967 IBaseFilter* pFilter,
4970 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4972 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
4977 static HRESULT WINAPI GraphConfig_GetFilterFlags(IGraphConfig *iface,
4978 IBaseFilter* pFilter,
4981 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4983 FIXME("(%p)->(%p, %p): stub!\n", This, pFilter, dwFlags);
4988 static HRESULT WINAPI GraphConfig_RemoveFilterEx(IGraphConfig *iface,
4989 IBaseFilter* pFilter,
4992 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4994 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
4999 static const IGraphConfigVtbl IGraphConfig_VTable =
5001 GraphConfig_QueryInterface,
5003 GraphConfig_Release,
5004 GraphConfig_Reconnect,
5005 GraphConfig_Reconfigure,
5006 GraphConfig_AddFilterToCache,
5007 GraphConfig_EnumCacheFilter,
5008 GraphConfig_RemoveFilterFromCache,
5009 GraphConfig_GetStartTime,
5010 GraphConfig_PushThroughData,
5011 GraphConfig_SetFilterFlags,
5012 GraphConfig_GetFilterFlags,
5013 GraphConfig_RemoveFilterEx
5016 static const IUnknownVtbl IInner_VTable =
5018 FilterGraphInner_QueryInterface,
5019 FilterGraphInner_AddRef,
5020 FilterGraphInner_Release
5023 static HRESULT WINAPI Filtergraph_QueryInterface(IFilterGraphImpl *This,
5026 if (This->bAggregatable)
5027 This->bUnkOuterValid = TRUE;
5029 if (This->pUnkOuter)
5031 if (This->bAggregatable)
5032 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
5034 if (IsEqualIID(riid, &IID_IUnknown))
5038 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
5039 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
5040 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
5041 This->bAggregatable = TRUE;
5046 return E_NOINTERFACE;
5049 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
5052 static ULONG WINAPI Filtergraph_AddRef(IFilterGraphImpl *This) {
5053 if (This->pUnkOuter && This->bUnkOuterValid)
5054 return IUnknown_AddRef(This->pUnkOuter);
5055 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
5058 static ULONG WINAPI Filtergraph_Release(IFilterGraphImpl *This) {
5059 if (This->pUnkOuter && This->bUnkOuterValid)
5060 return IUnknown_Release(This->pUnkOuter);
5061 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
5064 /* This is the only function that actually creates a FilterGraph class... */
5065 HRESULT FilterGraph_create(IUnknown *pUnkOuter, LPVOID *ppObj)
5067 IFilterGraphImpl *fimpl;
5070 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
5074 fimpl = CoTaskMemAlloc(sizeof(*fimpl));
5075 fimpl->pUnkOuter = pUnkOuter;
5076 fimpl->bUnkOuterValid = FALSE;
5077 fimpl->bAggregatable = FALSE;
5078 fimpl->IInner_vtbl = &IInner_VTable;
5079 fimpl->IFilterGraph2_vtbl = &IFilterGraph2_VTable;
5080 fimpl->IMediaControl_vtbl = &IMediaControl_VTable;
5081 fimpl->IMediaSeeking_vtbl = &IMediaSeeking_VTable;
5082 fimpl->IBasicAudio_vtbl = &IBasicAudio_VTable;
5083 fimpl->IBasicVideo_vtbl = &IBasicVideo_VTable;
5084 fimpl->IVideoWindow_vtbl = &IVideoWindow_VTable;
5085 fimpl->IMediaEventEx_vtbl = &IMediaEventEx_VTable;
5086 fimpl->IMediaFilter_vtbl = &IMediaFilter_VTable;
5087 fimpl->IMediaEventSink_vtbl = &IMediaEventSink_VTable;
5088 fimpl->IGraphConfig_vtbl = &IGraphConfig_VTable;
5089 fimpl->IMediaPosition_vtbl = &IMediaPosition_VTable;
5091 fimpl->ppFiltersInGraph = NULL;
5092 fimpl->pFilterNames = NULL;
5093 fimpl->nFilters = 0;
5094 fimpl->filterCapacity = 0;
5095 fimpl->nameIndex = 1;
5096 fimpl->refClock = NULL;
5097 fimpl->hEventCompletion = CreateEventW(0, TRUE, FALSE, 0);
5098 fimpl->HandleEcComplete = TRUE;
5099 fimpl->HandleEcRepaint = TRUE;
5100 fimpl->HandleEcClockChanged = TRUE;
5101 fimpl->notif.hWnd = 0;
5102 fimpl->notif.disabled = FALSE;
5103 fimpl->nRenderers = 0;
5104 fimpl->EcCompleteCount = 0;
5105 fimpl->state = State_Stopped;
5106 EventsQueue_Init(&fimpl->evqueue);
5107 InitializeCriticalSection(&fimpl->cs);
5108 fimpl->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IFilterGraphImpl.cs");
5109 fimpl->nItfCacheEntries = 0;
5110 memcpy(&fimpl->timeformatseek, &TIME_FORMAT_MEDIA_TIME, sizeof(GUID));
5111 fimpl->start_time = fimpl->position = 0;
5112 fimpl->stop_position = -1;
5114 hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&fimpl->pFilterMapper2);
5116 ERR("Unable to create filter mapper (%x)\n", hr);
5119 IFilterGraph2_SetDefaultSyncSource((IFilterGraph2*)fimpl);
5125 HRESULT FilterGraphNoThread_create(IUnknown *pUnkOuter, LPVOID *ppObj)
5127 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
5128 return FilterGraph_create(pUnkOuter, ppObj);