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;
203 static HRESULT WINAPI Filtergraph_QueryInterface(IFilterGraphImpl *This,
204 REFIID riid, LPVOID * ppv);
205 static ULONG WINAPI Filtergraph_AddRef(IFilterGraphImpl *This);
206 static ULONG WINAPI Filtergraph_Release(IFilterGraphImpl *This);
208 static HRESULT WINAPI FilterGraphInner_QueryInterface(IUnknown * iface,
211 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
212 TRACE("(%p)->(%s (%p), %p)\n", This, debugstr_guid(riid), riid, ppvObj);
214 if (This->bAggregatable)
215 This->bUnkOuterValid = TRUE;
217 if (IsEqualGUID(&IID_IUnknown, riid)) {
218 *ppvObj = &(This->IInner_vtbl);
219 TRACE(" returning IUnknown interface (%p)\n", *ppvObj);
220 } else if (IsEqualGUID(&IID_IFilterGraph, riid) ||
221 IsEqualGUID(&IID_IFilterGraph2, riid) ||
222 IsEqualGUID(&IID_IGraphBuilder, riid)) {
223 *ppvObj = &(This->IFilterGraph2_vtbl);
224 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj);
225 } else if (IsEqualGUID(&IID_IMediaControl, riid)) {
226 *ppvObj = &(This->IMediaControl_vtbl);
227 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj);
228 } else if (IsEqualGUID(&IID_IMediaSeeking, riid)) {
229 *ppvObj = &(This->IMediaSeeking_vtbl);
230 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj);
231 } else if (IsEqualGUID(&IID_IBasicAudio, riid)) {
232 *ppvObj = &(This->IBasicAudio_vtbl);
233 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj);
234 } else if (IsEqualGUID(&IID_IBasicVideo, riid)) {
235 *ppvObj = &(This->IBasicVideo_vtbl);
236 TRACE(" returning IBasicVideo interface (%p)\n", *ppvObj);
237 } else if (IsEqualGUID(&IID_IVideoWindow, riid)) {
238 *ppvObj = &(This->IVideoWindow_vtbl);
239 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj);
240 } else if (IsEqualGUID(&IID_IMediaEvent, riid) ||
241 IsEqualGUID(&IID_IMediaEventEx, riid)) {
242 *ppvObj = &(This->IMediaEventEx_vtbl);
243 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj);
244 } else if (IsEqualGUID(&IID_IMediaFilter, riid) ||
245 IsEqualGUID(&IID_IPersist, riid)) {
246 *ppvObj = &(This->IMediaFilter_vtbl);
247 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj);
248 } else if (IsEqualGUID(&IID_IMediaEventSink, riid)) {
249 *ppvObj = &(This->IMediaEventSink_vtbl);
250 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj);
251 } else if (IsEqualGUID(&IID_IGraphConfig, riid)) {
252 *ppvObj = &(This->IGraphConfig_vtbl);
253 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj);
254 } else if (IsEqualGUID(&IID_IMediaPosition, riid)) {
255 *ppvObj = &(This->IMediaPosition_vtbl);
256 TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj);
259 FIXME("unknown interface %s\n", debugstr_guid(riid));
260 return E_NOINTERFACE;
263 IUnknown_AddRef((IUnknown *)(*ppvObj));
267 static ULONG WINAPI FilterGraphInner_AddRef(IUnknown * iface) {
268 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
269 ULONG ref = InterlockedIncrement(&This->ref);
271 TRACE("(%p)->(): new ref = %d\n", This, ref);
276 static ULONG WINAPI FilterGraphInner_Release(IUnknown * iface) {
277 ICOM_THIS_MULTI(IFilterGraphImpl, IInner_vtbl, iface);
278 ULONG ref = InterlockedDecrement(&This->ref);
280 TRACE("(%p)->(): new ref = %d\n", This, ref);
285 IMediaControl_Stop((IMediaControl*)&(This->IMediaControl_vtbl));
287 IReferenceClock_Release(This->refClock);
289 while (This->nFilters)
290 IFilterGraph2_RemoveFilter((IFilterGraph2*)This, This->ppFiltersInGraph[0]);
292 for (i = 0; i < This->nItfCacheEntries; i++)
294 if (This->ItfCacheEntries[i].iface)
295 IUnknown_Release(This->ItfCacheEntries[i].iface);
297 IFilterMapper2_Release(This->pFilterMapper2);
298 CloseHandle(This->hEventCompletion);
299 EventsQueue_Destroy(&This->evqueue);
300 This->cs.DebugInfo->Spare[0] = 0;
301 DeleteCriticalSection(&This->cs);
302 CoTaskMemFree(This->ppFiltersInGraph);
303 CoTaskMemFree(This->pFilterNames);
310 /*** IUnknown methods ***/
311 static HRESULT WINAPI FilterGraph2_QueryInterface(IFilterGraph2 *iface,
314 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
316 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
317 return Filtergraph_QueryInterface(This, riid, ppvObj);
320 static ULONG WINAPI FilterGraph2_AddRef(IFilterGraph2 *iface) {
321 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
323 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This, iface);
325 return Filtergraph_AddRef(This);
328 static ULONG WINAPI FilterGraph2_Release(IFilterGraph2 *iface) {
329 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
331 TRACE("(%p/%p)->() calling FilterGraph Release\n", This, iface);
333 return Filtergraph_Release(This);
336 /*** IFilterGraph methods ***/
337 static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface,
338 IBaseFilter *pFilter,
340 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
343 WCHAR* wszFilterName = NULL;
344 int duplicate_name = FALSE;
346 TRACE("(%p/%p)->(%p, %s (%p))\n", This, iface, pFilter, debugstr_w(pName), pName);
351 wszFilterName = CoTaskMemAlloc( (pName ? strlenW(pName) + 6 : 5) * sizeof(WCHAR) );
355 /* Check if name already exists */
356 for(i = 0; i < This->nFilters; i++)
357 if (!strcmpW(This->pFilterNames[i], pName))
359 duplicate_name = TRUE;
364 /* If no name given or name already existing, generate one */
365 if (!pName || duplicate_name)
367 static const WCHAR wszFmt1[] = {'%','s',' ','%','0','4','d',0};
368 static const WCHAR wszFmt2[] = {'%','0','4','d',0};
370 for (j = 0; j < 10000 ; j++)
374 sprintfW(wszFilterName, wszFmt1, pName, This->nameIndex);
376 sprintfW(wszFilterName, wszFmt2, This->nameIndex);
377 TRACE("Generated name %s\n", debugstr_w(wszFilterName));
379 /* Check if the generated name already exists */
380 for(i = 0; i < This->nFilters; i++)
381 if (!strcmpW(This->pFilterNames[i], wszFilterName))
384 /* Compute next index and exit if generated name is suitable */
385 if (This->nameIndex++ == 10000)
387 if (i == This->nFilters)
390 /* Unable to find a suitable name */
393 CoTaskMemFree(wszFilterName);
394 return VFW_E_DUPLICATE_NAME;
398 memcpy(wszFilterName, pName, (strlenW(pName) + 1) * sizeof(WCHAR));
400 if (This->nFilters + 1 > This->filterCapacity)
402 int newCapacity = This->filterCapacity ? 2 * This->filterCapacity : 1;
403 IBaseFilter ** ppNewFilters = CoTaskMemAlloc(newCapacity * sizeof(IBaseFilter*));
404 LPWSTR * pNewNames = CoTaskMemAlloc(newCapacity * sizeof(LPWSTR));
405 memcpy(ppNewFilters, This->ppFiltersInGraph, This->nFilters * sizeof(IBaseFilter*));
406 memcpy(pNewNames, This->pFilterNames, This->nFilters * sizeof(LPWSTR));
407 if (!This->filterCapacity)
409 CoTaskMemFree(This->ppFiltersInGraph);
410 CoTaskMemFree(This->pFilterNames);
412 This->ppFiltersInGraph = ppNewFilters;
413 This->pFilterNames = pNewNames;
414 This->filterCapacity = newCapacity;
417 hr = IBaseFilter_JoinFilterGraph(pFilter, (IFilterGraph *)This, wszFilterName);
421 IBaseFilter_AddRef(pFilter);
422 This->ppFiltersInGraph[This->nFilters] = pFilter;
423 This->pFilterNames[This->nFilters] = wszFilterName;
425 IBaseFilter_SetSyncSource(pFilter, This->refClock);
428 CoTaskMemFree(wszFilterName);
430 if (SUCCEEDED(hr) && duplicate_name)
431 return VFW_S_DUPLICATE_NAME;
436 static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface,
437 IBaseFilter *pFilter) {
438 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
442 TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
444 /* FIXME: check graph is stopped */
446 for (i = 0; i < This->nFilters; i++)
448 if (This->ppFiltersInGraph[i] == pFilter)
450 IEnumPins *penumpins;
451 hr = IBaseFilter_EnumPins(pFilter, &penumpins);
454 while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK) {
455 IPin_Disconnect(ppin);
458 IEnumPins_Release(penumpins);
461 hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, This->pFilterNames[i]);
464 IBaseFilter_SetSyncSource(pFilter, NULL);
465 IBaseFilter_Release(pFilter);
466 CoTaskMemFree(This->pFilterNames[i]);
467 memmove(This->ppFiltersInGraph+i, This->ppFiltersInGraph+i+1, sizeof(IBaseFilter*)*(This->nFilters - 1 - i));
468 memmove(This->pFilterNames+i, This->pFilterNames+i+1, sizeof(LPWSTR)*(This->nFilters - 1 - i));
470 /* Invalidate interfaces in the cache */
471 for (i = 0; i < This->nItfCacheEntries; i++)
472 if (pFilter == This->ItfCacheEntries[i].filter)
474 IUnknown_Release(This->ItfCacheEntries[i].iface);
475 This->ItfCacheEntries[i].iface = NULL;
476 This->ItfCacheEntries[i].filter = NULL;
484 return hr; /* FIXME: check this error code */
487 static HRESULT WINAPI FilterGraph2_EnumFilters(IFilterGraph2 *iface,
488 IEnumFilters **ppEnum) {
489 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
491 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
493 return IEnumFiltersImpl_Construct(This->ppFiltersInGraph, This->nFilters, ppEnum);
496 static HRESULT WINAPI FilterGraph2_FindFilterByName(IFilterGraph2 *iface,
498 IBaseFilter **ppFilter) {
499 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
502 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_w(pName), pName, ppFilter);
507 for (i = 0; i < This->nFilters; i++)
509 if (!strcmpW(pName, This->pFilterNames[i]))
511 *ppFilter = This->ppFiltersInGraph[i];
512 IBaseFilter_AddRef(*ppFilter);
518 return VFW_E_NOT_FOUND;
521 /* NOTE: despite the implication, it doesn't matter which
522 * way round you put in the input and output pins */
523 static HRESULT WINAPI FilterGraph2_ConnectDirect(IFilterGraph2 *iface,
526 const AM_MEDIA_TYPE *pmt) {
530 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
532 TRACE("(%p/%p)->(%p, %p, %p)\n", This, iface, ppinIn, ppinOut, pmt);
534 /* FIXME: check pins are in graph */
536 if (TRACE_ON(quartz))
540 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
544 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
545 IBaseFilter_Release(PinInfo.pFilter);
547 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
551 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
552 IBaseFilter_Release(PinInfo.pFilter);
555 hr = IPin_QueryDirection(ppinIn, &dir);
558 if (dir == PINDIR_INPUT)
559 hr = IPin_Connect(ppinOut, ppinIn, pmt);
561 hr = IPin_Connect(ppinIn, ppinOut, pmt);
567 static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface,
569 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
570 IPin *pConnectedTo = NULL;
572 PIN_DIRECTION pindir;
574 IPin_QueryDirection(ppin, &pindir);
575 hr = IPin_ConnectedTo(ppin, &pConnectedTo);
577 TRACE("Querying connected to failed: %x\n", hr);
580 IPin_Disconnect(ppin);
581 IPin_Disconnect(pConnectedTo);
582 if (pindir == PINDIR_INPUT)
583 hr = IPin_Connect(pConnectedTo, ppin, NULL);
585 hr = IPin_Connect(ppin, pConnectedTo, NULL);
586 IPin_Release(pConnectedTo);
588 ERR("Reconnecting pins failed, pins are not connected now..\n");
589 TRACE("(%p->%p) -- %p %p -> %x\n", iface, This, ppin, pConnectedTo, hr);
593 static HRESULT WINAPI FilterGraph2_Disconnect(IFilterGraph2 *iface,
595 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
597 TRACE("(%p/%p)->(%p)\n", This, iface, ppin);
599 return IPin_Disconnect(ppin);
602 static HRESULT WINAPI FilterGraph2_SetDefaultSyncSource(IFilterGraph2 *iface) {
603 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
605 TRACE("(%p/%p)->(): stub !!!\n", iface, This);
610 static HRESULT GetFilterInfo(IMoniker* pMoniker, GUID* pclsid, VARIANT* pvar)
612 static const WCHAR wszClsidName[] = {'C','L','S','I','D',0};
613 static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
614 IPropertyBag * pPropBagCat = NULL;
618 V_VT(pvar) = VT_BSTR;
620 hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
623 hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL);
626 hr = CLSIDFromString(V_UNION(pvar, bstrVal), pclsid);
629 hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL);
632 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid), debugstr_w(V_UNION(pvar, bstrVal)));
635 IPropertyBag_Release(pPropBagCat);
640 static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPin*** pppins, ULONG* pnb)
645 TRACE("(%p, %p, %p, %p)\n", pfilter, pinputpin, pppins, pnb);
646 hr = IPin_QueryInternalConnections(pinputpin, NULL, &nb);
649 } else if (hr == S_FALSE) {
650 *pppins = CoTaskMemAlloc(sizeof(IPin*)*nb);
651 hr = IPin_QueryInternalConnections(pinputpin, *pppins, &nb);
653 ERR("Error (%x)\n", hr);
655 } else if (hr == E_NOTIMPL) {
656 /* Input connected to all outputs */
657 IEnumPins* penumpins;
660 TRACE("E_NOTIMPL\n");
661 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
663 ERR("filter Enumpins failed (%x)\n", hr);
667 /* Count output pins */
668 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
669 PIN_DIRECTION pindir;
670 IPin_QueryDirection(ppin, &pindir);
671 if (pindir == PINDIR_OUTPUT)
675 *pppins = CoTaskMemAlloc(sizeof(IPin*)*i);
676 /* Retrieve output pins */
677 IEnumPins_Reset(penumpins);
679 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
680 PIN_DIRECTION pindir;
681 IPin_QueryDirection(ppin, &pindir);
682 if (pindir == PINDIR_OUTPUT)
683 (*pppins)[i++] = ppin;
687 IEnumPins_Release(penumpins);
690 ERR("Next failed (%x)\n", hr);
693 } else if (FAILED(hr)) {
694 ERR("Cannot get internal connection (%x)\n", hr);
702 /*** IGraphBuilder methods ***/
703 static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface,
706 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
709 IEnumMediaTypes* penummt;
711 IEnumPins* penumpins;
712 IEnumMoniker* pEnumMoniker;
720 TRACE("(%p/%p)->(%p, %p)\n", This, iface, ppinOut, ppinIn);
722 if (TRACE_ON(quartz))
724 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
728 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
729 IBaseFilter_Release(PinInfo.pFilter);
731 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
735 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
736 IBaseFilter_Release(PinInfo.pFilter);
739 /* Try direct connection first */
740 hr = IPin_Connect(ppinOut, ppinIn, NULL);
744 TRACE("Direct connection failed, trying to insert other filters\n");
746 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
750 hr = IBaseFilter_GetClassID(PinInfo.pFilter, &FilterCLSID);
751 IBaseFilter_Release(PinInfo.pFilter);
755 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
756 * filter to the minor mediatype of input pin of the renderer */
757 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
759 ERR("EnumMediaTypes (%x)\n", hr);
763 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
765 ERR("IEnumMediaTypes_Next (%x)\n", hr);
770 ERR("No media type found!\n");
773 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
774 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
776 /* Try to find a suitable filter that can connect to the pin to render */
777 tab[0] = mt->majortype;
778 tab[1] = mt->subtype;
779 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
781 ERR("Unable to enum filters (%x)\n", hr);
785 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
790 IPin* ppinfilter = NULL;
791 IBaseFilter* pfilter = NULL;
793 hr = GetFilterInfo(pMoniker, &clsid, &var);
794 IMoniker_Release(pMoniker);
796 ERR("Unable to retrieve filter info (%x)\n", hr);
800 if (IsEqualGUID(&clsid, &FilterCLSID)) {
801 /* Skip filter (same as the one the output pin belongs to) */
805 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
807 ERR("Unable to create filter (%x), trying next one\n", hr);
811 hr = IFilterGraph2_AddFilter(iface, pfilter, V_UNION(&var, bstrVal));
813 ERR("Unable to add filter (%x)\n", hr);
814 IBaseFilter_Release(pfilter);
819 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
821 ERR("Enumpins (%x)\n", hr);
825 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
826 IEnumPins_Release(penumpins);
829 ERR("Next (%x)\n", hr);
837 hr = IPin_Connect(ppinOut, ppinfilter, NULL);
839 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
842 TRACE("Successfully connected to filter, follow chain...\n");
844 /* Render all output pins of the filter by calling IFilterGraph2_Render on each of them */
845 hr = GetInternalConnections(pfilter, ppinfilter, &ppins, &nb);
850 IPin_Disconnect(ppinOut);
853 TRACE("pins to consider: %d\n", nb);
854 for(i = 0; i < nb; i++) {
855 TRACE("Processing pin %d\n", i);
856 hr = IFilterGraph2_Connect(iface, ppins[i], ppinIn);
858 TRACE("Cannot render pin %p (%x)\n", ppinfilter, hr);
860 IPin_Release(ppins[i]);
861 if (SUCCEEDED(hr)) break;
863 while (++i < nb) IPin_Release(ppins[i]);
864 CoTaskMemFree(ppins);
865 IPin_Release(ppinfilter);
866 IBaseFilter_Release(pfilter);
871 if (ppinfilter) IPin_Release(ppinfilter);
873 IFilterGraph2_RemoveFilter(iface, pfilter);
874 IBaseFilter_Release(pfilter);
878 IEnumMediaTypes_Release(penummt);
884 static HRESULT WINAPI FilterGraph2_Render(IFilterGraph2 *iface,
886 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
887 IEnumMediaTypes* penummt;
892 IEnumMoniker* pEnumMoniker;
897 TRACE("(%p/%p)->(%p)\n", This, iface, ppinOut);
899 if (TRACE_ON(quartz))
903 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
907 TRACE("Filter owning pin => %p\n", PinInfo.pFilter);
908 IBaseFilter_Release(PinInfo.pFilter);
911 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
913 ERR("EnumMediaTypes (%x)\n", hr);
919 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
921 ERR("IEnumMediaTypes_Next (%x)\n", hr);
926 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
927 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
929 /* Try to find a suitable renderer with the same media type */
930 tab[0] = mt->majortype;
932 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL);
934 ERR("Unable to enum filters (%x)\n", hr);
938 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
943 IBaseFilter* pfilter = NULL;
944 IEnumPins* penumpins;
947 hr = GetFilterInfo(pMoniker, &clsid, &var);
948 IMoniker_Release(pMoniker);
950 ERR("Unable to retrieve filter info (%x)\n", hr);
954 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
956 ERR("Unable to create filter (%x), trying next one\n", hr);
960 hr = IFilterGraph2_AddFilter(iface, pfilter, V_UNION(&var, bstrVal));
962 ERR("Unable to add filter (%x)\n", hr);
963 IBaseFilter_Release(pfilter);
968 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
970 ERR("Splitter Enumpins (%x)\n", hr);
973 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
974 IEnumPins_Release(penumpins);
976 ERR("Next (%x)\n", hr);
984 /* Connect the pin to render to the renderer */
985 hr = IFilterGraph2_Connect(iface, ppinOut, ppinfilter);
987 TRACE("Unable to connect to renderer (%x)\n", hr);
988 IPin_Release(ppinfilter);
991 IPin_Release(ppinfilter);
992 IBaseFilter_Release(pfilter);
998 IFilterGraph2_RemoveFilter(iface, pfilter);
999 IBaseFilter_Release(pfilter);
1003 DeleteMediaType(mt);
1007 IEnumMediaTypes_Release(penummt);
1012 static HRESULT WINAPI FilterGraph2_RenderFile(IFilterGraph2 *iface,
1013 LPCWSTR lpcwstrFile,
1014 LPCWSTR lpcwstrPlayList) {
1015 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1016 static const WCHAR string[] = {'R','e','a','d','e','r',0};
1017 IBaseFilter* preader = NULL;
1018 IBaseFilter* psplitter = NULL;
1019 IPin* ppinreader = NULL;
1020 IPin* ppinsplitter = NULL;
1021 IEnumPins* penumpins;
1024 IEnumMoniker* pEnumMoniker = NULL;
1026 IPin** ppins = NULL;
1029 IFileSourceFilter* pfile = NULL;
1033 TRACE("(%p/%p)->(%s, %s)\n", This, iface, debugstr_w(lpcwstrFile), debugstr_w(lpcwstrPlayList));
1035 if (lpcwstrPlayList != NULL)
1036 return E_INVALIDARG;
1038 hr = IFilterGraph2_AddSourceFilter(iface, lpcwstrFile, string, &preader);
1040 /* Retrieve file media type */
1042 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1043 if (SUCCEEDED(hr)) {
1044 hr = IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1045 IFileSourceFilter_Release(pfile);
1049 hr = IBaseFilter_EnumPins(preader, &penumpins);
1050 if (SUCCEEDED(hr)) {
1051 hr = IEnumPins_Next(penumpins, 1, &ppinreader, &pin);
1052 IEnumPins_Release(penumpins);
1055 if (SUCCEEDED(hr)) {
1056 tab[0] = mt.majortype;
1057 tab[1] = mt.subtype;
1058 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, MERIT_UNLIKELY, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
1064 IPin_Release(ppinreader);
1066 IEnumMoniker_Release(pEnumMoniker);
1068 IFilterGraph2_RemoveFilter(iface, preader);
1069 IBaseFilter_Release(preader);
1074 hr = VFW_E_CANNOT_RENDER;
1075 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
1080 hr = GetFilterInfo(pMoniker, &clsid, &var);
1081 IMoniker_Release(pMoniker);
1083 ERR("Unable to retrieve filter info (%x)\n", hr);
1087 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&psplitter);
1089 ERR("Unable to create filter (%x), trying next one\n", hr);
1093 hr = IFilterGraph2_AddFilter(iface, psplitter, V_UNION(&var, bstrVal));
1095 ERR("Unable add filter (%x)\n", hr);
1096 IBaseFilter_Release(psplitter);
1100 /* Connect file source and splitter filters together */
1101 /* Make the splitter analyze incoming data */
1103 hr = IBaseFilter_EnumPins(psplitter, &penumpins);
1104 if (SUCCEEDED(hr)) {
1105 hr = IEnumPins_Next(penumpins, 1, &ppinsplitter, &pin);
1106 IEnumPins_Release(penumpins);
1110 hr = IPin_Connect(ppinreader, ppinsplitter, NULL);
1112 /* Make sure there's some output pins in the filter */
1114 hr = GetInternalConnections(psplitter, ppinsplitter, &ppins, &nb);
1115 if (SUCCEEDED(hr)) {
1117 IPin_Disconnect(ppinreader);
1118 TRACE("No output pins found in filter\n");
1119 hr = VFW_E_CANNOT_RENDER;
1124 IPin_Release(ppinsplitter);
1125 ppinsplitter = NULL;
1127 if (SUCCEEDED(hr)) {
1128 TRACE("Successfully connected to filter\n");
1132 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
1135 CoTaskMemFree(ppins);
1138 IFilterGraph2_RemoveFilter(iface, psplitter);
1139 IBaseFilter_Release(psplitter);
1143 /* Render all output pin of the splitter by calling IFilterGraph2_Render on each of them */
1144 if (SUCCEEDED(hr)) {
1147 TRACE("pins to consider: %d\n", nb);
1148 for(i = 0; i < nb; i++) {
1149 TRACE("Processing pin %d\n", i);
1150 hr = IFilterGraph2_Render(iface, ppins[i]);
1152 ERR("Cannot render pin %p (%x)\n", ppins[i], hr);
1155 IPin_Release(ppins[i]);
1157 CoTaskMemFree(ppins);
1159 hr = (partial ? VFW_S_PARTIAL_RENDER : S_OK);
1162 IPin_Release(ppinreader);
1163 IBaseFilter_Release(preader);
1165 IBaseFilter_Release(psplitter);
1170 static HRESULT WINAPI FilterGraph2_AddSourceFilter(IFilterGraph2 *iface,
1171 LPCWSTR lpcwstrFileName,
1172 LPCWSTR lpcwstrFilterName,
1173 IBaseFilter **ppFilter) {
1174 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1176 IBaseFilter* preader;
1177 IFileSourceFilter* pfile = NULL;
1181 TRACE("(%p/%p)->(%s, %s, %p)\n", This, iface, debugstr_w(lpcwstrFileName), debugstr_w(lpcwstrFilterName), ppFilter);
1183 /* Instantiate a file source filter */
1184 hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&preader);
1186 ERR("Unable to create file source filter (%x)\n", hr);
1190 hr = IFilterGraph2_AddFilter(iface, preader, lpcwstrFilterName);
1192 ERR("Unable add filter (%x)\n", hr);
1193 IBaseFilter_Release(preader);
1197 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1199 ERR("Unable to get IFileSourceInterface (%x)\n", hr);
1203 /* Load the file in the file source filter */
1204 hr = IFileSourceFilter_Load(pfile, lpcwstrFileName, NULL);
1206 ERR("Load (%x)\n", hr);
1210 IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1212 ERR("GetCurFile (%x)\n", hr);
1215 TRACE("File %s\n", debugstr_w(filename));
1216 TRACE("MajorType %s\n", debugstr_guid(&mt.majortype));
1217 TRACE("SubType %s\n", debugstr_guid(&mt.subtype));
1220 *ppFilter = preader;
1221 IFileSourceFilter_Release(pfile);
1227 IFileSourceFilter_Release(pfile);
1228 IFilterGraph2_RemoveFilter(iface, preader);
1229 IBaseFilter_Release(preader);
1234 static HRESULT WINAPI FilterGraph2_SetLogFile(IFilterGraph2 *iface,
1236 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1238 TRACE("(%p/%p)->(%08x): stub !!!\n", This, iface, (DWORD) hFile);
1243 static HRESULT WINAPI FilterGraph2_Abort(IFilterGraph2 *iface) {
1244 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1246 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1251 static HRESULT WINAPI FilterGraph2_ShouldOperationContinue(IFilterGraph2 *iface) {
1252 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1254 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1259 /*** IFilterGraph2 methods ***/
1260 static HRESULT WINAPI FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2 *iface,
1263 LPCWSTR lpcwstrFilterName,
1264 IBaseFilter **ppFilter) {
1265 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1267 TRACE("(%p/%p)->(%p %p %s %p): stub !!!\n", This, iface, pMoniker, pCtx, debugstr_w(lpcwstrFilterName), ppFilter);
1272 static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface,
1274 const AM_MEDIA_TYPE *pmt) {
1275 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1277 TRACE("(%p/%p)->(%p %p): stub !!!\n", This, iface, ppin, pmt);
1282 static HRESULT WINAPI FilterGraph2_RenderEx(IFilterGraph2 *iface,
1286 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1288 TRACE("(%p/%p)->(%p %08x %p): stub !!!\n", This, iface, pPinOut, dwFlags, pvContext);
1294 static const IFilterGraph2Vtbl IFilterGraph2_VTable =
1296 FilterGraph2_QueryInterface,
1297 FilterGraph2_AddRef,
1298 FilterGraph2_Release,
1299 FilterGraph2_AddFilter,
1300 FilterGraph2_RemoveFilter,
1301 FilterGraph2_EnumFilters,
1302 FilterGraph2_FindFilterByName,
1303 FilterGraph2_ConnectDirect,
1304 FilterGraph2_Reconnect,
1305 FilterGraph2_Disconnect,
1306 FilterGraph2_SetDefaultSyncSource,
1307 FilterGraph2_Connect,
1308 FilterGraph2_Render,
1309 FilterGraph2_RenderFile,
1310 FilterGraph2_AddSourceFilter,
1311 FilterGraph2_SetLogFile,
1313 FilterGraph2_ShouldOperationContinue,
1314 FilterGraph2_AddSourceFilterForMoniker,
1315 FilterGraph2_ReconnectEx,
1316 FilterGraph2_RenderEx
1319 /*** IUnknown methods ***/
1320 static HRESULT WINAPI MediaControl_QueryInterface(IMediaControl *iface,
1323 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1325 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1327 return Filtergraph_QueryInterface(This, riid, ppvObj);
1330 static ULONG WINAPI MediaControl_AddRef(IMediaControl *iface) {
1331 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1333 TRACE("(%p/%p)->()\n", This, iface);
1335 return Filtergraph_AddRef(This);
1338 static ULONG WINAPI MediaControl_Release(IMediaControl *iface) {
1339 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1341 TRACE("(%p/%p)->()\n", This, iface);
1343 return Filtergraph_Release(This);
1347 /*** IDispatch methods ***/
1348 static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface,
1350 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1352 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1357 static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface,
1360 ITypeInfo**ppTInfo) {
1361 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1363 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1368 static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface,
1374 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1376 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1381 static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface,
1382 DISPID dispIdMember,
1386 DISPPARAMS*pDispParams,
1388 EXCEPINFO*pExepInfo,
1390 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1392 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);
1397 typedef HRESULT(WINAPI *fnFoundFilter)(IBaseFilter *);
1399 static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundFilter FoundFilter)
1408 TRACE("%p %p\n", pGraph, pOutputPin);
1409 PinInfo.pFilter = NULL;
1411 hr = IPin_ConnectedTo(pOutputPin, &pInputPin);
1415 hr = IPin_QueryPinInfo(pInputPin, &PinInfo);
1417 hr = GetInternalConnections(PinInfo.pFilter, pInputPin, &ppPins, &nb);
1418 IPin_Release(pInputPin);
1425 TRACE("Reached a renderer\n");
1426 /* Count renderers for end of stream notification */
1427 pGraph->nRenderers++;
1431 for(i = 0; i < nb; i++)
1433 /* Explore the graph downstream from this pin
1434 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1435 * several input pins are connected to the same output (a MUX for instance). */
1436 ExploreGraph(pGraph, ppPins[i], FoundFilter);
1437 IPin_Release(ppPins[i]);
1440 CoTaskMemFree(ppPins);
1442 TRACE("Doing stuff with filter %p\n", PinInfo.pFilter);
1443 FoundFilter(PinInfo.pFilter);
1446 if (PinInfo.pFilter) IBaseFilter_Release(PinInfo.pFilter);
1450 static HRESULT WINAPI SendRun(IBaseFilter *pFilter) {
1451 return IBaseFilter_Run(pFilter, 0);
1454 static HRESULT WINAPI SendPause(IBaseFilter *pFilter) {
1455 return IBaseFilter_Pause(pFilter);
1458 static HRESULT WINAPI SendStop(IBaseFilter *pFilter) {
1459 return IBaseFilter_Stop(pFilter);
1462 static HRESULT SendFilterMessage(IMediaControl *iface, fnFoundFilter FoundFilter) {
1463 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1465 IBaseFilter* pfilter;
1471 TRACE("(%p/%p)->()\n", This, iface);
1473 /* Explorer the graph from source filters to renderers, determine renderers
1474 * number and run filters from renderers to source filters */
1475 This->nRenderers = 0;
1476 ResetEvent(This->hEventCompletion);
1478 for(i = 0; i < This->nFilters; i++)
1481 pfilter = This->ppFiltersInGraph[i];
1482 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
1485 ERR("Enum pins failed %x\n", hr);
1488 /* Check if it is a source filter */
1489 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1491 IPin_QueryDirection(pPin, &dir);
1493 if (dir == PINDIR_INPUT)
1501 TRACE("Found a source filter %p\n", pfilter);
1502 IEnumPins_Reset(pEnum);
1503 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1505 /* Explore the graph downstream from this pin */
1506 ExploreGraph(This, pPin, FoundFilter);
1509 FoundFilter(pfilter);
1511 IEnumPins_Release(pEnum);
1517 /*** IMediaControl methods ***/
1518 static HRESULT WINAPI MediaControl_Run(IMediaControl *iface) {
1519 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1520 TRACE("(%p/%p)->()\n", This, iface);
1522 if (This->state == State_Running) return S_OK;
1524 EnterCriticalSection(&This->cs);
1525 SendFilterMessage(iface, SendRun);
1526 This->state = State_Running;
1527 LeaveCriticalSection(&This->cs);
1531 static HRESULT WINAPI MediaControl_Pause(IMediaControl *iface) {
1532 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1533 TRACE("(%p/%p)->()\n", This, iface);
1535 if (This->state == State_Paused) return S_OK;
1537 EnterCriticalSection(&This->cs);
1538 SendFilterMessage(iface, SendPause);
1539 This->state = State_Paused;
1540 LeaveCriticalSection(&This->cs);
1544 static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface) {
1545 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1546 TRACE("(%p/%p)->()\n", This, iface);
1548 if (This->state == State_Stopped) return S_OK;
1550 EnterCriticalSection(&This->cs);
1551 if (This->state == State_Running) SendFilterMessage(iface, SendPause);
1552 SendFilterMessage(iface, SendStop);
1553 This->state = State_Stopped;
1554 LeaveCriticalSection(&This->cs);
1558 static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface,
1560 OAFilterState *pfs) {
1561 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1563 TRACE("(%p/%p)->(%d, %p): semi-stub !!!\n", This, iface, msTimeout, pfs);
1565 EnterCriticalSection(&This->cs);
1569 LeaveCriticalSection(&This->cs);
1574 static HRESULT WINAPI MediaControl_RenderFile(IMediaControl *iface,
1576 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1578 TRACE("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename);
1583 static HRESULT WINAPI MediaControl_AddSourceFilter(IMediaControl *iface,
1585 IDispatch **ppUnk) {
1586 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1588 TRACE("(%p/%p)->(%s (%p), %p): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename, ppUnk);
1593 static HRESULT WINAPI MediaControl_get_FilterCollection(IMediaControl *iface,
1594 IDispatch **ppUnk) {
1595 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1597 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1602 static HRESULT WINAPI MediaControl_get_RegFilterCollection(IMediaControl *iface,
1603 IDispatch **ppUnk) {
1604 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1606 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1611 static HRESULT WINAPI MediaControl_StopWhenReady(IMediaControl *iface) {
1612 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1614 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1620 static const IMediaControlVtbl IMediaControl_VTable =
1622 MediaControl_QueryInterface,
1623 MediaControl_AddRef,
1624 MediaControl_Release,
1625 MediaControl_GetTypeInfoCount,
1626 MediaControl_GetTypeInfo,
1627 MediaControl_GetIDsOfNames,
1628 MediaControl_Invoke,
1632 MediaControl_GetState,
1633 MediaControl_RenderFile,
1634 MediaControl_AddSourceFilter,
1635 MediaControl_get_FilterCollection,
1636 MediaControl_get_RegFilterCollection,
1637 MediaControl_StopWhenReady
1641 /*** IUnknown methods ***/
1642 static HRESULT WINAPI MediaSeeking_QueryInterface(IMediaSeeking *iface,
1645 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1647 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1649 return Filtergraph_QueryInterface(This, riid, ppvObj);
1652 static ULONG WINAPI MediaSeeking_AddRef(IMediaSeeking *iface) {
1653 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1655 TRACE("(%p/%p)->()\n", This, iface);
1657 return Filtergraph_AddRef(This);
1660 static ULONG WINAPI MediaSeeking_Release(IMediaSeeking *iface) {
1661 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1663 TRACE("(%p/%p)->()\n", This, iface);
1665 return Filtergraph_Release(This);
1668 /*** IMediaSeeking methods ***/
1669 static HRESULT WINAPI MediaSeeking_GetCapabilities(IMediaSeeking *iface,
1670 DWORD *pCapabilities) {
1671 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1673 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCapabilities);
1678 static HRESULT WINAPI MediaSeeking_CheckCapabilities(IMediaSeeking *iface,
1679 DWORD *pCapabilities) {
1680 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1682 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCapabilities);
1687 static HRESULT WINAPI MediaSeeking_IsFormatSupported(IMediaSeeking *iface,
1688 const GUID *pFormat) {
1689 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1691 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1696 static HRESULT WINAPI MediaSeeking_QueryPreferredFormat(IMediaSeeking *iface,
1698 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1700 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1705 static HRESULT WINAPI MediaSeeking_GetTimeFormat(IMediaSeeking *iface,
1707 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1709 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1714 static HRESULT WINAPI MediaSeeking_IsUsingTimeFormat(IMediaSeeking *iface,
1715 const GUID *pFormat) {
1716 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1718 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1723 static HRESULT WINAPI MediaSeeking_SetTimeFormat(IMediaSeeking *iface,
1724 const GUID *pFormat) {
1725 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1727 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1732 static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface,
1733 LONGLONG *pDuration) {
1734 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1736 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDuration);
1741 static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface,
1743 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1745 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pStop);
1750 static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface,
1751 LONGLONG *pCurrent) {
1752 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1754 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCurrent);
1759 static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface,
1761 const GUID *pTargetFormat,
1763 const GUID *pSourceFormat) {
1764 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1766 TRACE("(%p/%p)->(%p, %p, 0x%s, %p): stub !!!\n", This, iface, pTarget,
1767 pTargetFormat, wine_dbgstr_longlong(Source), pSourceFormat);
1772 static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface,
1774 DWORD dwCurrentFlags,
1776 DWORD dwStopFlags) {
1777 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1779 TRACE("(%p/%p)->(%p, %08x, %p, %08x): stub !!!\n", This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
1784 static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface,
1787 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1789 TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pCurrent, pStop);
1794 static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface,
1795 LONGLONG *pEarliest,
1796 LONGLONG *pLatest) {
1797 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1799 TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
1804 static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface,
1806 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1808 TRACE("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
1813 static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface,
1815 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1817 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
1822 static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface,
1823 LONGLONG *pllPreroll) {
1824 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1826 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
1832 static const IMediaSeekingVtbl IMediaSeeking_VTable =
1834 MediaSeeking_QueryInterface,
1835 MediaSeeking_AddRef,
1836 MediaSeeking_Release,
1837 MediaSeeking_GetCapabilities,
1838 MediaSeeking_CheckCapabilities,
1839 MediaSeeking_IsFormatSupported,
1840 MediaSeeking_QueryPreferredFormat,
1841 MediaSeeking_GetTimeFormat,
1842 MediaSeeking_IsUsingTimeFormat,
1843 MediaSeeking_SetTimeFormat,
1844 MediaSeeking_GetDuration,
1845 MediaSeeking_GetStopPosition,
1846 MediaSeeking_GetCurrentPosition,
1847 MediaSeeking_ConvertTimeFormat,
1848 MediaSeeking_SetPositions,
1849 MediaSeeking_GetPositions,
1850 MediaSeeking_GetAvailable,
1851 MediaSeeking_SetRate,
1852 MediaSeeking_GetRate,
1853 MediaSeeking_GetPreroll
1856 /*** IUnknown methods ***/
1857 static HRESULT WINAPI MediaPosition_QueryInterface(IMediaPosition* iface, REFIID riid, void** ppvObj){
1858 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
1860 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1862 return Filtergraph_QueryInterface(This, riid, ppvObj);
1865 static ULONG WINAPI MediaPosition_AddRef(IMediaPosition *iface){
1866 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
1868 TRACE("(%p/%p)->()\n", This, iface);
1870 return Filtergraph_AddRef(This);
1873 static ULONG WINAPI MediaPosition_Release(IMediaPosition *iface){
1874 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
1876 TRACE("(%p/%p)->()\n", This, iface);
1878 return Filtergraph_Release(This);
1881 /*** IDispatch methods ***/
1882 static HRESULT WINAPI MediaPosition_GetTypeInfoCount(IMediaPosition *iface, UINT* pctinfo){
1883 FIXME("(%p) stub!\n", iface);
1887 static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo){
1888 FIXME("(%p) stub!\n", iface);
1892 static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition* iface, REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId){
1893 FIXME("(%p) stub!\n", iface);
1897 static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition* iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr){
1898 FIXME("(%p) stub!\n", iface);
1902 /*** IMediaPosition methods ***/
1903 static HRESULT WINAPI MediaPosition_get_Duration(IMediaPosition * iface, REFTIME *plength){
1904 FIXME("(%p)->(%p) stub!\n", iface, plength);
1908 static HRESULT WINAPI MediaPosition_put_CurrentPosition(IMediaPosition * iface, REFTIME llTime){
1909 FIXME("(%p)->(%f) stub!\n", iface, llTime);
1913 static HRESULT WINAPI MediaPosition_get_CurrentPosition(IMediaPosition * iface, REFTIME *pllTime){
1914 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
1918 static HRESULT WINAPI MediaPosition_get_StopTime(IMediaPosition * iface, REFTIME *pllTime){
1919 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
1923 static HRESULT WINAPI MediaPosition_put_StopTime(IMediaPosition * iface, REFTIME llTime){
1924 FIXME("(%p)->(%f) stub!\n", iface, llTime);
1928 static HRESULT WINAPI MediaPosition_get_PrerollTime(IMediaPosition * iface, REFTIME *pllTime){
1929 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
1933 static HRESULT WINAPI MediaPosition_put_PrerollTime(IMediaPosition * iface, REFTIME llTime){
1934 FIXME("(%p)->(%f) stub!\n", iface, llTime);
1938 static HRESULT WINAPI MediaPosition_put_Rate(IMediaPosition * iface, double dRate){
1939 FIXME("(%p)->(%f) stub!\n", iface, dRate);
1943 static HRESULT WINAPI MediaPosition_get_Rate(IMediaPosition * iface, double *pdRate){
1944 FIXME("(%p)->(%p) stub!\n", iface, pdRate);
1948 static HRESULT WINAPI MediaPosition_CanSeekForward(IMediaPosition * iface, LONG *pCanSeekForward){
1949 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekForward);
1953 static HRESULT WINAPI MediaPosition_CanSeekBackward(IMediaPosition * iface, LONG *pCanSeekBackward){
1954 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekBackward);
1959 static const IMediaPositionVtbl IMediaPosition_VTable =
1961 MediaPosition_QueryInterface,
1962 MediaPosition_AddRef,
1963 MediaPosition_Release,
1964 MediaPosition_GetTypeInfoCount,
1965 MediaPosition_GetTypeInfo,
1966 MediaPosition_GetIDsOfNames,
1967 MediaPosition_Invoke,
1968 MediaPosition_get_Duration,
1969 MediaPosition_put_CurrentPosition,
1970 MediaPosition_get_CurrentPosition,
1971 MediaPosition_get_StopTime,
1972 MediaPosition_put_StopTime,
1973 MediaPosition_get_PrerollTime,
1974 MediaPosition_put_PrerollTime,
1975 MediaPosition_put_Rate,
1976 MediaPosition_get_Rate,
1977 MediaPosition_CanSeekForward,
1978 MediaPosition_CanSeekBackward
1981 static HRESULT GetTargetInterface(IFilterGraphImpl* pGraph, REFIID riid, LPVOID* ppvObj)
1983 HRESULT hr = E_NOINTERFACE;
1987 /* Check if the interface type is already registered */
1988 for (entry = 0; entry < pGraph->nItfCacheEntries; entry++)
1989 if (riid == pGraph->ItfCacheEntries[entry].riid)
1991 if (pGraph->ItfCacheEntries[entry].iface)
1993 /* Return the interface if available */
1994 *ppvObj = pGraph->ItfCacheEntries[entry].iface;
2000 if (entry >= MAX_ITF_CACHE_ENTRIES)
2002 FIXME("Not enough space to store interface in the cache\n");
2003 return E_OUTOFMEMORY;
2006 /* Find a filter supporting the requested interface */
2007 for (i = 0; i < pGraph->nFilters; i++)
2009 hr = IBaseFilter_QueryInterface(pGraph->ppFiltersInGraph[i], riid, ppvObj);
2012 pGraph->ItfCacheEntries[entry].riid = riid;
2013 pGraph->ItfCacheEntries[entry].filter = pGraph->ppFiltersInGraph[i];
2014 pGraph->ItfCacheEntries[entry].iface = (IUnknown*)*ppvObj;
2015 if (entry >= pGraph->nItfCacheEntries)
2016 pGraph->nItfCacheEntries++;
2019 if (hr != E_NOINTERFACE)
2026 /*** IUnknown methods ***/
2027 static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface,
2030 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2032 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2034 return Filtergraph_QueryInterface(This, riid, ppvObj);
2037 static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface) {
2038 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2040 TRACE("(%p/%p)->()\n", This, iface);
2042 return Filtergraph_AddRef(This);
2045 static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface) {
2046 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2048 TRACE("(%p/%p)->()\n", This, iface);
2050 return Filtergraph_Release(This);
2053 /*** IDispatch methods ***/
2054 static HRESULT WINAPI BasicAudio_GetTypeInfoCount(IBasicAudio *iface,
2056 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2057 IBasicAudio* pBasicAudio;
2060 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2062 EnterCriticalSection(&This->cs);
2064 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2067 hr = IBasicAudio_GetTypeInfoCount(pBasicAudio, pctinfo);
2069 LeaveCriticalSection(&This->cs);
2074 static HRESULT WINAPI BasicAudio_GetTypeInfo(IBasicAudio *iface,
2077 ITypeInfo**ppTInfo) {
2078 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2079 IBasicAudio* pBasicAudio;
2082 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2084 EnterCriticalSection(&This->cs);
2086 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2089 hr = IBasicAudio_GetTypeInfo(pBasicAudio, iTInfo, lcid, ppTInfo);
2091 LeaveCriticalSection(&This->cs);
2096 static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface,
2102 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2103 IBasicAudio* pBasicAudio;
2106 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2108 EnterCriticalSection(&This->cs);
2110 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2113 hr = IBasicAudio_GetIDsOfNames(pBasicAudio, riid, rgszNames, cNames, lcid, rgDispId);
2115 LeaveCriticalSection(&This->cs);
2120 static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface,
2121 DISPID dispIdMember,
2125 DISPPARAMS*pDispParams,
2127 EXCEPINFO*pExepInfo,
2129 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2130 IBasicAudio* pBasicAudio;
2133 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);
2135 EnterCriticalSection(&This->cs);
2137 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2140 hr = IBasicAudio_Invoke(pBasicAudio, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2142 LeaveCriticalSection(&This->cs);
2147 /*** IBasicAudio methods ***/
2148 static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface,
2150 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2151 IBasicAudio* pBasicAudio;
2154 TRACE("(%p/%p)->(%ld)\n", This, iface, lVolume);
2156 EnterCriticalSection(&This->cs);
2158 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2161 hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
2163 LeaveCriticalSection(&This->cs);
2168 static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface,
2170 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2171 IBasicAudio* pBasicAudio;
2174 TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
2176 EnterCriticalSection(&This->cs);
2178 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2181 hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
2183 LeaveCriticalSection(&This->cs);
2188 static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface,
2190 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2191 IBasicAudio* pBasicAudio;
2194 TRACE("(%p/%p)->(%ld)\n", This, iface, lBalance);
2196 EnterCriticalSection(&This->cs);
2198 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2201 hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
2203 LeaveCriticalSection(&This->cs);
2208 static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface,
2210 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2211 IBasicAudio* pBasicAudio;
2214 TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
2216 EnterCriticalSection(&This->cs);
2218 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2221 hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
2223 LeaveCriticalSection(&This->cs);
2228 static const IBasicAudioVtbl IBasicAudio_VTable =
2230 BasicAudio_QueryInterface,
2233 BasicAudio_GetTypeInfoCount,
2234 BasicAudio_GetTypeInfo,
2235 BasicAudio_GetIDsOfNames,
2237 BasicAudio_put_Volume,
2238 BasicAudio_get_Volume,
2239 BasicAudio_put_Balance,
2240 BasicAudio_get_Balance
2243 /*** IUnknown methods ***/
2244 static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo *iface,
2247 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2249 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2251 return Filtergraph_QueryInterface(This, riid, ppvObj);
2254 static ULONG WINAPI BasicVideo_AddRef(IBasicVideo *iface) {
2255 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2257 TRACE("(%p/%p)->()\n", This, iface);
2259 return Filtergraph_AddRef(This);
2262 static ULONG WINAPI BasicVideo_Release(IBasicVideo *iface) {
2263 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2265 TRACE("(%p/%p)->()\n", This, iface);
2267 return Filtergraph_Release(This);
2270 /*** IDispatch methods ***/
2271 static HRESULT WINAPI BasicVideo_GetTypeInfoCount(IBasicVideo *iface,
2273 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2274 IBasicVideo* pBasicVideo;
2277 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2279 EnterCriticalSection(&This->cs);
2281 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2284 hr = IBasicVideo_GetTypeInfoCount(pBasicVideo, pctinfo);
2286 LeaveCriticalSection(&This->cs);
2291 static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo *iface,
2294 ITypeInfo**ppTInfo) {
2295 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2296 IBasicVideo* pBasicVideo;
2299 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2301 EnterCriticalSection(&This->cs);
2303 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2306 hr = IBasicVideo_GetTypeInfo(pBasicVideo, iTInfo, lcid, ppTInfo);
2308 LeaveCriticalSection(&This->cs);
2313 static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo *iface,
2319 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2320 IBasicVideo* pBasicVideo;
2323 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2325 EnterCriticalSection(&This->cs);
2327 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2330 hr = IBasicVideo_GetIDsOfNames(pBasicVideo, riid, rgszNames, cNames, lcid, rgDispId);
2332 LeaveCriticalSection(&This->cs);
2337 static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo *iface,
2338 DISPID dispIdMember,
2342 DISPPARAMS*pDispParams,
2344 EXCEPINFO*pExepInfo,
2346 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2347 IBasicVideo* pBasicVideo;
2350 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);
2352 EnterCriticalSection(&This->cs);
2354 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2357 hr = IBasicVideo_Invoke(pBasicVideo, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2359 LeaveCriticalSection(&This->cs);
2364 /*** IBasicVideo methods ***/
2365 static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo *iface,
2366 REFTIME *pAvgTimePerFrame) {
2367 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2368 IBasicVideo* pBasicVideo;
2371 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
2373 EnterCriticalSection(&This->cs);
2375 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2378 hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
2380 LeaveCriticalSection(&This->cs);
2385 static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo *iface,
2387 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2388 IBasicVideo* pBasicVideo;
2391 TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
2393 EnterCriticalSection(&This->cs);
2395 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2398 hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
2400 LeaveCriticalSection(&This->cs);
2405 static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo *iface,
2406 long *pBitErrorRate) {
2407 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2408 IBasicVideo* pBasicVideo;
2411 TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
2413 EnterCriticalSection(&This->cs);
2415 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2418 hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
2420 LeaveCriticalSection(&This->cs);
2425 static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo *iface,
2426 long *pVideoWidth) {
2427 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2428 IBasicVideo* pBasicVideo;
2431 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
2433 EnterCriticalSection(&This->cs);
2435 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2438 hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
2440 LeaveCriticalSection(&This->cs);
2445 static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo *iface,
2446 long *pVideoHeight) {
2447 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2448 IBasicVideo* pBasicVideo;
2451 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
2453 EnterCriticalSection(&This->cs);
2455 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2458 hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
2460 LeaveCriticalSection(&This->cs);
2465 static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo *iface,
2467 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2468 IBasicVideo* pBasicVideo;
2471 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
2473 EnterCriticalSection(&This->cs);
2475 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2478 hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
2480 LeaveCriticalSection(&This->cs);
2485 static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo *iface,
2486 long *pSourceLeft) {
2487 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2488 IBasicVideo* pBasicVideo;
2491 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
2493 EnterCriticalSection(&This->cs);
2495 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2498 hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
2500 LeaveCriticalSection(&This->cs);
2505 static HRESULT WINAPI BasicVideo_put_SourceWidth(IBasicVideo *iface,
2507 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2508 IBasicVideo* pBasicVideo;
2511 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
2513 EnterCriticalSection(&This->cs);
2515 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2518 hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
2520 LeaveCriticalSection(&This->cs);
2525 static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo *iface,
2526 long *pSourceWidth) {
2527 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2528 IBasicVideo* pBasicVideo;
2531 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
2533 EnterCriticalSection(&This->cs);
2535 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2538 hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
2540 LeaveCriticalSection(&This->cs);
2545 static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo *iface,
2547 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2548 IBasicVideo* pBasicVideo;
2551 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
2553 EnterCriticalSection(&This->cs);
2555 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2558 hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
2560 LeaveCriticalSection(&This->cs);
2565 static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo *iface,
2567 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2568 IBasicVideo* pBasicVideo;
2571 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
2573 EnterCriticalSection(&This->cs);
2575 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2578 hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
2580 LeaveCriticalSection(&This->cs);
2585 static HRESULT WINAPI BasicVideo_put_SourceHeight(IBasicVideo *iface,
2586 long SourceHeight) {
2587 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2588 IBasicVideo* pBasicVideo;
2591 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
2593 EnterCriticalSection(&This->cs);
2595 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2598 hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
2600 LeaveCriticalSection(&This->cs);
2605 static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo *iface,
2606 long *pSourceHeight) {
2607 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2608 IBasicVideo* pBasicVideo;
2611 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
2613 EnterCriticalSection(&This->cs);
2615 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2618 hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
2620 LeaveCriticalSection(&This->cs);
2625 static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo *iface,
2626 long DestinationLeft) {
2627 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2628 IBasicVideo* pBasicVideo;
2631 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
2633 EnterCriticalSection(&This->cs);
2635 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2638 hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
2640 LeaveCriticalSection(&This->cs);
2645 static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo *iface,
2646 long *pDestinationLeft) {
2647 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2648 IBasicVideo* pBasicVideo;
2651 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
2653 EnterCriticalSection(&This->cs);
2655 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2658 hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
2660 LeaveCriticalSection(&This->cs);
2665 static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo *iface,
2666 long DestinationWidth) {
2667 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2668 IBasicVideo* pBasicVideo;
2671 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
2673 EnterCriticalSection(&This->cs);
2675 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2678 hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
2680 LeaveCriticalSection(&This->cs);
2685 static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo *iface,
2686 long *pDestinationWidth) {
2687 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2688 IBasicVideo* pBasicVideo;
2691 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
2693 EnterCriticalSection(&This->cs);
2695 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2698 hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
2700 LeaveCriticalSection(&This->cs);
2705 static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo *iface,
2706 long DestinationTop) {
2707 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2708 IBasicVideo* pBasicVideo;
2711 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
2713 EnterCriticalSection(&This->cs);
2715 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2718 hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
2720 LeaveCriticalSection(&This->cs);
2725 static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo *iface,
2726 long *pDestinationTop) {
2727 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2728 IBasicVideo* pBasicVideo;
2731 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
2733 EnterCriticalSection(&This->cs);
2735 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2738 hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
2740 LeaveCriticalSection(&This->cs);
2745 static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo *iface,
2746 long DestinationHeight) {
2747 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2748 IBasicVideo* pBasicVideo;
2751 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
2753 EnterCriticalSection(&This->cs);
2755 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2758 hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
2760 LeaveCriticalSection(&This->cs);
2765 static HRESULT WINAPI BasicVideo_get_DestinationHeight(IBasicVideo *iface,
2766 long *pDestinationHeight) {
2767 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2768 IBasicVideo* pBasicVideo;
2771 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
2773 EnterCriticalSection(&This->cs);
2775 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2778 hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
2780 LeaveCriticalSection(&This->cs);
2785 static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo *iface,
2790 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2791 IBasicVideo* pBasicVideo;
2794 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2796 EnterCriticalSection(&This->cs);
2798 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2801 hr = IBasicVideo_SetSourcePosition(pBasicVideo, Left, Top, Width, Height);
2803 LeaveCriticalSection(&This->cs);
2808 static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo *iface,
2813 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2814 IBasicVideo* pBasicVideo;
2817 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2819 EnterCriticalSection(&This->cs);
2821 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2824 hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
2826 LeaveCriticalSection(&This->cs);
2831 static HRESULT WINAPI BasicVideo_SetDefaultSourcePosition(IBasicVideo *iface) {
2832 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2833 IBasicVideo* pBasicVideo;
2836 TRACE("(%p/%p)->()\n", This, iface);
2838 EnterCriticalSection(&This->cs);
2840 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2843 hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
2845 LeaveCriticalSection(&This->cs);
2850 static HRESULT WINAPI BasicVideo_SetDestinationPosition(IBasicVideo *iface,
2855 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2856 IBasicVideo* pBasicVideo;
2859 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2861 EnterCriticalSection(&This->cs);
2863 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2866 hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left, Top, Width, Height);
2868 LeaveCriticalSection(&This->cs);
2873 static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo *iface,
2878 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2879 IBasicVideo* pBasicVideo;
2882 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2884 EnterCriticalSection(&This->cs);
2886 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2889 hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
2891 LeaveCriticalSection(&This->cs);
2896 static HRESULT WINAPI BasicVideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
2897 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2898 IBasicVideo* pBasicVideo;
2901 TRACE("(%p/%p)->()\n", This, iface);
2903 EnterCriticalSection(&This->cs);
2905 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2908 hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
2910 LeaveCriticalSection(&This->cs);
2915 static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo *iface,
2918 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2919 IBasicVideo* pBasicVideo;
2922 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
2924 EnterCriticalSection(&This->cs);
2926 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2929 hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
2931 LeaveCriticalSection(&This->cs);
2936 static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo *iface,
2941 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2942 IBasicVideo* pBasicVideo;
2945 TRACE("(%p/%p)->(%ld, %ld, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
2947 EnterCriticalSection(&This->cs);
2949 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2952 hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex, Entries, pRetrieved, pPalette);
2954 LeaveCriticalSection(&This->cs);
2959 static HRESULT WINAPI BasicVideo_GetCurrentImage(IBasicVideo *iface,
2962 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2963 IBasicVideo* pBasicVideo;
2966 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pBufferSize, pDIBImage);
2968 EnterCriticalSection(&This->cs);
2970 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2973 hr = IBasicVideo_GetCurrentImage(pBasicVideo, pBufferSize, pDIBImage);
2975 LeaveCriticalSection(&This->cs);
2980 static HRESULT WINAPI BasicVideo_IsUsingDefaultSource(IBasicVideo *iface) {
2981 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2982 IBasicVideo* pBasicVideo;
2985 TRACE("(%p/%p)->()\n", This, iface);
2987 EnterCriticalSection(&This->cs);
2989 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2992 hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
2994 LeaveCriticalSection(&This->cs);
2999 static HRESULT WINAPI BasicVideo_IsUsingDefaultDestination(IBasicVideo *iface) {
3000 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
3001 IBasicVideo* pBasicVideo;
3004 TRACE("(%p/%p)->()\n", This, iface);
3006 EnterCriticalSection(&This->cs);
3008 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3011 hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
3013 LeaveCriticalSection(&This->cs);
3019 static const IBasicVideoVtbl IBasicVideo_VTable =
3021 BasicVideo_QueryInterface,
3024 BasicVideo_GetTypeInfoCount,
3025 BasicVideo_GetTypeInfo,
3026 BasicVideo_GetIDsOfNames,
3028 BasicVideo_get_AvgTimePerFrame,
3029 BasicVideo_get_BitRate,
3030 BasicVideo_get_BitErrorRate,
3031 BasicVideo_get_VideoWidth,
3032 BasicVideo_get_VideoHeight,
3033 BasicVideo_put_SourceLeft,
3034 BasicVideo_get_SourceLeft,
3035 BasicVideo_put_SourceWidth,
3036 BasicVideo_get_SourceWidth,
3037 BasicVideo_put_SourceTop,
3038 BasicVideo_get_SourceTop,
3039 BasicVideo_put_SourceHeight,
3040 BasicVideo_get_SourceHeight,
3041 BasicVideo_put_DestinationLeft,
3042 BasicVideo_get_DestinationLeft,
3043 BasicVideo_put_DestinationWidth,
3044 BasicVideo_get_DestinationWidth,
3045 BasicVideo_put_DestinationTop,
3046 BasicVideo_get_DestinationTop,
3047 BasicVideo_put_DestinationHeight,
3048 BasicVideo_get_DestinationHeight,
3049 BasicVideo_SetSourcePosition,
3050 BasicVideo_GetSourcePosition,
3051 BasicVideo_SetDefaultSourcePosition,
3052 BasicVideo_SetDestinationPosition,
3053 BasicVideo_GetDestinationPosition,
3054 BasicVideo_SetDefaultDestinationPosition,
3055 BasicVideo_GetVideoSize,
3056 BasicVideo_GetVideoPaletteEntries,
3057 BasicVideo_GetCurrentImage,
3058 BasicVideo_IsUsingDefaultSource,
3059 BasicVideo_IsUsingDefaultDestination
3063 /*** IUnknown methods ***/
3064 static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface,
3067 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3069 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
3071 return Filtergraph_QueryInterface(This, riid, ppvObj);
3074 static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface) {
3075 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3077 TRACE("(%p/%p)->()\n", This, iface);
3079 return Filtergraph_AddRef(This);
3082 static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface) {
3083 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3085 TRACE("(%p/%p)->()\n", This, iface);
3087 return Filtergraph_Release(This);
3090 /*** IDispatch methods ***/
3091 static HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface,
3093 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3094 IVideoWindow* pVideoWindow;
3097 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
3099 EnterCriticalSection(&This->cs);
3101 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3104 hr = IVideoWindow_GetTypeInfoCount(pVideoWindow, pctinfo);
3106 LeaveCriticalSection(&This->cs);
3111 static HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface,
3114 ITypeInfo**ppTInfo) {
3115 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3116 IVideoWindow* pVideoWindow;
3119 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
3121 EnterCriticalSection(&This->cs);
3123 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3126 hr = IVideoWindow_GetTypeInfo(pVideoWindow, iTInfo, lcid, ppTInfo);
3128 LeaveCriticalSection(&This->cs);
3133 static HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface,
3139 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3140 IVideoWindow* pVideoWindow;
3143 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
3145 EnterCriticalSection(&This->cs);
3147 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3150 hr = IVideoWindow_GetIDsOfNames(pVideoWindow, riid, rgszNames, cNames, lcid, rgDispId);
3152 LeaveCriticalSection(&This->cs);
3157 static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface,
3158 DISPID dispIdMember,
3162 DISPPARAMS*pDispParams,
3164 EXCEPINFO*pExepInfo,
3166 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3167 IVideoWindow* pVideoWindow;
3170 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);
3172 EnterCriticalSection(&This->cs);
3174 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3177 hr = IVideoWindow_Invoke(pVideoWindow, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
3179 LeaveCriticalSection(&This->cs);
3185 /*** IVideoWindow methods ***/
3186 static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface,
3188 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3189 IVideoWindow* pVideoWindow;
3192 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
3194 EnterCriticalSection(&This->cs);
3196 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3199 hr = IVideoWindow_put_Caption(pVideoWindow, strCaption);
3201 LeaveCriticalSection(&This->cs);
3206 static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface,
3208 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3209 IVideoWindow* pVideoWindow;
3212 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
3214 EnterCriticalSection(&This->cs);
3216 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3219 hr = IVideoWindow_get_Caption(pVideoWindow, strCaption);
3221 LeaveCriticalSection(&This->cs);
3226 static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface,
3228 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3229 IVideoWindow* pVideoWindow;
3232 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyle);
3234 EnterCriticalSection(&This->cs);
3236 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3239 hr = IVideoWindow_put_WindowStyle(pVideoWindow, WindowStyle);
3241 LeaveCriticalSection(&This->cs);
3246 static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface,
3247 long *WindowStyle) {
3248 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3249 IVideoWindow* pVideoWindow;
3252 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
3254 EnterCriticalSection(&This->cs);
3256 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3259 hr = IVideoWindow_get_WindowStyle(pVideoWindow, WindowStyle);
3261 LeaveCriticalSection(&This->cs);
3266 static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface,
3267 long WindowStyleEx) {
3268 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3269 IVideoWindow* pVideoWindow;
3272 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
3274 EnterCriticalSection(&This->cs);
3276 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3279 hr = IVideoWindow_put_WindowStyleEx(pVideoWindow, WindowStyleEx);
3281 LeaveCriticalSection(&This->cs);
3286 static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface,
3287 long *WindowStyleEx) {
3288 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3289 IVideoWindow* pVideoWindow;
3292 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
3294 EnterCriticalSection(&This->cs);
3296 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3299 hr = IVideoWindow_get_WindowStyleEx(pVideoWindow, WindowStyleEx);
3301 LeaveCriticalSection(&This->cs);
3306 static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface,
3308 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3309 IVideoWindow* pVideoWindow;
3312 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
3314 EnterCriticalSection(&This->cs);
3316 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3319 hr = IVideoWindow_put_AutoShow(pVideoWindow, AutoShow);
3321 LeaveCriticalSection(&This->cs);
3326 static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface,
3328 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3329 IVideoWindow* pVideoWindow;
3332 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
3334 EnterCriticalSection(&This->cs);
3336 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3339 hr = IVideoWindow_get_AutoShow(pVideoWindow, AutoShow);
3341 LeaveCriticalSection(&This->cs);
3346 static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface,
3348 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3349 IVideoWindow* pVideoWindow;
3352 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowState);
3354 EnterCriticalSection(&This->cs);
3356 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3359 hr = IVideoWindow_put_WindowState(pVideoWindow, WindowState);
3361 LeaveCriticalSection(&This->cs);
3366 static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface,
3367 long *WindowState) {
3368 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3369 IVideoWindow* pVideoWindow;
3372 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
3374 EnterCriticalSection(&This->cs);
3376 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3379 hr = IVideoWindow_get_WindowState(pVideoWindow, WindowState);
3381 LeaveCriticalSection(&This->cs);
3386 static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface,
3387 long BackgroundPalette) {
3388 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3389 IVideoWindow* pVideoWindow;
3392 TRACE("(%p/%p)->(%ld)\n", This, iface, BackgroundPalette);
3394 EnterCriticalSection(&This->cs);
3396 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3399 hr = IVideoWindow_put_BackgroundPalette(pVideoWindow, BackgroundPalette);
3401 LeaveCriticalSection(&This->cs);
3406 static HRESULT WINAPI VideoWindow_get_BackgroundPalette(IVideoWindow *iface,
3407 long *pBackgroundPalette) {
3408 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3409 IVideoWindow* pVideoWindow;
3412 TRACE("(%p/%p)->(%p)\n", This, iface, pBackgroundPalette);
3414 EnterCriticalSection(&This->cs);
3416 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3419 hr = IVideoWindow_get_BackgroundPalette(pVideoWindow, pBackgroundPalette);
3421 LeaveCriticalSection(&This->cs);
3426 static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface,
3428 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3429 IVideoWindow* pVideoWindow;
3432 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
3434 EnterCriticalSection(&This->cs);
3436 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3439 hr = IVideoWindow_put_Visible(pVideoWindow, Visible);
3441 LeaveCriticalSection(&This->cs);
3446 static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface,
3448 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3449 IVideoWindow* pVideoWindow;
3452 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
3454 EnterCriticalSection(&This->cs);
3456 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3459 hr = IVideoWindow_get_Visible(pVideoWindow, pVisible);
3461 LeaveCriticalSection(&This->cs);
3466 static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface,
3468 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3469 IVideoWindow* pVideoWindow;
3472 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
3474 EnterCriticalSection(&This->cs);
3476 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3479 hr = IVideoWindow_put_Left(pVideoWindow, Left);
3481 LeaveCriticalSection(&This->cs);
3486 static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface,
3488 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3489 IVideoWindow* pVideoWindow;
3492 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
3494 EnterCriticalSection(&This->cs);
3496 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3499 hr = IVideoWindow_get_Left(pVideoWindow, pLeft);
3501 LeaveCriticalSection(&This->cs);
3506 static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface,
3508 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3509 IVideoWindow* pVideoWindow;
3512 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
3514 EnterCriticalSection(&This->cs);
3516 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3519 hr = IVideoWindow_put_Width(pVideoWindow, Width);
3521 LeaveCriticalSection(&This->cs);
3526 static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface,
3528 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3529 IVideoWindow* pVideoWindow;
3532 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
3534 EnterCriticalSection(&This->cs);
3536 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3539 hr = IVideoWindow_get_Width(pVideoWindow, pWidth);
3541 LeaveCriticalSection(&This->cs);
3546 static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface,
3548 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3549 IVideoWindow* pVideoWindow;
3552 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
3554 EnterCriticalSection(&This->cs);
3556 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3559 hr = IVideoWindow_put_Top(pVideoWindow, Top);
3561 LeaveCriticalSection(&This->cs);
3566 static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface,
3568 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3569 IVideoWindow* pVideoWindow;
3572 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
3574 EnterCriticalSection(&This->cs);
3576 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3579 hr = IVideoWindow_get_Top(pVideoWindow, pTop);
3581 LeaveCriticalSection(&This->cs);
3586 static HRESULT WINAPI VideoWindow_put_Height(IVideoWindow *iface,
3588 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3589 IVideoWindow* pVideoWindow;
3592 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
3594 EnterCriticalSection(&This->cs);
3596 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3599 hr = IVideoWindow_put_Height(pVideoWindow, Height);
3601 LeaveCriticalSection(&This->cs);
3606 static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface,
3608 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3609 IVideoWindow* pVideoWindow;
3612 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
3614 EnterCriticalSection(&This->cs);
3616 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3619 hr = IVideoWindow_get_Height(pVideoWindow, pHeight);
3621 LeaveCriticalSection(&This->cs);
3626 static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface,
3628 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3629 IVideoWindow* pVideoWindow;
3632 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
3634 EnterCriticalSection(&This->cs);
3636 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3639 hr = IVideoWindow_put_Owner(pVideoWindow, Owner);
3641 LeaveCriticalSection(&This->cs);
3646 static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface,
3648 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3649 IVideoWindow* pVideoWindow;
3652 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
3654 EnterCriticalSection(&This->cs);
3656 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3659 hr = IVideoWindow_get_Owner(pVideoWindow, Owner);
3661 LeaveCriticalSection(&This->cs);
3666 static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface,
3668 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3669 IVideoWindow* pVideoWindow;
3672 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
3674 EnterCriticalSection(&This->cs);
3676 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3679 hr = IVideoWindow_put_MessageDrain(pVideoWindow, Drain);
3681 LeaveCriticalSection(&This->cs);
3686 static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface,
3688 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3689 IVideoWindow* pVideoWindow;
3692 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
3694 EnterCriticalSection(&This->cs);
3696 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3699 hr = IVideoWindow_get_MessageDrain(pVideoWindow, Drain);
3701 LeaveCriticalSection(&This->cs);
3706 static HRESULT WINAPI VideoWindow_get_BorderColor(IVideoWindow *iface,
3708 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3709 IVideoWindow* pVideoWindow;
3712 TRACE("(%p/%p)->(%p)\n", This, iface, Color);
3714 EnterCriticalSection(&This->cs);
3716 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3719 hr = IVideoWindow_get_BorderColor(pVideoWindow, Color);
3721 LeaveCriticalSection(&This->cs);
3726 static HRESULT WINAPI VideoWindow_put_BorderColor(IVideoWindow *iface,
3728 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3729 IVideoWindow* pVideoWindow;
3732 TRACE("(%p/%p)->(%ld)\n", This, iface, Color);
3734 EnterCriticalSection(&This->cs);
3736 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3739 hr = IVideoWindow_put_BorderColor(pVideoWindow, Color);
3741 LeaveCriticalSection(&This->cs);
3746 static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
3747 long *FullScreenMode) {
3748 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3749 IVideoWindow* pVideoWindow;
3752 TRACE("(%p/%p)->(%p)\n", This, iface, FullScreenMode);
3754 EnterCriticalSection(&This->cs);
3756 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3759 hr = IVideoWindow_get_FullScreenMode(pVideoWindow, FullScreenMode);
3761 LeaveCriticalSection(&This->cs);
3766 static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface,
3767 long FullScreenMode) {
3768 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3769 IVideoWindow* pVideoWindow;
3772 TRACE("(%p/%p)->(%ld)\n", This, iface, FullScreenMode);
3774 EnterCriticalSection(&This->cs);
3776 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3779 hr = IVideoWindow_put_FullScreenMode(pVideoWindow, FullScreenMode);
3781 LeaveCriticalSection(&This->cs);
3786 static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface,
3788 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3789 IVideoWindow* pVideoWindow;
3792 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
3794 EnterCriticalSection(&This->cs);
3796 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3799 hr = IVideoWindow_SetWindowForeground(pVideoWindow, Focus);
3801 LeaveCriticalSection(&This->cs);
3806 static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface,
3811 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3812 IVideoWindow* pVideoWindow;
3815 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
3817 EnterCriticalSection(&This->cs);
3819 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3822 hr = IVideoWindow_NotifyOwnerMessage(pVideoWindow, hwnd, uMsg, wParam, lParam);
3824 LeaveCriticalSection(&This->cs);
3829 static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface,
3834 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3835 IVideoWindow* pVideoWindow;
3838 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
3840 EnterCriticalSection(&This->cs);
3842 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3845 hr = IVideoWindow_SetWindowPosition(pVideoWindow, Left, Top, Width, Height);
3847 LeaveCriticalSection(&This->cs);
3852 static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface,
3857 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3858 IVideoWindow* pVideoWindow;
3861 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3863 EnterCriticalSection(&This->cs);
3865 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3868 hr = IVideoWindow_GetWindowPosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
3870 LeaveCriticalSection(&This->cs);
3875 static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface,
3878 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3879 IVideoWindow* pVideoWindow;
3882 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3884 EnterCriticalSection(&This->cs);
3886 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3889 hr = IVideoWindow_GetMinIdealImageSize(pVideoWindow, pWidth, pHeight);
3891 LeaveCriticalSection(&This->cs);
3896 static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface,
3899 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3900 IVideoWindow* pVideoWindow;
3903 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3905 EnterCriticalSection(&This->cs);
3907 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3910 hr = IVideoWindow_GetMaxIdealImageSize(pVideoWindow, pWidth, pHeight);
3912 LeaveCriticalSection(&This->cs);
3917 static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface,
3922 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3923 IVideoWindow* pVideoWindow;
3926 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3928 EnterCriticalSection(&This->cs);
3930 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3933 hr = IVideoWindow_GetRestorePosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
3935 LeaveCriticalSection(&This->cs);
3940 static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface,
3942 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3943 IVideoWindow* pVideoWindow;
3946 TRACE("(%p/%p)->(%ld)\n", This, iface, HideCursor);
3948 EnterCriticalSection(&This->cs);
3950 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3953 hr = IVideoWindow_HideCursor(pVideoWindow, HideCursor);
3955 LeaveCriticalSection(&This->cs);
3960 static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface,
3961 long *CursorHidden) {
3962 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3963 IVideoWindow* pVideoWindow;
3966 TRACE("(%p/%p)->(%p)\n", This, iface, CursorHidden);
3968 EnterCriticalSection(&This->cs);
3970 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3973 hr = IVideoWindow_IsCursorHidden(pVideoWindow, CursorHidden);
3975 LeaveCriticalSection(&This->cs);
3981 static const IVideoWindowVtbl IVideoWindow_VTable =
3983 VideoWindow_QueryInterface,
3985 VideoWindow_Release,
3986 VideoWindow_GetTypeInfoCount,
3987 VideoWindow_GetTypeInfo,
3988 VideoWindow_GetIDsOfNames,
3990 VideoWindow_put_Caption,
3991 VideoWindow_get_Caption,
3992 VideoWindow_put_WindowStyle,
3993 VideoWindow_get_WindowStyle,
3994 VideoWindow_put_WindowStyleEx,
3995 VideoWindow_get_WindowStyleEx,
3996 VideoWindow_put_AutoShow,
3997 VideoWindow_get_AutoShow,
3998 VideoWindow_put_WindowState,
3999 VideoWindow_get_WindowState,
4000 VideoWindow_put_BackgroundPalette,
4001 VideoWindow_get_BackgroundPalette,
4002 VideoWindow_put_Visible,
4003 VideoWindow_get_Visible,
4004 VideoWindow_put_Left,
4005 VideoWindow_get_Left,
4006 VideoWindow_put_Width,
4007 VideoWindow_get_Width,
4008 VideoWindow_put_Top,
4009 VideoWindow_get_Top,
4010 VideoWindow_put_Height,
4011 VideoWindow_get_Height,
4012 VideoWindow_put_Owner,
4013 VideoWindow_get_Owner,
4014 VideoWindow_put_MessageDrain,
4015 VideoWindow_get_MessageDrain,
4016 VideoWindow_get_BorderColor,
4017 VideoWindow_put_BorderColor,
4018 VideoWindow_get_FullScreenMode,
4019 VideoWindow_put_FullScreenMode,
4020 VideoWindow_SetWindowForeground,
4021 VideoWindow_NotifyOwnerMessage,
4022 VideoWindow_SetWindowPosition,
4023 VideoWindow_GetWindowPosition,
4024 VideoWindow_GetMinIdealImageSize,
4025 VideoWindow_GetMaxIdealImageSize,
4026 VideoWindow_GetRestorePosition,
4027 VideoWindow_HideCursor,
4028 VideoWindow_IsCursorHidden
4032 /*** IUnknown methods ***/
4033 static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface,
4036 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4038 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
4040 return Filtergraph_QueryInterface(This, riid, ppvObj);
4043 static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface) {
4044 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4046 TRACE("(%p/%p)->()\n", This, iface);
4048 return Filtergraph_AddRef(This);
4051 static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface) {
4052 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4054 TRACE("(%p/%p)->()\n", This, iface);
4056 return Filtergraph_Release(This);
4059 /*** IDispatch methods ***/
4060 static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface,
4062 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4064 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
4069 static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface,
4072 ITypeInfo**ppTInfo) {
4073 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4075 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
4080 static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface,
4086 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4088 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
4093 static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface,
4094 DISPID dispIdMember,
4098 DISPPARAMS*pDispParams,
4100 EXCEPINFO*pExepInfo,
4102 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4104 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);
4109 /*** IMediaEvent methods ***/
4110 static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface,
4112 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4114 TRACE("(%p/%p)->(%p)\n", This, iface, hEvent);
4116 *hEvent = (OAEVENT)This->evqueue.msg_event;
4121 static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface,
4126 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4129 TRACE("(%p/%p)->(%p, %p, %p, %ld)\n", This, iface, lEventCode, lParam1, lParam2, msTimeout);
4131 if (EventsQueue_GetEvent(&This->evqueue, &evt, msTimeout))
4133 *lEventCode = evt.lEventCode;
4134 *lParam1 = evt.lParam1;
4135 *lParam2 = evt.lParam2;
4143 static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface,
4146 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4148 TRACE("(%p/%p)->(%ld, %p)\n", This, iface, msTimeout, pEvCode);
4150 if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
4152 *pEvCode = This->CompletionStatus;
4160 static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface,
4162 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4164 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4166 if (lEvCode == EC_COMPLETE)
4167 This->HandleEcComplete = FALSE;
4168 else if (lEvCode == EC_REPAINT)
4169 This->HandleEcRepaint = FALSE;
4170 else if (lEvCode == EC_CLOCK_CHANGED)
4171 This->HandleEcClockChanged = FALSE;
4178 static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(IMediaEventEx *iface,
4180 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4182 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4184 if (lEvCode == EC_COMPLETE)
4185 This->HandleEcComplete = TRUE;
4186 else if (lEvCode == EC_REPAINT)
4187 This->HandleEcRepaint = TRUE;
4188 else if (lEvCode == EC_CLOCK_CHANGED)
4189 This->HandleEcClockChanged = TRUE;
4196 static HRESULT WINAPI MediaEvent_FreeEventParams(IMediaEventEx *iface,
4200 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4202 TRACE("(%p/%p)->(%ld, %08lx, %08lx): stub !!!\n", This, iface, lEvCode, lParam1, lParam2);
4207 /*** IMediaEventEx methods ***/
4208 static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
4211 LONG_PTR lInstanceData) {
4212 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4214 TRACE("(%p/%p)->(%08x, %ld, %08lx)\n", This, iface, (DWORD) hwnd, lMsg, lInstanceData);
4216 This->notif.hWnd = (HWND)hwnd;
4217 This->notif.msg = lMsg;
4218 This->notif.instance = (long) lInstanceData;
4223 static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface,
4224 long lNoNotifyFlags) {
4225 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4227 TRACE("(%p/%p)->(%ld)\n", This, iface, lNoNotifyFlags);
4229 if ((lNoNotifyFlags != 0) && (lNoNotifyFlags != 1))
4230 return E_INVALIDARG;
4232 This->notif.disabled = lNoNotifyFlags;
4237 static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface,
4238 long *lplNoNotifyFlags) {
4239 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4241 TRACE("(%p/%p)->(%p)\n", This, iface, lplNoNotifyFlags);
4243 if (!lplNoNotifyFlags)
4246 *lplNoNotifyFlags = This->notif.disabled;
4252 static const IMediaEventExVtbl IMediaEventEx_VTable =
4254 MediaEvent_QueryInterface,
4257 MediaEvent_GetTypeInfoCount,
4258 MediaEvent_GetTypeInfo,
4259 MediaEvent_GetIDsOfNames,
4261 MediaEvent_GetEventHandle,
4262 MediaEvent_GetEvent,
4263 MediaEvent_WaitForCompletion,
4264 MediaEvent_CancelDefaultHandling,
4265 MediaEvent_RestoreDefaultHandling,
4266 MediaEvent_FreeEventParams,
4267 MediaEvent_SetNotifyWindow,
4268 MediaEvent_SetNotifyFlags,
4269 MediaEvent_GetNotifyFlags
4273 static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID riid, LPVOID *ppv)
4275 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4277 return Filtergraph_QueryInterface(This, riid, ppv);
4280 static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
4282 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4284 return Filtergraph_AddRef(This);
4287 static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
4289 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4291 return Filtergraph_Release(This);
4294 static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClassID)
4296 FIXME("(%p): stub\n", pClassID);
4301 static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
4303 FIXME("(): stub\n");
4308 static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
4310 FIXME("(): stub\n");
4315 static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME tStart)
4317 FIXME("(0x%s): stub\n", wine_dbgstr_longlong(tStart));
4322 static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD dwMsTimeout, FILTER_STATE * pState)
4324 FIXME("(%d, %p): stub\n", dwMsTimeout, pState);
4329 static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
4331 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4335 TRACE("(%p/%p)->(%p)\n", iface, This, pClock);
4337 EnterCriticalSection(&This->cs);
4339 for (i = 0;i < This->nFilters;i++)
4341 hr = IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], pClock);
4349 IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], This->refClock);
4354 IReferenceClock_Release(This->refClock);
4355 This->refClock = pClock;
4357 IReferenceClock_AddRef(This->refClock);
4359 if (This->HandleEcClockChanged)
4361 IMediaEventSink *pEventSink;
4364 eshr = IMediaFilter_QueryInterface(iface, &IID_IMediaEventSink, (LPVOID)&pEventSink);
4365 if (SUCCEEDED(eshr))
4367 IMediaEventSink_Notify(pEventSink, EC_CLOCK_CHANGED, 0, 0);
4368 IMediaEventSink_Release(pEventSink);
4373 LeaveCriticalSection(&This->cs);
4378 static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
4380 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4382 TRACE("(%p/%p)->(%p)\n", iface, This, ppClock);
4387 EnterCriticalSection(&This->cs);
4389 *ppClock = This->refClock;
4391 IReferenceClock_AddRef(*ppClock);
4393 LeaveCriticalSection(&This->cs);
4398 static const IMediaFilterVtbl IMediaFilter_VTable =
4400 MediaFilter_QueryInterface,
4402 MediaFilter_Release,
4403 MediaFilter_GetClassID,
4407 MediaFilter_GetState,
4408 MediaFilter_SetSyncSource,
4409 MediaFilter_GetSyncSource
4412 static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID riid, LPVOID *ppv)
4414 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4416 return Filtergraph_QueryInterface(This, riid, ppv);
4419 static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
4421 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4423 return Filtergraph_AddRef(This);
4426 static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
4428 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4430 return Filtergraph_Release(This);
4433 static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, long EventCode, LONG_PTR EventParam1, LONG_PTR EventParam2)
4435 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4438 TRACE("(%p/%p)->(%ld, %ld, %ld)\n", This, iface, EventCode, EventParam1, EventParam2);
4440 /* We need thread safety here, let's use the events queue's one */
4441 EnterCriticalSection(&This->evqueue.msg_crst);
4443 if ((EventCode == EC_COMPLETE) && This->HandleEcComplete)
4445 TRACE("Process EC_COMPLETE notification\n");
4446 if (++This->EcCompleteCount == This->nRenderers)
4448 evt.lEventCode = EC_COMPLETE;
4451 TRACE("Send EC_COMPLETE to app\n");
4452 EventsQueue_PutEvent(&This->evqueue, &evt);
4453 if (!This->notif.disabled && This->notif.hWnd)
4455 TRACE("Send Window message\n");
4456 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4458 This->CompletionStatus = EC_COMPLETE;
4459 SetEvent(This->hEventCompletion);
4462 else if ((EventCode == EC_REPAINT) && This->HandleEcRepaint)
4464 /* FIXME: Not handled yet */
4468 evt.lEventCode = EventCode;
4469 evt.lParam1 = EventParam1;
4470 evt.lParam2 = EventParam2;
4471 EventsQueue_PutEvent(&This->evqueue, &evt);
4472 if (!This->notif.disabled && This->notif.hWnd)
4473 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4476 LeaveCriticalSection(&This->evqueue.msg_crst);
4480 static const IMediaEventSinkVtbl IMediaEventSink_VTable =
4482 MediaEventSink_QueryInterface,
4483 MediaEventSink_AddRef,
4484 MediaEventSink_Release,
4485 MediaEventSink_Notify
4488 static HRESULT WINAPI GraphConfig_QueryInterface(IGraphConfig *iface, REFIID riid, LPVOID *ppv)
4490 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4492 return Filtergraph_QueryInterface(This, riid, ppv);
4495 static ULONG WINAPI GraphConfig_AddRef(IGraphConfig *iface)
4497 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4499 return Filtergraph_AddRef(This);
4502 static ULONG WINAPI GraphConfig_Release(IGraphConfig *iface)
4504 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4506 return Filtergraph_Release(This);
4509 static HRESULT WINAPI GraphConfig_Reconnect(IGraphConfig *iface,
4512 const AM_MEDIA_TYPE* pmtFirstConnection,
4513 IBaseFilter* pUsingFilter,
4517 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4519 FIXME("(%p)->(%p, %p, %p, %p, %p, %x): stub!\n", This, pOutputPin, pInputPin, pmtFirstConnection, pUsingFilter, hAbortEvent, dwFlags);
4524 static HRESULT WINAPI GraphConfig_Reconfigure(IGraphConfig *iface,
4525 IGraphConfigCallback* pCallback,
4530 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4532 FIXME("(%p)->(%p, %p, %x, %p): stub!\n", This, pCallback, pvContext, dwFlags, hAbortEvent);
4537 static HRESULT WINAPI GraphConfig_AddFilterToCache(IGraphConfig *iface,
4538 IBaseFilter* pFilter)
4540 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4542 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4547 static HRESULT WINAPI GraphConfig_EnumCacheFilter(IGraphConfig *iface,
4548 IEnumFilters** pEnum)
4550 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4552 FIXME("(%p)->(%p): stub!\n", This, pEnum);
4557 static HRESULT WINAPI GraphConfig_RemoveFilterFromCache(IGraphConfig *iface,
4558 IBaseFilter* pFilter)
4560 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4562 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4567 static HRESULT WINAPI GraphConfig_GetStartTime(IGraphConfig *iface,
4568 REFERENCE_TIME* prtStart)
4570 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4572 FIXME("(%p)->(%p): stub!\n", This, prtStart);
4577 static HRESULT WINAPI GraphConfig_PushThroughData(IGraphConfig *iface,
4579 IPinConnection* pConnection,
4582 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4584 FIXME("(%p)->(%p, %p, %p): stub!\n", This, pOutputPin, pConnection, hEventAbort);
4589 static HRESULT WINAPI GraphConfig_SetFilterFlags(IGraphConfig *iface,
4590 IBaseFilter* pFilter,
4593 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4595 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
4600 static HRESULT WINAPI GraphConfig_GetFilterFlags(IGraphConfig *iface,
4601 IBaseFilter* pFilter,
4604 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4606 FIXME("(%p)->(%p, %p): stub!\n", This, pFilter, dwFlags);
4611 static HRESULT WINAPI GraphConfig_RemoveFilterEx(IGraphConfig *iface,
4612 IBaseFilter* pFilter,
4615 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4617 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
4622 static const IGraphConfigVtbl IGraphConfig_VTable =
4624 GraphConfig_QueryInterface,
4626 GraphConfig_Release,
4627 GraphConfig_Reconnect,
4628 GraphConfig_Reconfigure,
4629 GraphConfig_AddFilterToCache,
4630 GraphConfig_EnumCacheFilter,
4631 GraphConfig_RemoveFilterFromCache,
4632 GraphConfig_GetStartTime,
4633 GraphConfig_PushThroughData,
4634 GraphConfig_SetFilterFlags,
4635 GraphConfig_GetFilterFlags,
4636 GraphConfig_RemoveFilterEx
4639 static const IUnknownVtbl IInner_VTable =
4641 FilterGraphInner_QueryInterface,
4642 FilterGraphInner_AddRef,
4643 FilterGraphInner_Release
4646 static HRESULT WINAPI Filtergraph_QueryInterface(IFilterGraphImpl *This,
4649 if (This->bAggregatable)
4650 This->bUnkOuterValid = TRUE;
4652 if (This->pUnkOuter)
4654 if (This->bAggregatable)
4655 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
4657 if (IsEqualIID(riid, &IID_IUnknown))
4661 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
4662 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
4663 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
4664 This->bAggregatable = TRUE;
4669 return E_NOINTERFACE;
4672 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
4675 static ULONG WINAPI Filtergraph_AddRef(IFilterGraphImpl *This) {
4676 if (This->pUnkOuter && This->bUnkOuterValid)
4677 return IUnknown_AddRef(This->pUnkOuter);
4678 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
4681 static ULONG WINAPI Filtergraph_Release(IFilterGraphImpl *This) {
4682 if (This->pUnkOuter && This->bUnkOuterValid)
4683 return IUnknown_Release(This->pUnkOuter);
4684 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
4687 /* This is the only function that actually creates a FilterGraph class... */
4688 HRESULT FilterGraph_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4690 IFilterGraphImpl *fimpl;
4693 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
4697 fimpl = CoTaskMemAlloc(sizeof(*fimpl));
4698 fimpl->pUnkOuter = pUnkOuter;
4699 fimpl->bUnkOuterValid = FALSE;
4700 fimpl->bAggregatable = FALSE;
4701 fimpl->IInner_vtbl = &IInner_VTable;
4702 fimpl->IFilterGraph2_vtbl = &IFilterGraph2_VTable;
4703 fimpl->IMediaControl_vtbl = &IMediaControl_VTable;
4704 fimpl->IMediaSeeking_vtbl = &IMediaSeeking_VTable;
4705 fimpl->IBasicAudio_vtbl = &IBasicAudio_VTable;
4706 fimpl->IBasicVideo_vtbl = &IBasicVideo_VTable;
4707 fimpl->IVideoWindow_vtbl = &IVideoWindow_VTable;
4708 fimpl->IMediaEventEx_vtbl = &IMediaEventEx_VTable;
4709 fimpl->IMediaFilter_vtbl = &IMediaFilter_VTable;
4710 fimpl->IMediaEventSink_vtbl = &IMediaEventSink_VTable;
4711 fimpl->IGraphConfig_vtbl = &IGraphConfig_VTable;
4712 fimpl->IMediaPosition_vtbl = &IMediaPosition_VTable;
4714 fimpl->ppFiltersInGraph = NULL;
4715 fimpl->pFilterNames = NULL;
4716 fimpl->nFilters = 0;
4717 fimpl->filterCapacity = 0;
4718 fimpl->nameIndex = 1;
4719 fimpl->refClock = NULL;
4720 fimpl->hEventCompletion = CreateEventW(0, TRUE, FALSE, 0);
4721 fimpl->HandleEcComplete = TRUE;
4722 fimpl->HandleEcRepaint = TRUE;
4723 fimpl->HandleEcClockChanged = TRUE;
4724 fimpl->notif.hWnd = 0;
4725 fimpl->notif.disabled = FALSE;
4726 fimpl->nRenderers = 0;
4727 fimpl->EcCompleteCount = 0;
4728 fimpl->state = State_Stopped;
4729 EventsQueue_Init(&fimpl->evqueue);
4730 InitializeCriticalSection(&fimpl->cs);
4731 fimpl->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IFilterGraphImpl.cs");
4732 fimpl->nItfCacheEntries = 0;
4734 hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&fimpl->pFilterMapper2);
4736 ERR("Unable to create filter mapper (%x)\n", hr);
4744 HRESULT FilterGraphNoThread_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4746 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
4747 return FilterGraph_create(pUnkOuter, ppObj);