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
33 #include "wine/debug.h"
34 #include "quartz_private.h"
40 #include "wine/unicode.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
46 HWND hWnd; /* Target window */
47 long msg; /* User window message */
48 long instance; /* User data */
49 int disabled; /* Disabled messages posting */
53 long lEventCode; /* Event code */
54 LONG_PTR lParam1; /* Param1 */
55 LONG_PTR lParam2; /* Param2 */
58 /* messages ring implementation for queuing events (taken from winmm) */
59 #define EVENTS_RING_BUFFER_INCREMENT 64
65 CRITICAL_SECTION msg_crst;
66 HANDLE msg_event; /* Signaled for no empty queue */
69 static int EventsQueue_Init(EventsQueue* omr)
73 omr->msg_event = CreateEventW(NULL, TRUE, FALSE, NULL);
74 omr->ring_buffer_size = EVENTS_RING_BUFFER_INCREMENT;
75 omr->messages = CoTaskMemAlloc(omr->ring_buffer_size * sizeof(Event));
76 ZeroMemory(omr->messages, omr->ring_buffer_size * sizeof(Event));
78 InitializeCriticalSection(&omr->msg_crst);
79 omr->msg_crst.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": EventsQueue.msg_crst");
83 static int EventsQueue_Destroy(EventsQueue* omr)
85 CloseHandle(omr->msg_event);
86 CoTaskMemFree(omr->messages);
87 omr->msg_crst.DebugInfo->Spare[0] = 0;
88 DeleteCriticalSection(&omr->msg_crst);
92 static int EventsQueue_PutEvent(EventsQueue* omr, const Event* evt)
94 EnterCriticalSection(&omr->msg_crst);
95 if ((omr->msg_toget == ((omr->msg_tosave + 1) % omr->ring_buffer_size)))
97 int old_ring_buffer_size = omr->ring_buffer_size;
98 omr->ring_buffer_size += EVENTS_RING_BUFFER_INCREMENT;
99 TRACE("omr->ring_buffer_size=%d\n",omr->ring_buffer_size);
100 omr->messages = HeapReAlloc(GetProcessHeap(),0,omr->messages, omr->ring_buffer_size * sizeof(Event));
101 /* Now we need to rearrange the ring buffer so that the new
102 buffers just allocated are in between omr->msg_tosave and
105 if (omr->msg_tosave < omr->msg_toget)
107 memmove(&(omr->messages[omr->msg_toget + EVENTS_RING_BUFFER_INCREMENT]),
108 &(omr->messages[omr->msg_toget]),
109 sizeof(Event)*(old_ring_buffer_size - omr->msg_toget)
111 omr->msg_toget += EVENTS_RING_BUFFER_INCREMENT;
114 omr->messages[omr->msg_tosave] = *evt;
115 SetEvent(omr->msg_event);
116 omr->msg_tosave = (omr->msg_tosave + 1) % omr->ring_buffer_size;
117 LeaveCriticalSection(&omr->msg_crst);
121 static int EventsQueue_GetEvent(EventsQueue* omr, Event* evt, long msTimeOut)
123 if (WaitForSingleObject(omr->msg_event, msTimeOut) != WAIT_OBJECT_0)
126 EnterCriticalSection(&omr->msg_crst);
128 if (omr->msg_toget == omr->msg_tosave) /* buffer empty ? */
130 LeaveCriticalSection(&omr->msg_crst);
134 *evt = omr->messages[omr->msg_toget];
135 omr->msg_toget = (omr->msg_toget + 1) % omr->ring_buffer_size;
137 /* Mark the buffer as empty if needed */
138 if (omr->msg_toget == omr->msg_tosave) /* buffer empty ? */
139 ResetEvent(omr->msg_event);
141 LeaveCriticalSection(&omr->msg_crst);
145 #define MAX_ITF_CACHE_ENTRIES 3
146 typedef struct _ITF_CACHE_ENTRY {
152 typedef struct _IFilterGraphImpl {
153 const IFilterGraph2Vtbl *IFilterGraph2_vtbl;
154 const IMediaControlVtbl *IMediaControl_vtbl;
155 const IMediaSeekingVtbl *IMediaSeeking_vtbl;
156 const IBasicAudioVtbl *IBasicAudio_vtbl;
157 const IBasicVideoVtbl *IBasicVideo_vtbl;
158 const IVideoWindowVtbl *IVideoWindow_vtbl;
159 const IMediaEventExVtbl *IMediaEventEx_vtbl;
160 const IMediaFilterVtbl *IMediaFilter_vtbl;
161 const IMediaEventSinkVtbl *IMediaEventSink_vtbl;
162 const IGraphConfigVtbl *IGraphConfig_vtbl;
163 const IMediaPositionVtbl *IMediaPosition_vtbl;
164 const IUnknownVtbl * IInner_vtbl;
165 /* IAMGraphStreams */
172 /* IRegisterServiceProvider */
173 /* IResourceMananger */
174 /* IServiceProvider */
175 /* IVideoFrameStep */
178 IFilterMapper2 * pFilterMapper2;
179 IBaseFilter ** ppFiltersInGraph;
180 LPWSTR * pFilterNames;
184 IReferenceClock *refClock;
186 HANDLE hEventCompletion;
187 int CompletionStatus;
191 int HandleEcComplete;
193 int HandleEcClockChanged;
196 ITF_CACHE_ENTRY ItfCacheEntries[MAX_ITF_CACHE_ENTRIES];
197 int nItfCacheEntries;
198 IUnknown * pUnkOuter;
204 static HRESULT WINAPI Filtergraph_QueryInterface(IFilterGraphImpl *This,
205 REFIID riid, LPVOID * ppv);
206 static ULONG WINAPI Filtergraph_AddRef(IFilterGraphImpl *This);
207 static ULONG WINAPI Filtergraph_Release(IFilterGraphImpl *This);
209 static HRESULT WINAPI FilterGraphInner_QueryInterface(IUnknown * iface,
212 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
213 TRACE("(%p)->(%s (%p), %p)\n", This, debugstr_guid(riid), riid, ppvObj);
215 if (This->bAggregatable)
216 This->bUnkOuterValid = TRUE;
218 if (IsEqualGUID(&IID_IUnknown, riid)) {
219 *ppvObj = &(This->IInner_vtbl);
220 TRACE(" returning IUnknown interface (%p)\n", *ppvObj);
221 } else if (IsEqualGUID(&IID_IFilterGraph, riid) ||
222 IsEqualGUID(&IID_IFilterGraph2, riid) ||
223 IsEqualGUID(&IID_IGraphBuilder, riid)) {
224 *ppvObj = &(This->IFilterGraph2_vtbl);
225 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj);
226 } else if (IsEqualGUID(&IID_IMediaControl, riid)) {
227 *ppvObj = &(This->IMediaControl_vtbl);
228 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj);
229 } else if (IsEqualGUID(&IID_IMediaSeeking, riid)) {
230 *ppvObj = &(This->IMediaSeeking_vtbl);
231 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj);
232 } else if (IsEqualGUID(&IID_IBasicAudio, riid)) {
233 *ppvObj = &(This->IBasicAudio_vtbl);
234 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj);
235 } else if (IsEqualGUID(&IID_IBasicVideo, riid)) {
236 *ppvObj = &(This->IBasicVideo_vtbl);
237 TRACE(" returning IBasicVideo interface (%p)\n", *ppvObj);
238 } else if (IsEqualGUID(&IID_IVideoWindow, riid)) {
239 *ppvObj = &(This->IVideoWindow_vtbl);
240 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj);
241 } else if (IsEqualGUID(&IID_IMediaEvent, riid) ||
242 IsEqualGUID(&IID_IMediaEventEx, riid)) {
243 *ppvObj = &(This->IMediaEventEx_vtbl);
244 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj);
245 } else if (IsEqualGUID(&IID_IMediaFilter, riid) ||
246 IsEqualGUID(&IID_IPersist, riid)) {
247 *ppvObj = &(This->IMediaFilter_vtbl);
248 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj);
249 } else if (IsEqualGUID(&IID_IMediaEventSink, riid)) {
250 *ppvObj = &(This->IMediaEventSink_vtbl);
251 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj);
252 } else if (IsEqualGUID(&IID_IGraphConfig, riid)) {
253 *ppvObj = &(This->IGraphConfig_vtbl);
254 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj);
255 } else if (IsEqualGUID(&IID_IMediaPosition, riid)) {
256 *ppvObj = &(This->IMediaPosition_vtbl);
257 TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj);
260 FIXME("unknown interface %s\n", debugstr_guid(riid));
261 return E_NOINTERFACE;
264 IUnknown_AddRef((IUnknown *)(*ppvObj));
268 static ULONG WINAPI FilterGraphInner_AddRef(IUnknown * iface) {
269 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
270 ULONG ref = InterlockedIncrement(&This->ref);
272 TRACE("(%p)->(): new ref = %d\n", This, ref);
277 static ULONG WINAPI FilterGraphInner_Release(IUnknown * iface) {
278 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
279 ULONG ref = InterlockedDecrement(&This->ref);
281 TRACE("(%p)->(): new ref = %d\n", This, ref);
286 IMediaControl_Stop((IMediaControl*)&(This->IMediaControl_vtbl));
288 IReferenceClock_Release(This->refClock);
290 while (This->nFilters)
291 IFilterGraph2_RemoveFilter((IFilterGraph2*)This, This->ppFiltersInGraph[0]);
293 for (i = 0; i < This->nItfCacheEntries; i++)
295 if (This->ItfCacheEntries[i].iface)
296 IUnknown_Release(This->ItfCacheEntries[i].iface);
298 IFilterMapper2_Release(This->pFilterMapper2);
299 CloseHandle(This->hEventCompletion);
300 EventsQueue_Destroy(&This->evqueue);
301 This->cs.DebugInfo->Spare[0] = 0;
302 DeleteCriticalSection(&This->cs);
303 CoTaskMemFree(This->ppFiltersInGraph);
304 CoTaskMemFree(This->pFilterNames);
311 /*** IUnknown methods ***/
312 static HRESULT WINAPI FilterGraph2_QueryInterface(IFilterGraph2 *iface,
315 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
317 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
318 return Filtergraph_QueryInterface(This, riid, ppvObj);
321 static ULONG WINAPI FilterGraph2_AddRef(IFilterGraph2 *iface) {
322 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
324 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This, iface);
326 return Filtergraph_AddRef(This);
329 static ULONG WINAPI FilterGraph2_Release(IFilterGraph2 *iface) {
330 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
332 TRACE("(%p/%p)->() calling FilterGraph Release\n", This, iface);
334 return Filtergraph_Release(This);
337 /*** IFilterGraph methods ***/
338 static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface,
339 IBaseFilter *pFilter,
341 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
344 WCHAR* wszFilterName = NULL;
345 int duplicate_name = FALSE;
347 TRACE("(%p/%p)->(%p, %s (%p))\n", This, iface, pFilter, debugstr_w(pName), pName);
352 wszFilterName = CoTaskMemAlloc( (pName ? strlenW(pName) + 6 : 5) * sizeof(WCHAR) );
356 /* Check if name already exists */
357 for(i = 0; i < This->nFilters; i++)
358 if (!strcmpW(This->pFilterNames[i], pName))
360 duplicate_name = TRUE;
365 /* If no name given or name already existing, generate one */
366 if (!pName || duplicate_name)
368 static const WCHAR wszFmt1[] = {'%','s',' ','%','0','4','d',0};
369 static const WCHAR wszFmt2[] = {'%','0','4','d',0};
371 for (j = 0; j < 10000 ; j++)
375 sprintfW(wszFilterName, wszFmt1, pName, This->nameIndex);
377 sprintfW(wszFilterName, wszFmt2, This->nameIndex);
378 TRACE("Generated name %s\n", debugstr_w(wszFilterName));
380 /* Check if the generated name already exists */
381 for(i = 0; i < This->nFilters; i++)
382 if (!strcmpW(This->pFilterNames[i], wszFilterName))
385 /* Compute next index and exit if generated name is suitable */
386 if (This->nameIndex++ == 10000)
388 if (i == This->nFilters)
391 /* Unable to find a suitable name */
394 CoTaskMemFree(wszFilterName);
395 return VFW_E_DUPLICATE_NAME;
399 memcpy(wszFilterName, pName, (strlenW(pName) + 1) * sizeof(WCHAR));
401 if (This->nFilters + 1 > This->filterCapacity)
403 int newCapacity = This->filterCapacity ? 2 * This->filterCapacity : 1;
404 IBaseFilter ** ppNewFilters = CoTaskMemAlloc(newCapacity * sizeof(IBaseFilter*));
405 LPWSTR * pNewNames = CoTaskMemAlloc(newCapacity * sizeof(LPWSTR));
406 memcpy(ppNewFilters, This->ppFiltersInGraph, This->nFilters * sizeof(IBaseFilter*));
407 memcpy(pNewNames, This->pFilterNames, This->nFilters * sizeof(LPWSTR));
408 if (!This->filterCapacity)
410 CoTaskMemFree(This->ppFiltersInGraph);
411 CoTaskMemFree(This->pFilterNames);
413 This->ppFiltersInGraph = ppNewFilters;
414 This->pFilterNames = pNewNames;
415 This->filterCapacity = newCapacity;
418 hr = IBaseFilter_JoinFilterGraph(pFilter, (IFilterGraph *)This, wszFilterName);
422 IBaseFilter_AddRef(pFilter);
423 This->ppFiltersInGraph[This->nFilters] = pFilter;
424 This->pFilterNames[This->nFilters] = wszFilterName;
426 IBaseFilter_SetSyncSource(pFilter, This->refClock);
429 CoTaskMemFree(wszFilterName);
431 if (SUCCEEDED(hr) && duplicate_name)
432 return VFW_S_DUPLICATE_NAME;
437 static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface,
438 IBaseFilter *pFilter) {
439 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
443 TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
445 /* FIXME: check graph is stopped */
447 for (i = 0; i < This->nFilters; i++)
449 if (This->ppFiltersInGraph[i] == pFilter)
451 IEnumPins *penumpins;
452 IBaseFilter_Stop(pFilter);
453 hr = IBaseFilter_EnumPins(pFilter, &penumpins);
456 while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK) {
459 IPin_ConnectedTo(ppin, &victim);
462 h = IPin_Disconnect(victim);
463 TRACE("Disconnect other side: %08x\n", h);
464 if (h == VFW_E_NOT_STOPPED)
467 IPin_QueryPinInfo(victim, &pinfo);
468 IBaseFilter_Stop(pinfo.pFilter);
469 IBaseFilter_Release(pinfo.pFilter);
470 h = IPin_Disconnect(victim);
471 TRACE("Disconnect retry: %08x\n", h);
473 IPin_Release(victim);
475 h = IPin_Disconnect(ppin);
476 TRACE("Disconnect 2: %08x\n", h);
478 IEnumPins_Release(penumpins);
481 hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, This->pFilterNames[i]);
484 IBaseFilter_SetSyncSource(pFilter, NULL);
485 IBaseFilter_Release(pFilter);
486 CoTaskMemFree(This->pFilterNames[i]);
487 memmove(This->ppFiltersInGraph+i, This->ppFiltersInGraph+i+1, sizeof(IBaseFilter*)*(This->nFilters - 1 - i));
488 memmove(This->pFilterNames+i, This->pFilterNames+i+1, sizeof(LPWSTR)*(This->nFilters - 1 - i));
490 /* Invalidate interfaces in the cache */
491 for (i = 0; i < This->nItfCacheEntries; i++)
492 if (pFilter == This->ItfCacheEntries[i].filter)
494 IUnknown_Release(This->ItfCacheEntries[i].iface);
495 This->ItfCacheEntries[i].iface = NULL;
496 This->ItfCacheEntries[i].filter = NULL;
504 return hr; /* FIXME: check this error code */
507 static HRESULT WINAPI FilterGraph2_EnumFilters(IFilterGraph2 *iface,
508 IEnumFilters **ppEnum) {
509 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
511 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
513 return IEnumFiltersImpl_Construct(This->ppFiltersInGraph, This->nFilters, ppEnum);
516 static HRESULT WINAPI FilterGraph2_FindFilterByName(IFilterGraph2 *iface,
518 IBaseFilter **ppFilter) {
519 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
522 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_w(pName), pName, ppFilter);
527 for (i = 0; i < This->nFilters; i++)
529 if (!strcmpW(pName, This->pFilterNames[i]))
531 *ppFilter = This->ppFiltersInGraph[i];
532 IBaseFilter_AddRef(*ppFilter);
538 return VFW_E_NOT_FOUND;
541 /* NOTE: despite the implication, it doesn't matter which
542 * way round you put in the input and output pins */
543 static HRESULT WINAPI FilterGraph2_ConnectDirect(IFilterGraph2 *iface,
546 const AM_MEDIA_TYPE *pmt) {
550 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
552 TRACE("(%p/%p)->(%p, %p, %p)\n", This, iface, ppinIn, ppinOut, pmt);
554 /* FIXME: check pins are in graph */
556 if (TRACE_ON(quartz))
560 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
564 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
565 IBaseFilter_Release(PinInfo.pFilter);
567 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
571 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
572 IBaseFilter_Release(PinInfo.pFilter);
575 hr = IPin_QueryDirection(ppinIn, &dir);
578 if (dir == PINDIR_INPUT)
579 hr = IPin_Connect(ppinOut, ppinIn, pmt);
581 hr = IPin_Connect(ppinIn, ppinOut, pmt);
587 static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface,
589 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
590 IPin *pConnectedTo = NULL;
592 PIN_DIRECTION pindir;
594 IPin_QueryDirection(ppin, &pindir);
595 hr = IPin_ConnectedTo(ppin, &pConnectedTo);
597 TRACE("Querying connected to failed: %x\n", hr);
600 IPin_Disconnect(ppin);
601 IPin_Disconnect(pConnectedTo);
602 if (pindir == PINDIR_INPUT)
603 hr = IPin_Connect(pConnectedTo, ppin, NULL);
605 hr = IPin_Connect(ppin, pConnectedTo, NULL);
606 IPin_Release(pConnectedTo);
608 ERR("Reconnecting pins failed, pins are not connected now..\n");
609 TRACE("(%p->%p) -- %p %p -> %x\n", iface, This, ppin, pConnectedTo, hr);
613 static HRESULT WINAPI FilterGraph2_Disconnect(IFilterGraph2 *iface,
615 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
617 TRACE("(%p/%p)->(%p)\n", This, iface, ppin);
619 return IPin_Disconnect(ppin);
622 static HRESULT WINAPI FilterGraph2_SetDefaultSyncSource(IFilterGraph2 *iface) {
623 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
624 IReferenceClock *pClock = NULL;
627 TRACE("(%p/%p)->() semi-stub\n", iface, This);
629 hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, &IID_IReferenceClock, (LPVOID*)&pClock);
633 hr = IMediaFilter_SetSyncSource((IMediaFilter*)&(This->IMediaFilter_vtbl), pClock);
634 IReferenceClock_Release(pClock);
640 static HRESULT GetFilterInfo(IMoniker* pMoniker, GUID* pclsid, VARIANT* pvar)
642 static const WCHAR wszClsidName[] = {'C','L','S','I','D',0};
643 static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
644 IPropertyBag * pPropBagCat = NULL;
648 V_VT(pvar) = VT_BSTR;
650 hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
653 hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL);
656 hr = CLSIDFromString(V_UNION(pvar, bstrVal), pclsid);
659 hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL);
662 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid), debugstr_w(V_UNION(pvar, bstrVal)));
665 IPropertyBag_Release(pPropBagCat);
670 static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPin*** pppins, ULONG* pnb)
675 TRACE("(%p, %p, %p, %p)\n", pfilter, pinputpin, pppins, pnb);
676 hr = IPin_QueryInternalConnections(pinputpin, NULL, &nb);
679 } else if (hr == S_FALSE) {
680 *pppins = CoTaskMemAlloc(sizeof(IPin*)*nb);
681 hr = IPin_QueryInternalConnections(pinputpin, *pppins, &nb);
683 ERR("Error (%x)\n", hr);
685 } else if (hr == E_NOTIMPL) {
686 /* Input connected to all outputs */
687 IEnumPins* penumpins;
690 TRACE("E_NOTIMPL\n");
691 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
693 ERR("filter Enumpins failed (%x)\n", hr);
697 /* Count output pins */
698 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
699 PIN_DIRECTION pindir;
700 IPin_QueryDirection(ppin, &pindir);
701 if (pindir == PINDIR_OUTPUT)
705 *pppins = CoTaskMemAlloc(sizeof(IPin*)*i);
706 /* Retrieve output pins */
707 IEnumPins_Reset(penumpins);
709 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
710 PIN_DIRECTION pindir;
711 IPin_QueryDirection(ppin, &pindir);
712 if (pindir == PINDIR_OUTPUT)
713 (*pppins)[i++] = ppin;
717 IEnumPins_Release(penumpins);
720 ERR("Next failed (%x)\n", hr);
723 } else if (FAILED(hr)) {
724 ERR("Cannot get internal connection (%x)\n", hr);
732 /*** IGraphBuilder methods ***/
733 static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface,
736 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
739 IEnumMediaTypes* penummt;
741 IEnumPins* penumpins;
742 IEnumMoniker* pEnumMoniker;
750 TRACE("(%p/%p)->(%p, %p)\n", This, iface, ppinOut, ppinIn);
752 if (TRACE_ON(quartz))
754 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
758 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
759 IBaseFilter_Release(PinInfo.pFilter);
761 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
765 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
766 IBaseFilter_Release(PinInfo.pFilter);
769 /* Try direct connection first */
770 hr = IPin_Connect(ppinOut, ppinIn, NULL);
774 TRACE("Direct connection failed, trying to insert other filters\n");
776 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
780 hr = IBaseFilter_GetClassID(PinInfo.pFilter, &FilterCLSID);
781 IBaseFilter_Release(PinInfo.pFilter);
785 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
786 * filter to the minor mediatype of input pin of the renderer */
787 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
789 ERR("EnumMediaTypes (%x)\n", hr);
793 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
795 ERR("IEnumMediaTypes_Next (%x)\n", hr);
800 ERR("No media type found!\n");
803 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
804 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
806 /* Try to find a suitable filter that can connect to the pin to render */
807 tab[0] = mt->majortype;
808 tab[1] = mt->subtype;
809 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
811 ERR("Unable to enum filters (%x)\n", hr);
815 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
820 IPin* ppinfilter = NULL;
821 IBaseFilter* pfilter = NULL;
823 hr = GetFilterInfo(pMoniker, &clsid, &var);
824 IMoniker_Release(pMoniker);
826 ERR("Unable to retrieve filter info (%x)\n", hr);
830 if (IsEqualGUID(&clsid, &FilterCLSID)) {
831 /* Skip filter (same as the one the output pin belongs to) */
835 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
837 ERR("Unable to create filter (%x), trying next one\n", hr);
841 hr = IFilterGraph2_AddFilter(iface, pfilter, V_UNION(&var, bstrVal));
843 ERR("Unable to add filter (%x)\n", hr);
844 IBaseFilter_Release(pfilter);
849 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
851 ERR("Enumpins (%x)\n", hr);
855 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
856 IEnumPins_Release(penumpins);
859 ERR("Next (%x)\n", hr);
867 hr = IPin_Connect(ppinOut, ppinfilter, NULL);
869 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
872 TRACE("Successfully connected to filter, follow chain...\n");
874 /* Render all output pins of the filter by calling IFilterGraph2_Render on each of them */
875 hr = GetInternalConnections(pfilter, ppinfilter, &ppins, &nb);
880 IPin_Disconnect(ppinOut);
883 TRACE("pins to consider: %d\n", nb);
884 for(i = 0; i < nb; i++) {
885 TRACE("Processing pin %d\n", i);
886 hr = IFilterGraph2_Connect(iface, ppins[i], ppinIn);
888 TRACE("Cannot render pin %p (%x)\n", ppinfilter, hr);
890 IPin_Release(ppins[i]);
891 if (SUCCEEDED(hr)) break;
893 while (++i < nb) IPin_Release(ppins[i]);
894 CoTaskMemFree(ppins);
895 IPin_Release(ppinfilter);
896 IBaseFilter_Release(pfilter);
901 if (ppinfilter) IPin_Release(ppinfilter);
903 IFilterGraph2_RemoveFilter(iface, pfilter);
904 IBaseFilter_Release(pfilter);
908 IEnumMediaTypes_Release(penummt);
914 static HRESULT WINAPI FilterGraph2_Render(IFilterGraph2 *iface,
916 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
917 IEnumMediaTypes* penummt;
922 IEnumMoniker* pEnumMoniker;
927 TRACE("(%p/%p)->(%p)\n", This, iface, ppinOut);
929 if (TRACE_ON(quartz))
933 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
937 TRACE("Filter owning pin => %p\n", PinInfo.pFilter);
938 IBaseFilter_Release(PinInfo.pFilter);
941 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
943 ERR("EnumMediaTypes (%x)\n", hr);
949 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
951 ERR("IEnumMediaTypes_Next (%x)\n", hr);
956 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
957 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
959 /* Try to find a suitable renderer with the same media type */
960 tab[0] = mt->majortype;
962 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL);
964 ERR("Unable to enum filters (%x)\n", hr);
968 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
973 IBaseFilter* pfilter = NULL;
974 IEnumPins* penumpins;
977 hr = GetFilterInfo(pMoniker, &clsid, &var);
978 IMoniker_Release(pMoniker);
980 ERR("Unable to retrieve filter info (%x)\n", hr);
984 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
986 ERR("Unable to create filter (%x), trying next one\n", hr);
990 hr = IFilterGraph2_AddFilter(iface, pfilter, V_UNION(&var, bstrVal));
992 ERR("Unable to add filter (%x)\n", hr);
993 IBaseFilter_Release(pfilter);
998 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
1000 ERR("Splitter Enumpins (%x)\n", hr);
1003 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
1004 IEnumPins_Release(penumpins);
1006 ERR("Next (%x)\n", hr);
1014 /* Connect the pin to render to the renderer */
1015 hr = IFilterGraph2_Connect(iface, ppinOut, ppinfilter);
1017 TRACE("Unable to connect to renderer (%x)\n", hr);
1018 IPin_Release(ppinfilter);
1021 IPin_Release(ppinfilter);
1022 IBaseFilter_Release(pfilter);
1028 IFilterGraph2_RemoveFilter(iface, pfilter);
1029 IBaseFilter_Release(pfilter);
1033 DeleteMediaType(mt);
1037 IEnumMediaTypes_Release(penummt);
1042 static HRESULT WINAPI FilterGraph2_RenderFile(IFilterGraph2 *iface,
1043 LPCWSTR lpcwstrFile,
1044 LPCWSTR lpcwstrPlayList) {
1045 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1046 static const WCHAR string[] = {'R','e','a','d','e','r',0};
1047 IBaseFilter* preader = NULL;
1048 IBaseFilter* psplitter = NULL;
1049 IPin* ppinreader = NULL;
1050 IPin* ppinsplitter = NULL;
1051 IEnumPins* penumpins;
1054 IEnumMoniker* pEnumMoniker = NULL;
1056 IPin** ppins = NULL;
1059 IFileSourceFilter* pfile = NULL;
1063 TRACE("(%p/%p)->(%s, %s)\n", This, iface, debugstr_w(lpcwstrFile), debugstr_w(lpcwstrPlayList));
1065 if (lpcwstrPlayList != NULL)
1066 return E_INVALIDARG;
1068 hr = IFilterGraph2_AddSourceFilter(iface, lpcwstrFile, string, &preader);
1070 /* Retrieve file media type */
1072 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1073 if (SUCCEEDED(hr)) {
1074 hr = IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1075 IFileSourceFilter_Release(pfile);
1079 hr = IBaseFilter_EnumPins(preader, &penumpins);
1080 if (SUCCEEDED(hr)) {
1081 hr = IEnumPins_Next(penumpins, 1, &ppinreader, &pin);
1082 IEnumPins_Release(penumpins);
1085 if (SUCCEEDED(hr)) {
1086 tab[0] = mt.majortype;
1087 tab[1] = mt.subtype;
1088 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
1094 IPin_Release(ppinreader);
1096 IEnumMoniker_Release(pEnumMoniker);
1098 IFilterGraph2_RemoveFilter(iface, preader);
1099 IBaseFilter_Release(preader);
1104 hr = VFW_E_CANNOT_RENDER;
1105 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
1110 hr = GetFilterInfo(pMoniker, &clsid, &var);
1111 IMoniker_Release(pMoniker);
1113 ERR("Unable to retrieve filter info (%x)\n", hr);
1117 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&psplitter);
1119 ERR("Unable to create filter (%x), trying next one\n", hr);
1123 hr = IFilterGraph2_AddFilter(iface, psplitter, V_UNION(&var, bstrVal));
1125 ERR("Unable add filter (%x)\n", hr);
1126 IBaseFilter_Release(psplitter);
1130 /* Connect file source and splitter filters together */
1131 /* Make the splitter analyze incoming data */
1133 hr = IBaseFilter_EnumPins(psplitter, &penumpins);
1134 if (SUCCEEDED(hr)) {
1135 hr = IEnumPins_Next(penumpins, 1, &ppinsplitter, &pin);
1136 IEnumPins_Release(penumpins);
1140 hr = IPin_Connect(ppinreader, ppinsplitter, NULL);
1142 /* Make sure there's some output pins in the filter */
1144 hr = GetInternalConnections(psplitter, ppinsplitter, &ppins, &nb);
1145 if (SUCCEEDED(hr)) {
1147 IPin_Disconnect(ppinreader);
1148 TRACE("No output pins found in filter\n");
1149 hr = VFW_E_CANNOT_RENDER;
1154 IPin_Release(ppinsplitter);
1155 ppinsplitter = NULL;
1157 if (SUCCEEDED(hr)) {
1158 TRACE("Successfully connected to filter\n");
1162 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
1165 CoTaskMemFree(ppins);
1168 IFilterGraph2_RemoveFilter(iface, psplitter);
1169 IBaseFilter_Release(psplitter);
1173 /* Render all output pin of the splitter by calling IFilterGraph2_Render on each of them */
1174 if (SUCCEEDED(hr)) {
1177 TRACE("pins to consider: %d\n", nb);
1178 for(i = 0; i < nb; i++) {
1179 TRACE("Processing pin %d\n", i);
1180 hr = IFilterGraph2_Render(iface, ppins[i]);
1182 ERR("Cannot render pin %p (%x)\n", ppins[i], hr);
1185 IPin_Release(ppins[i]);
1187 CoTaskMemFree(ppins);
1189 hr = (partial ? VFW_S_PARTIAL_RENDER : S_OK);
1192 IPin_Release(ppinreader);
1193 IBaseFilter_Release(preader);
1195 IBaseFilter_Release(psplitter);
1200 static HRESULT WINAPI FilterGraph2_AddSourceFilter(IFilterGraph2 *iface,
1201 LPCWSTR lpcwstrFileName,
1202 LPCWSTR lpcwstrFilterName,
1203 IBaseFilter **ppFilter) {
1204 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1206 IBaseFilter* preader;
1207 IFileSourceFilter* pfile = NULL;
1211 TRACE("(%p/%p)->(%s, %s, %p)\n", This, iface, debugstr_w(lpcwstrFileName), debugstr_w(lpcwstrFilterName), ppFilter);
1213 /* Instantiate a file source filter */
1214 hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&preader);
1216 ERR("Unable to create file source filter (%x)\n", hr);
1220 hr = IFilterGraph2_AddFilter(iface, preader, lpcwstrFilterName);
1222 ERR("Unable add filter (%x)\n", hr);
1223 IBaseFilter_Release(preader);
1227 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1229 ERR("Unable to get IFileSourceInterface (%x)\n", hr);
1233 /* Load the file in the file source filter */
1234 hr = IFileSourceFilter_Load(pfile, lpcwstrFileName, NULL);
1236 ERR("Load (%x)\n", hr);
1240 IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1242 ERR("GetCurFile (%x)\n", hr);
1245 TRACE("File %s\n", debugstr_w(filename));
1246 TRACE("MajorType %s\n", debugstr_guid(&mt.majortype));
1247 TRACE("SubType %s\n", debugstr_guid(&mt.subtype));
1250 *ppFilter = preader;
1251 IFileSourceFilter_Release(pfile);
1257 IFileSourceFilter_Release(pfile);
1258 IFilterGraph2_RemoveFilter(iface, preader);
1259 IBaseFilter_Release(preader);
1264 static HRESULT WINAPI FilterGraph2_SetLogFile(IFilterGraph2 *iface,
1266 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1268 TRACE("(%p/%p)->(%08x): stub !!!\n", This, iface, (DWORD) hFile);
1273 static HRESULT WINAPI FilterGraph2_Abort(IFilterGraph2 *iface) {
1274 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1276 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1281 static HRESULT WINAPI FilterGraph2_ShouldOperationContinue(IFilterGraph2 *iface) {
1282 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1284 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1289 /*** IFilterGraph2 methods ***/
1290 static HRESULT WINAPI FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2 *iface,
1293 LPCWSTR lpcwstrFilterName,
1294 IBaseFilter **ppFilter) {
1295 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1297 TRACE("(%p/%p)->(%p %p %s %p): stub !!!\n", This, iface, pMoniker, pCtx, debugstr_w(lpcwstrFilterName), ppFilter);
1302 static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface,
1304 const AM_MEDIA_TYPE *pmt) {
1305 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1307 TRACE("(%p/%p)->(%p %p): stub !!!\n", This, iface, ppin, pmt);
1312 static HRESULT WINAPI FilterGraph2_RenderEx(IFilterGraph2 *iface,
1316 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1318 TRACE("(%p/%p)->(%p %08x %p): stub !!!\n", This, iface, pPinOut, dwFlags, pvContext);
1324 static const IFilterGraph2Vtbl IFilterGraph2_VTable =
1326 FilterGraph2_QueryInterface,
1327 FilterGraph2_AddRef,
1328 FilterGraph2_Release,
1329 FilterGraph2_AddFilter,
1330 FilterGraph2_RemoveFilter,
1331 FilterGraph2_EnumFilters,
1332 FilterGraph2_FindFilterByName,
1333 FilterGraph2_ConnectDirect,
1334 FilterGraph2_Reconnect,
1335 FilterGraph2_Disconnect,
1336 FilterGraph2_SetDefaultSyncSource,
1337 FilterGraph2_Connect,
1338 FilterGraph2_Render,
1339 FilterGraph2_RenderFile,
1340 FilterGraph2_AddSourceFilter,
1341 FilterGraph2_SetLogFile,
1343 FilterGraph2_ShouldOperationContinue,
1344 FilterGraph2_AddSourceFilterForMoniker,
1345 FilterGraph2_ReconnectEx,
1346 FilterGraph2_RenderEx
1349 /*** IUnknown methods ***/
1350 static HRESULT WINAPI MediaControl_QueryInterface(IMediaControl *iface,
1353 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1355 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1357 return Filtergraph_QueryInterface(This, riid, ppvObj);
1360 static ULONG WINAPI MediaControl_AddRef(IMediaControl *iface) {
1361 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1363 TRACE("(%p/%p)->()\n", This, iface);
1365 return Filtergraph_AddRef(This);
1368 static ULONG WINAPI MediaControl_Release(IMediaControl *iface) {
1369 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1371 TRACE("(%p/%p)->()\n", This, iface);
1373 return Filtergraph_Release(This);
1377 /*** IDispatch methods ***/
1378 static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface,
1380 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1382 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1387 static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface,
1390 ITypeInfo**ppTInfo) {
1391 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1393 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1398 static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface,
1404 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1406 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1411 static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface,
1412 DISPID dispIdMember,
1416 DISPPARAMS*pDispParams,
1418 EXCEPINFO*pExepInfo,
1420 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1422 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);
1427 typedef HRESULT(WINAPI *fnFoundFilter)(IBaseFilter *);
1429 static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundFilter FoundFilter)
1438 TRACE("%p %p\n", pGraph, pOutputPin);
1439 PinInfo.pFilter = NULL;
1441 hr = IPin_ConnectedTo(pOutputPin, &pInputPin);
1445 hr = IPin_QueryPinInfo(pInputPin, &PinInfo);
1447 hr = GetInternalConnections(PinInfo.pFilter, pInputPin, &ppPins, &nb);
1448 IPin_Release(pInputPin);
1455 TRACE("Reached a renderer\n");
1456 /* Count renderers for end of stream notification */
1457 pGraph->nRenderers++;
1461 for(i = 0; i < nb; i++)
1463 /* Explore the graph downstream from this pin
1464 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1465 * several input pins are connected to the same output (a MUX for instance). */
1466 ExploreGraph(pGraph, ppPins[i], FoundFilter);
1467 IPin_Release(ppPins[i]);
1470 CoTaskMemFree(ppPins);
1472 TRACE("Doing stuff with filter %p\n", PinInfo.pFilter);
1473 FoundFilter(PinInfo.pFilter);
1476 if (PinInfo.pFilter) IBaseFilter_Release(PinInfo.pFilter);
1480 static HRESULT WINAPI SendRun(IBaseFilter *pFilter) {
1482 IReferenceClock *clock = NULL;
1484 IBaseFilter_GetSyncSource(pFilter, &clock);
1487 IReferenceClock_GetTime(clock, &time);
1493 IReferenceClock_Release(clock);
1496 return IBaseFilter_Run(pFilter, time);
1499 static HRESULT WINAPI SendPause(IBaseFilter *pFilter) {
1500 return IBaseFilter_Pause(pFilter);
1503 static HRESULT WINAPI SendStop(IBaseFilter *pFilter) {
1504 return IBaseFilter_Stop(pFilter);
1507 static HRESULT SendFilterMessage(IMediaControl *iface, fnFoundFilter FoundFilter) {
1508 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1510 IBaseFilter* pfilter;
1516 TRACE("(%p/%p)->()\n", This, iface);
1518 /* Explorer the graph from source filters to renderers, determine renderers
1519 * number and run filters from renderers to source filters */
1520 This->nRenderers = 0;
1521 ResetEvent(This->hEventCompletion);
1523 for(i = 0; i < This->nFilters; i++)
1526 pfilter = This->ppFiltersInGraph[i];
1527 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
1530 ERR("Enum pins failed %x\n", hr);
1533 /* Check if it is a source filter */
1534 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1536 IPin_QueryDirection(pPin, &dir);
1538 if (dir == PINDIR_INPUT)
1546 TRACE("Found a source filter %p\n", pfilter);
1547 IEnumPins_Reset(pEnum);
1548 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1550 /* Explore the graph downstream from this pin */
1551 ExploreGraph(This, pPin, FoundFilter);
1554 FoundFilter(pfilter);
1556 IEnumPins_Release(pEnum);
1562 /*** IMediaControl methods ***/
1563 static HRESULT WINAPI MediaControl_Run(IMediaControl *iface) {
1564 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1565 TRACE("(%p/%p)->()\n", This, iface);
1567 if (This->state == State_Running) return S_OK;
1569 EnterCriticalSection(&This->cs);
1570 SendFilterMessage(iface, SendRun);
1571 This->state = State_Running;
1572 LeaveCriticalSection(&This->cs);
1576 static HRESULT WINAPI MediaControl_Pause(IMediaControl *iface) {
1577 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1578 TRACE("(%p/%p)->()\n", This, iface);
1580 if (This->state == State_Paused) return S_OK;
1582 EnterCriticalSection(&This->cs);
1583 SendFilterMessage(iface, SendPause);
1584 This->state = State_Paused;
1585 LeaveCriticalSection(&This->cs);
1589 static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface) {
1590 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1591 TRACE("(%p/%p)->()\n", This, iface);
1593 if (This->state == State_Stopped) return S_OK;
1595 EnterCriticalSection(&This->cs);
1596 if (This->state == State_Running) SendFilterMessage(iface, SendPause);
1597 SendFilterMessage(iface, SendStop);
1598 This->state = State_Stopped;
1599 LeaveCriticalSection(&This->cs);
1603 static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface,
1605 OAFilterState *pfs) {
1606 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1608 TRACE("(%p/%p)->(%d, %p): semi-stub !!!\n", This, iface, msTimeout, pfs);
1610 EnterCriticalSection(&This->cs);
1614 LeaveCriticalSection(&This->cs);
1619 static HRESULT WINAPI MediaControl_RenderFile(IMediaControl *iface,
1621 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1623 FIXME("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename);
1628 static HRESULT WINAPI MediaControl_AddSourceFilter(IMediaControl *iface,
1630 IDispatch **ppUnk) {
1631 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1633 FIXME("(%p/%p)->(%s (%p), %p): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename, ppUnk);
1638 static HRESULT WINAPI MediaControl_get_FilterCollection(IMediaControl *iface,
1639 IDispatch **ppUnk) {
1640 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1642 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1647 static HRESULT WINAPI MediaControl_get_RegFilterCollection(IMediaControl *iface,
1648 IDispatch **ppUnk) {
1649 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1651 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1656 static HRESULT WINAPI MediaControl_StopWhenReady(IMediaControl *iface) {
1657 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1659 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1665 static const IMediaControlVtbl IMediaControl_VTable =
1667 MediaControl_QueryInterface,
1668 MediaControl_AddRef,
1669 MediaControl_Release,
1670 MediaControl_GetTypeInfoCount,
1671 MediaControl_GetTypeInfo,
1672 MediaControl_GetIDsOfNames,
1673 MediaControl_Invoke,
1677 MediaControl_GetState,
1678 MediaControl_RenderFile,
1679 MediaControl_AddSourceFilter,
1680 MediaControl_get_FilterCollection,
1681 MediaControl_get_RegFilterCollection,
1682 MediaControl_StopWhenReady
1686 /*** IUnknown methods ***/
1687 static HRESULT WINAPI MediaSeeking_QueryInterface(IMediaSeeking *iface,
1690 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1692 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1694 return Filtergraph_QueryInterface(This, riid, ppvObj);
1697 static ULONG WINAPI MediaSeeking_AddRef(IMediaSeeking *iface) {
1698 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1700 TRACE("(%p/%p)->()\n", This, iface);
1702 return Filtergraph_AddRef(This);
1705 static ULONG WINAPI MediaSeeking_Release(IMediaSeeking *iface) {
1706 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1708 TRACE("(%p/%p)->()\n", This, iface);
1710 return Filtergraph_Release(This);
1713 typedef HRESULT WINAPI (*fnFoundSeek)(IFilterGraphImpl *This, IMediaSeeking*, DWORD_PTR arg);
1715 static HRESULT all_renderers_seek(IFilterGraphImpl *This, fnFoundSeek FoundSeek, DWORD_PTR arg) {
1716 BOOL allnotimpl = TRUE;
1718 IBaseFilter* pfilter;
1720 HRESULT hr, hr_return = S_OK;
1725 TRACE("(%p)->(%p %08lx)\n", This, FoundSeek, arg);
1726 /* Send a message to all renderers, they are responsible for broadcasting it further */
1728 for(i = 0; i < This->nFilters; i++)
1730 BOOL renderer = TRUE;
1731 pfilter = This->ppFiltersInGraph[i];
1732 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
1735 ERR("Enum pins failed %x\n", hr);
1738 /* Check if it is a source filter */
1739 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1741 IPin_QueryDirection(pPin, &dir);
1743 if (dir != PINDIR_INPUT)
1749 IEnumPins_Release(pEnum);
1752 IMediaSeeking *seek = NULL;
1753 IBaseFilter_QueryInterface(pfilter, &IID_IMediaSeeking, (void**)&seek);
1756 hr = FoundSeek(This, seek, arg);
1757 IMediaSeeking_Release(seek);
1758 if (hr_return != E_NOTIMPL)
1760 if (hr_return == S_OK || (FAILED(hr) && hr != E_NOTIMPL && !FAILED(hr_return)))
1770 static HRESULT WINAPI FoundCapabilities(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pcaps)
1775 hr = IMediaSeeking_GetCapabilities(seek, &caps);
1779 /* Only add common capabilities everything supports */
1780 *(DWORD*)pcaps &= caps;
1785 /*** IMediaSeeking methods ***/
1786 static HRESULT WINAPI MediaSeeking_GetCapabilities(IMediaSeeking *iface,
1787 DWORD *pCapabilities) {
1788 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1790 TRACE("(%p/%p)->(%p)\n", This, iface, pCapabilities);
1795 EnterCriticalSection(&This->cs);
1796 *pCapabilities = 0xffffffff;
1798 hr = all_renderers_seek(This, FoundCapabilities, (DWORD_PTR)pCapabilities);
1799 LeaveCriticalSection(&This->cs);
1804 static HRESULT WINAPI MediaSeeking_CheckCapabilities(IMediaSeeking *iface,
1805 DWORD *pCapabilities) {
1806 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1809 TRACE("(%p/%p)->(%p)\n", This, iface, pCapabilities);
1814 EnterCriticalSection(&This->cs);
1815 originalcaps = *pCapabilities;
1816 hr = all_renderers_seek(This, FoundCapabilities, (DWORD_PTR)pCapabilities);
1817 LeaveCriticalSection(&This->cs);
1822 if (!*pCapabilities)
1824 if (*pCapabilities != originalcaps)
1829 static HRESULT WINAPI MediaSeeking_IsFormatSupported(IMediaSeeking *iface,
1830 const GUID *pFormat) {
1831 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1836 TRACE("(%p/%p)->(%s)\n", This, iface, debugstr_guid(pFormat));
1838 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
1840 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat));
1847 static HRESULT WINAPI MediaSeeking_QueryPreferredFormat(IMediaSeeking *iface,
1849 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1854 FIXME("(%p/%p)->(%p): semi-stub !!!\n", This, iface, pFormat);
1855 memcpy(pFormat, &TIME_FORMAT_MEDIA_TIME, sizeof(GUID));
1860 static HRESULT WINAPI MediaSeeking_GetTimeFormat(IMediaSeeking *iface,
1862 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1867 TRACE("(%p/%p)->(%p)\n", This, iface, pFormat);
1868 memcpy(pFormat, &This->timeformatseek, sizeof(GUID));
1873 static HRESULT WINAPI MediaSeeking_IsUsingTimeFormat(IMediaSeeking *iface,
1874 const GUID *pFormat) {
1875 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1877 TRACE("(%p/%p)->(%p)\n", This, iface, pFormat);
1881 if (memcmp(pFormat, &This->timeformatseek, sizeof(GUID)))
1887 static HRESULT WINAPI MediaSeeking_SetTimeFormat(IMediaSeeking *iface,
1888 const GUID *pFormat) {
1889 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1894 TRACE("(%p/%p)->(%s)\n", This, iface, debugstr_guid(pFormat));
1896 if (This->state != State_Stopped)
1897 return VFW_E_WRONG_STATE;
1899 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
1901 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat));
1902 return E_INVALIDARG;
1908 static HRESULT WINAPI FoundDuration(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pduration)
1911 LONGLONG duration = 0, *pdur = (LONGLONG*)pduration;
1913 hr = IMediaSeeking_GetDuration(seek, &duration);
1917 /* FIXME: Minimum or maximum duration? */
1918 if (!*pdur < duration)
1924 static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface,
1925 LONGLONG *pDuration) {
1926 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1929 TRACE("(%p/%p)->(%p)\n", This, iface, pDuration);
1934 EnterCriticalSection(&This->cs);
1936 hr = all_renderers_seek(This, FoundDuration, (DWORD_PTR)pDuration);
1937 LeaveCriticalSection(&This->cs);
1942 static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface,
1944 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1946 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pStop);
1951 static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface,
1952 LONGLONG *pCurrent) {
1953 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1955 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pCurrent);
1960 static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface,
1962 const GUID *pTargetFormat,
1964 const GUID *pSourceFormat) {
1965 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1967 FIXME("(%p/%p)->(%p, %p, 0x%s, %p): stub !!!\n", This, iface, pTarget,
1968 pTargetFormat, wine_dbgstr_longlong(Source), pSourceFormat);
1973 static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface,
1975 DWORD dwCurrentFlags,
1977 DWORD dwStopFlags) {
1978 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1980 FIXME("(%p/%p)->(%p, %08x, %p, %08x): stub !!!\n", This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
1985 static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface,
1988 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1990 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pCurrent, pStop);
1995 static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface,
1996 LONGLONG *pEarliest,
1997 LONGLONG *pLatest) {
1998 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2000 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
2005 static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface,
2007 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2009 FIXME("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
2014 static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface,
2016 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2018 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
2023 static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface,
2024 LONGLONG *pllPreroll) {
2025 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
2027 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
2033 static const IMediaSeekingVtbl IMediaSeeking_VTable =
2035 MediaSeeking_QueryInterface,
2036 MediaSeeking_AddRef,
2037 MediaSeeking_Release,
2038 MediaSeeking_GetCapabilities,
2039 MediaSeeking_CheckCapabilities,
2040 MediaSeeking_IsFormatSupported,
2041 MediaSeeking_QueryPreferredFormat,
2042 MediaSeeking_GetTimeFormat,
2043 MediaSeeking_IsUsingTimeFormat,
2044 MediaSeeking_SetTimeFormat,
2045 MediaSeeking_GetDuration,
2046 MediaSeeking_GetStopPosition,
2047 MediaSeeking_GetCurrentPosition,
2048 MediaSeeking_ConvertTimeFormat,
2049 MediaSeeking_SetPositions,
2050 MediaSeeking_GetPositions,
2051 MediaSeeking_GetAvailable,
2052 MediaSeeking_SetRate,
2053 MediaSeeking_GetRate,
2054 MediaSeeking_GetPreroll
2057 /*** IUnknown methods ***/
2058 static HRESULT WINAPI MediaPosition_QueryInterface(IMediaPosition* iface, REFIID riid, void** ppvObj){
2059 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
2061 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2063 return Filtergraph_QueryInterface(This, riid, ppvObj);
2066 static ULONG WINAPI MediaPosition_AddRef(IMediaPosition *iface){
2067 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
2069 TRACE("(%p/%p)->()\n", This, iface);
2071 return Filtergraph_AddRef(This);
2074 static ULONG WINAPI MediaPosition_Release(IMediaPosition *iface){
2075 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
2077 TRACE("(%p/%p)->()\n", This, iface);
2079 return Filtergraph_Release(This);
2082 /*** IDispatch methods ***/
2083 static HRESULT WINAPI MediaPosition_GetTypeInfoCount(IMediaPosition *iface, UINT* pctinfo){
2084 FIXME("(%p) stub!\n", iface);
2088 static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo){
2089 FIXME("(%p) stub!\n", iface);
2093 static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition* iface, REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId){
2094 FIXME("(%p) stub!\n", iface);
2098 static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition* iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr){
2099 FIXME("(%p) stub!\n", iface);
2103 /*** IMediaPosition methods ***/
2104 static HRESULT WINAPI MediaPosition_get_Duration(IMediaPosition * iface, REFTIME *plength){
2105 FIXME("(%p)->(%p) stub!\n", iface, plength);
2109 static HRESULT WINAPI MediaPosition_put_CurrentPosition(IMediaPosition * iface, REFTIME llTime){
2110 FIXME("(%p)->(%f) stub!\n", iface, llTime);
2114 static HRESULT WINAPI MediaPosition_get_CurrentPosition(IMediaPosition * iface, REFTIME *pllTime){
2115 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
2119 static HRESULT WINAPI MediaPosition_get_StopTime(IMediaPosition * iface, REFTIME *pllTime){
2120 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
2124 static HRESULT WINAPI MediaPosition_put_StopTime(IMediaPosition * iface, REFTIME llTime){
2125 FIXME("(%p)->(%f) stub!\n", iface, llTime);
2129 static HRESULT WINAPI MediaPosition_get_PrerollTime(IMediaPosition * iface, REFTIME *pllTime){
2130 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
2134 static HRESULT WINAPI MediaPosition_put_PrerollTime(IMediaPosition * iface, REFTIME llTime){
2135 FIXME("(%p)->(%f) stub!\n", iface, llTime);
2139 static HRESULT WINAPI MediaPosition_put_Rate(IMediaPosition * iface, double dRate){
2140 FIXME("(%p)->(%f) stub!\n", iface, dRate);
2144 static HRESULT WINAPI MediaPosition_get_Rate(IMediaPosition * iface, double *pdRate){
2145 FIXME("(%p)->(%p) stub!\n", iface, pdRate);
2149 static HRESULT WINAPI MediaPosition_CanSeekForward(IMediaPosition * iface, LONG *pCanSeekForward){
2150 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekForward);
2154 static HRESULT WINAPI MediaPosition_CanSeekBackward(IMediaPosition * iface, LONG *pCanSeekBackward){
2155 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekBackward);
2160 static const IMediaPositionVtbl IMediaPosition_VTable =
2162 MediaPosition_QueryInterface,
2163 MediaPosition_AddRef,
2164 MediaPosition_Release,
2165 MediaPosition_GetTypeInfoCount,
2166 MediaPosition_GetTypeInfo,
2167 MediaPosition_GetIDsOfNames,
2168 MediaPosition_Invoke,
2169 MediaPosition_get_Duration,
2170 MediaPosition_put_CurrentPosition,
2171 MediaPosition_get_CurrentPosition,
2172 MediaPosition_get_StopTime,
2173 MediaPosition_put_StopTime,
2174 MediaPosition_get_PrerollTime,
2175 MediaPosition_put_PrerollTime,
2176 MediaPosition_put_Rate,
2177 MediaPosition_get_Rate,
2178 MediaPosition_CanSeekForward,
2179 MediaPosition_CanSeekBackward
2182 static HRESULT GetTargetInterface(IFilterGraphImpl* pGraph, REFIID riid, LPVOID* ppvObj)
2184 HRESULT hr = E_NOINTERFACE;
2188 /* Check if the interface type is already registered */
2189 for (entry = 0; entry < pGraph->nItfCacheEntries; entry++)
2190 if (riid == pGraph->ItfCacheEntries[entry].riid)
2192 if (pGraph->ItfCacheEntries[entry].iface)
2194 /* Return the interface if available */
2195 *ppvObj = pGraph->ItfCacheEntries[entry].iface;
2201 if (entry >= MAX_ITF_CACHE_ENTRIES)
2203 FIXME("Not enough space to store interface in the cache\n");
2204 return E_OUTOFMEMORY;
2207 /* Find a filter supporting the requested interface */
2208 for (i = 0; i < pGraph->nFilters; i++)
2210 hr = IBaseFilter_QueryInterface(pGraph->ppFiltersInGraph[i], riid, ppvObj);
2213 pGraph->ItfCacheEntries[entry].riid = riid;
2214 pGraph->ItfCacheEntries[entry].filter = pGraph->ppFiltersInGraph[i];
2215 pGraph->ItfCacheEntries[entry].iface = (IUnknown*)*ppvObj;
2216 if (entry >= pGraph->nItfCacheEntries)
2217 pGraph->nItfCacheEntries++;
2220 if (hr != E_NOINTERFACE)
2227 /*** IUnknown methods ***/
2228 static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface,
2231 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2233 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2235 return Filtergraph_QueryInterface(This, riid, ppvObj);
2238 static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface) {
2239 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2241 TRACE("(%p/%p)->()\n", This, iface);
2243 return Filtergraph_AddRef(This);
2246 static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface) {
2247 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2249 TRACE("(%p/%p)->()\n", This, iface);
2251 return Filtergraph_Release(This);
2254 /*** IDispatch methods ***/
2255 static HRESULT WINAPI BasicAudio_GetTypeInfoCount(IBasicAudio *iface,
2257 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2258 IBasicAudio* pBasicAudio;
2261 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2263 EnterCriticalSection(&This->cs);
2265 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2268 hr = IBasicAudio_GetTypeInfoCount(pBasicAudio, pctinfo);
2270 LeaveCriticalSection(&This->cs);
2275 static HRESULT WINAPI BasicAudio_GetTypeInfo(IBasicAudio *iface,
2278 ITypeInfo**ppTInfo) {
2279 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2280 IBasicAudio* pBasicAudio;
2283 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2285 EnterCriticalSection(&This->cs);
2287 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2290 hr = IBasicAudio_GetTypeInfo(pBasicAudio, iTInfo, lcid, ppTInfo);
2292 LeaveCriticalSection(&This->cs);
2297 static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface,
2303 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2304 IBasicAudio* pBasicAudio;
2307 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2309 EnterCriticalSection(&This->cs);
2311 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2314 hr = IBasicAudio_GetIDsOfNames(pBasicAudio, riid, rgszNames, cNames, lcid, rgDispId);
2316 LeaveCriticalSection(&This->cs);
2321 static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface,
2322 DISPID dispIdMember,
2326 DISPPARAMS*pDispParams,
2328 EXCEPINFO*pExepInfo,
2330 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2331 IBasicAudio* pBasicAudio;
2334 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);
2336 EnterCriticalSection(&This->cs);
2338 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2341 hr = IBasicAudio_Invoke(pBasicAudio, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2343 LeaveCriticalSection(&This->cs);
2348 /*** IBasicAudio methods ***/
2349 static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface,
2351 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2352 IBasicAudio* pBasicAudio;
2355 TRACE("(%p/%p)->(%ld)\n", This, iface, lVolume);
2357 EnterCriticalSection(&This->cs);
2359 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2362 hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
2364 LeaveCriticalSection(&This->cs);
2369 static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface,
2371 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2372 IBasicAudio* pBasicAudio;
2375 TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
2377 EnterCriticalSection(&This->cs);
2379 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2382 hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
2384 LeaveCriticalSection(&This->cs);
2389 static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface,
2391 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2392 IBasicAudio* pBasicAudio;
2395 TRACE("(%p/%p)->(%ld)\n", This, iface, lBalance);
2397 EnterCriticalSection(&This->cs);
2399 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2402 hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
2404 LeaveCriticalSection(&This->cs);
2409 static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface,
2411 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2412 IBasicAudio* pBasicAudio;
2415 TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
2417 EnterCriticalSection(&This->cs);
2419 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2422 hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
2424 LeaveCriticalSection(&This->cs);
2429 static const IBasicAudioVtbl IBasicAudio_VTable =
2431 BasicAudio_QueryInterface,
2434 BasicAudio_GetTypeInfoCount,
2435 BasicAudio_GetTypeInfo,
2436 BasicAudio_GetIDsOfNames,
2438 BasicAudio_put_Volume,
2439 BasicAudio_get_Volume,
2440 BasicAudio_put_Balance,
2441 BasicAudio_get_Balance
2444 /*** IUnknown methods ***/
2445 static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo *iface,
2448 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2450 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2452 return Filtergraph_QueryInterface(This, riid, ppvObj);
2455 static ULONG WINAPI BasicVideo_AddRef(IBasicVideo *iface) {
2456 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2458 TRACE("(%p/%p)->()\n", This, iface);
2460 return Filtergraph_AddRef(This);
2463 static ULONG WINAPI BasicVideo_Release(IBasicVideo *iface) {
2464 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2466 TRACE("(%p/%p)->()\n", This, iface);
2468 return Filtergraph_Release(This);
2471 /*** IDispatch methods ***/
2472 static HRESULT WINAPI BasicVideo_GetTypeInfoCount(IBasicVideo *iface,
2474 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2475 IBasicVideo* pBasicVideo;
2478 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2480 EnterCriticalSection(&This->cs);
2482 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2485 hr = IBasicVideo_GetTypeInfoCount(pBasicVideo, pctinfo);
2487 LeaveCriticalSection(&This->cs);
2492 static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo *iface,
2495 ITypeInfo**ppTInfo) {
2496 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2497 IBasicVideo* pBasicVideo;
2500 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2502 EnterCriticalSection(&This->cs);
2504 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2507 hr = IBasicVideo_GetTypeInfo(pBasicVideo, iTInfo, lcid, ppTInfo);
2509 LeaveCriticalSection(&This->cs);
2514 static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo *iface,
2520 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2521 IBasicVideo* pBasicVideo;
2524 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2526 EnterCriticalSection(&This->cs);
2528 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2531 hr = IBasicVideo_GetIDsOfNames(pBasicVideo, riid, rgszNames, cNames, lcid, rgDispId);
2533 LeaveCriticalSection(&This->cs);
2538 static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo *iface,
2539 DISPID dispIdMember,
2543 DISPPARAMS*pDispParams,
2545 EXCEPINFO*pExepInfo,
2547 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2548 IBasicVideo* pBasicVideo;
2551 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);
2553 EnterCriticalSection(&This->cs);
2555 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2558 hr = IBasicVideo_Invoke(pBasicVideo, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2560 LeaveCriticalSection(&This->cs);
2565 /*** IBasicVideo methods ***/
2566 static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo *iface,
2567 REFTIME *pAvgTimePerFrame) {
2568 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2569 IBasicVideo* pBasicVideo;
2572 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
2574 EnterCriticalSection(&This->cs);
2576 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2579 hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
2581 LeaveCriticalSection(&This->cs);
2586 static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo *iface,
2588 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2589 IBasicVideo* pBasicVideo;
2592 TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
2594 EnterCriticalSection(&This->cs);
2596 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2599 hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
2601 LeaveCriticalSection(&This->cs);
2606 static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo *iface,
2607 long *pBitErrorRate) {
2608 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2609 IBasicVideo* pBasicVideo;
2612 TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
2614 EnterCriticalSection(&This->cs);
2616 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2619 hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
2621 LeaveCriticalSection(&This->cs);
2626 static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo *iface,
2627 long *pVideoWidth) {
2628 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2629 IBasicVideo* pBasicVideo;
2632 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
2634 EnterCriticalSection(&This->cs);
2636 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2639 hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
2641 LeaveCriticalSection(&This->cs);
2646 static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo *iface,
2647 long *pVideoHeight) {
2648 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2649 IBasicVideo* pBasicVideo;
2652 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
2654 EnterCriticalSection(&This->cs);
2656 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2659 hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
2661 LeaveCriticalSection(&This->cs);
2666 static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo *iface,
2668 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2669 IBasicVideo* pBasicVideo;
2672 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
2674 EnterCriticalSection(&This->cs);
2676 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2679 hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
2681 LeaveCriticalSection(&This->cs);
2686 static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo *iface,
2687 long *pSourceLeft) {
2688 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2689 IBasicVideo* pBasicVideo;
2692 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
2694 EnterCriticalSection(&This->cs);
2696 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2699 hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
2701 LeaveCriticalSection(&This->cs);
2706 static HRESULT WINAPI BasicVideo_put_SourceWidth(IBasicVideo *iface,
2708 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2709 IBasicVideo* pBasicVideo;
2712 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
2714 EnterCriticalSection(&This->cs);
2716 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2719 hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
2721 LeaveCriticalSection(&This->cs);
2726 static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo *iface,
2727 long *pSourceWidth) {
2728 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2729 IBasicVideo* pBasicVideo;
2732 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
2734 EnterCriticalSection(&This->cs);
2736 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2739 hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
2741 LeaveCriticalSection(&This->cs);
2746 static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo *iface,
2748 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2749 IBasicVideo* pBasicVideo;
2752 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
2754 EnterCriticalSection(&This->cs);
2756 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2759 hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
2761 LeaveCriticalSection(&This->cs);
2766 static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo *iface,
2768 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2769 IBasicVideo* pBasicVideo;
2772 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
2774 EnterCriticalSection(&This->cs);
2776 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2779 hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
2781 LeaveCriticalSection(&This->cs);
2786 static HRESULT WINAPI BasicVideo_put_SourceHeight(IBasicVideo *iface,
2787 long SourceHeight) {
2788 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2789 IBasicVideo* pBasicVideo;
2792 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
2794 EnterCriticalSection(&This->cs);
2796 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2799 hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
2801 LeaveCriticalSection(&This->cs);
2806 static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo *iface,
2807 long *pSourceHeight) {
2808 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2809 IBasicVideo* pBasicVideo;
2812 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
2814 EnterCriticalSection(&This->cs);
2816 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2819 hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
2821 LeaveCriticalSection(&This->cs);
2826 static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo *iface,
2827 long DestinationLeft) {
2828 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2829 IBasicVideo* pBasicVideo;
2832 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
2834 EnterCriticalSection(&This->cs);
2836 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2839 hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
2841 LeaveCriticalSection(&This->cs);
2846 static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo *iface,
2847 long *pDestinationLeft) {
2848 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2849 IBasicVideo* pBasicVideo;
2852 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
2854 EnterCriticalSection(&This->cs);
2856 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2859 hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
2861 LeaveCriticalSection(&This->cs);
2866 static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo *iface,
2867 long DestinationWidth) {
2868 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2869 IBasicVideo* pBasicVideo;
2872 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
2874 EnterCriticalSection(&This->cs);
2876 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2879 hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
2881 LeaveCriticalSection(&This->cs);
2886 static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo *iface,
2887 long *pDestinationWidth) {
2888 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2889 IBasicVideo* pBasicVideo;
2892 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
2894 EnterCriticalSection(&This->cs);
2896 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2899 hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
2901 LeaveCriticalSection(&This->cs);
2906 static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo *iface,
2907 long DestinationTop) {
2908 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2909 IBasicVideo* pBasicVideo;
2912 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
2914 EnterCriticalSection(&This->cs);
2916 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2919 hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
2921 LeaveCriticalSection(&This->cs);
2926 static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo *iface,
2927 long *pDestinationTop) {
2928 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2929 IBasicVideo* pBasicVideo;
2932 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
2934 EnterCriticalSection(&This->cs);
2936 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2939 hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
2941 LeaveCriticalSection(&This->cs);
2946 static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo *iface,
2947 long DestinationHeight) {
2948 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2949 IBasicVideo* pBasicVideo;
2952 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
2954 EnterCriticalSection(&This->cs);
2956 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2959 hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
2961 LeaveCriticalSection(&This->cs);
2966 static HRESULT WINAPI BasicVideo_get_DestinationHeight(IBasicVideo *iface,
2967 long *pDestinationHeight) {
2968 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2969 IBasicVideo* pBasicVideo;
2972 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
2974 EnterCriticalSection(&This->cs);
2976 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2979 hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
2981 LeaveCriticalSection(&This->cs);
2986 static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo *iface,
2991 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2992 IBasicVideo* pBasicVideo;
2995 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2997 EnterCriticalSection(&This->cs);
2999 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3002 hr = IBasicVideo_SetSourcePosition(pBasicVideo, Left, Top, Width, Height);
3004 LeaveCriticalSection(&This->cs);
3009 static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo *iface,
3014 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3015 IBasicVideo* pBasicVideo;
3018 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3020 EnterCriticalSection(&This->cs);
3022 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3025 hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
3027 LeaveCriticalSection(&This->cs);
3032 static HRESULT WINAPI BasicVideo_SetDefaultSourcePosition(IBasicVideo *iface) {
3033 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3034 IBasicVideo* pBasicVideo;
3037 TRACE("(%p/%p)->()\n", This, iface);
3039 EnterCriticalSection(&This->cs);
3041 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3044 hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
3046 LeaveCriticalSection(&This->cs);
3051 static HRESULT WINAPI BasicVideo_SetDestinationPosition(IBasicVideo *iface,
3056 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3057 IBasicVideo* pBasicVideo;
3060 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
3062 EnterCriticalSection(&This->cs);
3064 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3067 hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left, Top, Width, Height);
3069 LeaveCriticalSection(&This->cs);
3074 static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo *iface,
3079 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3080 IBasicVideo* pBasicVideo;
3083 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3085 EnterCriticalSection(&This->cs);
3087 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3090 hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
3092 LeaveCriticalSection(&This->cs);
3097 static HRESULT WINAPI BasicVideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
3098 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3099 IBasicVideo* pBasicVideo;
3102 TRACE("(%p/%p)->()\n", This, iface);
3104 EnterCriticalSection(&This->cs);
3106 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3109 hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
3111 LeaveCriticalSection(&This->cs);
3116 static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo *iface,
3119 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3120 IBasicVideo* pBasicVideo;
3123 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3125 EnterCriticalSection(&This->cs);
3127 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3130 hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
3132 LeaveCriticalSection(&This->cs);
3137 static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo *iface,
3142 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3143 IBasicVideo* pBasicVideo;
3146 TRACE("(%p/%p)->(%ld, %ld, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
3148 EnterCriticalSection(&This->cs);
3150 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3153 hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex, Entries, pRetrieved, pPalette);
3155 LeaveCriticalSection(&This->cs);
3160 static HRESULT WINAPI BasicVideo_GetCurrentImage(IBasicVideo *iface,
3163 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3164 IBasicVideo* pBasicVideo;
3167 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pBufferSize, pDIBImage);
3169 EnterCriticalSection(&This->cs);
3171 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3174 hr = IBasicVideo_GetCurrentImage(pBasicVideo, pBufferSize, pDIBImage);
3176 LeaveCriticalSection(&This->cs);
3181 static HRESULT WINAPI BasicVideo_IsUsingDefaultSource(IBasicVideo *iface) {
3182 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3183 IBasicVideo* pBasicVideo;
3186 TRACE("(%p/%p)->()\n", This, iface);
3188 EnterCriticalSection(&This->cs);
3190 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3193 hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
3195 LeaveCriticalSection(&This->cs);
3200 static HRESULT WINAPI BasicVideo_IsUsingDefaultDestination(IBasicVideo *iface) {
3201 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3202 IBasicVideo* pBasicVideo;
3205 TRACE("(%p/%p)->()\n", This, iface);
3207 EnterCriticalSection(&This->cs);
3209 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3212 hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
3214 LeaveCriticalSection(&This->cs);
3220 static const IBasicVideoVtbl IBasicVideo_VTable =
3222 BasicVideo_QueryInterface,
3225 BasicVideo_GetTypeInfoCount,
3226 BasicVideo_GetTypeInfo,
3227 BasicVideo_GetIDsOfNames,
3229 BasicVideo_get_AvgTimePerFrame,
3230 BasicVideo_get_BitRate,
3231 BasicVideo_get_BitErrorRate,
3232 BasicVideo_get_VideoWidth,
3233 BasicVideo_get_VideoHeight,
3234 BasicVideo_put_SourceLeft,
3235 BasicVideo_get_SourceLeft,
3236 BasicVideo_put_SourceWidth,
3237 BasicVideo_get_SourceWidth,
3238 BasicVideo_put_SourceTop,
3239 BasicVideo_get_SourceTop,
3240 BasicVideo_put_SourceHeight,
3241 BasicVideo_get_SourceHeight,
3242 BasicVideo_put_DestinationLeft,
3243 BasicVideo_get_DestinationLeft,
3244 BasicVideo_put_DestinationWidth,
3245 BasicVideo_get_DestinationWidth,
3246 BasicVideo_put_DestinationTop,
3247 BasicVideo_get_DestinationTop,
3248 BasicVideo_put_DestinationHeight,
3249 BasicVideo_get_DestinationHeight,
3250 BasicVideo_SetSourcePosition,
3251 BasicVideo_GetSourcePosition,
3252 BasicVideo_SetDefaultSourcePosition,
3253 BasicVideo_SetDestinationPosition,
3254 BasicVideo_GetDestinationPosition,
3255 BasicVideo_SetDefaultDestinationPosition,
3256 BasicVideo_GetVideoSize,
3257 BasicVideo_GetVideoPaletteEntries,
3258 BasicVideo_GetCurrentImage,
3259 BasicVideo_IsUsingDefaultSource,
3260 BasicVideo_IsUsingDefaultDestination
3264 /*** IUnknown methods ***/
3265 static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface,
3268 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3270 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
3272 return Filtergraph_QueryInterface(This, riid, ppvObj);
3275 static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface) {
3276 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3278 TRACE("(%p/%p)->()\n", This, iface);
3280 return Filtergraph_AddRef(This);
3283 static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface) {
3284 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3286 TRACE("(%p/%p)->()\n", This, iface);
3288 return Filtergraph_Release(This);
3291 /*** IDispatch methods ***/
3292 static HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface,
3294 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3295 IVideoWindow* pVideoWindow;
3298 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
3300 EnterCriticalSection(&This->cs);
3302 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3305 hr = IVideoWindow_GetTypeInfoCount(pVideoWindow, pctinfo);
3307 LeaveCriticalSection(&This->cs);
3312 static HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface,
3315 ITypeInfo**ppTInfo) {
3316 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3317 IVideoWindow* pVideoWindow;
3320 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
3322 EnterCriticalSection(&This->cs);
3324 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3327 hr = IVideoWindow_GetTypeInfo(pVideoWindow, iTInfo, lcid, ppTInfo);
3329 LeaveCriticalSection(&This->cs);
3334 static HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface,
3340 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3341 IVideoWindow* pVideoWindow;
3344 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
3346 EnterCriticalSection(&This->cs);
3348 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3351 hr = IVideoWindow_GetIDsOfNames(pVideoWindow, riid, rgszNames, cNames, lcid, rgDispId);
3353 LeaveCriticalSection(&This->cs);
3358 static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface,
3359 DISPID dispIdMember,
3363 DISPPARAMS*pDispParams,
3365 EXCEPINFO*pExepInfo,
3367 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3368 IVideoWindow* pVideoWindow;
3371 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);
3373 EnterCriticalSection(&This->cs);
3375 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3378 hr = IVideoWindow_Invoke(pVideoWindow, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
3380 LeaveCriticalSection(&This->cs);
3386 /*** IVideoWindow methods ***/
3387 static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface,
3389 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3390 IVideoWindow* pVideoWindow;
3393 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
3395 EnterCriticalSection(&This->cs);
3397 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3400 hr = IVideoWindow_put_Caption(pVideoWindow, strCaption);
3402 LeaveCriticalSection(&This->cs);
3407 static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface,
3409 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3410 IVideoWindow* pVideoWindow;
3413 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
3415 EnterCriticalSection(&This->cs);
3417 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3420 hr = IVideoWindow_get_Caption(pVideoWindow, strCaption);
3422 LeaveCriticalSection(&This->cs);
3427 static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface,
3429 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3430 IVideoWindow* pVideoWindow;
3433 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyle);
3435 EnterCriticalSection(&This->cs);
3437 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3440 hr = IVideoWindow_put_WindowStyle(pVideoWindow, WindowStyle);
3442 LeaveCriticalSection(&This->cs);
3447 static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface,
3448 long *WindowStyle) {
3449 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3450 IVideoWindow* pVideoWindow;
3453 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
3455 EnterCriticalSection(&This->cs);
3457 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3460 hr = IVideoWindow_get_WindowStyle(pVideoWindow, WindowStyle);
3462 LeaveCriticalSection(&This->cs);
3467 static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface,
3468 long WindowStyleEx) {
3469 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3470 IVideoWindow* pVideoWindow;
3473 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
3475 EnterCriticalSection(&This->cs);
3477 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3480 hr = IVideoWindow_put_WindowStyleEx(pVideoWindow, WindowStyleEx);
3482 LeaveCriticalSection(&This->cs);
3487 static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface,
3488 long *WindowStyleEx) {
3489 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3490 IVideoWindow* pVideoWindow;
3493 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
3495 EnterCriticalSection(&This->cs);
3497 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3500 hr = IVideoWindow_get_WindowStyleEx(pVideoWindow, WindowStyleEx);
3502 LeaveCriticalSection(&This->cs);
3507 static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface,
3509 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3510 IVideoWindow* pVideoWindow;
3513 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
3515 EnterCriticalSection(&This->cs);
3517 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3520 hr = IVideoWindow_put_AutoShow(pVideoWindow, AutoShow);
3522 LeaveCriticalSection(&This->cs);
3527 static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface,
3529 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3530 IVideoWindow* pVideoWindow;
3533 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
3535 EnterCriticalSection(&This->cs);
3537 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3540 hr = IVideoWindow_get_AutoShow(pVideoWindow, AutoShow);
3542 LeaveCriticalSection(&This->cs);
3547 static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface,
3549 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3550 IVideoWindow* pVideoWindow;
3553 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowState);
3555 EnterCriticalSection(&This->cs);
3557 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3560 hr = IVideoWindow_put_WindowState(pVideoWindow, WindowState);
3562 LeaveCriticalSection(&This->cs);
3567 static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface,
3568 long *WindowState) {
3569 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3570 IVideoWindow* pVideoWindow;
3573 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
3575 EnterCriticalSection(&This->cs);
3577 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3580 hr = IVideoWindow_get_WindowState(pVideoWindow, WindowState);
3582 LeaveCriticalSection(&This->cs);
3587 static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface,
3588 long BackgroundPalette) {
3589 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3590 IVideoWindow* pVideoWindow;
3593 TRACE("(%p/%p)->(%ld)\n", This, iface, BackgroundPalette);
3595 EnterCriticalSection(&This->cs);
3597 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3600 hr = IVideoWindow_put_BackgroundPalette(pVideoWindow, BackgroundPalette);
3602 LeaveCriticalSection(&This->cs);
3607 static HRESULT WINAPI VideoWindow_get_BackgroundPalette(IVideoWindow *iface,
3608 long *pBackgroundPalette) {
3609 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3610 IVideoWindow* pVideoWindow;
3613 TRACE("(%p/%p)->(%p)\n", This, iface, pBackgroundPalette);
3615 EnterCriticalSection(&This->cs);
3617 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3620 hr = IVideoWindow_get_BackgroundPalette(pVideoWindow, pBackgroundPalette);
3622 LeaveCriticalSection(&This->cs);
3627 static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface,
3629 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3630 IVideoWindow* pVideoWindow;
3633 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
3635 EnterCriticalSection(&This->cs);
3637 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3640 hr = IVideoWindow_put_Visible(pVideoWindow, Visible);
3642 LeaveCriticalSection(&This->cs);
3647 static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface,
3649 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3650 IVideoWindow* pVideoWindow;
3653 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
3655 EnterCriticalSection(&This->cs);
3657 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3660 hr = IVideoWindow_get_Visible(pVideoWindow, pVisible);
3662 LeaveCriticalSection(&This->cs);
3667 static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface,
3669 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3670 IVideoWindow* pVideoWindow;
3673 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
3675 EnterCriticalSection(&This->cs);
3677 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3680 hr = IVideoWindow_put_Left(pVideoWindow, Left);
3682 LeaveCriticalSection(&This->cs);
3687 static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface,
3689 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3690 IVideoWindow* pVideoWindow;
3693 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
3695 EnterCriticalSection(&This->cs);
3697 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3700 hr = IVideoWindow_get_Left(pVideoWindow, pLeft);
3702 LeaveCriticalSection(&This->cs);
3707 static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface,
3709 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3710 IVideoWindow* pVideoWindow;
3713 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
3715 EnterCriticalSection(&This->cs);
3717 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3720 hr = IVideoWindow_put_Width(pVideoWindow, Width);
3722 LeaveCriticalSection(&This->cs);
3727 static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface,
3729 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3730 IVideoWindow* pVideoWindow;
3733 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
3735 EnterCriticalSection(&This->cs);
3737 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3740 hr = IVideoWindow_get_Width(pVideoWindow, pWidth);
3742 LeaveCriticalSection(&This->cs);
3747 static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface,
3749 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3750 IVideoWindow* pVideoWindow;
3753 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
3755 EnterCriticalSection(&This->cs);
3757 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3760 hr = IVideoWindow_put_Top(pVideoWindow, Top);
3762 LeaveCriticalSection(&This->cs);
3767 static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface,
3769 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3770 IVideoWindow* pVideoWindow;
3773 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
3775 EnterCriticalSection(&This->cs);
3777 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3780 hr = IVideoWindow_get_Top(pVideoWindow, pTop);
3782 LeaveCriticalSection(&This->cs);
3787 static HRESULT WINAPI VideoWindow_put_Height(IVideoWindow *iface,
3789 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3790 IVideoWindow* pVideoWindow;
3793 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
3795 EnterCriticalSection(&This->cs);
3797 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3800 hr = IVideoWindow_put_Height(pVideoWindow, Height);
3802 LeaveCriticalSection(&This->cs);
3807 static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface,
3809 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3810 IVideoWindow* pVideoWindow;
3813 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
3815 EnterCriticalSection(&This->cs);
3817 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3820 hr = IVideoWindow_get_Height(pVideoWindow, pHeight);
3822 LeaveCriticalSection(&This->cs);
3827 static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface,
3829 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3830 IVideoWindow* pVideoWindow;
3833 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
3835 EnterCriticalSection(&This->cs);
3837 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3840 hr = IVideoWindow_put_Owner(pVideoWindow, Owner);
3842 LeaveCriticalSection(&This->cs);
3847 static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface,
3849 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3850 IVideoWindow* pVideoWindow;
3853 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
3855 EnterCriticalSection(&This->cs);
3857 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3860 hr = IVideoWindow_get_Owner(pVideoWindow, Owner);
3862 LeaveCriticalSection(&This->cs);
3867 static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface,
3869 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3870 IVideoWindow* pVideoWindow;
3873 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
3875 EnterCriticalSection(&This->cs);
3877 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3880 hr = IVideoWindow_put_MessageDrain(pVideoWindow, Drain);
3882 LeaveCriticalSection(&This->cs);
3887 static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface,
3889 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3890 IVideoWindow* pVideoWindow;
3893 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
3895 EnterCriticalSection(&This->cs);
3897 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3900 hr = IVideoWindow_get_MessageDrain(pVideoWindow, Drain);
3902 LeaveCriticalSection(&This->cs);
3907 static HRESULT WINAPI VideoWindow_get_BorderColor(IVideoWindow *iface,
3909 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3910 IVideoWindow* pVideoWindow;
3913 TRACE("(%p/%p)->(%p)\n", This, iface, Color);
3915 EnterCriticalSection(&This->cs);
3917 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3920 hr = IVideoWindow_get_BorderColor(pVideoWindow, Color);
3922 LeaveCriticalSection(&This->cs);
3927 static HRESULT WINAPI VideoWindow_put_BorderColor(IVideoWindow *iface,
3929 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3930 IVideoWindow* pVideoWindow;
3933 TRACE("(%p/%p)->(%ld)\n", This, iface, Color);
3935 EnterCriticalSection(&This->cs);
3937 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3940 hr = IVideoWindow_put_BorderColor(pVideoWindow, Color);
3942 LeaveCriticalSection(&This->cs);
3947 static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
3948 long *FullScreenMode) {
3949 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3950 IVideoWindow* pVideoWindow;
3953 TRACE("(%p/%p)->(%p)\n", This, iface, FullScreenMode);
3955 EnterCriticalSection(&This->cs);
3957 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3960 hr = IVideoWindow_get_FullScreenMode(pVideoWindow, FullScreenMode);
3962 LeaveCriticalSection(&This->cs);
3967 static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface,
3968 long FullScreenMode) {
3969 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3970 IVideoWindow* pVideoWindow;
3973 TRACE("(%p/%p)->(%ld)\n", This, iface, FullScreenMode);
3975 EnterCriticalSection(&This->cs);
3977 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3980 hr = IVideoWindow_put_FullScreenMode(pVideoWindow, FullScreenMode);
3982 LeaveCriticalSection(&This->cs);
3987 static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface,
3989 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3990 IVideoWindow* pVideoWindow;
3993 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
3995 EnterCriticalSection(&This->cs);
3997 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4000 hr = IVideoWindow_SetWindowForeground(pVideoWindow, Focus);
4002 LeaveCriticalSection(&This->cs);
4007 static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface,
4012 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4013 IVideoWindow* pVideoWindow;
4016 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
4018 EnterCriticalSection(&This->cs);
4020 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4023 hr = IVideoWindow_NotifyOwnerMessage(pVideoWindow, hwnd, uMsg, wParam, lParam);
4025 LeaveCriticalSection(&This->cs);
4030 static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface,
4035 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4036 IVideoWindow* pVideoWindow;
4039 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
4041 EnterCriticalSection(&This->cs);
4043 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4046 hr = IVideoWindow_SetWindowPosition(pVideoWindow, Left, Top, Width, Height);
4048 LeaveCriticalSection(&This->cs);
4053 static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface,
4058 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4059 IVideoWindow* pVideoWindow;
4062 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
4064 EnterCriticalSection(&This->cs);
4066 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4069 hr = IVideoWindow_GetWindowPosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
4071 LeaveCriticalSection(&This->cs);
4076 static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface,
4079 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4080 IVideoWindow* pVideoWindow;
4083 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
4085 EnterCriticalSection(&This->cs);
4087 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4090 hr = IVideoWindow_GetMinIdealImageSize(pVideoWindow, pWidth, pHeight);
4092 LeaveCriticalSection(&This->cs);
4097 static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface,
4100 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4101 IVideoWindow* pVideoWindow;
4104 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
4106 EnterCriticalSection(&This->cs);
4108 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4111 hr = IVideoWindow_GetMaxIdealImageSize(pVideoWindow, pWidth, pHeight);
4113 LeaveCriticalSection(&This->cs);
4118 static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface,
4123 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4124 IVideoWindow* pVideoWindow;
4127 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
4129 EnterCriticalSection(&This->cs);
4131 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4134 hr = IVideoWindow_GetRestorePosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
4136 LeaveCriticalSection(&This->cs);
4141 static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface,
4143 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4144 IVideoWindow* pVideoWindow;
4147 TRACE("(%p/%p)->(%ld)\n", This, iface, HideCursor);
4149 EnterCriticalSection(&This->cs);
4151 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4154 hr = IVideoWindow_HideCursor(pVideoWindow, HideCursor);
4156 LeaveCriticalSection(&This->cs);
4161 static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface,
4162 long *CursorHidden) {
4163 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
4164 IVideoWindow* pVideoWindow;
4167 TRACE("(%p/%p)->(%p)\n", This, iface, CursorHidden);
4169 EnterCriticalSection(&This->cs);
4171 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4174 hr = IVideoWindow_IsCursorHidden(pVideoWindow, CursorHidden);
4176 LeaveCriticalSection(&This->cs);
4182 static const IVideoWindowVtbl IVideoWindow_VTable =
4184 VideoWindow_QueryInterface,
4186 VideoWindow_Release,
4187 VideoWindow_GetTypeInfoCount,
4188 VideoWindow_GetTypeInfo,
4189 VideoWindow_GetIDsOfNames,
4191 VideoWindow_put_Caption,
4192 VideoWindow_get_Caption,
4193 VideoWindow_put_WindowStyle,
4194 VideoWindow_get_WindowStyle,
4195 VideoWindow_put_WindowStyleEx,
4196 VideoWindow_get_WindowStyleEx,
4197 VideoWindow_put_AutoShow,
4198 VideoWindow_get_AutoShow,
4199 VideoWindow_put_WindowState,
4200 VideoWindow_get_WindowState,
4201 VideoWindow_put_BackgroundPalette,
4202 VideoWindow_get_BackgroundPalette,
4203 VideoWindow_put_Visible,
4204 VideoWindow_get_Visible,
4205 VideoWindow_put_Left,
4206 VideoWindow_get_Left,
4207 VideoWindow_put_Width,
4208 VideoWindow_get_Width,
4209 VideoWindow_put_Top,
4210 VideoWindow_get_Top,
4211 VideoWindow_put_Height,
4212 VideoWindow_get_Height,
4213 VideoWindow_put_Owner,
4214 VideoWindow_get_Owner,
4215 VideoWindow_put_MessageDrain,
4216 VideoWindow_get_MessageDrain,
4217 VideoWindow_get_BorderColor,
4218 VideoWindow_put_BorderColor,
4219 VideoWindow_get_FullScreenMode,
4220 VideoWindow_put_FullScreenMode,
4221 VideoWindow_SetWindowForeground,
4222 VideoWindow_NotifyOwnerMessage,
4223 VideoWindow_SetWindowPosition,
4224 VideoWindow_GetWindowPosition,
4225 VideoWindow_GetMinIdealImageSize,
4226 VideoWindow_GetMaxIdealImageSize,
4227 VideoWindow_GetRestorePosition,
4228 VideoWindow_HideCursor,
4229 VideoWindow_IsCursorHidden
4233 /*** IUnknown methods ***/
4234 static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface,
4237 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4239 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
4241 return Filtergraph_QueryInterface(This, riid, ppvObj);
4244 static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface) {
4245 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4247 TRACE("(%p/%p)->()\n", This, iface);
4249 return Filtergraph_AddRef(This);
4252 static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface) {
4253 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4255 TRACE("(%p/%p)->()\n", This, iface);
4257 return Filtergraph_Release(This);
4260 /*** IDispatch methods ***/
4261 static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface,
4263 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4265 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
4270 static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface,
4273 ITypeInfo**ppTInfo) {
4274 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4276 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
4281 static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface,
4287 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4289 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
4294 static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface,
4295 DISPID dispIdMember,
4299 DISPPARAMS*pDispParams,
4301 EXCEPINFO*pExepInfo,
4303 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4305 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);
4310 /*** IMediaEvent methods ***/
4311 static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface,
4313 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4315 TRACE("(%p/%p)->(%p)\n", This, iface, hEvent);
4317 *hEvent = (OAEVENT)This->evqueue.msg_event;
4322 static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface,
4327 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4330 TRACE("(%p/%p)->(%p, %p, %p, %ld)\n", This, iface, lEventCode, lParam1, lParam2, msTimeout);
4332 if (EventsQueue_GetEvent(&This->evqueue, &evt, msTimeout))
4334 *lEventCode = evt.lEventCode;
4335 *lParam1 = evt.lParam1;
4336 *lParam2 = evt.lParam2;
4344 static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface,
4347 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4349 TRACE("(%p/%p)->(%ld, %p)\n", This, iface, msTimeout, pEvCode);
4351 if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
4353 *pEvCode = This->CompletionStatus;
4361 static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface,
4363 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4365 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4367 if (lEvCode == EC_COMPLETE)
4368 This->HandleEcComplete = FALSE;
4369 else if (lEvCode == EC_REPAINT)
4370 This->HandleEcRepaint = FALSE;
4371 else if (lEvCode == EC_CLOCK_CHANGED)
4372 This->HandleEcClockChanged = FALSE;
4379 static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(IMediaEventEx *iface,
4381 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4383 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4385 if (lEvCode == EC_COMPLETE)
4386 This->HandleEcComplete = TRUE;
4387 else if (lEvCode == EC_REPAINT)
4388 This->HandleEcRepaint = TRUE;
4389 else if (lEvCode == EC_CLOCK_CHANGED)
4390 This->HandleEcClockChanged = TRUE;
4397 static HRESULT WINAPI MediaEvent_FreeEventParams(IMediaEventEx *iface,
4401 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4403 TRACE("(%p/%p)->(%ld, %08lx, %08lx): stub !!!\n", This, iface, lEvCode, lParam1, lParam2);
4408 /*** IMediaEventEx methods ***/
4409 static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
4412 LONG_PTR lInstanceData) {
4413 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4415 TRACE("(%p/%p)->(%08x, %ld, %08lx)\n", This, iface, (DWORD) hwnd, lMsg, lInstanceData);
4417 This->notif.hWnd = (HWND)hwnd;
4418 This->notif.msg = lMsg;
4419 This->notif.instance = (long) lInstanceData;
4424 static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface,
4425 long lNoNotifyFlags) {
4426 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4428 TRACE("(%p/%p)->(%ld)\n", This, iface, lNoNotifyFlags);
4430 if ((lNoNotifyFlags != 0) && (lNoNotifyFlags != 1))
4431 return E_INVALIDARG;
4433 This->notif.disabled = lNoNotifyFlags;
4438 static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface,
4439 long *lplNoNotifyFlags) {
4440 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4442 TRACE("(%p/%p)->(%p)\n", This, iface, lplNoNotifyFlags);
4444 if (!lplNoNotifyFlags)
4447 *lplNoNotifyFlags = This->notif.disabled;
4453 static const IMediaEventExVtbl IMediaEventEx_VTable =
4455 MediaEvent_QueryInterface,
4458 MediaEvent_GetTypeInfoCount,
4459 MediaEvent_GetTypeInfo,
4460 MediaEvent_GetIDsOfNames,
4462 MediaEvent_GetEventHandle,
4463 MediaEvent_GetEvent,
4464 MediaEvent_WaitForCompletion,
4465 MediaEvent_CancelDefaultHandling,
4466 MediaEvent_RestoreDefaultHandling,
4467 MediaEvent_FreeEventParams,
4468 MediaEvent_SetNotifyWindow,
4469 MediaEvent_SetNotifyFlags,
4470 MediaEvent_GetNotifyFlags
4474 static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID riid, LPVOID *ppv)
4476 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4478 return Filtergraph_QueryInterface(This, riid, ppv);
4481 static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
4483 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4485 return Filtergraph_AddRef(This);
4488 static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
4490 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4492 return Filtergraph_Release(This);
4495 static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClassID)
4497 FIXME("(%p): stub\n", pClassID);
4502 static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
4504 FIXME("(): stub\n");
4509 static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
4511 FIXME("(): stub\n");
4516 static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME tStart)
4518 FIXME("(0x%s): stub\n", wine_dbgstr_longlong(tStart));
4523 static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD dwMsTimeout, FILTER_STATE * pState)
4525 FIXME("(%d, %p): stub\n", dwMsTimeout, pState);
4530 static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
4532 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4536 TRACE("(%p/%p)->(%p)\n", iface, This, pClock);
4538 EnterCriticalSection(&This->cs);
4540 for (i = 0;i < This->nFilters;i++)
4542 hr = IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], pClock);
4550 IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], This->refClock);
4555 IReferenceClock_Release(This->refClock);
4556 This->refClock = pClock;
4558 IReferenceClock_AddRef(This->refClock);
4560 if (This->HandleEcClockChanged)
4562 IMediaEventSink *pEventSink;
4565 eshr = IMediaFilter_QueryInterface(iface, &IID_IMediaEventSink, (LPVOID)&pEventSink);
4566 if (SUCCEEDED(eshr))
4568 IMediaEventSink_Notify(pEventSink, EC_CLOCK_CHANGED, 0, 0);
4569 IMediaEventSink_Release(pEventSink);
4574 LeaveCriticalSection(&This->cs);
4579 static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
4581 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4583 TRACE("(%p/%p)->(%p)\n", iface, This, ppClock);
4588 EnterCriticalSection(&This->cs);
4590 *ppClock = This->refClock;
4592 IReferenceClock_AddRef(*ppClock);
4594 LeaveCriticalSection(&This->cs);
4599 static const IMediaFilterVtbl IMediaFilter_VTable =
4601 MediaFilter_QueryInterface,
4603 MediaFilter_Release,
4604 MediaFilter_GetClassID,
4608 MediaFilter_GetState,
4609 MediaFilter_SetSyncSource,
4610 MediaFilter_GetSyncSource
4613 static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID riid, LPVOID *ppv)
4615 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4617 return Filtergraph_QueryInterface(This, riid, ppv);
4620 static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
4622 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4624 return Filtergraph_AddRef(This);
4627 static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
4629 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4631 return Filtergraph_Release(This);
4634 static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, long EventCode, LONG_PTR EventParam1, LONG_PTR EventParam2)
4636 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4639 TRACE("(%p/%p)->(%ld, %ld, %ld)\n", This, iface, EventCode, EventParam1, EventParam2);
4641 /* We need thread safety here, let's use the events queue's one */
4642 EnterCriticalSection(&This->evqueue.msg_crst);
4644 if ((EventCode == EC_COMPLETE) && This->HandleEcComplete)
4646 TRACE("Process EC_COMPLETE notification\n");
4647 if (++This->EcCompleteCount == This->nRenderers)
4649 evt.lEventCode = EC_COMPLETE;
4652 TRACE("Send EC_COMPLETE to app\n");
4653 EventsQueue_PutEvent(&This->evqueue, &evt);
4654 if (!This->notif.disabled && This->notif.hWnd)
4656 TRACE("Send Window message\n");
4657 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4659 This->CompletionStatus = EC_COMPLETE;
4660 SetEvent(This->hEventCompletion);
4663 else if ((EventCode == EC_REPAINT) && This->HandleEcRepaint)
4665 /* FIXME: Not handled yet */
4669 evt.lEventCode = EventCode;
4670 evt.lParam1 = EventParam1;
4671 evt.lParam2 = EventParam2;
4672 EventsQueue_PutEvent(&This->evqueue, &evt);
4673 if (!This->notif.disabled && This->notif.hWnd)
4674 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4677 LeaveCriticalSection(&This->evqueue.msg_crst);
4681 static const IMediaEventSinkVtbl IMediaEventSink_VTable =
4683 MediaEventSink_QueryInterface,
4684 MediaEventSink_AddRef,
4685 MediaEventSink_Release,
4686 MediaEventSink_Notify
4689 static HRESULT WINAPI GraphConfig_QueryInterface(IGraphConfig *iface, REFIID riid, LPVOID *ppv)
4691 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4693 return Filtergraph_QueryInterface(This, riid, ppv);
4696 static ULONG WINAPI GraphConfig_AddRef(IGraphConfig *iface)
4698 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4700 return Filtergraph_AddRef(This);
4703 static ULONG WINAPI GraphConfig_Release(IGraphConfig *iface)
4705 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4707 return Filtergraph_Release(This);
4710 static HRESULT WINAPI GraphConfig_Reconnect(IGraphConfig *iface,
4713 const AM_MEDIA_TYPE* pmtFirstConnection,
4714 IBaseFilter* pUsingFilter,
4718 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4720 FIXME("(%p)->(%p, %p, %p, %p, %p, %x): stub!\n", This, pOutputPin, pInputPin, pmtFirstConnection, pUsingFilter, hAbortEvent, dwFlags);
4725 static HRESULT WINAPI GraphConfig_Reconfigure(IGraphConfig *iface,
4726 IGraphConfigCallback* pCallback,
4731 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4733 FIXME("(%p)->(%p, %p, %x, %p): stub!\n", This, pCallback, pvContext, dwFlags, hAbortEvent);
4738 static HRESULT WINAPI GraphConfig_AddFilterToCache(IGraphConfig *iface,
4739 IBaseFilter* pFilter)
4741 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4743 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4748 static HRESULT WINAPI GraphConfig_EnumCacheFilter(IGraphConfig *iface,
4749 IEnumFilters** pEnum)
4751 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4753 FIXME("(%p)->(%p): stub!\n", This, pEnum);
4758 static HRESULT WINAPI GraphConfig_RemoveFilterFromCache(IGraphConfig *iface,
4759 IBaseFilter* pFilter)
4761 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4763 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4768 static HRESULT WINAPI GraphConfig_GetStartTime(IGraphConfig *iface,
4769 REFERENCE_TIME* prtStart)
4771 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4773 FIXME("(%p)->(%p): stub!\n", This, prtStart);
4778 static HRESULT WINAPI GraphConfig_PushThroughData(IGraphConfig *iface,
4780 IPinConnection* pConnection,
4783 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4785 FIXME("(%p)->(%p, %p, %p): stub!\n", This, pOutputPin, pConnection, hEventAbort);
4790 static HRESULT WINAPI GraphConfig_SetFilterFlags(IGraphConfig *iface,
4791 IBaseFilter* pFilter,
4794 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4796 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
4801 static HRESULT WINAPI GraphConfig_GetFilterFlags(IGraphConfig *iface,
4802 IBaseFilter* pFilter,
4805 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4807 FIXME("(%p)->(%p, %p): stub!\n", This, pFilter, dwFlags);
4812 static HRESULT WINAPI GraphConfig_RemoveFilterEx(IGraphConfig *iface,
4813 IBaseFilter* pFilter,
4816 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4818 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
4823 static const IGraphConfigVtbl IGraphConfig_VTable =
4825 GraphConfig_QueryInterface,
4827 GraphConfig_Release,
4828 GraphConfig_Reconnect,
4829 GraphConfig_Reconfigure,
4830 GraphConfig_AddFilterToCache,
4831 GraphConfig_EnumCacheFilter,
4832 GraphConfig_RemoveFilterFromCache,
4833 GraphConfig_GetStartTime,
4834 GraphConfig_PushThroughData,
4835 GraphConfig_SetFilterFlags,
4836 GraphConfig_GetFilterFlags,
4837 GraphConfig_RemoveFilterEx
4840 static const IUnknownVtbl IInner_VTable =
4842 FilterGraphInner_QueryInterface,
4843 FilterGraphInner_AddRef,
4844 FilterGraphInner_Release
4847 static HRESULT WINAPI Filtergraph_QueryInterface(IFilterGraphImpl *This,
4850 if (This->bAggregatable)
4851 This->bUnkOuterValid = TRUE;
4853 if (This->pUnkOuter)
4855 if (This->bAggregatable)
4856 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
4858 if (IsEqualIID(riid, &IID_IUnknown))
4862 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
4863 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
4864 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
4865 This->bAggregatable = TRUE;
4870 return E_NOINTERFACE;
4873 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
4876 static ULONG WINAPI Filtergraph_AddRef(IFilterGraphImpl *This) {
4877 if (This->pUnkOuter && This->bUnkOuterValid)
4878 return IUnknown_AddRef(This->pUnkOuter);
4879 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
4882 static ULONG WINAPI Filtergraph_Release(IFilterGraphImpl *This) {
4883 if (This->pUnkOuter && This->bUnkOuterValid)
4884 return IUnknown_Release(This->pUnkOuter);
4885 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
4888 /* This is the only function that actually creates a FilterGraph class... */
4889 HRESULT FilterGraph_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4891 IFilterGraphImpl *fimpl;
4894 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
4898 fimpl = CoTaskMemAlloc(sizeof(*fimpl));
4899 fimpl->pUnkOuter = pUnkOuter;
4900 fimpl->bUnkOuterValid = FALSE;
4901 fimpl->bAggregatable = FALSE;
4902 fimpl->IInner_vtbl = &IInner_VTable;
4903 fimpl->IFilterGraph2_vtbl = &IFilterGraph2_VTable;
4904 fimpl->IMediaControl_vtbl = &IMediaControl_VTable;
4905 fimpl->IMediaSeeking_vtbl = &IMediaSeeking_VTable;
4906 fimpl->IBasicAudio_vtbl = &IBasicAudio_VTable;
4907 fimpl->IBasicVideo_vtbl = &IBasicVideo_VTable;
4908 fimpl->IVideoWindow_vtbl = &IVideoWindow_VTable;
4909 fimpl->IMediaEventEx_vtbl = &IMediaEventEx_VTable;
4910 fimpl->IMediaFilter_vtbl = &IMediaFilter_VTable;
4911 fimpl->IMediaEventSink_vtbl = &IMediaEventSink_VTable;
4912 fimpl->IGraphConfig_vtbl = &IGraphConfig_VTable;
4913 fimpl->IMediaPosition_vtbl = &IMediaPosition_VTable;
4915 fimpl->ppFiltersInGraph = NULL;
4916 fimpl->pFilterNames = NULL;
4917 fimpl->nFilters = 0;
4918 fimpl->filterCapacity = 0;
4919 fimpl->nameIndex = 1;
4920 fimpl->refClock = NULL;
4921 fimpl->hEventCompletion = CreateEventW(0, TRUE, FALSE, 0);
4922 fimpl->HandleEcComplete = TRUE;
4923 fimpl->HandleEcRepaint = TRUE;
4924 fimpl->HandleEcClockChanged = TRUE;
4925 fimpl->notif.hWnd = 0;
4926 fimpl->notif.disabled = FALSE;
4927 fimpl->nRenderers = 0;
4928 fimpl->EcCompleteCount = 0;
4929 fimpl->state = State_Stopped;
4930 EventsQueue_Init(&fimpl->evqueue);
4931 InitializeCriticalSection(&fimpl->cs);
4932 fimpl->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IFilterGraphImpl.cs");
4933 fimpl->nItfCacheEntries = 0;
4934 memcpy(&fimpl->timeformatseek, &TIME_FORMAT_MEDIA_TIME, sizeof(GUID));
4936 hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&fimpl->pFilterMapper2);
4938 ERR("Unable to create filter mapper (%x)\n", hr);
4941 IFilterGraph2_SetDefaultSyncSource((IFilterGraph2*)fimpl);
4947 HRESULT FilterGraphNoThread_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4949 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
4950 return FilterGraph_create(pUnkOuter, ppObj);