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 IBasicVideo2Vtbl *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 */
173 /* IRegisterServiceProvider */
174 /* IResourceMananger */
175 /* IServiceProvider */
176 /* IVideoFrameStep */
179 IFilterMapper2 * pFilterMapper2;
180 IBaseFilter ** ppFiltersInGraph;
181 LPWSTR * pFilterNames;
185 IReferenceClock *refClock;
187 HANDLE hEventCompletion;
188 int CompletionStatus;
192 int HandleEcComplete;
194 int HandleEcClockChanged;
197 ITF_CACHE_ENTRY ItfCacheEntries[MAX_ITF_CACHE_ENTRIES];
198 int nItfCacheEntries;
199 IUnknown * pUnkOuter;
205 LONGLONG stop_position;
208 static HRESULT WINAPI Filtergraph_QueryInterface(IFilterGraphImpl *This,
209 REFIID riid, LPVOID * ppv);
210 static ULONG WINAPI Filtergraph_AddRef(IFilterGraphImpl *This);
211 static ULONG WINAPI Filtergraph_Release(IFilterGraphImpl *This);
213 static HRESULT WINAPI FilterGraphInner_QueryInterface(IUnknown * iface,
216 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
217 TRACE("(%p)->(%s (%p), %p)\n", This, debugstr_guid(riid), riid, ppvObj);
219 if (This->bAggregatable)
220 This->bUnkOuterValid = TRUE;
222 if (IsEqualGUID(&IID_IUnknown, riid)) {
223 *ppvObj = &(This->IInner_vtbl);
224 TRACE(" returning IUnknown interface (%p)\n", *ppvObj);
225 } else if (IsEqualGUID(&IID_IFilterGraph, riid) ||
226 IsEqualGUID(&IID_IFilterGraph2, riid) ||
227 IsEqualGUID(&IID_IGraphBuilder, riid)) {
228 *ppvObj = &(This->IFilterGraph2_vtbl);
229 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj);
230 } else if (IsEqualGUID(&IID_IMediaControl, riid)) {
231 *ppvObj = &(This->IMediaControl_vtbl);
232 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj);
233 } else if (IsEqualGUID(&IID_IMediaSeeking, riid)) {
234 *ppvObj = &(This->IMediaSeeking_vtbl);
235 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj);
236 } else if (IsEqualGUID(&IID_IBasicAudio, riid)) {
237 *ppvObj = &(This->IBasicAudio_vtbl);
238 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj);
239 } else if (IsEqualGUID(&IID_IBasicVideo, riid) ||
240 IsEqualGUID(&IID_IBasicVideo2, riid)) {
241 *ppvObj = &(This->IBasicVideo_vtbl);
242 TRACE(" returning IBasicVideo2 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)
284 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
285 ULONG ref = InterlockedDecrement(&This->ref);
287 TRACE("(%p)->(): new ref = %d\n", This, ref);
292 IMediaControl_Stop((IMediaControl*)&(This->IMediaControl_vtbl));
294 while (This->nFilters)
295 IFilterGraph2_RemoveFilter((IFilterGraph2*)This, This->ppFiltersInGraph[0]);
298 IReferenceClock_Release(This->refClock);
300 for (i = 0; i < This->nItfCacheEntries; i++)
302 if (This->ItfCacheEntries[i].iface)
303 IUnknown_Release(This->ItfCacheEntries[i].iface);
305 IFilterMapper2_Release(This->pFilterMapper2);
306 CloseHandle(This->hEventCompletion);
307 EventsQueue_Destroy(&This->evqueue);
308 This->cs.DebugInfo->Spare[0] = 0;
309 DeleteCriticalSection(&This->cs);
310 CoTaskMemFree(This->ppFiltersInGraph);
311 CoTaskMemFree(This->pFilterNames);
318 /*** IUnknown methods ***/
319 static HRESULT WINAPI FilterGraph2_QueryInterface(IFilterGraph2 *iface,
322 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
324 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
325 return Filtergraph_QueryInterface(This, riid, ppvObj);
328 static ULONG WINAPI FilterGraph2_AddRef(IFilterGraph2 *iface) {
329 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
331 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This, iface);
333 return Filtergraph_AddRef(This);
336 static ULONG WINAPI FilterGraph2_Release(IFilterGraph2 *iface) {
337 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
339 TRACE("(%p/%p)->() calling FilterGraph Release\n", This, iface);
341 return Filtergraph_Release(This);
344 /*** IFilterGraph methods ***/
345 static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface,
346 IBaseFilter *pFilter,
348 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
351 WCHAR* wszFilterName = NULL;
352 int duplicate_name = FALSE;
354 TRACE("(%p/%p)->(%p, %s (%p))\n", This, iface, pFilter, debugstr_w(pName), pName);
359 wszFilterName = CoTaskMemAlloc( (pName ? strlenW(pName) + 6 : 5) * sizeof(WCHAR) );
363 /* Check if name already exists */
364 for(i = 0; i < This->nFilters; i++)
365 if (!strcmpW(This->pFilterNames[i], pName))
367 duplicate_name = TRUE;
372 /* If no name given or name already existing, generate one */
373 if (!pName || duplicate_name)
375 static const WCHAR wszFmt1[] = {'%','s',' ','%','0','4','d',0};
376 static const WCHAR wszFmt2[] = {'%','0','4','d',0};
378 for (j = 0; j < 10000 ; j++)
382 sprintfW(wszFilterName, wszFmt1, pName, This->nameIndex);
384 sprintfW(wszFilterName, wszFmt2, This->nameIndex);
385 TRACE("Generated name %s\n", debugstr_w(wszFilterName));
387 /* Check if the generated name already exists */
388 for(i = 0; i < This->nFilters; i++)
389 if (!strcmpW(This->pFilterNames[i], wszFilterName))
392 /* Compute next index and exit if generated name is suitable */
393 if (This->nameIndex++ == 10000)
395 if (i == This->nFilters)
398 /* Unable to find a suitable name */
401 CoTaskMemFree(wszFilterName);
402 return VFW_E_DUPLICATE_NAME;
406 memcpy(wszFilterName, pName, (strlenW(pName) + 1) * sizeof(WCHAR));
408 if (This->nFilters + 1 > This->filterCapacity)
410 int newCapacity = This->filterCapacity ? 2 * This->filterCapacity : 1;
411 IBaseFilter ** ppNewFilters = CoTaskMemAlloc(newCapacity * sizeof(IBaseFilter*));
412 LPWSTR * pNewNames = CoTaskMemAlloc(newCapacity * sizeof(LPWSTR));
413 memcpy(ppNewFilters, This->ppFiltersInGraph, This->nFilters * sizeof(IBaseFilter*));
414 memcpy(pNewNames, This->pFilterNames, This->nFilters * sizeof(LPWSTR));
415 if (This->filterCapacity)
417 CoTaskMemFree(This->ppFiltersInGraph);
418 CoTaskMemFree(This->pFilterNames);
420 This->ppFiltersInGraph = ppNewFilters;
421 This->pFilterNames = pNewNames;
422 This->filterCapacity = newCapacity;
425 hr = IBaseFilter_JoinFilterGraph(pFilter, (IFilterGraph *)This, wszFilterName);
429 IBaseFilter_AddRef(pFilter);
430 This->ppFiltersInGraph[This->nFilters] = pFilter;
431 This->pFilterNames[This->nFilters] = wszFilterName;
433 IBaseFilter_SetSyncSource(pFilter, This->refClock);
436 CoTaskMemFree(wszFilterName);
438 if (SUCCEEDED(hr) && duplicate_name)
439 return VFW_S_DUPLICATE_NAME;
444 static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilter *pFilter)
446 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
450 TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
452 /* FIXME: check graph is stopped */
454 for (i = 0; i < This->nFilters; i++)
456 if (This->ppFiltersInGraph[i] == pFilter)
458 IEnumPins *penumpins = NULL;
461 TRACE("Removing filter %s\n", debugstr_w(This->pFilterNames[i]));
462 IBaseFilter_GetState(pFilter, 0, &state);
463 if (state == State_Running)
464 IBaseFilter_Pause(pFilter);
465 if (state != State_Stopped)
466 IBaseFilter_Stop(pFilter);
468 hr = IBaseFilter_EnumPins(pFilter, &penumpins);
471 while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK)
475 IPin_ConnectedTo(ppin, &victim);
478 h = IPin_Disconnect(victim);
479 TRACE("Disconnect other side: %08x\n", h);
480 if (h == VFW_E_NOT_STOPPED)
483 IPin_QueryPinInfo(victim, &pinfo);
485 IBaseFilter_GetState(pinfo.pFilter, 0, &state);
486 if (state == State_Running)
487 IBaseFilter_Pause(pinfo.pFilter);
488 IBaseFilter_Stop(pinfo.pFilter);
489 IBaseFilter_Release(pinfo.pFilter);
490 h = IPin_Disconnect(victim);
491 TRACE("Disconnect retry: %08x\n", h);
493 IPin_Release(victim);
495 h = IPin_Disconnect(ppin);
496 TRACE("Disconnect 2: %08x\n", h);
498 IEnumPins_Release(penumpins);
501 hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, This->pFilterNames[i]);
504 IBaseFilter_SetSyncSource(pFilter, NULL);
505 IBaseFilter_Release(pFilter);
506 CoTaskMemFree(This->pFilterNames[i]);
507 memmove(This->ppFiltersInGraph+i, This->ppFiltersInGraph+i+1, sizeof(IBaseFilter*)*(This->nFilters - 1 - i));
508 memmove(This->pFilterNames+i, This->pFilterNames+i+1, sizeof(LPWSTR)*(This->nFilters - 1 - i));
510 /* Invalidate interfaces in the cache */
511 for (i = 0; i < This->nItfCacheEntries; i++)
512 if (pFilter == This->ItfCacheEntries[i].filter)
514 IUnknown_Release(This->ItfCacheEntries[i].iface);
515 This->ItfCacheEntries[i].iface = NULL;
516 This->ItfCacheEntries[i].filter = NULL;
524 return hr; /* FIXME: check this error code */
527 static HRESULT WINAPI FilterGraph2_EnumFilters(IFilterGraph2 *iface,
528 IEnumFilters **ppEnum) {
529 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
531 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
533 return IEnumFiltersImpl_Construct(This->ppFiltersInGraph, This->nFilters, ppEnum);
536 static HRESULT WINAPI FilterGraph2_FindFilterByName(IFilterGraph2 *iface,
538 IBaseFilter **ppFilter) {
539 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
542 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_w(pName), pName, ppFilter);
547 for (i = 0; i < This->nFilters; i++)
549 if (!strcmpW(pName, This->pFilterNames[i]))
551 *ppFilter = This->ppFiltersInGraph[i];
552 IBaseFilter_AddRef(*ppFilter);
558 return VFW_E_NOT_FOUND;
561 /* NOTE: despite the implication, it doesn't matter which
562 * way round you put in the input and output pins */
563 static HRESULT WINAPI FilterGraph2_ConnectDirect(IFilterGraph2 *iface,
566 const AM_MEDIA_TYPE *pmt) {
570 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
572 TRACE("(%p/%p)->(%p, %p, %p)\n", This, iface, ppinIn, ppinOut, pmt);
574 /* FIXME: check pins are in graph */
576 if (TRACE_ON(quartz))
580 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
584 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
585 IBaseFilter_Release(PinInfo.pFilter);
587 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
591 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
592 IBaseFilter_Release(PinInfo.pFilter);
595 hr = IPin_QueryDirection(ppinIn, &dir);
598 if (dir == PINDIR_INPUT)
599 hr = IPin_Connect(ppinOut, ppinIn, pmt);
601 hr = IPin_Connect(ppinIn, ppinOut, pmt);
607 static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface,
609 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
610 IPin *pConnectedTo = NULL;
612 PIN_DIRECTION pindir;
614 IPin_QueryDirection(ppin, &pindir);
615 hr = IPin_ConnectedTo(ppin, &pConnectedTo);
617 TRACE("Querying connected to failed: %x\n", hr);
620 IPin_Disconnect(ppin);
621 IPin_Disconnect(pConnectedTo);
622 if (pindir == PINDIR_INPUT)
623 hr = IPin_Connect(pConnectedTo, ppin, NULL);
625 hr = IPin_Connect(ppin, pConnectedTo, NULL);
626 IPin_Release(pConnectedTo);
628 ERR("Reconnecting pins failed, pins are not connected now..\n");
629 TRACE("(%p->%p) -- %p %p -> %x\n", iface, This, ppin, pConnectedTo, hr);
633 static HRESULT WINAPI FilterGraph2_Disconnect(IFilterGraph2 *iface,
635 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
637 TRACE("(%p/%p)->(%p)\n", This, iface, ppin);
639 return IPin_Disconnect(ppin);
642 static HRESULT WINAPI FilterGraph2_SetDefaultSyncSource(IFilterGraph2 *iface) {
643 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
644 IReferenceClock *pClock = NULL;
647 TRACE("(%p/%p)->() semi-stub\n", iface, This);
649 hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, &IID_IReferenceClock, (LPVOID*)&pClock);
653 hr = IMediaFilter_SetSyncSource((IMediaFilter*)&(This->IMediaFilter_vtbl), pClock);
654 IReferenceClock_Release(pClock);
660 static HRESULT GetFilterInfo(IMoniker* pMoniker, GUID* pclsid, VARIANT* pvar)
662 static const WCHAR wszClsidName[] = {'C','L','S','I','D',0};
663 static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
664 IPropertyBag * pPropBagCat = NULL;
668 V_VT(pvar) = VT_BSTR;
670 hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
673 hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL);
676 hr = CLSIDFromString(V_UNION(pvar, bstrVal), pclsid);
679 hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL);
682 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid), debugstr_w(V_UNION(pvar, bstrVal)));
685 IPropertyBag_Release(pPropBagCat);
690 static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPin*** pppins, ULONG* pnb)
695 TRACE("(%p, %p, %p, %p)\n", pfilter, pinputpin, pppins, pnb);
696 hr = IPin_QueryInternalConnections(pinputpin, NULL, &nb);
699 } else if (hr == S_FALSE) {
700 *pppins = CoTaskMemAlloc(sizeof(IPin*)*nb);
701 hr = IPin_QueryInternalConnections(pinputpin, *pppins, &nb);
703 ERR("Error (%x)\n", hr);
705 } else if (hr == E_NOTIMPL) {
706 /* Input connected to all outputs */
707 IEnumPins* penumpins;
710 TRACE("E_NOTIMPL\n");
711 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
713 ERR("filter Enumpins failed (%x)\n", hr);
717 /* Count output pins */
718 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
719 PIN_DIRECTION pindir;
720 IPin_QueryDirection(ppin, &pindir);
721 if (pindir == PINDIR_OUTPUT)
725 *pppins = CoTaskMemAlloc(sizeof(IPin*)*i);
726 /* Retrieve output pins */
727 IEnumPins_Reset(penumpins);
729 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
730 PIN_DIRECTION pindir;
731 IPin_QueryDirection(ppin, &pindir);
732 if (pindir == PINDIR_OUTPUT)
733 (*pppins)[i++] = ppin;
737 IEnumPins_Release(penumpins);
740 ERR("Next failed (%x)\n", hr);
743 } else if (FAILED(hr)) {
744 ERR("Cannot get internal connection (%x)\n", hr);
752 /*** IGraphBuilder methods ***/
753 static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface,
756 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
759 IEnumMediaTypes* penummt;
761 IEnumPins* penumpins;
762 IEnumMoniker* pEnumMoniker;
770 TRACE("(%p/%p)->(%p, %p)\n", This, iface, ppinOut, ppinIn);
772 if (TRACE_ON(quartz))
774 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
778 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
779 IBaseFilter_Release(PinInfo.pFilter);
781 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
785 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
786 IBaseFilter_Release(PinInfo.pFilter);
789 /* Try direct connection first */
790 hr = IPin_Connect(ppinOut, ppinIn, NULL);
794 TRACE("Direct connection failed, trying to insert other filters\n");
796 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
800 hr = IBaseFilter_GetClassID(PinInfo.pFilter, &FilterCLSID);
801 IBaseFilter_Release(PinInfo.pFilter);
805 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
806 * filter to the minor mediatype of input pin of the renderer */
807 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
809 ERR("EnumMediaTypes (%x)\n", hr);
813 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
815 ERR("IEnumMediaTypes_Next (%x)\n", hr);
820 ERR("No media type found!\n");
823 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
824 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
826 /* Try to find a suitable filter that can connect to the pin to render */
827 tab[0] = mt->majortype;
828 tab[1] = mt->subtype;
829 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
831 ERR("Unable to enum filters (%x)\n", hr);
835 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
840 IPin* ppinfilter = NULL;
841 IBaseFilter* pfilter = NULL;
843 hr = GetFilterInfo(pMoniker, &clsid, &var);
844 IMoniker_Release(pMoniker);
846 ERR("Unable to retrieve filter info (%x)\n", hr);
850 if (IsEqualGUID(&clsid, &FilterCLSID)) {
851 /* Skip filter (same as the one the output pin belongs to) */
855 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
857 ERR("Unable to create filter (%x), trying next one\n", hr);
861 hr = IFilterGraph2_AddFilter(iface, pfilter, V_UNION(&var, bstrVal));
863 ERR("Unable to add filter (%x)\n", hr);
864 IBaseFilter_Release(pfilter);
869 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
871 ERR("Enumpins (%x)\n", hr);
875 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
876 IEnumPins_Release(penumpins);
879 ERR("Next (%x)\n", hr);
887 hr = IPin_Connect(ppinOut, ppinfilter, NULL);
889 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
892 TRACE("Successfully connected to filter, follow chain...\n");
894 /* Render all output pins of the filter by calling IFilterGraph2_Render on each of them */
895 hr = GetInternalConnections(pfilter, ppinfilter, &ppins, &nb);
900 IPin_Disconnect(ppinOut);
903 TRACE("pins to consider: %d\n", nb);
904 for(i = 0; i < nb; i++) {
905 TRACE("Processing pin %d\n", i);
906 hr = IFilterGraph2_Connect(iface, ppins[i], ppinIn);
908 TRACE("Cannot render pin %p (%x)\n", ppinfilter, hr);
910 IPin_Release(ppins[i]);
911 if (SUCCEEDED(hr)) break;
913 while (++i < nb) IPin_Release(ppins[i]);
914 CoTaskMemFree(ppins);
915 IPin_Release(ppinfilter);
916 IBaseFilter_Release(pfilter);
921 if (ppinfilter) IPin_Release(ppinfilter);
923 IFilterGraph2_RemoveFilter(iface, pfilter);
924 IBaseFilter_Release(pfilter);
928 IEnumMediaTypes_Release(penummt);
934 static HRESULT WINAPI FilterGraph2_Render(IFilterGraph2 *iface,
936 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
937 IEnumMediaTypes* penummt;
942 IEnumMoniker* pEnumMoniker;
948 TRACE("(%p/%p)->(%p)\n", This, iface, ppinOut);
950 if (TRACE_ON(quartz))
954 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
958 TRACE("Filter owning pin => %p\n", PinInfo.pFilter);
959 IBaseFilter_Release(PinInfo.pFilter);
962 /* Try to find out if there is a renderer for the specified subtype already, and use that
964 EnterCriticalSection(&This->cs);
965 for (x = 0; x < This->nFilters; ++x)
967 BOOL renderer = TRUE;
968 IEnumPins *enumpins = NULL;
971 hr = IBaseFilter_EnumPins(This->ppFiltersInGraph[x], &enumpins);
973 if (FAILED(hr) || !enumpins)
976 IEnumPins_Reset(enumpins);
977 while (IEnumPins_Next(enumpins, 1, &pin, NULL) == S_OK)
979 PIN_DIRECTION dir = PINDIR_OUTPUT;
981 IPin_QueryDirection(pin, &dir);
984 if (dir != PINDIR_INPUT)
991 IEnumPins_Reset(enumpins);
992 if (renderer == TRUE)
994 while (IEnumPins_Next(enumpins, 1, &pin, NULL) == S_OK)
998 IPin_ConnectedTo(pin, &to);
1002 hr = IFilterGraph2_Connect(iface, ppinOut, pin);
1006 IEnumPins_Release(enumpins);
1007 LeaveCriticalSection(&This->cs);
1008 ERR("Connected succesfully\n");
1019 IEnumPins_Release(enumpins);
1022 LeaveCriticalSection(&This->cs);
1024 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
1026 ERR("EnumMediaTypes (%x)\n", hr);
1030 IEnumMediaTypes_Reset(penummt);
1034 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
1036 ERR("IEnumMediaTypes_Next (%x)\n", hr);
1041 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
1042 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
1044 /* Try to find a suitable renderer with the same media type */
1045 tab[0] = mt->majortype;
1047 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL);
1049 ERR("Unable to enum filters (%x)\n", hr);
1053 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
1058 IBaseFilter* pfilter = NULL;
1059 IEnumPins* penumpins;
1062 hr = GetFilterInfo(pMoniker, &clsid, &var);
1063 IMoniker_Release(pMoniker);
1065 ERR("Unable to retrieve filter info (%x)\n", hr);
1069 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
1071 ERR("Unable to create filter (%x), trying next one\n", hr);
1075 hr = IFilterGraph2_AddFilter(iface, pfilter, V_UNION(&var, bstrVal));
1077 ERR("Unable to add filter (%x)\n", hr);
1078 IBaseFilter_Release(pfilter);
1083 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
1085 ERR("Splitter Enumpins (%x)\n", hr);
1088 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
1089 IEnumPins_Release(penumpins);
1091 ERR("Next (%x)\n", hr);
1099 /* Connect the pin to render to the renderer */
1100 hr = IFilterGraph2_Connect(iface, ppinOut, ppinfilter);
1102 TRACE("Unable to connect to renderer (%x)\n", hr);
1103 IPin_Release(ppinfilter);
1106 IPin_Release(ppinfilter);
1107 IBaseFilter_Release(pfilter);
1113 IFilterGraph2_RemoveFilter(iface, pfilter);
1114 IBaseFilter_Release(pfilter);
1118 DeleteMediaType(mt);
1122 IEnumMediaTypes_Release(penummt);
1127 static HRESULT WINAPI FilterGraph2_RenderFile(IFilterGraph2 *iface,
1128 LPCWSTR lpcwstrFile,
1129 LPCWSTR lpcwstrPlayList) {
1130 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1131 static const WCHAR string[] = {'R','e','a','d','e','r',0};
1132 IBaseFilter* preader = NULL;
1133 IBaseFilter* psplitter = NULL;
1134 IPin* ppinreader = NULL;
1135 IPin* ppinsplitter = NULL;
1136 IEnumPins* penumpins;
1139 IEnumMoniker* pEnumMoniker = NULL;
1141 IPin** ppins = NULL;
1144 IFileSourceFilter* pfile = NULL;
1148 TRACE("(%p/%p)->(%s, %s)\n", This, iface, debugstr_w(lpcwstrFile), debugstr_w(lpcwstrPlayList));
1150 if (lpcwstrPlayList != NULL)
1151 return E_INVALIDARG;
1153 hr = IFilterGraph2_AddSourceFilter(iface, lpcwstrFile, string, &preader);
1155 /* Retrieve file media type */
1157 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1158 if (SUCCEEDED(hr)) {
1159 hr = IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1160 IFileSourceFilter_Release(pfile);
1164 hr = IBaseFilter_EnumPins(preader, &penumpins);
1165 if (SUCCEEDED(hr)) {
1166 hr = IEnumPins_Next(penumpins, 1, &ppinreader, &pin);
1167 IEnumPins_Release(penumpins);
1170 if (SUCCEEDED(hr)) {
1171 tab[0] = mt.majortype;
1172 tab[1] = mt.subtype;
1173 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
1179 IPin_Release(ppinreader);
1181 IEnumMoniker_Release(pEnumMoniker);
1183 IFilterGraph2_RemoveFilter(iface, preader);
1184 IBaseFilter_Release(preader);
1189 hr = VFW_E_CANNOT_RENDER;
1190 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
1195 hr = GetFilterInfo(pMoniker, &clsid, &var);
1196 IMoniker_Release(pMoniker);
1198 ERR("Unable to retrieve filter info (%x)\n", hr);
1202 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&psplitter);
1204 ERR("Unable to create filter (%x), trying next one\n", hr);
1208 hr = IFilterGraph2_AddFilter(iface, psplitter, V_UNION(&var, bstrVal));
1210 ERR("Unable add filter (%x)\n", hr);
1211 IBaseFilter_Release(psplitter);
1215 /* Connect file source and splitter filters together */
1216 /* Make the splitter analyze incoming data */
1218 hr = IBaseFilter_EnumPins(psplitter, &penumpins);
1219 if (SUCCEEDED(hr)) {
1220 hr = IEnumPins_Next(penumpins, 1, &ppinsplitter, &pin);
1221 IEnumPins_Release(penumpins);
1225 hr = IPin_Connect(ppinreader, ppinsplitter, NULL);
1227 /* Make sure there's some output pins in the filter */
1229 hr = GetInternalConnections(psplitter, ppinsplitter, &ppins, &nb);
1230 if (SUCCEEDED(hr)) {
1232 IPin_Disconnect(ppinreader);
1233 TRACE("No output pins found in filter\n");
1234 hr = VFW_E_CANNOT_RENDER;
1239 IPin_Release(ppinsplitter);
1240 ppinsplitter = NULL;
1242 if (SUCCEEDED(hr)) {
1243 TRACE("Successfully connected to filter\n");
1247 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
1250 CoTaskMemFree(ppins);
1253 IFilterGraph2_RemoveFilter(iface, psplitter);
1254 IBaseFilter_Release(psplitter);
1258 /* Render all output pin of the splitter by calling IFilterGraph2_Render on each of them */
1259 if (SUCCEEDED(hr)) {
1262 TRACE("pins to consider: %d\n", nb);
1263 for(i = 0; i < nb; i++) {
1264 TRACE("Processing pin %d\n", i);
1265 hr = IFilterGraph2_Render(iface, ppins[i]);
1267 ERR("Cannot render pin %p (%x)\n", ppins[i], hr);
1270 IPin_Release(ppins[i]);
1272 CoTaskMemFree(ppins);
1274 hr = (partial ? VFW_S_PARTIAL_RENDER : S_OK);
1277 IPin_Release(ppinreader);
1278 IBaseFilter_Release(preader);
1280 IBaseFilter_Release(psplitter);
1285 /* Some filters implement their own asynchronous reader (Theoretically they all should, try to load it first */
1286 static HRESULT GetFileSourceFilter(LPCOLESTR pszFileName, IBaseFilter **filter)
1288 static const WCHAR wszReg[] = {'M','e','d','i','a',' ','T','y','p','e','\\','E','x','t','e','n','s','i','o','n','s',0};
1293 lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszReg, 0, KEY_READ, &extkey);
1294 hr = HRESULT_FROM_WIN32(lRet);
1298 static const WCHAR filtersource[] = {'S','o','u','r','c','e',' ','F','i','l','t','e','r',0};
1299 WCHAR *ext = PathFindExtensionW(pszFileName);
1300 WCHAR clsid_key[39];
1302 DWORD size = sizeof(clsid_key);
1307 CloseHandle(extkey);
1311 lRet = RegOpenKeyExW(extkey, ext, 0, KEY_READ, &pathkey);
1312 hr = HRESULT_FROM_WIN32(lRet);
1313 CloseHandle(extkey);
1317 lRet = RegQueryValueExW(pathkey, filtersource, NULL, NULL, (LPBYTE)clsid_key, &size);
1318 hr = HRESULT_FROM_WIN32(lRet);
1319 CloseHandle(pathkey);
1323 CLSIDFromString(clsid_key, &clsid);
1325 TRACE("CLSID: %s\n", debugstr_guid(&clsid));
1326 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)filter);
1329 IFileSourceFilter *source = NULL;
1330 hr = IBaseFilter_QueryInterface(*filter, &IID_IFileSourceFilter, (LPVOID*)&source);
1332 IFileSourceFilter_Release(source);
1334 IBaseFilter_Release(*filter);
1342 static HRESULT WINAPI FilterGraph2_AddSourceFilter(IFilterGraph2 *iface,
1343 LPCWSTR lpcwstrFileName,
1344 LPCWSTR lpcwstrFilterName,
1345 IBaseFilter **ppFilter) {
1346 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1348 IBaseFilter* preader;
1349 IFileSourceFilter* pfile = NULL;
1353 TRACE("(%p/%p)->(%s, %s, %p)\n", This, iface, debugstr_w(lpcwstrFileName), debugstr_w(lpcwstrFilterName), ppFilter);
1355 /* Try from file name first, then fall back to default asynchronous reader */
1356 hr = GetFileSourceFilter(lpcwstrFileName, &preader);
1359 hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&preader);
1361 ERR("Unable to create file source filter (%x)\n", hr);
1365 hr = IFilterGraph2_AddFilter(iface, preader, lpcwstrFilterName);
1367 ERR("Unable add filter (%x)\n", hr);
1368 IBaseFilter_Release(preader);
1372 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1374 ERR("Unable to get IFileSourceInterface (%x)\n", hr);
1378 /* Load the file in the file source filter */
1379 hr = IFileSourceFilter_Load(pfile, lpcwstrFileName, NULL);
1381 ERR("Load (%x)\n", hr);
1385 IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1387 ERR("GetCurFile (%x)\n", hr);
1391 TRACE("File %s\n", debugstr_w(filename));
1392 TRACE("MajorType %s\n", debugstr_guid(&mt.majortype));
1393 TRACE("SubType %s\n", debugstr_guid(&mt.subtype));
1396 *ppFilter = preader;
1397 IFileSourceFilter_Release(pfile);
1403 IFileSourceFilter_Release(pfile);
1404 IFilterGraph2_RemoveFilter(iface, preader);
1405 IBaseFilter_Release(preader);
1410 static HRESULT WINAPI FilterGraph2_SetLogFile(IFilterGraph2 *iface,
1412 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1414 TRACE("(%p/%p)->(%08x): stub !!!\n", This, iface, (DWORD) hFile);
1419 static HRESULT WINAPI FilterGraph2_Abort(IFilterGraph2 *iface) {
1420 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1422 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1427 static HRESULT WINAPI FilterGraph2_ShouldOperationContinue(IFilterGraph2 *iface) {
1428 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1430 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1435 /*** IFilterGraph2 methods ***/
1436 static HRESULT WINAPI FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2 *iface,
1439 LPCWSTR lpcwstrFilterName,
1440 IBaseFilter **ppFilter) {
1441 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1443 TRACE("(%p/%p)->(%p %p %s %p): stub !!!\n", This, iface, pMoniker, pCtx, debugstr_w(lpcwstrFilterName), ppFilter);
1448 static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface,
1450 const AM_MEDIA_TYPE *pmt) {
1451 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1453 TRACE("(%p/%p)->(%p %p): stub !!!\n", This, iface, ppin, pmt);
1458 static HRESULT WINAPI FilterGraph2_RenderEx(IFilterGraph2 *iface,
1462 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1464 TRACE("(%p/%p)->(%p %08x %p): stub !!!\n", This, iface, pPinOut, dwFlags, pvContext);
1470 static const IFilterGraph2Vtbl IFilterGraph2_VTable =
1472 FilterGraph2_QueryInterface,
1473 FilterGraph2_AddRef,
1474 FilterGraph2_Release,
1475 FilterGraph2_AddFilter,
1476 FilterGraph2_RemoveFilter,
1477 FilterGraph2_EnumFilters,
1478 FilterGraph2_FindFilterByName,
1479 FilterGraph2_ConnectDirect,
1480 FilterGraph2_Reconnect,
1481 FilterGraph2_Disconnect,
1482 FilterGraph2_SetDefaultSyncSource,
1483 FilterGraph2_Connect,
1484 FilterGraph2_Render,
1485 FilterGraph2_RenderFile,
1486 FilterGraph2_AddSourceFilter,
1487 FilterGraph2_SetLogFile,
1489 FilterGraph2_ShouldOperationContinue,
1490 FilterGraph2_AddSourceFilterForMoniker,
1491 FilterGraph2_ReconnectEx,
1492 FilterGraph2_RenderEx
1495 /*** IUnknown methods ***/
1496 static HRESULT WINAPI MediaControl_QueryInterface(IMediaControl *iface,
1499 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1501 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1503 return Filtergraph_QueryInterface(This, riid, ppvObj);
1506 static ULONG WINAPI MediaControl_AddRef(IMediaControl *iface) {
1507 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1509 TRACE("(%p/%p)->()\n", This, iface);
1511 return Filtergraph_AddRef(This);
1514 static ULONG WINAPI MediaControl_Release(IMediaControl *iface) {
1515 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1517 TRACE("(%p/%p)->()\n", This, iface);
1519 return Filtergraph_Release(This);
1523 /*** IDispatch methods ***/
1524 static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface,
1526 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1528 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1533 static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface,
1536 ITypeInfo**ppTInfo) {
1537 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1539 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1544 static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface,
1550 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1552 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1557 static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface,
1558 DISPID dispIdMember,
1562 DISPPARAMS*pDispParams,
1564 EXCEPINFO*pExepInfo,
1566 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1568 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);
1573 typedef HRESULT(WINAPI *fnFoundFilter)(IBaseFilter *, DWORD_PTR data);
1575 static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundFilter FoundFilter, DWORD_PTR data)
1584 TRACE("%p %p\n", pGraph, pOutputPin);
1585 PinInfo.pFilter = NULL;
1587 hr = IPin_ConnectedTo(pOutputPin, &pInputPin);
1591 hr = IPin_QueryPinInfo(pInputPin, &PinInfo);
1593 hr = GetInternalConnections(PinInfo.pFilter, pInputPin, &ppPins, &nb);
1594 IPin_Release(pInputPin);
1601 TRACE("Reached a renderer\n");
1602 /* Count renderers for end of stream notification */
1603 pGraph->nRenderers++;
1607 for(i = 0; i < nb; i++)
1609 /* Explore the graph downstream from this pin
1610 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1611 * several input pins are connected to the same output (a MUX for instance). */
1612 ExploreGraph(pGraph, ppPins[i], FoundFilter, data);
1613 IPin_Release(ppPins[i]);
1616 CoTaskMemFree(ppPins);
1618 TRACE("Doing stuff with filter %p\n", PinInfo.pFilter);
1620 FoundFilter(PinInfo.pFilter, data);
1623 if (PinInfo.pFilter) IBaseFilter_Release(PinInfo.pFilter);
1627 static HRESULT WINAPI SendRun(IBaseFilter *pFilter, DWORD_PTR data)
1630 IReferenceClock *clock = NULL;
1632 IBaseFilter_GetSyncSource(pFilter, &clock);
1635 IReferenceClock_GetTime(clock, &time);
1641 IReferenceClock_Release(clock);
1644 return IBaseFilter_Run(pFilter, time);
1647 static HRESULT WINAPI SendPause(IBaseFilter *pFilter, DWORD_PTR data)
1649 return IBaseFilter_Pause(pFilter);
1652 static HRESULT WINAPI SendStop(IBaseFilter *pFilter, DWORD_PTR data)
1654 return IBaseFilter_Stop(pFilter);
1657 static HRESULT WINAPI SendGetState(IBaseFilter *pFilter, DWORD_PTR data)
1660 DWORD time_end = data;
1661 DWORD time_now = GetTickCount();
1664 if (time_end == INFINITE)
1668 else if (time_end > time_now)
1670 wait = time_end - time_now;
1675 return IBaseFilter_GetState(pFilter, wait, &state);
1679 static HRESULT SendFilterMessage(IMediaControl *iface, fnFoundFilter FoundFilter, DWORD_PTR data) {
1680 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1682 IBaseFilter* pfilter;
1688 TRACE("(%p/%p)->()\n", This, iface);
1690 /* Explorer the graph from source filters to renderers, determine renderers
1691 * number and run filters from renderers to source filters */
1692 This->nRenderers = 0;
1693 ResetEvent(This->hEventCompletion);
1695 for(i = 0; i < This->nFilters; i++)
1698 pfilter = This->ppFiltersInGraph[i];
1699 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
1702 ERR("Enum pins failed %x\n", hr);
1705 /* Check if it is a source filter */
1706 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1708 IPin_QueryDirection(pPin, &dir);
1710 if (dir == PINDIR_INPUT)
1718 TRACE("Found a source filter %p\n", pfilter);
1719 IEnumPins_Reset(pEnum);
1720 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1722 /* Explore the graph downstream from this pin */
1723 ExploreGraph(This, pPin, FoundFilter, data);
1726 FoundFilter(pfilter, data);
1728 IEnumPins_Release(pEnum);
1734 /*** IMediaControl methods ***/
1735 static HRESULT WINAPI MediaControl_Run(IMediaControl *iface) {
1736 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1737 TRACE("(%p/%p)->()\n", This, iface);
1739 if (This->state == State_Running) return S_OK;
1741 EnterCriticalSection(&This->cs);
1742 if (This->state == State_Stopped)
1743 This->EcCompleteCount = 0;
1747 IReferenceClock_GetTime(This->refClock, &This->start_time);
1748 This->start_time += 500000;
1750 else This->position = This->start_time = 0;
1752 SendFilterMessage(iface, SendRun, 0);
1753 This->state = State_Running;
1754 LeaveCriticalSection(&This->cs);
1758 static HRESULT WINAPI MediaControl_Pause(IMediaControl *iface) {
1759 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1760 TRACE("(%p/%p)->()\n", This, iface);
1762 if (This->state == State_Paused) return S_OK;
1764 EnterCriticalSection(&This->cs);
1765 if (This->state == State_Stopped)
1766 This->EcCompleteCount = 0;
1768 if (This->state == State_Running && This->refClock)
1770 LONGLONG time = This->start_time;
1771 IReferenceClock_GetTime(This->refClock, &time);
1772 This->position += time - This->start_time;
1775 SendFilterMessage(iface, SendPause, 0);
1776 This->state = State_Paused;
1777 LeaveCriticalSection(&This->cs);
1781 static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface) {
1782 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1783 TRACE("(%p/%p)->()\n", This, iface);
1785 if (This->state == State_Stopped) return S_OK;
1787 EnterCriticalSection(&This->cs);
1788 if (This->state == State_Running && This->refClock)
1790 LONGLONG time = This->start_time;
1791 IReferenceClock_GetTime(This->refClock, &time);
1792 This->position += time - This->start_time;
1795 if (This->state == State_Running) SendFilterMessage(iface, SendPause, 0);
1796 SendFilterMessage(iface, SendStop, 0);
1797 This->state = State_Stopped;
1798 LeaveCriticalSection(&This->cs);
1802 static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface,
1804 OAFilterState *pfs) {
1805 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1808 TRACE("(%p/%p)->(%d, %p)\n", This, iface, msTimeout, pfs);
1813 EnterCriticalSection(&This->cs);
1818 end = GetTickCount() + msTimeout;
1820 else if (msTimeout < 0)
1829 SendFilterMessage(iface, SendGetState, end);
1831 LeaveCriticalSection(&This->cs);
1836 static HRESULT WINAPI MediaControl_RenderFile(IMediaControl *iface,
1838 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1840 FIXME("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename);
1845 static HRESULT WINAPI MediaControl_AddSourceFilter(IMediaControl *iface,
1847 IDispatch **ppUnk) {
1848 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1850 FIXME("(%p/%p)->(%s (%p), %p): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename, ppUnk);
1855 static HRESULT WINAPI MediaControl_get_FilterCollection(IMediaControl *iface,
1856 IDispatch **ppUnk) {
1857 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1859 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1864 static HRESULT WINAPI MediaControl_get_RegFilterCollection(IMediaControl *iface,
1865 IDispatch **ppUnk) {
1866 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1868 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1873 static HRESULT WINAPI MediaControl_StopWhenReady(IMediaControl *iface) {
1874 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1876 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1882 static const IMediaControlVtbl IMediaControl_VTable =
1884 MediaControl_QueryInterface,
1885 MediaControl_AddRef,
1886 MediaControl_Release,
1887 MediaControl_GetTypeInfoCount,
1888 MediaControl_GetTypeInfo,
1889 MediaControl_GetIDsOfNames,
1890 MediaControl_Invoke,
1894 MediaControl_GetState,
1895 MediaControl_RenderFile,
1896 MediaControl_AddSourceFilter,
1897 MediaControl_get_FilterCollection,
1898 MediaControl_get_RegFilterCollection,
1899 MediaControl_StopWhenReady
1903 /*** IUnknown methods ***/
1904 static HRESULT WINAPI MediaSeeking_QueryInterface(IMediaSeeking *iface,
1907 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1909 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1911 return Filtergraph_QueryInterface(This, riid, ppvObj);
1914 static ULONG WINAPI MediaSeeking_AddRef(IMediaSeeking *iface) {
1915 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1917 TRACE("(%p/%p)->()\n", This, iface);
1919 return Filtergraph_AddRef(This);
1922 static ULONG WINAPI MediaSeeking_Release(IMediaSeeking *iface) {
1923 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1925 TRACE("(%p/%p)->()\n", This, iface);
1927 return Filtergraph_Release(This);
1930 typedef HRESULT WINAPI (*fnFoundSeek)(IFilterGraphImpl *This, IMediaSeeking*, DWORD_PTR arg);
1932 static HRESULT all_renderers_seek(IFilterGraphImpl *This, fnFoundSeek FoundSeek, DWORD_PTR arg) {
1933 BOOL allnotimpl = TRUE;
1935 IBaseFilter* pfilter;
1937 HRESULT hr, hr_return = S_OK;
1942 TRACE("(%p)->(%p %08lx)\n", This, FoundSeek, arg);
1943 /* Send a message to all renderers, they are responsible for broadcasting it further */
1945 for(i = 0; i < This->nFilters; i++)
1947 BOOL renderer = TRUE;
1948 pfilter = This->ppFiltersInGraph[i];
1949 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
1952 ERR("Enum pins failed %x\n", hr);
1955 /* Check if it is a source filter */
1956 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1958 IPin_QueryDirection(pPin, &dir);
1960 if (dir != PINDIR_INPUT)
1966 IEnumPins_Release(pEnum);
1969 IMediaSeeking *seek = NULL;
1970 IBaseFilter_QueryInterface(pfilter, &IID_IMediaSeeking, (void**)&seek);
1974 hr = FoundSeek(This, seek, arg);
1976 IMediaSeeking_Release(seek);
1977 if (hr_return != E_NOTIMPL)
1979 if (hr_return == S_OK || (FAILED(hr) && hr != E_NOTIMPL && !FAILED(hr_return)))
1989 static HRESULT WINAPI FoundCapabilities(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pcaps)
1994 hr = IMediaSeeking_GetCapabilities(seek, &caps);
1998 /* Only add common capabilities everything supports */
1999 *(DWORD*)pcaps &= caps;
2004 /*** IMediaSeeking methods ***/
2005 static HRESULT WINAPI MediaSeeking_GetCapabilities(IMediaSeeking *iface,
2006 DWORD *pCapabilities) {
2007 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2009 TRACE("(%p/%p)->(%p)\n", This, iface, pCapabilities);
2014 EnterCriticalSection(&This->cs);
2015 *pCapabilities = 0xffffffff;
2017 hr = all_renderers_seek(This, FoundCapabilities, (DWORD_PTR)pCapabilities);
2018 LeaveCriticalSection(&This->cs);
2023 static HRESULT WINAPI MediaSeeking_CheckCapabilities(IMediaSeeking *iface,
2024 DWORD *pCapabilities) {
2025 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2028 TRACE("(%p/%p)->(%p)\n", This, iface, pCapabilities);
2033 EnterCriticalSection(&This->cs);
2034 originalcaps = *pCapabilities;
2035 hr = all_renderers_seek(This, FoundCapabilities, (DWORD_PTR)pCapabilities);
2036 LeaveCriticalSection(&This->cs);
2041 if (!*pCapabilities)
2043 if (*pCapabilities != originalcaps)
2048 static HRESULT WINAPI MediaSeeking_IsFormatSupported(IMediaSeeking *iface,
2049 const GUID *pFormat) {
2050 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2055 TRACE("(%p/%p)->(%s)\n", This, iface, debugstr_guid(pFormat));
2057 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
2059 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat));
2066 static HRESULT WINAPI MediaSeeking_QueryPreferredFormat(IMediaSeeking *iface,
2068 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2073 FIXME("(%p/%p)->(%p): semi-stub !!!\n", This, iface, pFormat);
2074 memcpy(pFormat, &TIME_FORMAT_MEDIA_TIME, sizeof(GUID));
2079 static HRESULT WINAPI MediaSeeking_GetTimeFormat(IMediaSeeking *iface,
2081 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2086 TRACE("(%p/%p)->(%p)\n", This, iface, pFormat);
2087 memcpy(pFormat, &This->timeformatseek, sizeof(GUID));
2092 static HRESULT WINAPI MediaSeeking_IsUsingTimeFormat(IMediaSeeking *iface,
2093 const GUID *pFormat) {
2094 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2096 TRACE("(%p/%p)->(%p)\n", This, iface, pFormat);
2100 if (memcmp(pFormat, &This->timeformatseek, sizeof(GUID)))
2106 static HRESULT WINAPI MediaSeeking_SetTimeFormat(IMediaSeeking *iface,
2107 const GUID *pFormat) {
2108 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2113 TRACE("(%p/%p)->(%s)\n", This, iface, debugstr_guid(pFormat));
2115 if (This->state != State_Stopped)
2116 return VFW_E_WRONG_STATE;
2118 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
2120 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat));
2121 return E_INVALIDARG;
2127 static HRESULT WINAPI FoundDuration(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pduration)
2130 LONGLONG duration = 0, *pdur = (LONGLONG*)pduration;
2132 hr = IMediaSeeking_GetDuration(seek, &duration);
2136 /* FIXME: Minimum or maximum duration? Assuming minimum */
2137 if (duration > 0 && *pdur < duration)
2143 static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface,
2144 LONGLONG *pDuration) {
2145 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2148 TRACE("(%p/%p)->(%p)\n", This, iface, pDuration);
2153 EnterCriticalSection(&This->cs);
2155 hr = all_renderers_seek(This, FoundDuration, (DWORD_PTR)pDuration);
2156 LeaveCriticalSection(&This->cs);
2158 TRACE("--->%08x\n", hr);
2162 static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface,
2164 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2167 TRACE("(%p/%p)->(%p)\n", This, iface, pStop);
2172 EnterCriticalSection(&This->cs);
2173 if (This->stop_position < 0)
2174 /* Stop position not set, use duration instead */
2175 hr = IMediaSeeking_GetDuration(iface, pStop);
2177 *pStop = This->stop_position;
2179 LeaveCriticalSection(&This->cs);
2184 static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface,
2185 LONGLONG *pCurrent) {
2186 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2192 EnterCriticalSection(&This->cs);
2193 if (This->state == State_Running && This->refClock)
2195 IReferenceClock_GetTime(This->refClock, &time);
2197 time += This->position - This->start_time;
2198 if (time < This->position)
2199 time = This->position;
2203 *pCurrent = This->position;
2204 LeaveCriticalSection(&This->cs);
2206 TRACE("Time: %u.%03u\n", (DWORD)(*pCurrent / 10000000), (DWORD)((*pCurrent / 10000)%1000));
2211 static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface,
2213 const GUID *pTargetFormat,
2215 const GUID *pSourceFormat) {
2216 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2218 FIXME("(%p/%p)->(%p, %p, 0x%s, %p): stub !!!\n", This, iface, pTarget,
2219 pTargetFormat, wine_dbgstr_longlong(Source), pSourceFormat);
2225 LONGLONG* current, *stop;
2226 DWORD curflags, stopflags;
2229 static HRESULT WINAPI found_setposition(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pargs)
2231 struct pos_args *args = (void*)pargs;
2233 return IMediaSeeking_SetPositions(seek, args->current, args->curflags, args->stop, args->stopflags);
2236 static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface,
2238 DWORD dwCurrentFlags,
2240 DWORD dwStopFlags) {
2241 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2244 struct pos_args args;
2246 TRACE("(%p/%p)->(%p, %08x, %p, %08x)\n", This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
2248 EnterCriticalSection(&This->cs);
2249 state = This->state;
2250 TRACE("State: %s\n", state == State_Running ? "Running" : (state == State_Paused ? "Paused" : (state == State_Stopped ? "Stopped" : "UNKNOWN")));
2252 if ((dwCurrentFlags & 0x7) == AM_SEEKING_AbsolutePositioning)
2254 This->position = *pCurrent;
2256 else if ((dwCurrentFlags & 0x7) != AM_SEEKING_NoPositioning)
2257 FIXME("Adjust method %x not handled yet!\n", dwCurrentFlags & 0x7);
2259 if ((dwStopFlags & 0x7) == AM_SEEKING_AbsolutePositioning)
2260 This->stop_position = *pStop;
2261 else if ((dwStopFlags & 0x7) != AM_SEEKING_NoPositioning)
2262 FIXME("Stop position not handled yet!\n");
2264 args.current = pCurrent;
2266 args.curflags = dwCurrentFlags;
2267 args.stopflags = dwStopFlags;
2268 hr = all_renderers_seek(This, found_setposition, (DWORD_PTR)&args);
2270 if (This->refClock && ((dwCurrentFlags & 0x7) != AM_SEEKING_NoPositioning))
2272 /* Update start time, prevents weird jumps */
2273 IReferenceClock_GetTime(This->refClock, &This->start_time);
2275 LeaveCriticalSection(&This->cs);
2280 static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface,
2283 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2286 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pCurrent, pStop);
2287 hr = IMediaSeeking_GetCurrentPosition(iface, pCurrent);
2289 hr = IMediaSeeking_GetStopPosition(iface, pStop);
2294 static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface,
2295 LONGLONG *pEarliest,
2296 LONGLONG *pLatest) {
2297 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2299 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
2304 static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface,
2306 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2308 FIXME("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
2313 static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface,
2315 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2317 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
2322 static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface,
2323 LONGLONG *pllPreroll) {
2324 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2326 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
2332 static const IMediaSeekingVtbl IMediaSeeking_VTable =
2334 MediaSeeking_QueryInterface,
2335 MediaSeeking_AddRef,
2336 MediaSeeking_Release,
2337 MediaSeeking_GetCapabilities,
2338 MediaSeeking_CheckCapabilities,
2339 MediaSeeking_IsFormatSupported,
2340 MediaSeeking_QueryPreferredFormat,
2341 MediaSeeking_GetTimeFormat,
2342 MediaSeeking_IsUsingTimeFormat,
2343 MediaSeeking_SetTimeFormat,
2344 MediaSeeking_GetDuration,
2345 MediaSeeking_GetStopPosition,
2346 MediaSeeking_GetCurrentPosition,
2347 MediaSeeking_ConvertTimeFormat,
2348 MediaSeeking_SetPositions,
2349 MediaSeeking_GetPositions,
2350 MediaSeeking_GetAvailable,
2351 MediaSeeking_SetRate,
2352 MediaSeeking_GetRate,
2353 MediaSeeking_GetPreroll
2356 /*** IUnknown methods ***/
2357 static HRESULT WINAPI MediaPosition_QueryInterface(IMediaPosition* iface, REFIID riid, void** ppvObj){
2358 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
2360 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2362 return Filtergraph_QueryInterface(This, riid, ppvObj);
2365 static ULONG WINAPI MediaPosition_AddRef(IMediaPosition *iface){
2366 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
2368 TRACE("(%p/%p)->()\n", This, iface);
2370 return Filtergraph_AddRef(This);
2373 static ULONG WINAPI MediaPosition_Release(IMediaPosition *iface){
2374 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
2376 TRACE("(%p/%p)->()\n", This, iface);
2378 return Filtergraph_Release(This);
2381 /*** IDispatch methods ***/
2382 static HRESULT WINAPI MediaPosition_GetTypeInfoCount(IMediaPosition *iface, UINT* pctinfo){
2383 FIXME("(%p) stub!\n", iface);
2387 static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo){
2388 FIXME("(%p) stub!\n", iface);
2392 static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition* iface, REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId){
2393 FIXME("(%p) stub!\n", iface);
2397 static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition* iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr){
2398 FIXME("(%p) stub!\n", iface);
2402 /*** IMediaPosition methods ***/
2403 static HRESULT WINAPI MediaPosition_get_Duration(IMediaPosition * iface, REFTIME *plength){
2404 FIXME("(%p)->(%p) stub!\n", iface, plength);
2408 static HRESULT WINAPI MediaPosition_put_CurrentPosition(IMediaPosition * iface, REFTIME llTime){
2409 FIXME("(%p)->(%f) stub!\n", iface, llTime);
2413 static HRESULT WINAPI MediaPosition_get_CurrentPosition(IMediaPosition * iface, REFTIME *pllTime){
2414 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
2418 static HRESULT WINAPI MediaPosition_get_StopTime(IMediaPosition * iface, REFTIME *pllTime){
2419 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
2423 static HRESULT WINAPI MediaPosition_put_StopTime(IMediaPosition * iface, REFTIME llTime){
2424 FIXME("(%p)->(%f) stub!\n", iface, llTime);
2428 static HRESULT WINAPI MediaPosition_get_PrerollTime(IMediaPosition * iface, REFTIME *pllTime){
2429 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
2433 static HRESULT WINAPI MediaPosition_put_PrerollTime(IMediaPosition * iface, REFTIME llTime){
2434 FIXME("(%p)->(%f) stub!\n", iface, llTime);
2438 static HRESULT WINAPI MediaPosition_put_Rate(IMediaPosition * iface, double dRate){
2439 FIXME("(%p)->(%f) stub!\n", iface, dRate);
2443 static HRESULT WINAPI MediaPosition_get_Rate(IMediaPosition * iface, double *pdRate){
2444 FIXME("(%p)->(%p) stub!\n", iface, pdRate);
2448 static HRESULT WINAPI MediaPosition_CanSeekForward(IMediaPosition * iface, LONG *pCanSeekForward){
2449 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekForward);
2453 static HRESULT WINAPI MediaPosition_CanSeekBackward(IMediaPosition * iface, LONG *pCanSeekBackward){
2454 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekBackward);
2459 static const IMediaPositionVtbl IMediaPosition_VTable =
2461 MediaPosition_QueryInterface,
2462 MediaPosition_AddRef,
2463 MediaPosition_Release,
2464 MediaPosition_GetTypeInfoCount,
2465 MediaPosition_GetTypeInfo,
2466 MediaPosition_GetIDsOfNames,
2467 MediaPosition_Invoke,
2468 MediaPosition_get_Duration,
2469 MediaPosition_put_CurrentPosition,
2470 MediaPosition_get_CurrentPosition,
2471 MediaPosition_get_StopTime,
2472 MediaPosition_put_StopTime,
2473 MediaPosition_get_PrerollTime,
2474 MediaPosition_put_PrerollTime,
2475 MediaPosition_put_Rate,
2476 MediaPosition_get_Rate,
2477 MediaPosition_CanSeekForward,
2478 MediaPosition_CanSeekBackward
2481 static HRESULT GetTargetInterface(IFilterGraphImpl* pGraph, REFIID riid, LPVOID* ppvObj)
2483 HRESULT hr = E_NOINTERFACE;
2487 /* Check if the interface type is already registered */
2488 for (entry = 0; entry < pGraph->nItfCacheEntries; entry++)
2489 if (riid == pGraph->ItfCacheEntries[entry].riid)
2491 if (pGraph->ItfCacheEntries[entry].iface)
2493 /* Return the interface if available */
2494 *ppvObj = pGraph->ItfCacheEntries[entry].iface;
2500 if (entry >= MAX_ITF_CACHE_ENTRIES)
2502 FIXME("Not enough space to store interface in the cache\n");
2503 return E_OUTOFMEMORY;
2506 /* Find a filter supporting the requested interface */
2507 for (i = 0; i < pGraph->nFilters; i++)
2509 hr = IBaseFilter_QueryInterface(pGraph->ppFiltersInGraph[i], riid, ppvObj);
2512 pGraph->ItfCacheEntries[entry].riid = riid;
2513 pGraph->ItfCacheEntries[entry].filter = pGraph->ppFiltersInGraph[i];
2514 pGraph->ItfCacheEntries[entry].iface = (IUnknown*)*ppvObj;
2515 if (entry >= pGraph->nItfCacheEntries)
2516 pGraph->nItfCacheEntries++;
2519 if (hr != E_NOINTERFACE)
2526 /*** IUnknown methods ***/
2527 static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface,
2530 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2532 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2534 return Filtergraph_QueryInterface(This, riid, ppvObj);
2537 static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface) {
2538 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2540 TRACE("(%p/%p)->()\n", This, iface);
2542 return Filtergraph_AddRef(This);
2545 static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface) {
2546 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2548 TRACE("(%p/%p)->()\n", This, iface);
2550 return Filtergraph_Release(This);
2553 /*** IDispatch methods ***/
2554 static HRESULT WINAPI BasicAudio_GetTypeInfoCount(IBasicAudio *iface,
2556 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2557 IBasicAudio* pBasicAudio;
2560 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2562 EnterCriticalSection(&This->cs);
2564 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2567 hr = IBasicAudio_GetTypeInfoCount(pBasicAudio, pctinfo);
2569 LeaveCriticalSection(&This->cs);
2574 static HRESULT WINAPI BasicAudio_GetTypeInfo(IBasicAudio *iface,
2577 ITypeInfo**ppTInfo) {
2578 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2579 IBasicAudio* pBasicAudio;
2582 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2584 EnterCriticalSection(&This->cs);
2586 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2589 hr = IBasicAudio_GetTypeInfo(pBasicAudio, iTInfo, lcid, ppTInfo);
2591 LeaveCriticalSection(&This->cs);
2596 static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface,
2602 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2603 IBasicAudio* pBasicAudio;
2606 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2608 EnterCriticalSection(&This->cs);
2610 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2613 hr = IBasicAudio_GetIDsOfNames(pBasicAudio, riid, rgszNames, cNames, lcid, rgDispId);
2615 LeaveCriticalSection(&This->cs);
2620 static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface,
2621 DISPID dispIdMember,
2625 DISPPARAMS*pDispParams,
2627 EXCEPINFO*pExepInfo,
2629 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2630 IBasicAudio* pBasicAudio;
2633 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);
2635 EnterCriticalSection(&This->cs);
2637 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2640 hr = IBasicAudio_Invoke(pBasicAudio, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2642 LeaveCriticalSection(&This->cs);
2647 /*** IBasicAudio methods ***/
2648 static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface,
2650 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2651 IBasicAudio* pBasicAudio;
2654 TRACE("(%p/%p)->(%ld)\n", This, iface, lVolume);
2656 EnterCriticalSection(&This->cs);
2658 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2661 hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
2663 LeaveCriticalSection(&This->cs);
2668 static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface,
2670 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2671 IBasicAudio* pBasicAudio;
2674 TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
2676 EnterCriticalSection(&This->cs);
2678 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2681 hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
2683 LeaveCriticalSection(&This->cs);
2688 static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface,
2690 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2691 IBasicAudio* pBasicAudio;
2694 TRACE("(%p/%p)->(%ld)\n", This, iface, lBalance);
2696 EnterCriticalSection(&This->cs);
2698 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2701 hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
2703 LeaveCriticalSection(&This->cs);
2708 static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface,
2710 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2711 IBasicAudio* pBasicAudio;
2714 TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
2716 EnterCriticalSection(&This->cs);
2718 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2721 hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
2723 LeaveCriticalSection(&This->cs);
2728 static const IBasicAudioVtbl IBasicAudio_VTable =
2730 BasicAudio_QueryInterface,
2733 BasicAudio_GetTypeInfoCount,
2734 BasicAudio_GetTypeInfo,
2735 BasicAudio_GetIDsOfNames,
2737 BasicAudio_put_Volume,
2738 BasicAudio_get_Volume,
2739 BasicAudio_put_Balance,
2740 BasicAudio_get_Balance
2743 /*** IUnknown methods ***/
2744 static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo2 *iface,
2747 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2749 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2751 return Filtergraph_QueryInterface(This, riid, ppvObj);
2754 static ULONG WINAPI BasicVideo_AddRef(IBasicVideo2 *iface) {
2755 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2757 TRACE("(%p/%p)->()\n", This, iface);
2759 return Filtergraph_AddRef(This);
2762 static ULONG WINAPI BasicVideo_Release(IBasicVideo2 *iface) {
2763 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2765 TRACE("(%p/%p)->()\n", This, iface);
2767 return Filtergraph_Release(This);
2770 /*** IDispatch methods ***/
2771 static HRESULT WINAPI BasicVideo_GetTypeInfoCount(IBasicVideo2 *iface,
2773 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2774 IBasicVideo* pBasicVideo;
2777 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2779 EnterCriticalSection(&This->cs);
2781 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2784 hr = IBasicVideo_GetTypeInfoCount(pBasicVideo, pctinfo);
2786 LeaveCriticalSection(&This->cs);
2791 static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo2 *iface,
2794 ITypeInfo**ppTInfo) {
2795 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2796 IBasicVideo* pBasicVideo;
2799 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2801 EnterCriticalSection(&This->cs);
2803 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2806 hr = IBasicVideo_GetTypeInfo(pBasicVideo, iTInfo, lcid, ppTInfo);
2808 LeaveCriticalSection(&This->cs);
2813 static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo2 *iface,
2819 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2820 IBasicVideo* pBasicVideo;
2823 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2825 EnterCriticalSection(&This->cs);
2827 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2830 hr = IBasicVideo_GetIDsOfNames(pBasicVideo, riid, rgszNames, cNames, lcid, rgDispId);
2832 LeaveCriticalSection(&This->cs);
2837 static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo2 *iface,
2838 DISPID dispIdMember,
2842 DISPPARAMS*pDispParams,
2844 EXCEPINFO*pExepInfo,
2846 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2847 IBasicVideo* pBasicVideo;
2850 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);
2852 EnterCriticalSection(&This->cs);
2854 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2857 hr = IBasicVideo_Invoke(pBasicVideo, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2859 LeaveCriticalSection(&This->cs);
2864 /*** IBasicVideo methods ***/
2865 static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo2 *iface,
2866 REFTIME *pAvgTimePerFrame) {
2867 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2868 IBasicVideo* pBasicVideo;
2871 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
2873 EnterCriticalSection(&This->cs);
2875 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2878 hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
2880 LeaveCriticalSection(&This->cs);
2885 static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo2 *iface,
2887 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2888 IBasicVideo* pBasicVideo;
2891 TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
2893 EnterCriticalSection(&This->cs);
2895 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2898 hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
2900 LeaveCriticalSection(&This->cs);
2905 static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo2 *iface,
2906 long *pBitErrorRate) {
2907 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2908 IBasicVideo* pBasicVideo;
2911 TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
2913 EnterCriticalSection(&This->cs);
2915 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2918 hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
2920 LeaveCriticalSection(&This->cs);
2925 static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo2 *iface,
2926 long *pVideoWidth) {
2927 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2928 IBasicVideo* pBasicVideo;
2931 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
2933 EnterCriticalSection(&This->cs);
2935 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2938 hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
2940 LeaveCriticalSection(&This->cs);
2945 static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo2 *iface,
2946 long *pVideoHeight) {
2947 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2948 IBasicVideo* pBasicVideo;
2951 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
2953 EnterCriticalSection(&This->cs);
2955 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2958 hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
2960 LeaveCriticalSection(&This->cs);
2965 static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo2 *iface,
2967 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2968 IBasicVideo* pBasicVideo;
2971 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
2973 EnterCriticalSection(&This->cs);
2975 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2978 hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
2980 LeaveCriticalSection(&This->cs);
2985 static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo2 *iface,
2986 long *pSourceLeft) {
2987 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2988 IBasicVideo* pBasicVideo;
2991 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
2993 EnterCriticalSection(&This->cs);
2995 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2998 hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
3000 LeaveCriticalSection(&This->cs);
3005 static HRESULT WINAPI BasicVideo_put_SourceWidth(IBasicVideo2 *iface,
3007 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3008 IBasicVideo* pBasicVideo;
3011 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
3013 EnterCriticalSection(&This->cs);
3015 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3018 hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
3020 LeaveCriticalSection(&This->cs);
3025 static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo2 *iface,
3026 long *pSourceWidth) {
3027 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3028 IBasicVideo* pBasicVideo;
3031 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
3033 EnterCriticalSection(&This->cs);
3035 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3038 hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
3040 LeaveCriticalSection(&This->cs);
3045 static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo2 *iface,
3047 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3048 IBasicVideo* pBasicVideo;
3051 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
3053 EnterCriticalSection(&This->cs);
3055 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3058 hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
3060 LeaveCriticalSection(&This->cs);
3065 static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo2 *iface,
3067 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3068 IBasicVideo* pBasicVideo;
3071 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
3073 EnterCriticalSection(&This->cs);
3075 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3078 hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
3080 LeaveCriticalSection(&This->cs);
3085 static HRESULT WINAPI BasicVideo_put_SourceHeight(IBasicVideo2 *iface,
3086 long SourceHeight) {
3087 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3088 IBasicVideo* pBasicVideo;
3091 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
3093 EnterCriticalSection(&This->cs);
3095 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3098 hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
3100 LeaveCriticalSection(&This->cs);
3105 static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo2 *iface,
3106 long *pSourceHeight) {
3107 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3108 IBasicVideo* pBasicVideo;
3111 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
3113 EnterCriticalSection(&This->cs);
3115 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3118 hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
3120 LeaveCriticalSection(&This->cs);
3125 static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo2 *iface,
3126 long DestinationLeft) {
3127 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3128 IBasicVideo* pBasicVideo;
3131 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
3133 EnterCriticalSection(&This->cs);
3135 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3138 hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
3140 LeaveCriticalSection(&This->cs);
3145 static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo2 *iface,
3146 long *pDestinationLeft) {
3147 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3148 IBasicVideo* pBasicVideo;
3151 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
3153 EnterCriticalSection(&This->cs);
3155 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3158 hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
3160 LeaveCriticalSection(&This->cs);
3165 static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo2 *iface,
3166 long DestinationWidth) {
3167 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3168 IBasicVideo* pBasicVideo;
3171 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
3173 EnterCriticalSection(&This->cs);
3175 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3178 hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
3180 LeaveCriticalSection(&This->cs);
3185 static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo2 *iface,
3186 long *pDestinationWidth) {
3187 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3188 IBasicVideo* pBasicVideo;
3191 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
3193 EnterCriticalSection(&This->cs);
3195 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3198 hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
3200 LeaveCriticalSection(&This->cs);
3205 static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo2 *iface,
3206 long DestinationTop) {
3207 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3208 IBasicVideo* pBasicVideo;
3211 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
3213 EnterCriticalSection(&This->cs);
3215 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3218 hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
3220 LeaveCriticalSection(&This->cs);
3225 static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo2 *iface,
3226 long *pDestinationTop) {
3227 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3228 IBasicVideo* pBasicVideo;
3231 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
3233 EnterCriticalSection(&This->cs);
3235 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3238 hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
3240 LeaveCriticalSection(&This->cs);
3245 static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo2 *iface,
3246 long DestinationHeight) {
3247 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3248 IBasicVideo* pBasicVideo;
3251 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
3253 EnterCriticalSection(&This->cs);
3255 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3258 hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
3260 LeaveCriticalSection(&This->cs);
3265 static HRESULT WINAPI BasicVideo_get_DestinationHeight(IBasicVideo2 *iface,
3266 long *pDestinationHeight) {
3267 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3268 IBasicVideo* pBasicVideo;
3271 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
3273 EnterCriticalSection(&This->cs);
3275 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3278 hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
3280 LeaveCriticalSection(&This->cs);
3285 static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo2 *iface,
3290 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3291 IBasicVideo* pBasicVideo;
3294 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
3296 EnterCriticalSection(&This->cs);
3298 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3301 hr = IBasicVideo_SetSourcePosition(pBasicVideo, Left, Top, Width, Height);
3303 LeaveCriticalSection(&This->cs);
3308 static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo2 *iface,
3313 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3314 IBasicVideo* pBasicVideo;
3317 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3319 EnterCriticalSection(&This->cs);
3321 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3324 hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
3326 LeaveCriticalSection(&This->cs);
3331 static HRESULT WINAPI BasicVideo_SetDefaultSourcePosition(IBasicVideo2 *iface) {
3332 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3333 IBasicVideo* pBasicVideo;
3336 TRACE("(%p/%p)->()\n", This, iface);
3338 EnterCriticalSection(&This->cs);
3340 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3343 hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
3345 LeaveCriticalSection(&This->cs);
3350 static HRESULT WINAPI BasicVideo_SetDestinationPosition(IBasicVideo2 *iface,
3355 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3356 IBasicVideo* pBasicVideo;
3359 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
3361 EnterCriticalSection(&This->cs);
3363 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3366 hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left, Top, Width, Height);
3368 LeaveCriticalSection(&This->cs);
3373 static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo2 *iface,
3378 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3379 IBasicVideo* pBasicVideo;
3382 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3384 EnterCriticalSection(&This->cs);
3386 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3389 hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
3391 LeaveCriticalSection(&This->cs);
3396 static HRESULT WINAPI BasicVideo_SetDefaultDestinationPosition(IBasicVideo2 *iface) {
3397 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3398 IBasicVideo* pBasicVideo;
3401 TRACE("(%p/%p)->()\n", This, iface);
3403 EnterCriticalSection(&This->cs);
3405 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3408 hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
3410 LeaveCriticalSection(&This->cs);
3415 static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo2 *iface,
3418 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3419 IBasicVideo* pBasicVideo;
3422 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3424 EnterCriticalSection(&This->cs);
3426 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3429 hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
3431 LeaveCriticalSection(&This->cs);
3436 static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo2 *iface,
3441 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3442 IBasicVideo* pBasicVideo;
3445 TRACE("(%p/%p)->(%ld, %ld, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
3447 EnterCriticalSection(&This->cs);
3449 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3452 hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex, Entries, pRetrieved, pPalette);
3454 LeaveCriticalSection(&This->cs);
3459 static HRESULT WINAPI BasicVideo_GetCurrentImage(IBasicVideo2 *iface,
3462 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3463 IBasicVideo* pBasicVideo;
3466 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pBufferSize, pDIBImage);
3468 EnterCriticalSection(&This->cs);
3470 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3473 hr = IBasicVideo_GetCurrentImage(pBasicVideo, pBufferSize, pDIBImage);
3475 LeaveCriticalSection(&This->cs);
3480 static HRESULT WINAPI BasicVideo_IsUsingDefaultSource(IBasicVideo2 *iface) {
3481 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3482 IBasicVideo* pBasicVideo;
3485 TRACE("(%p/%p)->()\n", This, iface);
3487 EnterCriticalSection(&This->cs);
3489 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3492 hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
3494 LeaveCriticalSection(&This->cs);
3499 static HRESULT WINAPI BasicVideo_IsUsingDefaultDestination(IBasicVideo2 *iface) {
3500 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3501 IBasicVideo* pBasicVideo;
3504 TRACE("(%p/%p)->()\n", This, iface);
3506 EnterCriticalSection(&This->cs);
3508 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3511 hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
3513 LeaveCriticalSection(&This->cs);
3518 static HRESULT WINAPI BasicVideo2_GetPreferredAspectRatio(IBasicVideo2 *iface, LONG *plAspectX, LONG *plAspectY) {
3519 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3520 IBasicVideo2 *pBasicVideo2;
3523 TRACE("(%p/%p)->()\n", This, iface);
3525 EnterCriticalSection(&This->cs);
3527 hr = GetTargetInterface(This, &IID_IBasicVideo2, (LPVOID*)&pBasicVideo2);
3530 hr = BasicVideo2_GetPreferredAspectRatio(iface, plAspectX, plAspectY);
3532 LeaveCriticalSection(&This->cs);
3537 static const IBasicVideo2Vtbl IBasicVideo_VTable =
3539 BasicVideo_QueryInterface,
3542 BasicVideo_GetTypeInfoCount,
3543 BasicVideo_GetTypeInfo,
3544 BasicVideo_GetIDsOfNames,
3546 BasicVideo_get_AvgTimePerFrame,
3547 BasicVideo_get_BitRate,
3548 BasicVideo_get_BitErrorRate,
3549 BasicVideo_get_VideoWidth,
3550 BasicVideo_get_VideoHeight,
3551 BasicVideo_put_SourceLeft,
3552 BasicVideo_get_SourceLeft,
3553 BasicVideo_put_SourceWidth,
3554 BasicVideo_get_SourceWidth,
3555 BasicVideo_put_SourceTop,
3556 BasicVideo_get_SourceTop,
3557 BasicVideo_put_SourceHeight,
3558 BasicVideo_get_SourceHeight,
3559 BasicVideo_put_DestinationLeft,
3560 BasicVideo_get_DestinationLeft,
3561 BasicVideo_put_DestinationWidth,
3562 BasicVideo_get_DestinationWidth,
3563 BasicVideo_put_DestinationTop,
3564 BasicVideo_get_DestinationTop,
3565 BasicVideo_put_DestinationHeight,
3566 BasicVideo_get_DestinationHeight,
3567 BasicVideo_SetSourcePosition,
3568 BasicVideo_GetSourcePosition,
3569 BasicVideo_SetDefaultSourcePosition,
3570 BasicVideo_SetDestinationPosition,
3571 BasicVideo_GetDestinationPosition,
3572 BasicVideo_SetDefaultDestinationPosition,
3573 BasicVideo_GetVideoSize,
3574 BasicVideo_GetVideoPaletteEntries,
3575 BasicVideo_GetCurrentImage,
3576 BasicVideo_IsUsingDefaultSource,
3577 BasicVideo_IsUsingDefaultDestination,
3578 BasicVideo2_GetPreferredAspectRatio
3582 /*** IUnknown methods ***/
3583 static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface,
3586 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3588 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
3590 return Filtergraph_QueryInterface(This, riid, ppvObj);
3593 static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface) {
3594 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3596 TRACE("(%p/%p)->()\n", This, iface);
3598 return Filtergraph_AddRef(This);
3601 static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface) {
3602 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3604 TRACE("(%p/%p)->()\n", This, iface);
3606 return Filtergraph_Release(This);
3609 /*** IDispatch methods ***/
3610 static HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface,
3612 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3613 IVideoWindow* pVideoWindow;
3616 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
3618 EnterCriticalSection(&This->cs);
3620 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3623 hr = IVideoWindow_GetTypeInfoCount(pVideoWindow, pctinfo);
3625 LeaveCriticalSection(&This->cs);
3630 static HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface,
3633 ITypeInfo**ppTInfo) {
3634 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3635 IVideoWindow* pVideoWindow;
3638 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
3640 EnterCriticalSection(&This->cs);
3642 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3645 hr = IVideoWindow_GetTypeInfo(pVideoWindow, iTInfo, lcid, ppTInfo);
3647 LeaveCriticalSection(&This->cs);
3652 static HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface,
3658 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3659 IVideoWindow* pVideoWindow;
3662 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
3664 EnterCriticalSection(&This->cs);
3666 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3669 hr = IVideoWindow_GetIDsOfNames(pVideoWindow, riid, rgszNames, cNames, lcid, rgDispId);
3671 LeaveCriticalSection(&This->cs);
3676 static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface,
3677 DISPID dispIdMember,
3681 DISPPARAMS*pDispParams,
3683 EXCEPINFO*pExepInfo,
3685 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3686 IVideoWindow* pVideoWindow;
3689 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);
3691 EnterCriticalSection(&This->cs);
3693 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3696 hr = IVideoWindow_Invoke(pVideoWindow, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
3698 LeaveCriticalSection(&This->cs);
3704 /*** IVideoWindow methods ***/
3705 static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface,
3707 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3708 IVideoWindow* pVideoWindow;
3711 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
3713 EnterCriticalSection(&This->cs);
3715 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3718 hr = IVideoWindow_put_Caption(pVideoWindow, strCaption);
3720 LeaveCriticalSection(&This->cs);
3725 static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface,
3727 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3728 IVideoWindow* pVideoWindow;
3731 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
3733 EnterCriticalSection(&This->cs);
3735 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3738 hr = IVideoWindow_get_Caption(pVideoWindow, strCaption);
3740 LeaveCriticalSection(&This->cs);
3745 static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface,
3747 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3748 IVideoWindow* pVideoWindow;
3751 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyle);
3753 EnterCriticalSection(&This->cs);
3755 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3758 hr = IVideoWindow_put_WindowStyle(pVideoWindow, WindowStyle);
3760 LeaveCriticalSection(&This->cs);
3765 static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface,
3766 long *WindowStyle) {
3767 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3768 IVideoWindow* pVideoWindow;
3771 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
3773 EnterCriticalSection(&This->cs);
3775 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3778 hr = IVideoWindow_get_WindowStyle(pVideoWindow, WindowStyle);
3780 LeaveCriticalSection(&This->cs);
3785 static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface,
3786 long WindowStyleEx) {
3787 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3788 IVideoWindow* pVideoWindow;
3791 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
3793 EnterCriticalSection(&This->cs);
3795 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3798 hr = IVideoWindow_put_WindowStyleEx(pVideoWindow, WindowStyleEx);
3800 LeaveCriticalSection(&This->cs);
3805 static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface,
3806 long *WindowStyleEx) {
3807 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3808 IVideoWindow* pVideoWindow;
3811 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
3813 EnterCriticalSection(&This->cs);
3815 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3818 hr = IVideoWindow_get_WindowStyleEx(pVideoWindow, WindowStyleEx);
3820 LeaveCriticalSection(&This->cs);
3825 static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface,
3827 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3828 IVideoWindow* pVideoWindow;
3831 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
3833 EnterCriticalSection(&This->cs);
3835 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3838 hr = IVideoWindow_put_AutoShow(pVideoWindow, AutoShow);
3840 LeaveCriticalSection(&This->cs);
3845 static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface,
3847 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3848 IVideoWindow* pVideoWindow;
3851 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
3853 EnterCriticalSection(&This->cs);
3855 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3858 hr = IVideoWindow_get_AutoShow(pVideoWindow, AutoShow);
3860 LeaveCriticalSection(&This->cs);
3865 static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface,
3867 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3868 IVideoWindow* pVideoWindow;
3871 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowState);
3873 EnterCriticalSection(&This->cs);
3875 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3878 hr = IVideoWindow_put_WindowState(pVideoWindow, WindowState);
3880 LeaveCriticalSection(&This->cs);
3885 static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface,
3886 long *WindowState) {
3887 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3888 IVideoWindow* pVideoWindow;
3891 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
3893 EnterCriticalSection(&This->cs);
3895 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3898 hr = IVideoWindow_get_WindowState(pVideoWindow, WindowState);
3900 LeaveCriticalSection(&This->cs);
3905 static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface,
3906 long BackgroundPalette) {
3907 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3908 IVideoWindow* pVideoWindow;
3911 TRACE("(%p/%p)->(%ld)\n", This, iface, BackgroundPalette);
3913 EnterCriticalSection(&This->cs);
3915 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3918 hr = IVideoWindow_put_BackgroundPalette(pVideoWindow, BackgroundPalette);
3920 LeaveCriticalSection(&This->cs);
3925 static HRESULT WINAPI VideoWindow_get_BackgroundPalette(IVideoWindow *iface,
3926 long *pBackgroundPalette) {
3927 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3928 IVideoWindow* pVideoWindow;
3931 TRACE("(%p/%p)->(%p)\n", This, iface, pBackgroundPalette);
3933 EnterCriticalSection(&This->cs);
3935 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3938 hr = IVideoWindow_get_BackgroundPalette(pVideoWindow, pBackgroundPalette);
3940 LeaveCriticalSection(&This->cs);
3945 static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface,
3947 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3948 IVideoWindow* pVideoWindow;
3951 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
3953 EnterCriticalSection(&This->cs);
3955 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3958 hr = IVideoWindow_put_Visible(pVideoWindow, Visible);
3960 LeaveCriticalSection(&This->cs);
3965 static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface,
3967 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3968 IVideoWindow* pVideoWindow;
3971 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
3973 EnterCriticalSection(&This->cs);
3975 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3978 hr = IVideoWindow_get_Visible(pVideoWindow, pVisible);
3980 LeaveCriticalSection(&This->cs);
3985 static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface,
3987 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3988 IVideoWindow* pVideoWindow;
3991 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
3993 EnterCriticalSection(&This->cs);
3995 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3998 hr = IVideoWindow_put_Left(pVideoWindow, Left);
4000 LeaveCriticalSection(&This->cs);
4005 static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface,
4007 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4008 IVideoWindow* pVideoWindow;
4011 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
4013 EnterCriticalSection(&This->cs);
4015 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4018 hr = IVideoWindow_get_Left(pVideoWindow, pLeft);
4020 LeaveCriticalSection(&This->cs);
4025 static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface,
4027 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4028 IVideoWindow* pVideoWindow;
4031 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
4033 EnterCriticalSection(&This->cs);
4035 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4038 hr = IVideoWindow_put_Width(pVideoWindow, Width);
4040 LeaveCriticalSection(&This->cs);
4045 static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface,
4047 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4048 IVideoWindow* pVideoWindow;
4051 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
4053 EnterCriticalSection(&This->cs);
4055 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4058 hr = IVideoWindow_get_Width(pVideoWindow, pWidth);
4060 LeaveCriticalSection(&This->cs);
4065 static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface,
4067 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4068 IVideoWindow* pVideoWindow;
4071 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
4073 EnterCriticalSection(&This->cs);
4075 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4078 hr = IVideoWindow_put_Top(pVideoWindow, Top);
4080 LeaveCriticalSection(&This->cs);
4085 static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface,
4087 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4088 IVideoWindow* pVideoWindow;
4091 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
4093 EnterCriticalSection(&This->cs);
4095 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4098 hr = IVideoWindow_get_Top(pVideoWindow, pTop);
4100 LeaveCriticalSection(&This->cs);
4105 static HRESULT WINAPI VideoWindow_put_Height(IVideoWindow *iface,
4107 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4108 IVideoWindow* pVideoWindow;
4111 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
4113 EnterCriticalSection(&This->cs);
4115 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4118 hr = IVideoWindow_put_Height(pVideoWindow, Height);
4120 LeaveCriticalSection(&This->cs);
4125 static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface,
4127 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4128 IVideoWindow* pVideoWindow;
4131 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
4133 EnterCriticalSection(&This->cs);
4135 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4138 hr = IVideoWindow_get_Height(pVideoWindow, pHeight);
4140 LeaveCriticalSection(&This->cs);
4145 static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface,
4147 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4148 IVideoWindow* pVideoWindow;
4151 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
4153 EnterCriticalSection(&This->cs);
4155 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4158 hr = IVideoWindow_put_Owner(pVideoWindow, Owner);
4160 LeaveCriticalSection(&This->cs);
4165 static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface,
4167 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4168 IVideoWindow* pVideoWindow;
4171 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
4173 EnterCriticalSection(&This->cs);
4175 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4178 hr = IVideoWindow_get_Owner(pVideoWindow, Owner);
4180 LeaveCriticalSection(&This->cs);
4185 static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface,
4187 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4188 IVideoWindow* pVideoWindow;
4191 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
4193 EnterCriticalSection(&This->cs);
4195 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4198 hr = IVideoWindow_put_MessageDrain(pVideoWindow, Drain);
4200 LeaveCriticalSection(&This->cs);
4205 static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface,
4207 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4208 IVideoWindow* pVideoWindow;
4211 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
4213 EnterCriticalSection(&This->cs);
4215 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4218 hr = IVideoWindow_get_MessageDrain(pVideoWindow, Drain);
4220 LeaveCriticalSection(&This->cs);
4225 static HRESULT WINAPI VideoWindow_get_BorderColor(IVideoWindow *iface,
4227 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4228 IVideoWindow* pVideoWindow;
4231 TRACE("(%p/%p)->(%p)\n", This, iface, Color);
4233 EnterCriticalSection(&This->cs);
4235 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4238 hr = IVideoWindow_get_BorderColor(pVideoWindow, Color);
4240 LeaveCriticalSection(&This->cs);
4245 static HRESULT WINAPI VideoWindow_put_BorderColor(IVideoWindow *iface,
4247 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4248 IVideoWindow* pVideoWindow;
4251 TRACE("(%p/%p)->(%ld)\n", This, iface, Color);
4253 EnterCriticalSection(&This->cs);
4255 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4258 hr = IVideoWindow_put_BorderColor(pVideoWindow, Color);
4260 LeaveCriticalSection(&This->cs);
4265 static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
4266 long *FullScreenMode) {
4267 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4268 IVideoWindow* pVideoWindow;
4271 TRACE("(%p/%p)->(%p)\n", This, iface, FullScreenMode);
4273 EnterCriticalSection(&This->cs);
4275 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4278 hr = IVideoWindow_get_FullScreenMode(pVideoWindow, FullScreenMode);
4280 LeaveCriticalSection(&This->cs);
4285 static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface,
4286 long FullScreenMode) {
4287 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4288 IVideoWindow* pVideoWindow;
4291 TRACE("(%p/%p)->(%ld)\n", This, iface, FullScreenMode);
4293 EnterCriticalSection(&This->cs);
4295 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4298 hr = IVideoWindow_put_FullScreenMode(pVideoWindow, FullScreenMode);
4300 LeaveCriticalSection(&This->cs);
4305 static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface,
4307 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4308 IVideoWindow* pVideoWindow;
4311 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
4313 EnterCriticalSection(&This->cs);
4315 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4318 hr = IVideoWindow_SetWindowForeground(pVideoWindow, Focus);
4320 LeaveCriticalSection(&This->cs);
4325 static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface,
4330 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4331 IVideoWindow* pVideoWindow;
4334 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
4336 EnterCriticalSection(&This->cs);
4338 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4341 hr = IVideoWindow_NotifyOwnerMessage(pVideoWindow, hwnd, uMsg, wParam, lParam);
4343 LeaveCriticalSection(&This->cs);
4348 static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface,
4353 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4354 IVideoWindow* pVideoWindow;
4357 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
4359 EnterCriticalSection(&This->cs);
4361 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4364 hr = IVideoWindow_SetWindowPosition(pVideoWindow, Left, Top, Width, Height);
4366 LeaveCriticalSection(&This->cs);
4371 static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface,
4376 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4377 IVideoWindow* pVideoWindow;
4380 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
4382 EnterCriticalSection(&This->cs);
4384 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4387 hr = IVideoWindow_GetWindowPosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
4389 LeaveCriticalSection(&This->cs);
4394 static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface,
4397 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4398 IVideoWindow* pVideoWindow;
4401 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
4403 EnterCriticalSection(&This->cs);
4405 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4408 hr = IVideoWindow_GetMinIdealImageSize(pVideoWindow, pWidth, pHeight);
4410 LeaveCriticalSection(&This->cs);
4415 static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface,
4418 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4419 IVideoWindow* pVideoWindow;
4422 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
4424 EnterCriticalSection(&This->cs);
4426 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4429 hr = IVideoWindow_GetMaxIdealImageSize(pVideoWindow, pWidth, pHeight);
4431 LeaveCriticalSection(&This->cs);
4436 static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface,
4441 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4442 IVideoWindow* pVideoWindow;
4445 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
4447 EnterCriticalSection(&This->cs);
4449 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4452 hr = IVideoWindow_GetRestorePosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
4454 LeaveCriticalSection(&This->cs);
4459 static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface,
4461 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4462 IVideoWindow* pVideoWindow;
4465 TRACE("(%p/%p)->(%ld)\n", This, iface, HideCursor);
4467 EnterCriticalSection(&This->cs);
4469 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4472 hr = IVideoWindow_HideCursor(pVideoWindow, HideCursor);
4474 LeaveCriticalSection(&This->cs);
4479 static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface,
4480 long *CursorHidden) {
4481 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4482 IVideoWindow* pVideoWindow;
4485 TRACE("(%p/%p)->(%p)\n", This, iface, CursorHidden);
4487 EnterCriticalSection(&This->cs);
4489 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4492 hr = IVideoWindow_IsCursorHidden(pVideoWindow, CursorHidden);
4494 LeaveCriticalSection(&This->cs);
4500 static const IVideoWindowVtbl IVideoWindow_VTable =
4502 VideoWindow_QueryInterface,
4504 VideoWindow_Release,
4505 VideoWindow_GetTypeInfoCount,
4506 VideoWindow_GetTypeInfo,
4507 VideoWindow_GetIDsOfNames,
4509 VideoWindow_put_Caption,
4510 VideoWindow_get_Caption,
4511 VideoWindow_put_WindowStyle,
4512 VideoWindow_get_WindowStyle,
4513 VideoWindow_put_WindowStyleEx,
4514 VideoWindow_get_WindowStyleEx,
4515 VideoWindow_put_AutoShow,
4516 VideoWindow_get_AutoShow,
4517 VideoWindow_put_WindowState,
4518 VideoWindow_get_WindowState,
4519 VideoWindow_put_BackgroundPalette,
4520 VideoWindow_get_BackgroundPalette,
4521 VideoWindow_put_Visible,
4522 VideoWindow_get_Visible,
4523 VideoWindow_put_Left,
4524 VideoWindow_get_Left,
4525 VideoWindow_put_Width,
4526 VideoWindow_get_Width,
4527 VideoWindow_put_Top,
4528 VideoWindow_get_Top,
4529 VideoWindow_put_Height,
4530 VideoWindow_get_Height,
4531 VideoWindow_put_Owner,
4532 VideoWindow_get_Owner,
4533 VideoWindow_put_MessageDrain,
4534 VideoWindow_get_MessageDrain,
4535 VideoWindow_get_BorderColor,
4536 VideoWindow_put_BorderColor,
4537 VideoWindow_get_FullScreenMode,
4538 VideoWindow_put_FullScreenMode,
4539 VideoWindow_SetWindowForeground,
4540 VideoWindow_NotifyOwnerMessage,
4541 VideoWindow_SetWindowPosition,
4542 VideoWindow_GetWindowPosition,
4543 VideoWindow_GetMinIdealImageSize,
4544 VideoWindow_GetMaxIdealImageSize,
4545 VideoWindow_GetRestorePosition,
4546 VideoWindow_HideCursor,
4547 VideoWindow_IsCursorHidden
4551 /*** IUnknown methods ***/
4552 static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface,
4555 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4557 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
4559 return Filtergraph_QueryInterface(This, riid, ppvObj);
4562 static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface) {
4563 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4565 TRACE("(%p/%p)->()\n", This, iface);
4567 return Filtergraph_AddRef(This);
4570 static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface) {
4571 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4573 TRACE("(%p/%p)->()\n", This, iface);
4575 return Filtergraph_Release(This);
4578 /*** IDispatch methods ***/
4579 static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface,
4581 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4583 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
4588 static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface,
4591 ITypeInfo**ppTInfo) {
4592 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4594 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
4599 static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface,
4605 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4607 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
4612 static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface,
4613 DISPID dispIdMember,
4617 DISPPARAMS*pDispParams,
4619 EXCEPINFO*pExepInfo,
4621 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4623 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);
4628 /*** IMediaEvent methods ***/
4629 static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface,
4631 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4633 TRACE("(%p/%p)->(%p)\n", This, iface, hEvent);
4635 *hEvent = (OAEVENT)This->evqueue.msg_event;
4640 static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface,
4645 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4648 TRACE("(%p/%p)->(%p, %p, %p, %ld)\n", This, iface, lEventCode, lParam1, lParam2, msTimeout);
4650 if (EventsQueue_GetEvent(&This->evqueue, &evt, msTimeout))
4652 *lEventCode = evt.lEventCode;
4653 *lParam1 = evt.lParam1;
4654 *lParam2 = evt.lParam2;
4662 static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface,
4665 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4667 TRACE("(%p/%p)->(%ld, %p)\n", This, iface, msTimeout, pEvCode);
4669 if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
4671 *pEvCode = This->CompletionStatus;
4679 static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface,
4681 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4683 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4685 if (lEvCode == EC_COMPLETE)
4686 This->HandleEcComplete = FALSE;
4687 else if (lEvCode == EC_REPAINT)
4688 This->HandleEcRepaint = FALSE;
4689 else if (lEvCode == EC_CLOCK_CHANGED)
4690 This->HandleEcClockChanged = FALSE;
4697 static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(IMediaEventEx *iface,
4699 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4701 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4703 if (lEvCode == EC_COMPLETE)
4704 This->HandleEcComplete = TRUE;
4705 else if (lEvCode == EC_REPAINT)
4706 This->HandleEcRepaint = TRUE;
4707 else if (lEvCode == EC_CLOCK_CHANGED)
4708 This->HandleEcClockChanged = TRUE;
4715 static HRESULT WINAPI MediaEvent_FreeEventParams(IMediaEventEx *iface,
4719 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4721 TRACE("(%p/%p)->(%ld, %08lx, %08lx): stub !!!\n", This, iface, lEvCode, lParam1, lParam2);
4726 /*** IMediaEventEx methods ***/
4727 static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
4730 LONG_PTR lInstanceData) {
4731 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4733 TRACE("(%p/%p)->(%08x, %ld, %08lx)\n", This, iface, (DWORD) hwnd, lMsg, lInstanceData);
4735 This->notif.hWnd = (HWND)hwnd;
4736 This->notif.msg = lMsg;
4737 This->notif.instance = (long) lInstanceData;
4742 static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface,
4743 long lNoNotifyFlags) {
4744 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4746 TRACE("(%p/%p)->(%ld)\n", This, iface, lNoNotifyFlags);
4748 if ((lNoNotifyFlags != 0) && (lNoNotifyFlags != 1))
4749 return E_INVALIDARG;
4751 This->notif.disabled = lNoNotifyFlags;
4756 static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface,
4757 long *lplNoNotifyFlags) {
4758 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4760 TRACE("(%p/%p)->(%p)\n", This, iface, lplNoNotifyFlags);
4762 if (!lplNoNotifyFlags)
4765 *lplNoNotifyFlags = This->notif.disabled;
4771 static const IMediaEventExVtbl IMediaEventEx_VTable =
4773 MediaEvent_QueryInterface,
4776 MediaEvent_GetTypeInfoCount,
4777 MediaEvent_GetTypeInfo,
4778 MediaEvent_GetIDsOfNames,
4780 MediaEvent_GetEventHandle,
4781 MediaEvent_GetEvent,
4782 MediaEvent_WaitForCompletion,
4783 MediaEvent_CancelDefaultHandling,
4784 MediaEvent_RestoreDefaultHandling,
4785 MediaEvent_FreeEventParams,
4786 MediaEvent_SetNotifyWindow,
4787 MediaEvent_SetNotifyFlags,
4788 MediaEvent_GetNotifyFlags
4792 static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID riid, LPVOID *ppv)
4794 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4796 return Filtergraph_QueryInterface(This, riid, ppv);
4799 static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
4801 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4803 return Filtergraph_AddRef(This);
4806 static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
4808 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4810 return Filtergraph_Release(This);
4813 static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClassID)
4815 FIXME("(%p): stub\n", pClassID);
4820 static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
4822 FIXME("(): stub\n");
4827 static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
4829 FIXME("(): stub\n");
4834 static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME tStart)
4836 FIXME("(0x%s): stub\n", wine_dbgstr_longlong(tStart));
4841 static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD dwMsTimeout, FILTER_STATE * pState)
4843 FIXME("(%d, %p): stub\n", dwMsTimeout, pState);
4848 static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
4850 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4854 TRACE("(%p/%p)->(%p)\n", iface, This, pClock);
4856 EnterCriticalSection(&This->cs);
4858 for (i = 0;i < This->nFilters;i++)
4860 hr = IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], pClock);
4868 IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], This->refClock);
4873 IReferenceClock_Release(This->refClock);
4874 This->refClock = pClock;
4876 IReferenceClock_AddRef(This->refClock);
4878 if (This->HandleEcClockChanged)
4880 IMediaEventSink *pEventSink;
4883 eshr = IMediaFilter_QueryInterface(iface, &IID_IMediaEventSink, (LPVOID)&pEventSink);
4884 if (SUCCEEDED(eshr))
4886 IMediaEventSink_Notify(pEventSink, EC_CLOCK_CHANGED, 0, 0);
4887 IMediaEventSink_Release(pEventSink);
4892 LeaveCriticalSection(&This->cs);
4897 static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
4899 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4901 TRACE("(%p/%p)->(%p)\n", iface, This, ppClock);
4906 EnterCriticalSection(&This->cs);
4908 *ppClock = This->refClock;
4910 IReferenceClock_AddRef(*ppClock);
4912 LeaveCriticalSection(&This->cs);
4917 static const IMediaFilterVtbl IMediaFilter_VTable =
4919 MediaFilter_QueryInterface,
4921 MediaFilter_Release,
4922 MediaFilter_GetClassID,
4926 MediaFilter_GetState,
4927 MediaFilter_SetSyncSource,
4928 MediaFilter_GetSyncSource
4931 static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID riid, LPVOID *ppv)
4933 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4935 return Filtergraph_QueryInterface(This, riid, ppv);
4938 static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
4940 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4942 return Filtergraph_AddRef(This);
4945 static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
4947 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4949 return Filtergraph_Release(This);
4952 static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, long EventCode, LONG_PTR EventParam1, LONG_PTR EventParam2)
4954 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4957 TRACE("(%p/%p)->(%ld, %ld, %ld)\n", This, iface, EventCode, EventParam1, EventParam2);
4959 /* We need thread safety here, let's use the events queue's one */
4960 EnterCriticalSection(&This->evqueue.msg_crst);
4962 if ((EventCode == EC_COMPLETE) && This->HandleEcComplete)
4964 TRACE("Process EC_COMPLETE notification\n");
4965 if (++This->EcCompleteCount == This->nRenderers)
4967 evt.lEventCode = EC_COMPLETE;
4970 TRACE("Send EC_COMPLETE to app\n");
4971 EventsQueue_PutEvent(&This->evqueue, &evt);
4972 if (!This->notif.disabled && This->notif.hWnd)
4974 TRACE("Send Window message\n");
4975 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4977 This->CompletionStatus = EC_COMPLETE;
4978 SetEvent(This->hEventCompletion);
4981 else if ((EventCode == EC_REPAINT) && This->HandleEcRepaint)
4983 /* FIXME: Not handled yet */
4987 evt.lEventCode = EventCode;
4988 evt.lParam1 = EventParam1;
4989 evt.lParam2 = EventParam2;
4990 EventsQueue_PutEvent(&This->evqueue, &evt);
4991 if (!This->notif.disabled && This->notif.hWnd)
4992 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4995 LeaveCriticalSection(&This->evqueue.msg_crst);
4999 static const IMediaEventSinkVtbl IMediaEventSink_VTable =
5001 MediaEventSink_QueryInterface,
5002 MediaEventSink_AddRef,
5003 MediaEventSink_Release,
5004 MediaEventSink_Notify
5007 static HRESULT WINAPI GraphConfig_QueryInterface(IGraphConfig *iface, REFIID riid, LPVOID *ppv)
5009 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5011 return Filtergraph_QueryInterface(This, riid, ppv);
5014 static ULONG WINAPI GraphConfig_AddRef(IGraphConfig *iface)
5016 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5018 return Filtergraph_AddRef(This);
5021 static ULONG WINAPI GraphConfig_Release(IGraphConfig *iface)
5023 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5025 return Filtergraph_Release(This);
5028 static HRESULT WINAPI GraphConfig_Reconnect(IGraphConfig *iface,
5031 const AM_MEDIA_TYPE* pmtFirstConnection,
5032 IBaseFilter* pUsingFilter,
5036 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5038 FIXME("(%p)->(%p, %p, %p, %p, %p, %x): stub!\n", This, pOutputPin, pInputPin, pmtFirstConnection, pUsingFilter, hAbortEvent, dwFlags);
5043 static HRESULT WINAPI GraphConfig_Reconfigure(IGraphConfig *iface,
5044 IGraphConfigCallback* pCallback,
5049 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5052 WARN("(%p)->(%p, %p, %x, %p): partial stub!\n", This, pCallback, pvContext, dwFlags, hAbortEvent);
5055 FIXME("The parameter hAbortEvent is not handled!\n");
5057 EnterCriticalSection(&This->cs);
5059 hr = IGraphConfigCallback_Reconfigure(pCallback, pvContext, dwFlags);
5061 LeaveCriticalSection(&This->cs);
5066 static HRESULT WINAPI GraphConfig_AddFilterToCache(IGraphConfig *iface,
5067 IBaseFilter* pFilter)
5069 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5071 FIXME("(%p)->(%p): stub!\n", This, pFilter);
5076 static HRESULT WINAPI GraphConfig_EnumCacheFilter(IGraphConfig *iface,
5077 IEnumFilters** pEnum)
5079 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5081 FIXME("(%p)->(%p): stub!\n", This, pEnum);
5086 static HRESULT WINAPI GraphConfig_RemoveFilterFromCache(IGraphConfig *iface,
5087 IBaseFilter* pFilter)
5089 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5091 FIXME("(%p)->(%p): stub!\n", This, pFilter);
5096 static HRESULT WINAPI GraphConfig_GetStartTime(IGraphConfig *iface,
5097 REFERENCE_TIME* prtStart)
5099 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5101 FIXME("(%p)->(%p): stub!\n", This, prtStart);
5106 static HRESULT WINAPI GraphConfig_PushThroughData(IGraphConfig *iface,
5108 IPinConnection* pConnection,
5111 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5113 FIXME("(%p)->(%p, %p, %p): stub!\n", This, pOutputPin, pConnection, hEventAbort);
5118 static HRESULT WINAPI GraphConfig_SetFilterFlags(IGraphConfig *iface,
5119 IBaseFilter* pFilter,
5122 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5124 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
5129 static HRESULT WINAPI GraphConfig_GetFilterFlags(IGraphConfig *iface,
5130 IBaseFilter* pFilter,
5133 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5135 FIXME("(%p)->(%p, %p): stub!\n", This, pFilter, dwFlags);
5140 static HRESULT WINAPI GraphConfig_RemoveFilterEx(IGraphConfig *iface,
5141 IBaseFilter* pFilter,
5144 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
5146 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
5151 static const IGraphConfigVtbl IGraphConfig_VTable =
5153 GraphConfig_QueryInterface,
5155 GraphConfig_Release,
5156 GraphConfig_Reconnect,
5157 GraphConfig_Reconfigure,
5158 GraphConfig_AddFilterToCache,
5159 GraphConfig_EnumCacheFilter,
5160 GraphConfig_RemoveFilterFromCache,
5161 GraphConfig_GetStartTime,
5162 GraphConfig_PushThroughData,
5163 GraphConfig_SetFilterFlags,
5164 GraphConfig_GetFilterFlags,
5165 GraphConfig_RemoveFilterEx
5168 static const IUnknownVtbl IInner_VTable =
5170 FilterGraphInner_QueryInterface,
5171 FilterGraphInner_AddRef,
5172 FilterGraphInner_Release
5175 static HRESULT WINAPI Filtergraph_QueryInterface(IFilterGraphImpl *This,
5178 if (This->bAggregatable)
5179 This->bUnkOuterValid = TRUE;
5181 if (This->pUnkOuter)
5183 if (This->bAggregatable)
5184 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
5186 if (IsEqualIID(riid, &IID_IUnknown))
5190 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
5191 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
5192 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
5193 This->bAggregatable = TRUE;
5198 return E_NOINTERFACE;
5201 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
5204 static ULONG WINAPI Filtergraph_AddRef(IFilterGraphImpl *This) {
5205 if (This->pUnkOuter && This->bUnkOuterValid)
5206 return IUnknown_AddRef(This->pUnkOuter);
5207 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
5210 static ULONG WINAPI Filtergraph_Release(IFilterGraphImpl *This) {
5211 if (This->pUnkOuter && This->bUnkOuterValid)
5212 return IUnknown_Release(This->pUnkOuter);
5213 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
5216 /* This is the only function that actually creates a FilterGraph class... */
5217 HRESULT FilterGraph_create(IUnknown *pUnkOuter, LPVOID *ppObj)
5219 IFilterGraphImpl *fimpl;
5222 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
5226 fimpl = CoTaskMemAlloc(sizeof(*fimpl));
5227 fimpl->pUnkOuter = pUnkOuter;
5228 fimpl->bUnkOuterValid = FALSE;
5229 fimpl->bAggregatable = FALSE;
5230 fimpl->IInner_vtbl = &IInner_VTable;
5231 fimpl->IFilterGraph2_vtbl = &IFilterGraph2_VTable;
5232 fimpl->IMediaControl_vtbl = &IMediaControl_VTable;
5233 fimpl->IMediaSeeking_vtbl = &IMediaSeeking_VTable;
5234 fimpl->IBasicAudio_vtbl = &IBasicAudio_VTable;
5235 fimpl->IBasicVideo_vtbl = &IBasicVideo_VTable;
5236 fimpl->IVideoWindow_vtbl = &IVideoWindow_VTable;
5237 fimpl->IMediaEventEx_vtbl = &IMediaEventEx_VTable;
5238 fimpl->IMediaFilter_vtbl = &IMediaFilter_VTable;
5239 fimpl->IMediaEventSink_vtbl = &IMediaEventSink_VTable;
5240 fimpl->IGraphConfig_vtbl = &IGraphConfig_VTable;
5241 fimpl->IMediaPosition_vtbl = &IMediaPosition_VTable;
5243 fimpl->ppFiltersInGraph = NULL;
5244 fimpl->pFilterNames = NULL;
5245 fimpl->nFilters = 0;
5246 fimpl->filterCapacity = 0;
5247 fimpl->nameIndex = 1;
5248 fimpl->refClock = NULL;
5249 fimpl->hEventCompletion = CreateEventW(0, TRUE, FALSE, 0);
5250 fimpl->HandleEcComplete = TRUE;
5251 fimpl->HandleEcRepaint = TRUE;
5252 fimpl->HandleEcClockChanged = TRUE;
5253 fimpl->notif.hWnd = 0;
5254 fimpl->notif.disabled = FALSE;
5255 fimpl->nRenderers = 0;
5256 fimpl->EcCompleteCount = 0;
5257 fimpl->state = State_Stopped;
5258 EventsQueue_Init(&fimpl->evqueue);
5259 InitializeCriticalSection(&fimpl->cs);
5260 fimpl->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IFilterGraphImpl.cs");
5261 fimpl->nItfCacheEntries = 0;
5262 memcpy(&fimpl->timeformatseek, &TIME_FORMAT_MEDIA_TIME, sizeof(GUID));
5263 fimpl->start_time = fimpl->position = 0;
5264 fimpl->stop_position = -1;
5266 hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&fimpl->pFilterMapper2);
5268 ERR("Unable to create filter mapper (%x)\n", hr);
5271 IFilterGraph2_SetDefaultSyncSource((IFilterGraph2*)fimpl);
5277 HRESULT FilterGraphNoThread_create(IUnknown *pUnkOuter, LPVOID *ppObj)
5279 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
5280 return FilterGraph_create(pUnkOuter, ppObj);