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 /* IAMGraphStreams */
171 /* IRegisterServiceProvider */
172 /* IResourceMananger */
173 /* IServiceProvider */
174 /* IVideoFrameStep */
177 IFilterMapper2 * pFilterMapper2;
178 IBaseFilter ** ppFiltersInGraph;
179 LPWSTR * pFilterNames;
183 IReferenceClock *refClock;
185 HANDLE hEventCompletion;
186 int CompletionStatus;
190 int HandleEcComplete;
192 int HandleEcClockChanged;
195 ITF_CACHE_ENTRY ItfCacheEntries[MAX_ITF_CACHE_ENTRIES];
196 int nItfCacheEntries;
200 static HRESULT Filtergraph_QueryInterface(IFilterGraphImpl *This,
203 TRACE("(%p)->(%s (%p), %p)\n", This, debugstr_guid(riid), riid, ppvObj);
205 if (IsEqualGUID(&IID_IUnknown, riid) ||
206 IsEqualGUID(&IID_IFilterGraph, riid) ||
207 IsEqualGUID(&IID_IFilterGraph2, riid) ||
208 IsEqualGUID(&IID_IGraphBuilder, riid)) {
209 *ppvObj = &(This->IFilterGraph2_vtbl);
210 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj);
211 } else if (IsEqualGUID(&IID_IMediaControl, riid)) {
212 *ppvObj = &(This->IMediaControl_vtbl);
213 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj);
214 } else if (IsEqualGUID(&IID_IMediaSeeking, riid)) {
215 *ppvObj = &(This->IMediaSeeking_vtbl);
216 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj);
217 } else if (IsEqualGUID(&IID_IBasicAudio, riid)) {
218 *ppvObj = &(This->IBasicAudio_vtbl);
219 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj);
220 } else if (IsEqualGUID(&IID_IBasicVideo, riid)) {
221 *ppvObj = &(This->IBasicVideo_vtbl);
222 TRACE(" returning IBasicVideo interface (%p)\n", *ppvObj);
223 } else if (IsEqualGUID(&IID_IVideoWindow, riid)) {
224 *ppvObj = &(This->IVideoWindow_vtbl);
225 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj);
226 } else if (IsEqualGUID(&IID_IMediaEvent, riid) ||
227 IsEqualGUID(&IID_IMediaEventEx, riid)) {
228 *ppvObj = &(This->IMediaEventEx_vtbl);
229 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj);
230 } else if (IsEqualGUID(&IID_IMediaFilter, riid) ||
231 IsEqualGUID(&IID_IPersist, riid)) {
232 *ppvObj = &(This->IMediaFilter_vtbl);
233 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj);
234 } else if (IsEqualGUID(&IID_IMediaEventSink, riid)) {
235 *ppvObj = &(This->IMediaEventSink_vtbl);
236 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj);
237 } else if (IsEqualGUID(&IID_IGraphConfig, riid)) {
238 *ppvObj = &(This->IGraphConfig_vtbl);
239 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj);
240 } else if (IsEqualGUID(&IID_IMediaPosition, riid)) {
241 *ppvObj = &(This->IMediaPosition_vtbl);
242 TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj);
245 FIXME("unknown interface %s\n", debugstr_guid(riid));
246 return E_NOINTERFACE;
249 InterlockedIncrement(&This->ref);
253 static ULONG Filtergraph_AddRef(IFilterGraphImpl *This) {
254 ULONG ref = InterlockedIncrement(&This->ref);
256 TRACE("(%p)->(): new ref = %d\n", This, ref);
261 static ULONG Filtergraph_Release(IFilterGraphImpl *This) {
262 ULONG ref = InterlockedDecrement(&This->ref);
264 TRACE("(%p)->(): new ref = %d\n", This, ref);
270 IReferenceClock_Release(This->refClock);
272 for (i = 0; i < This->nFilters; i++)
274 IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], NULL);
275 IBaseFilter_Release(This->ppFiltersInGraph[i]);
277 for (i = 0; i < This->nItfCacheEntries; i++)
279 if (This->ItfCacheEntries[i].iface)
280 IUnknown_Release(This->ItfCacheEntries[i].iface);
282 IFilterMapper2_Release(This->pFilterMapper2);
283 CloseHandle(This->hEventCompletion);
284 EventsQueue_Destroy(&This->evqueue);
285 This->cs.DebugInfo->Spare[0] = 0;
286 DeleteCriticalSection(&This->cs);
287 CoTaskMemFree(This->ppFiltersInGraph);
288 CoTaskMemFree(This->pFilterNames);
295 /*** IUnknown methods ***/
296 static HRESULT WINAPI FilterGraph2_QueryInterface(IFilterGraph2 *iface,
299 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
301 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
302 return Filtergraph_QueryInterface(This, riid, ppvObj);
305 static ULONG WINAPI FilterGraph2_AddRef(IFilterGraph2 *iface) {
306 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
308 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This, iface);
310 return Filtergraph_AddRef(This);
313 static ULONG WINAPI FilterGraph2_Release(IFilterGraph2 *iface) {
314 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
316 TRACE("(%p/%p)->() calling FilterGraph Release\n", This, iface);
318 return Filtergraph_Release(This);
321 /*** IFilterGraph methods ***/
322 static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface,
323 IBaseFilter *pFilter,
325 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
328 WCHAR* wszFilterName = NULL;
329 int duplicate_name = FALSE;
331 TRACE("(%p/%p)->(%p, %s (%p))\n", This, iface, pFilter, debugstr_w(pName), pName);
333 wszFilterName = CoTaskMemAlloc( (pName ? strlenW(pName) + 6 : 5) * sizeof(WCHAR) );
337 /* Check if name already exists */
338 for(i = 0; i < This->nFilters; i++)
339 if (!strcmpW(This->pFilterNames[i], pName))
341 duplicate_name = TRUE;
346 /* If no name given or name already existing, generate one */
347 if (!pName || duplicate_name)
349 static const WCHAR wszFmt1[] = {'%','s',' ','%','0','4','d',0};
350 static const WCHAR wszFmt2[] = {'%','0','4','d',0};
352 for (j = 0; j < 10000 ; j++)
356 sprintfW(wszFilterName, wszFmt1, pName, This->nameIndex);
358 sprintfW(wszFilterName, wszFmt2, This->nameIndex);
359 TRACE("Generated name %s\n", debugstr_w(wszFilterName));
361 /* Check if the generated name already exists */
362 for(i = 0; i < This->nFilters; i++)
363 if (!strcmpW(This->pFilterNames[i], wszFilterName))
366 /* Compute next index and exit if generated name is suitable */
367 if (This->nameIndex++ == 10000)
369 if (i == This->nFilters)
372 /* Unable to find a suitable name */
375 CoTaskMemFree(wszFilterName);
376 return VFW_E_DUPLICATE_NAME;
380 memcpy(wszFilterName, pName, (strlenW(pName) + 1) * sizeof(WCHAR));
382 if (This->nFilters + 1 > This->filterCapacity)
384 int newCapacity = This->filterCapacity ? 2 * This->filterCapacity : 1;
385 IBaseFilter ** ppNewFilters = CoTaskMemAlloc(newCapacity * sizeof(IBaseFilter*));
386 LPWSTR * pNewNames = CoTaskMemAlloc(newCapacity * sizeof(LPWSTR));
387 memcpy(ppNewFilters, This->ppFiltersInGraph, This->nFilters * sizeof(IBaseFilter*));
388 memcpy(pNewNames, This->pFilterNames, This->nFilters * sizeof(LPWSTR));
389 if (!This->filterCapacity)
391 CoTaskMemFree(This->ppFiltersInGraph);
392 CoTaskMemFree(This->pFilterNames);
394 This->ppFiltersInGraph = ppNewFilters;
395 This->pFilterNames = pNewNames;
396 This->filterCapacity = newCapacity;
399 hr = IBaseFilter_JoinFilterGraph(pFilter, (IFilterGraph *)This, wszFilterName);
403 IBaseFilter_AddRef(pFilter);
404 This->ppFiltersInGraph[This->nFilters] = pFilter;
405 This->pFilterNames[This->nFilters] = wszFilterName;
407 IBaseFilter_SetSyncSource(pFilter, This->refClock);
410 CoTaskMemFree(wszFilterName);
412 if (SUCCEEDED(hr) && duplicate_name)
413 return VFW_S_DUPLICATE_NAME;
418 static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface,
419 IBaseFilter *pFilter) {
420 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
424 TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
426 /* FIXME: check graph is stopped */
428 for (i = 0; i < This->nFilters; i++)
430 if (This->ppFiltersInGraph[i] == pFilter)
432 IEnumPins *penumpins;
433 hr = IBaseFilter_EnumPins(pFilter, &penumpins);
436 while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK) {
437 IPin_Disconnect(ppin);
440 IEnumPins_Release(penumpins);
443 hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, This->pFilterNames[i]);
446 IBaseFilter_SetSyncSource(pFilter, NULL);
447 IBaseFilter_Release(pFilter);
448 CoTaskMemFree(This->pFilterNames[i]);
449 memmove(This->ppFiltersInGraph+i, This->ppFiltersInGraph+i+1, sizeof(IBaseFilter*)*(This->nFilters - 1 - i));
450 memmove(This->pFilterNames+i, This->pFilterNames+i+1, sizeof(LPWSTR)*(This->nFilters - 1 - i));
452 /* Invalidate interfaces in the cache */
453 for (i = 0; i < This->nItfCacheEntries; i++)
454 if (pFilter == This->ItfCacheEntries[i].filter)
456 IUnknown_Release(This->ItfCacheEntries[i].iface);
457 This->ItfCacheEntries[i].iface = NULL;
458 This->ItfCacheEntries[i].filter = NULL;
466 return hr; /* FIXME: check this error code */
469 static HRESULT WINAPI FilterGraph2_EnumFilters(IFilterGraph2 *iface,
470 IEnumFilters **ppEnum) {
471 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
473 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
475 return IEnumFiltersImpl_Construct(This->ppFiltersInGraph, This->nFilters, ppEnum);
478 static HRESULT WINAPI FilterGraph2_FindFilterByName(IFilterGraph2 *iface,
480 IBaseFilter **ppFilter) {
481 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
484 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_w(pName), pName, ppFilter);
489 for (i = 0; i < This->nFilters; i++)
491 if (!strcmpW(pName, This->pFilterNames[i]))
493 *ppFilter = This->ppFiltersInGraph[i];
494 IBaseFilter_AddRef(*ppFilter);
500 return VFW_E_NOT_FOUND;
503 /* NOTE: despite the implication, it doesn't matter which
504 * way round you put in the input and output pins */
505 static HRESULT WINAPI FilterGraph2_ConnectDirect(IFilterGraph2 *iface,
508 const AM_MEDIA_TYPE *pmt) {
512 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
514 TRACE("(%p/%p)->(%p, %p, %p)\n", This, iface, ppinIn, ppinOut, pmt);
516 /* FIXME: check pins are in graph */
518 if (TRACE_ON(quartz))
522 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
526 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
527 IBaseFilter_Release(PinInfo.pFilter);
529 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
533 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
534 IBaseFilter_Release(PinInfo.pFilter);
537 hr = IPin_QueryDirection(ppinIn, &dir);
540 if (dir == PINDIR_INPUT)
541 hr = IPin_Connect(ppinOut, ppinIn, pmt);
543 hr = IPin_Connect(ppinIn, ppinOut, pmt);
549 static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface,
551 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
552 IPin *pConnectedTo = NULL;
554 PIN_DIRECTION pindir;
556 IPin_QueryDirection(ppin, &pindir);
557 hr = IPin_ConnectedTo(ppin, &pConnectedTo);
559 TRACE("Querying connected to failed: %x\n", hr);
562 IPin_Disconnect(ppin);
563 IPin_Disconnect(pConnectedTo);
564 if (pindir == PINDIR_INPUT)
565 hr = IPin_Connect(pConnectedTo, ppin, NULL);
567 hr = IPin_Connect(ppin, pConnectedTo, NULL);
568 IPin_Release(pConnectedTo);
570 ERR("Reconnecting pins failed, pins are not connected now..\n");
571 TRACE("(%p->%p) -- %p %p -> %x\n", iface, This, ppin, pConnectedTo, hr);
575 static HRESULT WINAPI FilterGraph2_Disconnect(IFilterGraph2 *iface,
577 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
579 TRACE("(%p/%p)->(%p)\n", This, iface, ppin);
581 return IPin_Disconnect(ppin);
584 static HRESULT WINAPI FilterGraph2_SetDefaultSyncSource(IFilterGraph2 *iface) {
585 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
587 TRACE("(%p/%p)->(): stub !!!\n", iface, This);
592 static HRESULT GetFilterInfo(IMoniker* pMoniker, GUID* pclsid, VARIANT* pvar)
594 static const WCHAR wszClsidName[] = {'C','L','S','I','D',0};
595 static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
596 IPropertyBag * pPropBagCat = NULL;
600 V_VT(pvar) = VT_BSTR;
602 hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
605 hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL);
608 hr = CLSIDFromString(V_UNION(pvar, bstrVal), pclsid);
611 hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL);
614 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid), debugstr_w(V_UNION(pvar, bstrVal)));
617 IPropertyBag_Release(pPropBagCat);
622 static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPin*** pppins, ULONG* pnb)
627 TRACE("(%p, %p, %p, %p)\n", pfilter, pinputpin, pppins, pnb);
628 hr = IPin_QueryInternalConnections(pinputpin, NULL, &nb);
631 } else if (hr == S_FALSE) {
632 *pppins = CoTaskMemAlloc(sizeof(IPin*)*nb);
633 hr = IPin_QueryInternalConnections(pinputpin, *pppins, &nb);
635 ERR("Error (%x)\n", hr);
637 } else if (hr == E_NOTIMPL) {
638 /* Input connected to all outputs */
639 IEnumPins* penumpins;
642 TRACE("E_NOTIMPL\n");
643 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
645 ERR("filter Enumpins failed (%x)\n", hr);
649 /* Count output pins */
650 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
651 PIN_DIRECTION pindir;
652 IPin_QueryDirection(ppin, &pindir);
653 if (pindir == PINDIR_OUTPUT)
657 *pppins = CoTaskMemAlloc(sizeof(IPin*)*i);
658 /* Retrieve output pins */
659 IEnumPins_Reset(penumpins);
661 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
662 PIN_DIRECTION pindir;
663 IPin_QueryDirection(ppin, &pindir);
664 if (pindir == PINDIR_OUTPUT)
665 (*pppins)[i++] = ppin;
669 IEnumPins_Release(penumpins);
672 ERR("Next failed (%x)\n", hr);
675 } else if (FAILED(hr)) {
676 ERR("Cannot get internal connection (%x)\n", hr);
684 /*** IGraphBuilder methods ***/
685 static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface,
688 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
691 IEnumMediaTypes* penummt;
693 IEnumPins* penumpins;
694 IEnumMoniker* pEnumMoniker;
702 TRACE("(%p/%p)->(%p, %p)\n", This, iface, ppinOut, ppinIn);
704 if (TRACE_ON(quartz))
706 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
710 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
711 IBaseFilter_Release(PinInfo.pFilter);
713 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
717 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
718 IBaseFilter_Release(PinInfo.pFilter);
721 /* Try direct connection first */
722 hr = IPin_Connect(ppinOut, ppinIn, NULL);
726 TRACE("Direct connection failed, trying to insert other filters\n");
728 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
732 hr = IBaseFilter_GetClassID(PinInfo.pFilter, &FilterCLSID);
733 IBaseFilter_Release(PinInfo.pFilter);
737 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
738 * filter to the minor mediatype of input pin of the renderer */
739 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
741 ERR("EnumMediaTypes (%x)\n", hr);
745 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
747 ERR("IEnumMediaTypes_Next (%x)\n", hr);
752 ERR("No media type found!\n");
755 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
756 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
758 /* Try to find a suitable filter that can connect to the pin to render */
759 tab[0] = mt->majortype;
760 tab[1] = mt->subtype;
761 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
763 ERR("Unable to enum filters (%x)\n", hr);
767 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
772 IPin* ppinfilter = NULL;
773 IBaseFilter* pfilter = NULL;
775 hr = GetFilterInfo(pMoniker, &clsid, &var);
776 IMoniker_Release(pMoniker);
778 ERR("Unable to retrieve filter info (%x)\n", hr);
782 if (IsEqualGUID(&clsid, &FilterCLSID)) {
783 /* Skip filter (same as the one the output pin belongs to) */
787 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
789 ERR("Unable to create filter (%x), trying next one\n", hr);
793 hr = IFilterGraph2_AddFilter(iface, pfilter, V_UNION(&var, bstrVal));
795 ERR("Unable to add filter (%x)\n", hr);
796 IBaseFilter_Release(pfilter);
801 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
803 ERR("Enumpins (%x)\n", hr);
807 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
808 IEnumPins_Release(penumpins);
811 ERR("Next (%x)\n", hr);
819 hr = IPin_Connect(ppinOut, ppinfilter, NULL);
821 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
824 TRACE("Successfully connected to filter, follow chain...\n");
826 /* Render all output pins of the filter by calling IFilterGraph2_Render on each of them */
827 hr = GetInternalConnections(pfilter, ppinfilter, &ppins, &nb);
832 IPin_Disconnect(ppinOut);
835 TRACE("pins to consider: %d\n", nb);
836 for(i = 0; i < nb; i++) {
837 TRACE("Processing pin %d\n", i);
838 hr = IFilterGraph2_Connect(iface, ppins[i], ppinIn);
840 TRACE("Cannot render pin %p (%x)\n", ppinfilter, hr);
842 IPin_Release(ppins[i]);
843 if (SUCCEEDED(hr)) break;
845 while (++i < nb) IPin_Release(ppins[i]);
846 CoTaskMemFree(ppins);
847 IPin_Release(ppinfilter);
848 IBaseFilter_Release(pfilter);
853 if (ppinfilter) IPin_Release(ppinfilter);
855 IFilterGraph2_RemoveFilter(iface, pfilter);
856 IBaseFilter_Release(pfilter);
860 IEnumMediaTypes_Release(penummt);
866 static HRESULT WINAPI FilterGraph2_Render(IFilterGraph2 *iface,
868 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
869 IEnumMediaTypes* penummt;
874 IEnumMoniker* pEnumMoniker;
879 TRACE("(%p/%p)->(%p)\n", This, iface, ppinOut);
881 if (TRACE_ON(quartz))
885 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
889 TRACE("Filter owning pin => %p\n", PinInfo.pFilter);
890 IBaseFilter_Release(PinInfo.pFilter);
893 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
895 ERR("EnumMediaTypes (%x)\n", hr);
901 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
903 ERR("IEnumMediaTypes_Next (%x)\n", hr);
908 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
909 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
911 /* Try to find a suitable renderer with the same media type */
912 tab[0] = mt->majortype;
914 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL);
916 ERR("Unable to enum filters (%x)\n", hr);
920 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
925 IBaseFilter* pfilter = NULL;
926 IEnumPins* penumpins;
929 hr = GetFilterInfo(pMoniker, &clsid, &var);
930 IMoniker_Release(pMoniker);
932 ERR("Unable to retrieve filter info (%x)\n", hr);
936 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
938 ERR("Unable to create filter (%x), trying next one\n", hr);
942 hr = IFilterGraph2_AddFilter(iface, pfilter, V_UNION(&var, bstrVal));
944 ERR("Unable to add filter (%x)\n", hr);
945 IBaseFilter_Release(pfilter);
950 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
952 ERR("Splitter Enumpins (%x)\n", hr);
955 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
956 IEnumPins_Release(penumpins);
958 ERR("Next (%x)\n", hr);
966 /* Connect the pin to render to the renderer */
967 hr = IFilterGraph2_Connect(iface, ppinOut, ppinfilter);
969 TRACE("Unable to connect to renderer (%x)\n", hr);
970 IPin_Release(ppinfilter);
973 IPin_Release(ppinfilter);
974 IBaseFilter_Release(pfilter);
980 IFilterGraph2_RemoveFilter(iface, pfilter);
981 IBaseFilter_Release(pfilter);
989 IEnumMediaTypes_Release(penummt);
994 static HRESULT WINAPI FilterGraph2_RenderFile(IFilterGraph2 *iface,
996 LPCWSTR lpcwstrPlayList) {
997 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
998 static const WCHAR string[] = {'R','e','a','d','e','r',0};
999 IBaseFilter* preader = NULL;
1000 IBaseFilter* psplitter = NULL;
1001 IPin* ppinreader = NULL;
1002 IPin* ppinsplitter = NULL;
1003 IEnumPins* penumpins;
1006 IEnumMoniker* pEnumMoniker = NULL;
1008 IPin** ppins = NULL;
1011 IFileSourceFilter* pfile = NULL;
1015 TRACE("(%p/%p)->(%s, %s)\n", This, iface, debugstr_w(lpcwstrFile), debugstr_w(lpcwstrPlayList));
1017 if (lpcwstrPlayList != NULL)
1018 return E_INVALIDARG;
1020 hr = IFilterGraph2_AddSourceFilter(iface, lpcwstrFile, string, &preader);
1022 /* Retrieve file media type */
1024 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1025 if (SUCCEEDED(hr)) {
1026 hr = IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1027 IFileSourceFilter_Release(pfile);
1031 hr = IBaseFilter_EnumPins(preader, &penumpins);
1032 if (SUCCEEDED(hr)) {
1033 hr = IEnumPins_Next(penumpins, 1, &ppinreader, &pin);
1034 IEnumPins_Release(penumpins);
1037 if (SUCCEEDED(hr)) {
1038 tab[0] = mt.majortype;
1039 tab[1] = mt.subtype;
1040 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
1046 IPin_Release(ppinreader);
1048 IEnumMoniker_Release(pEnumMoniker);
1050 IFilterGraph2_RemoveFilter(iface, preader);
1051 IBaseFilter_Release(preader);
1056 hr = VFW_E_CANNOT_RENDER;
1057 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
1062 hr = GetFilterInfo(pMoniker, &clsid, &var);
1063 IMoniker_Release(pMoniker);
1065 ERR("Unable to retrieve filter info (%x)\n", hr);
1069 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&psplitter);
1071 ERR("Unable to create filter (%x), trying next one\n", hr);
1075 hr = IFilterGraph2_AddFilter(iface, psplitter, V_UNION(&var, bstrVal));
1077 ERR("Unable add filter (%x)\n", hr);
1078 IBaseFilter_Release(psplitter);
1082 /* Connect file source and splitter filters together */
1083 /* Make the splitter analyze incoming data */
1085 hr = IBaseFilter_EnumPins(psplitter, &penumpins);
1086 if (SUCCEEDED(hr)) {
1087 hr = IEnumPins_Next(penumpins, 1, &ppinsplitter, &pin);
1088 IEnumPins_Release(penumpins);
1092 hr = IPin_Connect(ppinreader, ppinsplitter, NULL);
1094 /* Make sure there's some output pins in the filter */
1096 hr = GetInternalConnections(psplitter, ppinsplitter, &ppins, &nb);
1097 if (SUCCEEDED(hr)) {
1099 IPin_Disconnect(ppinreader);
1100 TRACE("No output pins found in filter\n");
1101 hr = VFW_E_CANNOT_RENDER;
1106 IPin_Release(ppinsplitter);
1107 ppinsplitter = NULL;
1109 if (SUCCEEDED(hr)) {
1110 TRACE("Successfully connected to filter\n");
1114 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
1117 CoTaskMemFree(ppins);
1120 IFilterGraph2_RemoveFilter(iface, psplitter);
1121 IBaseFilter_Release(psplitter);
1125 /* Render all output pin of the splitter by calling IFilterGraph2_Render on each of them */
1126 if (SUCCEEDED(hr)) {
1129 TRACE("pins to consider: %d\n", nb);
1130 for(i = 0; i < nb; i++) {
1131 TRACE("Processing pin %d\n", i);
1132 hr = IFilterGraph2_Render(iface, ppins[i]);
1134 ERR("Cannot render pin %p (%x)\n", ppins[i], hr);
1137 IPin_Release(ppins[i]);
1139 CoTaskMemFree(ppins);
1141 hr = (partial ? VFW_S_PARTIAL_RENDER : S_OK);
1144 IPin_Release(ppinreader);
1145 IBaseFilter_Release(preader);
1147 IBaseFilter_Release(psplitter);
1152 static HRESULT WINAPI FilterGraph2_AddSourceFilter(IFilterGraph2 *iface,
1153 LPCWSTR lpcwstrFileName,
1154 LPCWSTR lpcwstrFilterName,
1155 IBaseFilter **ppFilter) {
1156 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1158 IBaseFilter* preader;
1159 IFileSourceFilter* pfile = NULL;
1163 TRACE("(%p/%p)->(%s, %s, %p)\n", This, iface, debugstr_w(lpcwstrFileName), debugstr_w(lpcwstrFilterName), ppFilter);
1165 /* Instantiate a file source filter */
1166 hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&preader);
1168 ERR("Unable to create file source filter (%x)\n", hr);
1172 hr = IFilterGraph2_AddFilter(iface, preader, lpcwstrFilterName);
1174 ERR("Unable add filter (%x)\n", hr);
1175 IBaseFilter_Release(preader);
1179 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1181 ERR("Unable to get IFileSourceInterface (%x)\n", hr);
1185 /* Load the file in the file source filter */
1186 hr = IFileSourceFilter_Load(pfile, lpcwstrFileName, NULL);
1188 ERR("Load (%x)\n", hr);
1192 IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1194 ERR("GetCurFile (%x)\n", hr);
1197 TRACE("File %s\n", debugstr_w(filename));
1198 TRACE("MajorType %s\n", debugstr_guid(&mt.majortype));
1199 TRACE("SubType %s\n", debugstr_guid(&mt.subtype));
1202 *ppFilter = preader;
1203 IFileSourceFilter_Release(pfile);
1209 IFileSourceFilter_Release(pfile);
1210 IFilterGraph2_RemoveFilter(iface, preader);
1211 IBaseFilter_Release(preader);
1216 static HRESULT WINAPI FilterGraph2_SetLogFile(IFilterGraph2 *iface,
1218 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1220 TRACE("(%p/%p)->(%08x): stub !!!\n", This, iface, (DWORD) hFile);
1225 static HRESULT WINAPI FilterGraph2_Abort(IFilterGraph2 *iface) {
1226 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1228 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1233 static HRESULT WINAPI FilterGraph2_ShouldOperationContinue(IFilterGraph2 *iface) {
1234 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1236 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1241 /*** IFilterGraph2 methods ***/
1242 static HRESULT WINAPI FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2 *iface,
1245 LPCWSTR lpcwstrFilterName,
1246 IBaseFilter **ppFilter) {
1247 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1249 TRACE("(%p/%p)->(%p %p %s %p): stub !!!\n", This, iface, pMoniker, pCtx, debugstr_w(lpcwstrFilterName), ppFilter);
1254 static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface,
1256 const AM_MEDIA_TYPE *pmt) {
1257 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1259 TRACE("(%p/%p)->(%p %p): stub !!!\n", This, iface, ppin, pmt);
1264 static HRESULT WINAPI FilterGraph2_RenderEx(IFilterGraph2 *iface,
1268 ICOM_THIS_MULTI(IFilterGraphImpl, IFilterGraph2_vtbl, iface);
1270 TRACE("(%p/%p)->(%p %08x %p): stub !!!\n", This, iface, pPinOut, dwFlags, pvContext);
1276 static const IFilterGraph2Vtbl IFilterGraph2_VTable =
1278 FilterGraph2_QueryInterface,
1279 FilterGraph2_AddRef,
1280 FilterGraph2_Release,
1281 FilterGraph2_AddFilter,
1282 FilterGraph2_RemoveFilter,
1283 FilterGraph2_EnumFilters,
1284 FilterGraph2_FindFilterByName,
1285 FilterGraph2_ConnectDirect,
1286 FilterGraph2_Reconnect,
1287 FilterGraph2_Disconnect,
1288 FilterGraph2_SetDefaultSyncSource,
1289 FilterGraph2_Connect,
1290 FilterGraph2_Render,
1291 FilterGraph2_RenderFile,
1292 FilterGraph2_AddSourceFilter,
1293 FilterGraph2_SetLogFile,
1295 FilterGraph2_ShouldOperationContinue,
1296 FilterGraph2_AddSourceFilterForMoniker,
1297 FilterGraph2_ReconnectEx,
1298 FilterGraph2_RenderEx
1301 /*** IUnknown methods ***/
1302 static HRESULT WINAPI MediaControl_QueryInterface(IMediaControl *iface,
1305 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1307 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1309 return Filtergraph_QueryInterface(This, riid, ppvObj);
1312 static ULONG WINAPI MediaControl_AddRef(IMediaControl *iface) {
1313 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1315 TRACE("(%p/%p)->()\n", This, iface);
1317 return Filtergraph_AddRef(This);
1320 static ULONG WINAPI MediaControl_Release(IMediaControl *iface) {
1321 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1323 TRACE("(%p/%p)->()\n", This, iface);
1325 return Filtergraph_Release(This);
1329 /*** IDispatch methods ***/
1330 static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface,
1332 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1334 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1339 static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface,
1342 ITypeInfo**ppTInfo) {
1343 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1345 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1350 static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface,
1356 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1358 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1363 static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface,
1364 DISPID dispIdMember,
1368 DISPPARAMS*pDispParams,
1370 EXCEPINFO*pExepInfo,
1372 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1374 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);
1379 typedef HRESULT(WINAPI *fnFoundFilter)(IBaseFilter *);
1381 static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundFilter FoundFilter)
1390 TRACE("%p %p\n", pGraph, pOutputPin);
1391 PinInfo.pFilter = NULL;
1393 hr = IPin_ConnectedTo(pOutputPin, &pInputPin);
1397 hr = IPin_QueryPinInfo(pInputPin, &PinInfo);
1399 hr = GetInternalConnections(PinInfo.pFilter, pInputPin, &ppPins, &nb);
1400 IPin_Release(pInputPin);
1407 TRACE("Reached a renderer\n");
1408 /* Count renderers for end of stream notification */
1409 pGraph->nRenderers++;
1413 for(i = 0; i < nb; i++)
1415 /* Explore the graph downstream from this pin
1416 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1417 * several input pins are connected to the same output (a MUX for instance). */
1418 ExploreGraph(pGraph, ppPins[i], FoundFilter);
1419 IPin_Release(ppPins[i]);
1422 CoTaskMemFree(ppPins);
1424 TRACE("Doing stuff with filter %p\n", PinInfo.pFilter);
1425 FoundFilter(PinInfo.pFilter);
1428 if (PinInfo.pFilter) IBaseFilter_Release(PinInfo.pFilter);
1432 static HRESULT WINAPI SendRun(IBaseFilter *pFilter) {
1433 return IBaseFilter_Run(pFilter, 0);
1436 static HRESULT WINAPI SendPause(IBaseFilter *pFilter) {
1437 return IBaseFilter_Pause(pFilter);
1440 static HRESULT WINAPI SendStop(IBaseFilter *pFilter) {
1441 return IBaseFilter_Stop(pFilter);
1444 static HRESULT SendFilterMessage(IMediaControl *iface, fnFoundFilter FoundFilter) {
1445 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1447 IBaseFilter* pfilter;
1453 TRACE("(%p/%p)->()\n", This, iface);
1455 /* Explorer the graph from source filters to renderers, determine renderers
1456 * number and run filters from renderers to source filters */
1457 This->nRenderers = 0;
1458 ResetEvent(This->hEventCompletion);
1460 for(i = 0; i < This->nFilters; i++)
1463 pfilter = This->ppFiltersInGraph[i];
1464 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
1467 ERR("Enum pins failed %x\n", hr);
1470 /* Check if it is a source filter */
1471 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1473 IPin_QueryDirection(pPin, &dir);
1475 if (dir == PINDIR_INPUT)
1483 TRACE("Found a source filter %p\n", pfilter);
1484 IEnumPins_Reset(pEnum);
1485 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1487 /* Explore the graph downstream from this pin */
1488 ExploreGraph(This, pPin, FoundFilter);
1491 FoundFilter(pfilter);
1493 IEnumPins_Release(pEnum);
1499 /*** IMediaControl methods ***/
1500 static HRESULT WINAPI MediaControl_Run(IMediaControl *iface) {
1501 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1502 TRACE("(%p/%p)->()\n", This, iface);
1504 if (This->state == State_Running) return S_OK;
1506 EnterCriticalSection(&This->cs);
1507 SendFilterMessage(iface, SendRun);
1508 This->state = State_Running;
1509 LeaveCriticalSection(&This->cs);
1513 static HRESULT WINAPI MediaControl_Pause(IMediaControl *iface) {
1514 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1515 TRACE("(%p/%p)->()\n", This, iface);
1517 if (This->state == State_Paused) return S_OK;
1519 EnterCriticalSection(&This->cs);
1520 SendFilterMessage(iface, SendPause);
1521 This->state = State_Paused;
1522 LeaveCriticalSection(&This->cs);
1526 static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface) {
1527 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1528 TRACE("(%p/%p)->()\n", This, iface);
1530 if (This->state == State_Stopped) return S_OK;
1532 EnterCriticalSection(&This->cs);
1533 if (This->state == State_Running) SendFilterMessage(iface, SendPause);
1534 SendFilterMessage(iface, SendStop);
1535 This->state = State_Stopped;
1536 LeaveCriticalSection(&This->cs);
1540 static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface,
1542 OAFilterState *pfs) {
1543 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1545 TRACE("(%p/%p)->(%d, %p): semi-stub !!!\n", This, iface, msTimeout, pfs);
1547 EnterCriticalSection(&This->cs);
1551 LeaveCriticalSection(&This->cs);
1556 static HRESULT WINAPI MediaControl_RenderFile(IMediaControl *iface,
1558 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1560 TRACE("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename);
1565 static HRESULT WINAPI MediaControl_AddSourceFilter(IMediaControl *iface,
1567 IDispatch **ppUnk) {
1568 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1570 TRACE("(%p/%p)->(%s (%p), %p): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename, ppUnk);
1575 static HRESULT WINAPI MediaControl_get_FilterCollection(IMediaControl *iface,
1576 IDispatch **ppUnk) {
1577 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1579 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1584 static HRESULT WINAPI MediaControl_get_RegFilterCollection(IMediaControl *iface,
1585 IDispatch **ppUnk) {
1586 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1588 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1593 static HRESULT WINAPI MediaControl_StopWhenReady(IMediaControl *iface) {
1594 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1596 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1602 static const IMediaControlVtbl IMediaControl_VTable =
1604 MediaControl_QueryInterface,
1605 MediaControl_AddRef,
1606 MediaControl_Release,
1607 MediaControl_GetTypeInfoCount,
1608 MediaControl_GetTypeInfo,
1609 MediaControl_GetIDsOfNames,
1610 MediaControl_Invoke,
1614 MediaControl_GetState,
1615 MediaControl_RenderFile,
1616 MediaControl_AddSourceFilter,
1617 MediaControl_get_FilterCollection,
1618 MediaControl_get_RegFilterCollection,
1619 MediaControl_StopWhenReady
1623 /*** IUnknown methods ***/
1624 static HRESULT WINAPI MediaSeeking_QueryInterface(IMediaSeeking *iface,
1627 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1629 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1631 return Filtergraph_QueryInterface(This, riid, ppvObj);
1634 static ULONG WINAPI MediaSeeking_AddRef(IMediaSeeking *iface) {
1635 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1637 TRACE("(%p/%p)->()\n", This, iface);
1639 return Filtergraph_AddRef(This);
1642 static ULONG WINAPI MediaSeeking_Release(IMediaSeeking *iface) {
1643 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1645 TRACE("(%p/%p)->()\n", This, iface);
1647 return Filtergraph_Release(This);
1650 /*** IMediaSeeking methods ***/
1651 static HRESULT WINAPI MediaSeeking_GetCapabilities(IMediaSeeking *iface,
1652 DWORD *pCapabilities) {
1653 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1655 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCapabilities);
1660 static HRESULT WINAPI MediaSeeking_CheckCapabilities(IMediaSeeking *iface,
1661 DWORD *pCapabilities) {
1662 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1664 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCapabilities);
1669 static HRESULT WINAPI MediaSeeking_IsFormatSupported(IMediaSeeking *iface,
1670 const GUID *pFormat) {
1671 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1673 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1678 static HRESULT WINAPI MediaSeeking_QueryPreferredFormat(IMediaSeeking *iface,
1680 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1682 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1687 static HRESULT WINAPI MediaSeeking_GetTimeFormat(IMediaSeeking *iface,
1689 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1691 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1696 static HRESULT WINAPI MediaSeeking_IsUsingTimeFormat(IMediaSeeking *iface,
1697 const GUID *pFormat) {
1698 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1700 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1705 static HRESULT WINAPI MediaSeeking_SetTimeFormat(IMediaSeeking *iface,
1706 const GUID *pFormat) {
1707 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1709 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1714 static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface,
1715 LONGLONG *pDuration) {
1716 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1718 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDuration);
1723 static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface,
1725 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1727 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pStop);
1732 static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface,
1733 LONGLONG *pCurrent) {
1734 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1736 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCurrent);
1741 static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface,
1743 const GUID *pTargetFormat,
1745 const GUID *pSourceFormat) {
1746 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1748 TRACE("(%p/%p)->(%p, %p, 0x%s, %p): stub !!!\n", This, iface, pTarget,
1749 pTargetFormat, wine_dbgstr_longlong(Source), pSourceFormat);
1754 static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface,
1756 DWORD dwCurrentFlags,
1758 DWORD dwStopFlags) {
1759 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1761 TRACE("(%p/%p)->(%p, %08x, %p, %08x): stub !!!\n", This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
1766 static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface,
1769 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1771 TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pCurrent, pStop);
1776 static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface,
1777 LONGLONG *pEarliest,
1778 LONGLONG *pLatest) {
1779 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1781 TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
1786 static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface,
1788 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1790 TRACE("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
1795 static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface,
1797 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1799 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
1804 static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface,
1805 LONGLONG *pllPreroll) {
1806 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1808 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
1814 static const IMediaSeekingVtbl IMediaSeeking_VTable =
1816 MediaSeeking_QueryInterface,
1817 MediaSeeking_AddRef,
1818 MediaSeeking_Release,
1819 MediaSeeking_GetCapabilities,
1820 MediaSeeking_CheckCapabilities,
1821 MediaSeeking_IsFormatSupported,
1822 MediaSeeking_QueryPreferredFormat,
1823 MediaSeeking_GetTimeFormat,
1824 MediaSeeking_IsUsingTimeFormat,
1825 MediaSeeking_SetTimeFormat,
1826 MediaSeeking_GetDuration,
1827 MediaSeeking_GetStopPosition,
1828 MediaSeeking_GetCurrentPosition,
1829 MediaSeeking_ConvertTimeFormat,
1830 MediaSeeking_SetPositions,
1831 MediaSeeking_GetPositions,
1832 MediaSeeking_GetAvailable,
1833 MediaSeeking_SetRate,
1834 MediaSeeking_GetRate,
1835 MediaSeeking_GetPreroll
1838 /*** IUnknown methods ***/
1839 static HRESULT WINAPI MediaPosition_QueryInterface(IMediaPosition* iface, REFIID riid, void** ppvObj){
1840 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
1842 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1844 return Filtergraph_QueryInterface(This, riid, ppvObj);
1847 static ULONG WINAPI MediaPosition_AddRef(IMediaPosition *iface){
1848 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
1850 TRACE("(%p/%p)->()\n", This, iface);
1852 return Filtergraph_AddRef(This);
1855 static ULONG WINAPI MediaPosition_Release(IMediaPosition *iface){
1856 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
1858 TRACE("(%p/%p)->()\n", This, iface);
1860 return Filtergraph_Release(This);
1863 /*** IDispatch methods ***/
1864 static HRESULT WINAPI MediaPosition_GetTypeInfoCount(IMediaPosition *iface, UINT* pctinfo){
1865 FIXME("(%p) stub!\n", iface);
1869 static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo){
1870 FIXME("(%p) stub!\n", iface);
1874 static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition* iface, REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId){
1875 FIXME("(%p) stub!\n", iface);
1879 static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition* iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr){
1880 FIXME("(%p) stub!\n", iface);
1884 /*** IMediaPosition methods ***/
1885 static HRESULT WINAPI MediaPosition_get_Duration(IMediaPosition * iface, REFTIME *plength){
1886 FIXME("(%p)->(%p) stub!\n", iface, plength);
1890 static HRESULT WINAPI MediaPosition_put_CurrentPosition(IMediaPosition * iface, REFTIME llTime){
1891 FIXME("(%p)->(%f) stub!\n", iface, llTime);
1895 static HRESULT WINAPI MediaPosition_get_CurrentPosition(IMediaPosition * iface, REFTIME *pllTime){
1896 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
1900 static HRESULT WINAPI MediaPosition_get_StopTime(IMediaPosition * iface, REFTIME *pllTime){
1901 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
1905 static HRESULT WINAPI MediaPosition_put_StopTime(IMediaPosition * iface, REFTIME llTime){
1906 FIXME("(%p)->(%f) stub!\n", iface, llTime);
1910 static HRESULT WINAPI MediaPosition_get_PrerollTime(IMediaPosition * iface, REFTIME *pllTime){
1911 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
1915 static HRESULT WINAPI MediaPosition_put_PrerollTime(IMediaPosition * iface, REFTIME llTime){
1916 FIXME("(%p)->(%f) stub!\n", iface, llTime);
1920 static HRESULT WINAPI MediaPosition_put_Rate(IMediaPosition * iface, double dRate){
1921 FIXME("(%p)->(%f) stub!\n", iface, dRate);
1925 static HRESULT WINAPI MediaPosition_get_Rate(IMediaPosition * iface, double *pdRate){
1926 FIXME("(%p)->(%p) stub!\n", iface, pdRate);
1930 static HRESULT WINAPI MediaPosition_CanSeekForward(IMediaPosition * iface, LONG *pCanSeekForward){
1931 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekForward);
1935 static HRESULT WINAPI MediaPosition_CanSeekBackward(IMediaPosition * iface, LONG *pCanSeekBackward){
1936 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekBackward);
1941 static const IMediaPositionVtbl IMediaPosition_VTable =
1943 MediaPosition_QueryInterface,
1944 MediaPosition_AddRef,
1945 MediaPosition_Release,
1946 MediaPosition_GetTypeInfoCount,
1947 MediaPosition_GetTypeInfo,
1948 MediaPosition_GetIDsOfNames,
1949 MediaPosition_Invoke,
1950 MediaPosition_get_Duration,
1951 MediaPosition_put_CurrentPosition,
1952 MediaPosition_get_CurrentPosition,
1953 MediaPosition_get_StopTime,
1954 MediaPosition_put_StopTime,
1955 MediaPosition_get_PrerollTime,
1956 MediaPosition_put_PrerollTime,
1957 MediaPosition_put_Rate,
1958 MediaPosition_get_Rate,
1959 MediaPosition_CanSeekForward,
1960 MediaPosition_CanSeekBackward
1963 static HRESULT GetTargetInterface(IFilterGraphImpl* pGraph, REFIID riid, LPVOID* ppvObj)
1965 HRESULT hr = E_NOINTERFACE;
1969 /* Check if the interface type is already registered */
1970 for (entry = 0; entry < pGraph->nItfCacheEntries; entry++)
1971 if (riid == pGraph->ItfCacheEntries[entry].riid)
1973 if (pGraph->ItfCacheEntries[entry].iface)
1975 /* Return the interface if available */
1976 *ppvObj = pGraph->ItfCacheEntries[entry].iface;
1982 if (entry >= MAX_ITF_CACHE_ENTRIES)
1984 FIXME("Not enough space to store interface in the cache\n");
1985 return E_OUTOFMEMORY;
1988 /* Find a filter supporting the requested interface */
1989 for (i = 0; i < pGraph->nFilters; i++)
1991 hr = IBaseFilter_QueryInterface(pGraph->ppFiltersInGraph[i], riid, ppvObj);
1994 pGraph->ItfCacheEntries[entry].riid = riid;
1995 pGraph->ItfCacheEntries[entry].filter = pGraph->ppFiltersInGraph[i];
1996 pGraph->ItfCacheEntries[entry].iface = (IUnknown*)*ppvObj;
1997 if (entry >= pGraph->nItfCacheEntries)
1998 pGraph->nItfCacheEntries++;
2001 if (hr != E_NOINTERFACE)
2008 /*** IUnknown methods ***/
2009 static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface,
2012 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2014 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2016 return Filtergraph_QueryInterface(This, riid, ppvObj);
2019 static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface) {
2020 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2022 TRACE("(%p/%p)->()\n", This, iface);
2024 return Filtergraph_AddRef(This);
2027 static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface) {
2028 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2030 TRACE("(%p/%p)->()\n", This, iface);
2032 return Filtergraph_Release(This);
2035 /*** IDispatch methods ***/
2036 static HRESULT WINAPI BasicAudio_GetTypeInfoCount(IBasicAudio *iface,
2038 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2039 IBasicAudio* pBasicAudio;
2042 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2044 EnterCriticalSection(&This->cs);
2046 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2049 hr = IBasicAudio_GetTypeInfoCount(pBasicAudio, pctinfo);
2051 LeaveCriticalSection(&This->cs);
2056 static HRESULT WINAPI BasicAudio_GetTypeInfo(IBasicAudio *iface,
2059 ITypeInfo**ppTInfo) {
2060 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2061 IBasicAudio* pBasicAudio;
2064 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2066 EnterCriticalSection(&This->cs);
2068 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2071 hr = IBasicAudio_GetTypeInfo(pBasicAudio, iTInfo, lcid, ppTInfo);
2073 LeaveCriticalSection(&This->cs);
2078 static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface,
2084 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2085 IBasicAudio* pBasicAudio;
2088 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2090 EnterCriticalSection(&This->cs);
2092 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2095 hr = IBasicAudio_GetIDsOfNames(pBasicAudio, riid, rgszNames, cNames, lcid, rgDispId);
2097 LeaveCriticalSection(&This->cs);
2102 static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface,
2103 DISPID dispIdMember,
2107 DISPPARAMS*pDispParams,
2109 EXCEPINFO*pExepInfo,
2111 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2112 IBasicAudio* pBasicAudio;
2115 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);
2117 EnterCriticalSection(&This->cs);
2119 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2122 hr = IBasicAudio_Invoke(pBasicAudio, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2124 LeaveCriticalSection(&This->cs);
2129 /*** IBasicAudio methods ***/
2130 static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface,
2132 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2133 IBasicAudio* pBasicAudio;
2136 TRACE("(%p/%p)->(%ld)\n", This, iface, lVolume);
2138 EnterCriticalSection(&This->cs);
2140 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2143 hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
2145 LeaveCriticalSection(&This->cs);
2150 static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface,
2152 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2153 IBasicAudio* pBasicAudio;
2156 TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
2158 EnterCriticalSection(&This->cs);
2160 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2163 hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
2165 LeaveCriticalSection(&This->cs);
2170 static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface,
2172 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2173 IBasicAudio* pBasicAudio;
2176 TRACE("(%p/%p)->(%ld)\n", This, iface, lBalance);
2178 EnterCriticalSection(&This->cs);
2180 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2183 hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
2185 LeaveCriticalSection(&This->cs);
2190 static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface,
2192 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2193 IBasicAudio* pBasicAudio;
2196 TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
2198 EnterCriticalSection(&This->cs);
2200 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2203 hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
2205 LeaveCriticalSection(&This->cs);
2210 static const IBasicAudioVtbl IBasicAudio_VTable =
2212 BasicAudio_QueryInterface,
2215 BasicAudio_GetTypeInfoCount,
2216 BasicAudio_GetTypeInfo,
2217 BasicAudio_GetIDsOfNames,
2219 BasicAudio_put_Volume,
2220 BasicAudio_get_Volume,
2221 BasicAudio_put_Balance,
2222 BasicAudio_get_Balance
2225 /*** IUnknown methods ***/
2226 static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo *iface,
2229 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2231 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2233 return Filtergraph_QueryInterface(This, riid, ppvObj);
2236 static ULONG WINAPI BasicVideo_AddRef(IBasicVideo *iface) {
2237 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2239 TRACE("(%p/%p)->()\n", This, iface);
2241 return Filtergraph_AddRef(This);
2244 static ULONG WINAPI BasicVideo_Release(IBasicVideo *iface) {
2245 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2247 TRACE("(%p/%p)->()\n", This, iface);
2249 return Filtergraph_Release(This);
2252 /*** IDispatch methods ***/
2253 static HRESULT WINAPI BasicVideo_GetTypeInfoCount(IBasicVideo *iface,
2255 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2256 IBasicVideo* pBasicVideo;
2259 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2261 EnterCriticalSection(&This->cs);
2263 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2266 hr = IBasicVideo_GetTypeInfoCount(pBasicVideo, pctinfo);
2268 LeaveCriticalSection(&This->cs);
2273 static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo *iface,
2276 ITypeInfo**ppTInfo) {
2277 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2278 IBasicVideo* pBasicVideo;
2281 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2283 EnterCriticalSection(&This->cs);
2285 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2288 hr = IBasicVideo_GetTypeInfo(pBasicVideo, iTInfo, lcid, ppTInfo);
2290 LeaveCriticalSection(&This->cs);
2295 static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo *iface,
2301 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2302 IBasicVideo* pBasicVideo;
2305 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2307 EnterCriticalSection(&This->cs);
2309 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2312 hr = IBasicVideo_GetIDsOfNames(pBasicVideo, riid, rgszNames, cNames, lcid, rgDispId);
2314 LeaveCriticalSection(&This->cs);
2319 static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo *iface,
2320 DISPID dispIdMember,
2324 DISPPARAMS*pDispParams,
2326 EXCEPINFO*pExepInfo,
2328 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2329 IBasicVideo* pBasicVideo;
2332 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);
2334 EnterCriticalSection(&This->cs);
2336 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2339 hr = IBasicVideo_Invoke(pBasicVideo, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2341 LeaveCriticalSection(&This->cs);
2346 /*** IBasicVideo methods ***/
2347 static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo *iface,
2348 REFTIME *pAvgTimePerFrame) {
2349 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2350 IBasicVideo* pBasicVideo;
2353 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
2355 EnterCriticalSection(&This->cs);
2357 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2360 hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
2362 LeaveCriticalSection(&This->cs);
2367 static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo *iface,
2369 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2370 IBasicVideo* pBasicVideo;
2373 TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
2375 EnterCriticalSection(&This->cs);
2377 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2380 hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
2382 LeaveCriticalSection(&This->cs);
2387 static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo *iface,
2388 long *pBitErrorRate) {
2389 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2390 IBasicVideo* pBasicVideo;
2393 TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
2395 EnterCriticalSection(&This->cs);
2397 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2400 hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
2402 LeaveCriticalSection(&This->cs);
2407 static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo *iface,
2408 long *pVideoWidth) {
2409 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2410 IBasicVideo* pBasicVideo;
2413 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
2415 EnterCriticalSection(&This->cs);
2417 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2420 hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
2422 LeaveCriticalSection(&This->cs);
2427 static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo *iface,
2428 long *pVideoHeight) {
2429 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2430 IBasicVideo* pBasicVideo;
2433 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
2435 EnterCriticalSection(&This->cs);
2437 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2440 hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
2442 LeaveCriticalSection(&This->cs);
2447 static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo *iface,
2449 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2450 IBasicVideo* pBasicVideo;
2453 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
2455 EnterCriticalSection(&This->cs);
2457 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2460 hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
2462 LeaveCriticalSection(&This->cs);
2467 static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo *iface,
2468 long *pSourceLeft) {
2469 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2470 IBasicVideo* pBasicVideo;
2473 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
2475 EnterCriticalSection(&This->cs);
2477 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2480 hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
2482 LeaveCriticalSection(&This->cs);
2487 static HRESULT WINAPI BasicVideo_put_SourceWidth(IBasicVideo *iface,
2489 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2490 IBasicVideo* pBasicVideo;
2493 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
2495 EnterCriticalSection(&This->cs);
2497 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2500 hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
2502 LeaveCriticalSection(&This->cs);
2507 static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo *iface,
2508 long *pSourceWidth) {
2509 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2510 IBasicVideo* pBasicVideo;
2513 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
2515 EnterCriticalSection(&This->cs);
2517 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2520 hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
2522 LeaveCriticalSection(&This->cs);
2527 static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo *iface,
2529 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2530 IBasicVideo* pBasicVideo;
2533 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
2535 EnterCriticalSection(&This->cs);
2537 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2540 hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
2542 LeaveCriticalSection(&This->cs);
2547 static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo *iface,
2549 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2550 IBasicVideo* pBasicVideo;
2553 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
2555 EnterCriticalSection(&This->cs);
2557 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2560 hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
2562 LeaveCriticalSection(&This->cs);
2567 static HRESULT WINAPI BasicVideo_put_SourceHeight(IBasicVideo *iface,
2568 long SourceHeight) {
2569 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2570 IBasicVideo* pBasicVideo;
2573 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
2575 EnterCriticalSection(&This->cs);
2577 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2580 hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
2582 LeaveCriticalSection(&This->cs);
2587 static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo *iface,
2588 long *pSourceHeight) {
2589 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2590 IBasicVideo* pBasicVideo;
2593 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
2595 EnterCriticalSection(&This->cs);
2597 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2600 hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
2602 LeaveCriticalSection(&This->cs);
2607 static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo *iface,
2608 long DestinationLeft) {
2609 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2610 IBasicVideo* pBasicVideo;
2613 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
2615 EnterCriticalSection(&This->cs);
2617 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2620 hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
2622 LeaveCriticalSection(&This->cs);
2627 static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo *iface,
2628 long *pDestinationLeft) {
2629 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2630 IBasicVideo* pBasicVideo;
2633 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
2635 EnterCriticalSection(&This->cs);
2637 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2640 hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
2642 LeaveCriticalSection(&This->cs);
2647 static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo *iface,
2648 long DestinationWidth) {
2649 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2650 IBasicVideo* pBasicVideo;
2653 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
2655 EnterCriticalSection(&This->cs);
2657 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2660 hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
2662 LeaveCriticalSection(&This->cs);
2667 static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo *iface,
2668 long *pDestinationWidth) {
2669 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2670 IBasicVideo* pBasicVideo;
2673 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
2675 EnterCriticalSection(&This->cs);
2677 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2680 hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
2682 LeaveCriticalSection(&This->cs);
2687 static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo *iface,
2688 long DestinationTop) {
2689 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2690 IBasicVideo* pBasicVideo;
2693 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
2695 EnterCriticalSection(&This->cs);
2697 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2700 hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
2702 LeaveCriticalSection(&This->cs);
2707 static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo *iface,
2708 long *pDestinationTop) {
2709 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2710 IBasicVideo* pBasicVideo;
2713 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
2715 EnterCriticalSection(&This->cs);
2717 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2720 hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
2722 LeaveCriticalSection(&This->cs);
2727 static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo *iface,
2728 long DestinationHeight) {
2729 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2730 IBasicVideo* pBasicVideo;
2733 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
2735 EnterCriticalSection(&This->cs);
2737 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2740 hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
2742 LeaveCriticalSection(&This->cs);
2747 static HRESULT WINAPI BasicVideo_get_DestinationHeight(IBasicVideo *iface,
2748 long *pDestinationHeight) {
2749 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2750 IBasicVideo* pBasicVideo;
2753 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
2755 EnterCriticalSection(&This->cs);
2757 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2760 hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
2762 LeaveCriticalSection(&This->cs);
2767 static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo *iface,
2772 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2773 IBasicVideo* pBasicVideo;
2776 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2778 EnterCriticalSection(&This->cs);
2780 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2783 hr = IBasicVideo_SetSourcePosition(pBasicVideo, Left, Top, Width, Height);
2785 LeaveCriticalSection(&This->cs);
2790 static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo *iface,
2795 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2796 IBasicVideo* pBasicVideo;
2799 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2801 EnterCriticalSection(&This->cs);
2803 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2806 hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
2808 LeaveCriticalSection(&This->cs);
2813 static HRESULT WINAPI BasicVideo_SetDefaultSourcePosition(IBasicVideo *iface) {
2814 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2815 IBasicVideo* pBasicVideo;
2818 TRACE("(%p/%p)->()\n", This, iface);
2820 EnterCriticalSection(&This->cs);
2822 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2825 hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
2827 LeaveCriticalSection(&This->cs);
2832 static HRESULT WINAPI BasicVideo_SetDestinationPosition(IBasicVideo *iface,
2837 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2838 IBasicVideo* pBasicVideo;
2841 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2843 EnterCriticalSection(&This->cs);
2845 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2848 hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left, Top, Width, Height);
2850 LeaveCriticalSection(&This->cs);
2855 static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo *iface,
2860 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2861 IBasicVideo* pBasicVideo;
2864 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2866 EnterCriticalSection(&This->cs);
2868 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2871 hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
2873 LeaveCriticalSection(&This->cs);
2878 static HRESULT WINAPI BasicVideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
2879 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2880 IBasicVideo* pBasicVideo;
2883 TRACE("(%p/%p)->()\n", This, iface);
2885 EnterCriticalSection(&This->cs);
2887 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2890 hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
2892 LeaveCriticalSection(&This->cs);
2897 static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo *iface,
2900 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2901 IBasicVideo* pBasicVideo;
2904 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
2906 EnterCriticalSection(&This->cs);
2908 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2911 hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
2913 LeaveCriticalSection(&This->cs);
2918 static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo *iface,
2923 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2924 IBasicVideo* pBasicVideo;
2927 TRACE("(%p/%p)->(%ld, %ld, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
2929 EnterCriticalSection(&This->cs);
2931 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2934 hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex, Entries, pRetrieved, pPalette);
2936 LeaveCriticalSection(&This->cs);
2941 static HRESULT WINAPI BasicVideo_GetCurrentImage(IBasicVideo *iface,
2944 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2945 IBasicVideo* pBasicVideo;
2948 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pBufferSize, pDIBImage);
2950 EnterCriticalSection(&This->cs);
2952 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2955 hr = IBasicVideo_GetCurrentImage(pBasicVideo, pBufferSize, pDIBImage);
2957 LeaveCriticalSection(&This->cs);
2962 static HRESULT WINAPI BasicVideo_IsUsingDefaultSource(IBasicVideo *iface) {
2963 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2964 IBasicVideo* pBasicVideo;
2967 TRACE("(%p/%p)->()\n", This, iface);
2969 EnterCriticalSection(&This->cs);
2971 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2974 hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
2976 LeaveCriticalSection(&This->cs);
2981 static HRESULT WINAPI BasicVideo_IsUsingDefaultDestination(IBasicVideo *iface) {
2982 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2983 IBasicVideo* pBasicVideo;
2986 TRACE("(%p/%p)->()\n", This, iface);
2988 EnterCriticalSection(&This->cs);
2990 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2993 hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
2995 LeaveCriticalSection(&This->cs);
3001 static const IBasicVideoVtbl IBasicVideo_VTable =
3003 BasicVideo_QueryInterface,
3006 BasicVideo_GetTypeInfoCount,
3007 BasicVideo_GetTypeInfo,
3008 BasicVideo_GetIDsOfNames,
3010 BasicVideo_get_AvgTimePerFrame,
3011 BasicVideo_get_BitRate,
3012 BasicVideo_get_BitErrorRate,
3013 BasicVideo_get_VideoWidth,
3014 BasicVideo_get_VideoHeight,
3015 BasicVideo_put_SourceLeft,
3016 BasicVideo_get_SourceLeft,
3017 BasicVideo_put_SourceWidth,
3018 BasicVideo_get_SourceWidth,
3019 BasicVideo_put_SourceTop,
3020 BasicVideo_get_SourceTop,
3021 BasicVideo_put_SourceHeight,
3022 BasicVideo_get_SourceHeight,
3023 BasicVideo_put_DestinationLeft,
3024 BasicVideo_get_DestinationLeft,
3025 BasicVideo_put_DestinationWidth,
3026 BasicVideo_get_DestinationWidth,
3027 BasicVideo_put_DestinationTop,
3028 BasicVideo_get_DestinationTop,
3029 BasicVideo_put_DestinationHeight,
3030 BasicVideo_get_DestinationHeight,
3031 BasicVideo_SetSourcePosition,
3032 BasicVideo_GetSourcePosition,
3033 BasicVideo_SetDefaultSourcePosition,
3034 BasicVideo_SetDestinationPosition,
3035 BasicVideo_GetDestinationPosition,
3036 BasicVideo_SetDefaultDestinationPosition,
3037 BasicVideo_GetVideoSize,
3038 BasicVideo_GetVideoPaletteEntries,
3039 BasicVideo_GetCurrentImage,
3040 BasicVideo_IsUsingDefaultSource,
3041 BasicVideo_IsUsingDefaultDestination
3045 /*** IUnknown methods ***/
3046 static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface,
3049 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3051 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
3053 return Filtergraph_QueryInterface(This, riid, ppvObj);
3056 static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface) {
3057 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3059 TRACE("(%p/%p)->()\n", This, iface);
3061 return Filtergraph_AddRef(This);
3064 static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface) {
3065 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3067 TRACE("(%p/%p)->()\n", This, iface);
3069 return Filtergraph_Release(This);
3072 /*** IDispatch methods ***/
3073 static HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface,
3075 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3076 IVideoWindow* pVideoWindow;
3079 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
3081 EnterCriticalSection(&This->cs);
3083 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3086 hr = IVideoWindow_GetTypeInfoCount(pVideoWindow, pctinfo);
3088 LeaveCriticalSection(&This->cs);
3093 static HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface,
3096 ITypeInfo**ppTInfo) {
3097 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3098 IVideoWindow* pVideoWindow;
3101 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
3103 EnterCriticalSection(&This->cs);
3105 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3108 hr = IVideoWindow_GetTypeInfo(pVideoWindow, iTInfo, lcid, ppTInfo);
3110 LeaveCriticalSection(&This->cs);
3115 static HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface,
3121 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3122 IVideoWindow* pVideoWindow;
3125 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
3127 EnterCriticalSection(&This->cs);
3129 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3132 hr = IVideoWindow_GetIDsOfNames(pVideoWindow, riid, rgszNames, cNames, lcid, rgDispId);
3134 LeaveCriticalSection(&This->cs);
3139 static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface,
3140 DISPID dispIdMember,
3144 DISPPARAMS*pDispParams,
3146 EXCEPINFO*pExepInfo,
3148 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3149 IVideoWindow* pVideoWindow;
3152 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);
3154 EnterCriticalSection(&This->cs);
3156 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3159 hr = IVideoWindow_Invoke(pVideoWindow, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
3161 LeaveCriticalSection(&This->cs);
3167 /*** IVideoWindow methods ***/
3168 static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface,
3170 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3171 IVideoWindow* pVideoWindow;
3174 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
3176 EnterCriticalSection(&This->cs);
3178 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3181 hr = IVideoWindow_put_Caption(pVideoWindow, strCaption);
3183 LeaveCriticalSection(&This->cs);
3188 static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface,
3190 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3191 IVideoWindow* pVideoWindow;
3194 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
3196 EnterCriticalSection(&This->cs);
3198 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3201 hr = IVideoWindow_get_Caption(pVideoWindow, strCaption);
3203 LeaveCriticalSection(&This->cs);
3208 static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface,
3210 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3211 IVideoWindow* pVideoWindow;
3214 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyle);
3216 EnterCriticalSection(&This->cs);
3218 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3221 hr = IVideoWindow_put_WindowStyle(pVideoWindow, WindowStyle);
3223 LeaveCriticalSection(&This->cs);
3228 static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface,
3229 long *WindowStyle) {
3230 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3231 IVideoWindow* pVideoWindow;
3234 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
3236 EnterCriticalSection(&This->cs);
3238 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3241 hr = IVideoWindow_get_WindowStyle(pVideoWindow, WindowStyle);
3243 LeaveCriticalSection(&This->cs);
3248 static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface,
3249 long WindowStyleEx) {
3250 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3251 IVideoWindow* pVideoWindow;
3254 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
3256 EnterCriticalSection(&This->cs);
3258 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3261 hr = IVideoWindow_put_WindowStyleEx(pVideoWindow, WindowStyleEx);
3263 LeaveCriticalSection(&This->cs);
3268 static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface,
3269 long *WindowStyleEx) {
3270 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3271 IVideoWindow* pVideoWindow;
3274 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
3276 EnterCriticalSection(&This->cs);
3278 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3281 hr = IVideoWindow_get_WindowStyleEx(pVideoWindow, WindowStyleEx);
3283 LeaveCriticalSection(&This->cs);
3288 static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface,
3290 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3291 IVideoWindow* pVideoWindow;
3294 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
3296 EnterCriticalSection(&This->cs);
3298 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3301 hr = IVideoWindow_put_AutoShow(pVideoWindow, AutoShow);
3303 LeaveCriticalSection(&This->cs);
3308 static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface,
3310 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3311 IVideoWindow* pVideoWindow;
3314 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
3316 EnterCriticalSection(&This->cs);
3318 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3321 hr = IVideoWindow_get_AutoShow(pVideoWindow, AutoShow);
3323 LeaveCriticalSection(&This->cs);
3328 static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface,
3330 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3331 IVideoWindow* pVideoWindow;
3334 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowState);
3336 EnterCriticalSection(&This->cs);
3338 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3341 hr = IVideoWindow_put_WindowState(pVideoWindow, WindowState);
3343 LeaveCriticalSection(&This->cs);
3348 static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface,
3349 long *WindowState) {
3350 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3351 IVideoWindow* pVideoWindow;
3354 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
3356 EnterCriticalSection(&This->cs);
3358 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3361 hr = IVideoWindow_get_WindowState(pVideoWindow, WindowState);
3363 LeaveCriticalSection(&This->cs);
3368 static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface,
3369 long BackgroundPalette) {
3370 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3371 IVideoWindow* pVideoWindow;
3374 TRACE("(%p/%p)->(%ld)\n", This, iface, BackgroundPalette);
3376 EnterCriticalSection(&This->cs);
3378 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3381 hr = IVideoWindow_put_BackgroundPalette(pVideoWindow, BackgroundPalette);
3383 LeaveCriticalSection(&This->cs);
3388 static HRESULT WINAPI VideoWindow_get_BackgroundPalette(IVideoWindow *iface,
3389 long *pBackgroundPalette) {
3390 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3391 IVideoWindow* pVideoWindow;
3394 TRACE("(%p/%p)->(%p)\n", This, iface, pBackgroundPalette);
3396 EnterCriticalSection(&This->cs);
3398 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3401 hr = IVideoWindow_get_BackgroundPalette(pVideoWindow, pBackgroundPalette);
3403 LeaveCriticalSection(&This->cs);
3408 static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface,
3410 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3411 IVideoWindow* pVideoWindow;
3414 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
3416 EnterCriticalSection(&This->cs);
3418 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3421 hr = IVideoWindow_put_Visible(pVideoWindow, Visible);
3423 LeaveCriticalSection(&This->cs);
3428 static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface,
3430 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3431 IVideoWindow* pVideoWindow;
3434 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
3436 EnterCriticalSection(&This->cs);
3438 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3441 hr = IVideoWindow_get_Visible(pVideoWindow, pVisible);
3443 LeaveCriticalSection(&This->cs);
3448 static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface,
3450 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3451 IVideoWindow* pVideoWindow;
3454 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
3456 EnterCriticalSection(&This->cs);
3458 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3461 hr = IVideoWindow_put_Left(pVideoWindow, Left);
3463 LeaveCriticalSection(&This->cs);
3468 static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface,
3470 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3471 IVideoWindow* pVideoWindow;
3474 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
3476 EnterCriticalSection(&This->cs);
3478 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3481 hr = IVideoWindow_get_Left(pVideoWindow, pLeft);
3483 LeaveCriticalSection(&This->cs);
3488 static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface,
3490 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3491 IVideoWindow* pVideoWindow;
3494 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
3496 EnterCriticalSection(&This->cs);
3498 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3501 hr = IVideoWindow_put_Width(pVideoWindow, Width);
3503 LeaveCriticalSection(&This->cs);
3508 static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface,
3510 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3511 IVideoWindow* pVideoWindow;
3514 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
3516 EnterCriticalSection(&This->cs);
3518 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3521 hr = IVideoWindow_get_Width(pVideoWindow, pWidth);
3523 LeaveCriticalSection(&This->cs);
3528 static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface,
3530 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3531 IVideoWindow* pVideoWindow;
3534 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
3536 EnterCriticalSection(&This->cs);
3538 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3541 hr = IVideoWindow_put_Top(pVideoWindow, Top);
3543 LeaveCriticalSection(&This->cs);
3548 static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface,
3550 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3551 IVideoWindow* pVideoWindow;
3554 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
3556 EnterCriticalSection(&This->cs);
3558 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3561 hr = IVideoWindow_get_Top(pVideoWindow, pTop);
3563 LeaveCriticalSection(&This->cs);
3568 static HRESULT WINAPI VideoWindow_put_Height(IVideoWindow *iface,
3570 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3571 IVideoWindow* pVideoWindow;
3574 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
3576 EnterCriticalSection(&This->cs);
3578 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3581 hr = IVideoWindow_put_Height(pVideoWindow, Height);
3583 LeaveCriticalSection(&This->cs);
3588 static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface,
3590 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3591 IVideoWindow* pVideoWindow;
3594 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
3596 EnterCriticalSection(&This->cs);
3598 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3601 hr = IVideoWindow_get_Height(pVideoWindow, pHeight);
3603 LeaveCriticalSection(&This->cs);
3608 static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface,
3610 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3611 IVideoWindow* pVideoWindow;
3614 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
3616 EnterCriticalSection(&This->cs);
3618 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3621 hr = IVideoWindow_put_Owner(pVideoWindow, Owner);
3623 LeaveCriticalSection(&This->cs);
3628 static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface,
3630 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3631 IVideoWindow* pVideoWindow;
3634 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
3636 EnterCriticalSection(&This->cs);
3638 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3641 hr = IVideoWindow_get_Owner(pVideoWindow, Owner);
3643 LeaveCriticalSection(&This->cs);
3648 static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface,
3650 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3651 IVideoWindow* pVideoWindow;
3654 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
3656 EnterCriticalSection(&This->cs);
3658 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3661 hr = IVideoWindow_put_MessageDrain(pVideoWindow, Drain);
3663 LeaveCriticalSection(&This->cs);
3668 static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface,
3670 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3671 IVideoWindow* pVideoWindow;
3674 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
3676 EnterCriticalSection(&This->cs);
3678 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3681 hr = IVideoWindow_get_MessageDrain(pVideoWindow, Drain);
3683 LeaveCriticalSection(&This->cs);
3688 static HRESULT WINAPI VideoWindow_get_BorderColor(IVideoWindow *iface,
3690 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3691 IVideoWindow* pVideoWindow;
3694 TRACE("(%p/%p)->(%p)\n", This, iface, Color);
3696 EnterCriticalSection(&This->cs);
3698 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3701 hr = IVideoWindow_get_BorderColor(pVideoWindow, Color);
3703 LeaveCriticalSection(&This->cs);
3708 static HRESULT WINAPI VideoWindow_put_BorderColor(IVideoWindow *iface,
3710 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3711 IVideoWindow* pVideoWindow;
3714 TRACE("(%p/%p)->(%ld)\n", This, iface, Color);
3716 EnterCriticalSection(&This->cs);
3718 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3721 hr = IVideoWindow_put_BorderColor(pVideoWindow, Color);
3723 LeaveCriticalSection(&This->cs);
3728 static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
3729 long *FullScreenMode) {
3730 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3731 IVideoWindow* pVideoWindow;
3734 TRACE("(%p/%p)->(%p)\n", This, iface, FullScreenMode);
3736 EnterCriticalSection(&This->cs);
3738 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3741 hr = IVideoWindow_get_FullScreenMode(pVideoWindow, FullScreenMode);
3743 LeaveCriticalSection(&This->cs);
3748 static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface,
3749 long FullScreenMode) {
3750 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3751 IVideoWindow* pVideoWindow;
3754 TRACE("(%p/%p)->(%ld)\n", This, iface, FullScreenMode);
3756 EnterCriticalSection(&This->cs);
3758 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3761 hr = IVideoWindow_put_FullScreenMode(pVideoWindow, FullScreenMode);
3763 LeaveCriticalSection(&This->cs);
3768 static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface,
3770 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3771 IVideoWindow* pVideoWindow;
3774 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
3776 EnterCriticalSection(&This->cs);
3778 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3781 hr = IVideoWindow_SetWindowForeground(pVideoWindow, Focus);
3783 LeaveCriticalSection(&This->cs);
3788 static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface,
3793 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3794 IVideoWindow* pVideoWindow;
3797 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
3799 EnterCriticalSection(&This->cs);
3801 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3804 hr = IVideoWindow_NotifyOwnerMessage(pVideoWindow, hwnd, uMsg, wParam, lParam);
3806 LeaveCriticalSection(&This->cs);
3811 static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface,
3816 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3817 IVideoWindow* pVideoWindow;
3820 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
3822 EnterCriticalSection(&This->cs);
3824 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3827 hr = IVideoWindow_SetWindowPosition(pVideoWindow, Left, Top, Width, Height);
3829 LeaveCriticalSection(&This->cs);
3834 static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface,
3839 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3840 IVideoWindow* pVideoWindow;
3843 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3845 EnterCriticalSection(&This->cs);
3847 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3850 hr = IVideoWindow_GetWindowPosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
3852 LeaveCriticalSection(&This->cs);
3857 static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface,
3860 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3861 IVideoWindow* pVideoWindow;
3864 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3866 EnterCriticalSection(&This->cs);
3868 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3871 hr = IVideoWindow_GetMinIdealImageSize(pVideoWindow, pWidth, pHeight);
3873 LeaveCriticalSection(&This->cs);
3878 static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface,
3881 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3882 IVideoWindow* pVideoWindow;
3885 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3887 EnterCriticalSection(&This->cs);
3889 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3892 hr = IVideoWindow_GetMaxIdealImageSize(pVideoWindow, pWidth, pHeight);
3894 LeaveCriticalSection(&This->cs);
3899 static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface,
3904 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3905 IVideoWindow* pVideoWindow;
3908 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3910 EnterCriticalSection(&This->cs);
3912 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3915 hr = IVideoWindow_GetRestorePosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
3917 LeaveCriticalSection(&This->cs);
3922 static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface,
3924 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3925 IVideoWindow* pVideoWindow;
3928 TRACE("(%p/%p)->(%ld)\n", This, iface, HideCursor);
3930 EnterCriticalSection(&This->cs);
3932 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3935 hr = IVideoWindow_HideCursor(pVideoWindow, HideCursor);
3937 LeaveCriticalSection(&This->cs);
3942 static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface,
3943 long *CursorHidden) {
3944 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3945 IVideoWindow* pVideoWindow;
3948 TRACE("(%p/%p)->(%p)\n", This, iface, CursorHidden);
3950 EnterCriticalSection(&This->cs);
3952 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3955 hr = IVideoWindow_IsCursorHidden(pVideoWindow, CursorHidden);
3957 LeaveCriticalSection(&This->cs);
3963 static const IVideoWindowVtbl IVideoWindow_VTable =
3965 VideoWindow_QueryInterface,
3967 VideoWindow_Release,
3968 VideoWindow_GetTypeInfoCount,
3969 VideoWindow_GetTypeInfo,
3970 VideoWindow_GetIDsOfNames,
3972 VideoWindow_put_Caption,
3973 VideoWindow_get_Caption,
3974 VideoWindow_put_WindowStyle,
3975 VideoWindow_get_WindowStyle,
3976 VideoWindow_put_WindowStyleEx,
3977 VideoWindow_get_WindowStyleEx,
3978 VideoWindow_put_AutoShow,
3979 VideoWindow_get_AutoShow,
3980 VideoWindow_put_WindowState,
3981 VideoWindow_get_WindowState,
3982 VideoWindow_put_BackgroundPalette,
3983 VideoWindow_get_BackgroundPalette,
3984 VideoWindow_put_Visible,
3985 VideoWindow_get_Visible,
3986 VideoWindow_put_Left,
3987 VideoWindow_get_Left,
3988 VideoWindow_put_Width,
3989 VideoWindow_get_Width,
3990 VideoWindow_put_Top,
3991 VideoWindow_get_Top,
3992 VideoWindow_put_Height,
3993 VideoWindow_get_Height,
3994 VideoWindow_put_Owner,
3995 VideoWindow_get_Owner,
3996 VideoWindow_put_MessageDrain,
3997 VideoWindow_get_MessageDrain,
3998 VideoWindow_get_BorderColor,
3999 VideoWindow_put_BorderColor,
4000 VideoWindow_get_FullScreenMode,
4001 VideoWindow_put_FullScreenMode,
4002 VideoWindow_SetWindowForeground,
4003 VideoWindow_NotifyOwnerMessage,
4004 VideoWindow_SetWindowPosition,
4005 VideoWindow_GetWindowPosition,
4006 VideoWindow_GetMinIdealImageSize,
4007 VideoWindow_GetMaxIdealImageSize,
4008 VideoWindow_GetRestorePosition,
4009 VideoWindow_HideCursor,
4010 VideoWindow_IsCursorHidden
4014 /*** IUnknown methods ***/
4015 static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface,
4018 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4020 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
4022 return Filtergraph_QueryInterface(This, riid, ppvObj);
4025 static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface) {
4026 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4028 TRACE("(%p/%p)->()\n", This, iface);
4030 return Filtergraph_AddRef(This);
4033 static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface) {
4034 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4036 TRACE("(%p/%p)->()\n", This, iface);
4038 return Filtergraph_Release(This);
4041 /*** IDispatch methods ***/
4042 static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface,
4044 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4046 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
4051 static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface,
4054 ITypeInfo**ppTInfo) {
4055 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4057 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
4062 static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface,
4068 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4070 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
4075 static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface,
4076 DISPID dispIdMember,
4080 DISPPARAMS*pDispParams,
4082 EXCEPINFO*pExepInfo,
4084 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4086 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);
4091 /*** IMediaEvent methods ***/
4092 static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface,
4094 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4096 TRACE("(%p/%p)->(%p)\n", This, iface, hEvent);
4098 *hEvent = (OAEVENT)This->evqueue.msg_event;
4103 static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface,
4108 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4111 TRACE("(%p/%p)->(%p, %p, %p, %ld)\n", This, iface, lEventCode, lParam1, lParam2, msTimeout);
4113 if (EventsQueue_GetEvent(&This->evqueue, &evt, msTimeout))
4115 *lEventCode = evt.lEventCode;
4116 *lParam1 = evt.lParam1;
4117 *lParam2 = evt.lParam2;
4125 static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface,
4128 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4130 TRACE("(%p/%p)->(%ld, %p)\n", This, iface, msTimeout, pEvCode);
4132 if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
4134 *pEvCode = This->CompletionStatus;
4142 static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface,
4144 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4146 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4148 if (lEvCode == EC_COMPLETE)
4149 This->HandleEcComplete = FALSE;
4150 else if (lEvCode == EC_REPAINT)
4151 This->HandleEcRepaint = FALSE;
4152 else if (lEvCode == EC_CLOCK_CHANGED)
4153 This->HandleEcClockChanged = FALSE;
4160 static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(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 = TRUE;
4168 else if (lEvCode == EC_REPAINT)
4169 This->HandleEcRepaint = TRUE;
4170 else if (lEvCode == EC_CLOCK_CHANGED)
4171 This->HandleEcClockChanged = TRUE;
4178 static HRESULT WINAPI MediaEvent_FreeEventParams(IMediaEventEx *iface,
4182 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4184 TRACE("(%p/%p)->(%ld, %08lx, %08lx): stub !!!\n", This, iface, lEvCode, lParam1, lParam2);
4189 /*** IMediaEventEx methods ***/
4190 static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
4193 LONG_PTR lInstanceData) {
4194 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4196 TRACE("(%p/%p)->(%08x, %ld, %08lx)\n", This, iface, (DWORD) hwnd, lMsg, lInstanceData);
4198 This->notif.hWnd = (HWND)hwnd;
4199 This->notif.msg = lMsg;
4200 This->notif.instance = (long) lInstanceData;
4205 static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface,
4206 long lNoNotifyFlags) {
4207 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4209 TRACE("(%p/%p)->(%ld)\n", This, iface, lNoNotifyFlags);
4211 if ((lNoNotifyFlags != 0) && (lNoNotifyFlags != 1))
4212 return E_INVALIDARG;
4214 This->notif.disabled = lNoNotifyFlags;
4219 static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface,
4220 long *lplNoNotifyFlags) {
4221 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4223 TRACE("(%p/%p)->(%p)\n", This, iface, lplNoNotifyFlags);
4225 if (!lplNoNotifyFlags)
4228 *lplNoNotifyFlags = This->notif.disabled;
4234 static const IMediaEventExVtbl IMediaEventEx_VTable =
4236 MediaEvent_QueryInterface,
4239 MediaEvent_GetTypeInfoCount,
4240 MediaEvent_GetTypeInfo,
4241 MediaEvent_GetIDsOfNames,
4243 MediaEvent_GetEventHandle,
4244 MediaEvent_GetEvent,
4245 MediaEvent_WaitForCompletion,
4246 MediaEvent_CancelDefaultHandling,
4247 MediaEvent_RestoreDefaultHandling,
4248 MediaEvent_FreeEventParams,
4249 MediaEvent_SetNotifyWindow,
4250 MediaEvent_SetNotifyFlags,
4251 MediaEvent_GetNotifyFlags
4255 static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID riid, LPVOID *ppv)
4257 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4259 return Filtergraph_QueryInterface(This, riid, ppv);
4262 static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
4264 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4266 return Filtergraph_AddRef(This);
4269 static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
4271 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4273 return Filtergraph_Release(This);
4276 static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClassID)
4278 FIXME("(%p): stub\n", pClassID);
4283 static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
4285 FIXME("(): stub\n");
4290 static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
4292 FIXME("(): stub\n");
4297 static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME tStart)
4299 FIXME("(0x%s): stub\n", wine_dbgstr_longlong(tStart));
4304 static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD dwMsTimeout, FILTER_STATE * pState)
4306 FIXME("(%d, %p): stub\n", dwMsTimeout, pState);
4311 static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
4313 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4317 TRACE("(%p/%p)->(%p)\n", iface, This, pClock);
4319 EnterCriticalSection(&This->cs);
4321 for (i = 0;i < This->nFilters;i++)
4323 hr = IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], pClock);
4331 IBaseFilter_SetSyncSource(This->ppFiltersInGraph[i], This->refClock);
4336 IReferenceClock_Release(This->refClock);
4337 This->refClock = pClock;
4339 IReferenceClock_AddRef(This->refClock);
4341 if (This->HandleEcClockChanged)
4343 IMediaEventSink *pEventSink;
4346 eshr = IMediaFilter_QueryInterface(iface, &IID_IMediaEventSink, (LPVOID)&pEventSink);
4347 if (SUCCEEDED(eshr))
4349 IMediaEventSink_Notify(pEventSink, EC_CLOCK_CHANGED, 0, 0);
4350 IMediaEventSink_Release(pEventSink);
4355 LeaveCriticalSection(&This->cs);
4360 static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
4362 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4364 TRACE("(%p/%p)->(%p)\n", iface, This, ppClock);
4369 EnterCriticalSection(&This->cs);
4371 *ppClock = This->refClock;
4373 IReferenceClock_AddRef(*ppClock);
4375 LeaveCriticalSection(&This->cs);
4380 static const IMediaFilterVtbl IMediaFilter_VTable =
4382 MediaFilter_QueryInterface,
4384 MediaFilter_Release,
4385 MediaFilter_GetClassID,
4389 MediaFilter_GetState,
4390 MediaFilter_SetSyncSource,
4391 MediaFilter_GetSyncSource
4394 static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID riid, LPVOID *ppv)
4396 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4398 return Filtergraph_QueryInterface(This, riid, ppv);
4401 static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
4403 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4405 return Filtergraph_AddRef(This);
4408 static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
4410 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4412 return Filtergraph_Release(This);
4415 static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, long EventCode, LONG_PTR EventParam1, LONG_PTR EventParam2)
4417 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4420 TRACE("(%p/%p)->(%ld, %ld, %ld)\n", This, iface, EventCode, EventParam1, EventParam2);
4422 /* We need thread safety here, let's use the events queue's one */
4423 EnterCriticalSection(&This->evqueue.msg_crst);
4425 if ((EventCode == EC_COMPLETE) && This->HandleEcComplete)
4427 TRACE("Process EC_COMPLETE notification\n");
4428 if (++This->EcCompleteCount == This->nRenderers)
4430 evt.lEventCode = EC_COMPLETE;
4433 TRACE("Send EC_COMPLETE to app\n");
4434 EventsQueue_PutEvent(&This->evqueue, &evt);
4435 if (!This->notif.disabled && This->notif.hWnd)
4437 TRACE("Send Window message\n");
4438 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4440 This->CompletionStatus = EC_COMPLETE;
4441 SetEvent(This->hEventCompletion);
4444 else if ((EventCode == EC_REPAINT) && This->HandleEcRepaint)
4446 /* FIXME: Not handled yet */
4450 evt.lEventCode = EventCode;
4451 evt.lParam1 = EventParam1;
4452 evt.lParam2 = EventParam2;
4453 EventsQueue_PutEvent(&This->evqueue, &evt);
4454 if (!This->notif.disabled && This->notif.hWnd)
4455 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4458 LeaveCriticalSection(&This->evqueue.msg_crst);
4462 static const IMediaEventSinkVtbl IMediaEventSink_VTable =
4464 MediaEventSink_QueryInterface,
4465 MediaEventSink_AddRef,
4466 MediaEventSink_Release,
4467 MediaEventSink_Notify
4470 static HRESULT WINAPI GraphConfig_QueryInterface(IGraphConfig *iface, REFIID riid, LPVOID *ppv)
4472 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4474 return Filtergraph_QueryInterface(This, riid, ppv);
4477 static ULONG WINAPI GraphConfig_AddRef(IGraphConfig *iface)
4479 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4481 return Filtergraph_AddRef(This);
4484 static ULONG WINAPI GraphConfig_Release(IGraphConfig *iface)
4486 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4488 return Filtergraph_Release(This);
4491 static HRESULT WINAPI GraphConfig_Reconnect(IGraphConfig *iface,
4494 const AM_MEDIA_TYPE* pmtFirstConnection,
4495 IBaseFilter* pUsingFilter,
4499 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4501 FIXME("(%p)->(%p, %p, %p, %p, %p, %x): stub!\n", This, pOutputPin, pInputPin, pmtFirstConnection, pUsingFilter, hAbortEvent, dwFlags);
4506 static HRESULT WINAPI GraphConfig_Reconfigure(IGraphConfig *iface,
4507 IGraphConfigCallback* pCallback,
4512 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4514 FIXME("(%p)->(%p, %p, %x, %p): stub!\n", This, pCallback, pvContext, dwFlags, hAbortEvent);
4519 static HRESULT WINAPI GraphConfig_AddFilterToCache(IGraphConfig *iface,
4520 IBaseFilter* pFilter)
4522 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4524 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4529 static HRESULT WINAPI GraphConfig_EnumCacheFilter(IGraphConfig *iface,
4530 IEnumFilters** pEnum)
4532 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4534 FIXME("(%p)->(%p): stub!\n", This, pEnum);
4539 static HRESULT WINAPI GraphConfig_RemoveFilterFromCache(IGraphConfig *iface,
4540 IBaseFilter* pFilter)
4542 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4544 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4549 static HRESULT WINAPI GraphConfig_GetStartTime(IGraphConfig *iface,
4550 REFERENCE_TIME* prtStart)
4552 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4554 FIXME("(%p)->(%p): stub!\n", This, prtStart);
4559 static HRESULT WINAPI GraphConfig_PushThroughData(IGraphConfig *iface,
4561 IPinConnection* pConnection,
4564 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4566 FIXME("(%p)->(%p, %p, %p): stub!\n", This, pOutputPin, pConnection, hEventAbort);
4571 static HRESULT WINAPI GraphConfig_SetFilterFlags(IGraphConfig *iface,
4572 IBaseFilter* pFilter,
4575 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4577 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
4582 static HRESULT WINAPI GraphConfig_GetFilterFlags(IGraphConfig *iface,
4583 IBaseFilter* pFilter,
4586 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4588 FIXME("(%p)->(%p, %p): stub!\n", This, pFilter, dwFlags);
4593 static HRESULT WINAPI GraphConfig_RemoveFilterEx(IGraphConfig *iface,
4594 IBaseFilter* pFilter,
4597 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4599 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
4604 static const IGraphConfigVtbl IGraphConfig_VTable =
4606 GraphConfig_QueryInterface,
4608 GraphConfig_Release,
4609 GraphConfig_Reconnect,
4610 GraphConfig_Reconfigure,
4611 GraphConfig_AddFilterToCache,
4612 GraphConfig_EnumCacheFilter,
4613 GraphConfig_RemoveFilterFromCache,
4614 GraphConfig_GetStartTime,
4615 GraphConfig_PushThroughData,
4616 GraphConfig_SetFilterFlags,
4617 GraphConfig_GetFilterFlags,
4618 GraphConfig_RemoveFilterEx
4621 /* This is the only function that actually creates a FilterGraph class... */
4622 HRESULT FilterGraph_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4624 IFilterGraphImpl *fimpl;
4627 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
4630 return CLASS_E_NOAGGREGATION;
4632 fimpl = CoTaskMemAlloc(sizeof(*fimpl));
4633 fimpl->IFilterGraph2_vtbl = &IFilterGraph2_VTable;
4634 fimpl->IMediaControl_vtbl = &IMediaControl_VTable;
4635 fimpl->IMediaSeeking_vtbl = &IMediaSeeking_VTable;
4636 fimpl->IBasicAudio_vtbl = &IBasicAudio_VTable;
4637 fimpl->IBasicVideo_vtbl = &IBasicVideo_VTable;
4638 fimpl->IVideoWindow_vtbl = &IVideoWindow_VTable;
4639 fimpl->IMediaEventEx_vtbl = &IMediaEventEx_VTable;
4640 fimpl->IMediaFilter_vtbl = &IMediaFilter_VTable;
4641 fimpl->IMediaEventSink_vtbl = &IMediaEventSink_VTable;
4642 fimpl->IGraphConfig_vtbl = &IGraphConfig_VTable;
4643 fimpl->IMediaPosition_vtbl = &IMediaPosition_VTable;
4645 fimpl->ppFiltersInGraph = NULL;
4646 fimpl->pFilterNames = NULL;
4647 fimpl->nFilters = 0;
4648 fimpl->filterCapacity = 0;
4649 fimpl->nameIndex = 1;
4650 fimpl->refClock = NULL;
4651 fimpl->hEventCompletion = CreateEventW(0, TRUE, FALSE, 0);
4652 fimpl->HandleEcComplete = TRUE;
4653 fimpl->HandleEcRepaint = TRUE;
4654 fimpl->HandleEcClockChanged = TRUE;
4655 fimpl->notif.hWnd = 0;
4656 fimpl->notif.disabled = FALSE;
4657 fimpl->nRenderers = 0;
4658 fimpl->EcCompleteCount = 0;
4659 fimpl->state = State_Stopped;
4660 EventsQueue_Init(&fimpl->evqueue);
4661 InitializeCriticalSection(&fimpl->cs);
4662 fimpl->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IFilterGraphImpl.cs");
4663 fimpl->nItfCacheEntries = 0;
4665 hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&fimpl->pFilterMapper2);
4667 ERR("Unable to create filter mapper (%x)\n", hr);
4675 HRESULT FilterGraphNoThread_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4677 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
4678 return FilterGraph_create(pUnkOuter, ppObj);