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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include "wine/debug.h"
34 #include "quartz_private.h"
35 #define COM_NO_WINDOWS_H
41 #include "wine/unicode.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
47 HWND hWnd; /* Target window */
48 long msg; /* User window message */
49 long instance; /* User data */
50 int disabled; /* Disabled messages posting */
54 long lEventCode; /* Event code */
55 LONG_PTR lParam1; /* Param1 */
56 LONG_PTR lParam2; /* Param2 */
59 /* messages ring implementation for queuing events (taken from winmm) */
60 #define EVENTS_RING_BUFFER_INCREMENT 64
66 CRITICAL_SECTION msg_crst;
67 HANDLE msg_event; /* Signaled for no empty queue */
70 static int EventsQueue_Init(EventsQueue* omr)
74 omr->msg_event = CreateEventW(NULL, TRUE, FALSE, NULL);
75 omr->ring_buffer_size = EVENTS_RING_BUFFER_INCREMENT;
76 omr->messages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,omr->ring_buffer_size * sizeof(Event));
78 InitializeCriticalSection(&omr->msg_crst);
82 static int EventsQueue_Destroy(EventsQueue* omr)
84 CloseHandle(omr->msg_event);
85 HeapFree(GetProcessHeap(),0,omr->messages);
86 DeleteCriticalSection(&omr->msg_crst);
90 static int EventsQueue_PutEvent(EventsQueue* omr, Event* evt)
92 EnterCriticalSection(&omr->msg_crst);
93 if ((omr->msg_toget == ((omr->msg_tosave + 1) % omr->ring_buffer_size)))
95 int old_ring_buffer_size = omr->ring_buffer_size;
96 omr->ring_buffer_size += EVENTS_RING_BUFFER_INCREMENT;
97 TRACE("omr->ring_buffer_size=%d\n",omr->ring_buffer_size);
98 omr->messages = HeapReAlloc(GetProcessHeap(),0,omr->messages, omr->ring_buffer_size * sizeof(Event));
99 /* Now we need to rearrange the ring buffer so that the new
100 buffers just allocated are in between omr->msg_tosave and
103 if (omr->msg_tosave < omr->msg_toget)
105 memmove(&(omr->messages[omr->msg_toget + EVENTS_RING_BUFFER_INCREMENT]),
106 &(omr->messages[omr->msg_toget]),
107 sizeof(Event)*(old_ring_buffer_size - omr->msg_toget)
109 omr->msg_toget += EVENTS_RING_BUFFER_INCREMENT;
112 omr->messages[omr->msg_tosave] = *evt;
113 SetEvent(omr->msg_event);
114 omr->msg_tosave = (omr->msg_tosave + 1) % omr->ring_buffer_size;
115 LeaveCriticalSection(&omr->msg_crst);
119 static int EventsQueue_GetEvent(EventsQueue* omr, Event* evt, long msTimeOut)
121 if (WaitForSingleObject(omr->msg_event, msTimeOut) != WAIT_OBJECT_0)
124 EnterCriticalSection(&omr->msg_crst);
126 if (omr->msg_toget == omr->msg_tosave) /* buffer empty ? */
128 LeaveCriticalSection(&omr->msg_crst);
132 *evt = omr->messages[omr->msg_toget];
133 omr->msg_toget = (omr->msg_toget + 1) % omr->ring_buffer_size;
135 /* Mark the buffer as empty if needed */
136 if (omr->msg_toget == omr->msg_tosave) /* buffer empty ? */
137 ResetEvent(omr->msg_event);
139 LeaveCriticalSection(&omr->msg_crst);
143 #define MAX_ITF_CACHE_ENTRIES 3
144 typedef struct _ITF_CACHE_ENTRY {
150 typedef struct _IFilterGraphImpl {
151 const IGraphBuilderVtbl *IGraphBuilder_vtbl;
152 const IMediaControlVtbl *IMediaControl_vtbl;
153 const IMediaSeekingVtbl *IMediaSeeking_vtbl;
154 const IBasicAudioVtbl *IBasicAudio_vtbl;
155 const IBasicVideoVtbl *IBasicVideo_vtbl;
156 const IVideoWindowVtbl *IVideoWindow_vtbl;
157 const IMediaEventExVtbl *IMediaEventEx_vtbl;
158 const IMediaFilterVtbl *IMediaFilter_vtbl;
159 const IMediaEventSinkVtbl *IMediaEventSink_vtbl;
160 const IGraphConfigVtbl *IGraphConfig_vtbl;
161 /* IAMGraphStreams */
170 /* IRegisterServiceProvider */
171 /* IResourceMananger */
172 /* IServiceProvider */
173 /* IVideoFrameStep */
176 IFilterMapper2 * pFilterMapper2;
177 IBaseFilter ** ppFiltersInGraph;
178 LPWSTR * pFilterNames;
183 HANDLE hEventCompletion;
184 int CompletionStatus;
188 int HandleEcComplete;
192 ITF_CACHE_ENTRY ItfCacheEntries[MAX_ITF_CACHE_ENTRIES];
193 int nItfCacheEntries;
197 static HRESULT Filtergraph_QueryInterface(IFilterGraphImpl *This,
200 TRACE("(%p)->(%s (%p), %p)\n", This, debugstr_guid(riid), riid, ppvObj);
202 if (IsEqualGUID(&IID_IUnknown, riid) ||
203 IsEqualGUID(&IID_IFilterGraph, riid) ||
204 IsEqualGUID(&IID_IGraphBuilder, riid)) {
205 *ppvObj = &(This->IGraphBuilder_vtbl);
206 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj);
207 } else if (IsEqualGUID(&IID_IMediaControl, riid)) {
208 *ppvObj = &(This->IMediaControl_vtbl);
209 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj);
210 } else if (IsEqualGUID(&IID_IMediaSeeking, riid)) {
211 *ppvObj = &(This->IMediaSeeking_vtbl);
212 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj);
213 } else if (IsEqualGUID(&IID_IBasicAudio, riid)) {
214 *ppvObj = &(This->IBasicAudio_vtbl);
215 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj);
216 } else if (IsEqualGUID(&IID_IBasicVideo, riid)) {
217 *ppvObj = &(This->IBasicVideo_vtbl);
218 TRACE(" returning IBasicVideo interface (%p)\n", *ppvObj);
219 } else if (IsEqualGUID(&IID_IVideoWindow, riid)) {
220 *ppvObj = &(This->IVideoWindow_vtbl);
221 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj);
222 } else if (IsEqualGUID(&IID_IMediaEvent, riid) ||
223 IsEqualGUID(&IID_IMediaEventEx, riid)) {
224 *ppvObj = &(This->IMediaEventEx_vtbl);
225 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj);
226 } else if (IsEqualGUID(&IID_IMediaFilter, riid) ||
227 IsEqualGUID(&IID_IPersist, riid)) {
228 *ppvObj = &(This->IMediaFilter_vtbl);
229 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj);
230 } else if (IsEqualGUID(&IID_IMediaEventSink, riid)) {
231 *ppvObj = &(This->IMediaEventSink_vtbl);
232 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj);
233 } else if (IsEqualGUID(&IID_IGraphConfig, riid)) {
234 *ppvObj = &(This->IGraphConfig_vtbl);
235 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj);
238 FIXME("unknown interface %s\n", debugstr_guid(riid));
239 return E_NOINTERFACE;
242 InterlockedIncrement(&This->ref);
246 static ULONG Filtergraph_AddRef(IFilterGraphImpl *This) {
247 ULONG ref = InterlockedIncrement(&This->ref);
249 TRACE("(%p)->(): new ref = %ld\n", This, ref);
254 static ULONG Filtergraph_Release(IFilterGraphImpl *This) {
255 ULONG ref = InterlockedDecrement(&This->ref);
257 TRACE("(%p)->(): new ref = %ld\n", This, ref);
261 for (i = 0; i < This->nFilters; i++)
262 IBaseFilter_Release(This->ppFiltersInGraph[i]);
263 for (i = 0; i < This->nItfCacheEntries; i++)
264 IUnknown_Release(This->ItfCacheEntries[i].iface);
265 IFilterMapper2_Release(This->pFilterMapper2);
266 CloseHandle(This->hEventCompletion);
267 EventsQueue_Destroy(&This->evqueue);
268 DeleteCriticalSection(&This->cs);
269 HeapFree(GetProcessHeap(), 0, This->ppFiltersInGraph);
270 HeapFree(GetProcessHeap(), 0, This->pFilterNames);
271 HeapFree(GetProcessHeap(), 0, This);
277 /*** IUnknown methods ***/
278 static HRESULT WINAPI GraphBuilder_QueryInterface(IGraphBuilder *iface,
281 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
283 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
284 return Filtergraph_QueryInterface(This, riid, ppvObj);
287 static ULONG WINAPI GraphBuilder_AddRef(IGraphBuilder *iface) {
288 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
290 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This, iface);
292 return Filtergraph_AddRef(This);
295 static ULONG WINAPI GraphBuilder_Release(IGraphBuilder *iface) {
296 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
298 TRACE("(%p/%p)->() calling FilterGraph Release\n", This, iface);
300 return Filtergraph_Release(This);
303 /*** IFilterGraph methods ***/
304 static HRESULT WINAPI GraphBuilder_AddFilter(IGraphBuilder *iface,
305 IBaseFilter *pFilter,
307 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
310 WCHAR* wszFilterName = NULL;
311 int duplicate_name = FALSE;
313 TRACE("(%p/%p)->(%p, %s (%p))\n", This, iface, pFilter, debugstr_w(pName), pName);
315 wszFilterName = (WCHAR*) CoTaskMemAlloc( (pName ? strlenW(pName) + 6 : 5) * sizeof(WCHAR) );
319 /* Check if name already exists */
320 for(i = 0; i < This->nFilters; i++)
321 if (!strcmpW(This->pFilterNames[i], pName))
323 duplicate_name = TRUE;
328 /* If no name given or name already existing, generate one */
329 if (!pName || duplicate_name)
331 static const WCHAR wszFmt1[] = {'%','s',' ','%','0','4','d',0};
332 static const WCHAR wszFmt2[] = {'%','0','4','d',0};
334 for (j = 0; j < 10000 ; j++)
338 sprintfW(wszFilterName, wszFmt1, pName, This->nameIndex);
340 sprintfW(wszFilterName, wszFmt2, This->nameIndex);
341 TRACE("Generated name %s\n", debugstr_w(wszFilterName));
343 /* Check if the generated name already exists */
344 for(i = 0; i < This->nFilters; i++)
345 if (!strcmpW(This->pFilterNames[i], wszFilterName))
348 /* Compute next index and exit if generated name is suitable */
349 if (This->nameIndex++ == 10000)
351 if (i == This->nFilters)
354 /* Unable to find a suitable name */
357 CoTaskMemFree(wszFilterName);
358 return VFW_E_DUPLICATE_NAME;
362 memcpy(wszFilterName, pName, (strlenW(pName) + 1) * sizeof(WCHAR));
364 if (This->nFilters + 1 > This->filterCapacity)
366 int newCapacity = This->filterCapacity ? 2 * This->filterCapacity : 1;
367 IBaseFilter ** ppNewFilters = CoTaskMemAlloc(newCapacity * sizeof(IBaseFilter*));
368 LPWSTR * pNewNames = CoTaskMemAlloc(newCapacity * sizeof(LPWSTR));
369 memcpy(ppNewFilters, This->ppFiltersInGraph, This->nFilters * sizeof(IBaseFilter*));
370 memcpy(pNewNames, This->pFilterNames, This->nFilters * sizeof(LPWSTR));
371 if (!This->filterCapacity)
373 CoTaskMemFree(This->ppFiltersInGraph);
374 CoTaskMemFree(This->pFilterNames);
376 This->ppFiltersInGraph = ppNewFilters;
377 This->pFilterNames = pNewNames;
378 This->filterCapacity = newCapacity;
381 hr = IBaseFilter_JoinFilterGraph(pFilter, (IFilterGraph *)This, wszFilterName);
385 IBaseFilter_AddRef(pFilter);
386 This->ppFiltersInGraph[This->nFilters] = pFilter;
387 This->pFilterNames[This->nFilters] = wszFilterName;
391 CoTaskMemFree(wszFilterName);
393 if (SUCCEEDED(hr) && duplicate_name)
394 return VFW_S_DUPLICATE_NAME;
399 static HRESULT WINAPI GraphBuilder_RemoveFilter(IGraphBuilder *iface,
400 IBaseFilter *pFilter) {
401 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
405 TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
407 /* FIXME: check graph is stopped */
409 for (i = 0; i < This->nFilters; i++)
411 if (This->ppFiltersInGraph[i] == pFilter)
413 /* FIXME: disconnect pins */
414 hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, This->pFilterNames[i]);
417 IPin_Release(pFilter);
418 CoTaskMemFree(This->pFilterNames[i]);
419 memmove(This->ppFiltersInGraph+i, This->ppFiltersInGraph+i+1, sizeof(IBaseFilter*)*(This->nFilters - 1 - i));
420 memmove(This->pFilterNames+i, This->pFilterNames+i+1, sizeof(LPWSTR)*(This->nFilters - 1 - i));
422 /* Invalidate interfaces in the cache */
423 for (i = 0; i < This->nItfCacheEntries; i++)
424 if (pFilter == This->ItfCacheEntries[i].filter)
426 IUnknown_Release(This->ItfCacheEntries[i].iface);
427 This->ItfCacheEntries[i].iface = NULL;
428 This->ItfCacheEntries[i].filter = NULL;
436 return hr; /* FIXME: check this error code */
439 static HRESULT WINAPI GraphBuilder_EnumFilters(IGraphBuilder *iface,
440 IEnumFilters **ppEnum) {
441 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
443 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
445 return IEnumFiltersImpl_Construct(This->ppFiltersInGraph, This->nFilters, ppEnum);
448 static HRESULT WINAPI GraphBuilder_FindFilterByName(IGraphBuilder *iface,
450 IBaseFilter **ppFilter) {
451 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
454 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_w(pName), pName, ppFilter);
458 for (i = 0; i < This->nFilters; i++)
460 if (!strcmpW(pName, This->pFilterNames[i]))
462 *ppFilter = This->ppFiltersInGraph[i];
463 IBaseFilter_AddRef(*ppFilter);
468 return E_FAIL; /* FIXME: check this error code */
471 /* NOTE: despite the implication, it doesn't matter which
472 * way round you put in the input and output pins */
473 static HRESULT WINAPI GraphBuilder_ConnectDirect(IGraphBuilder *iface,
476 const AM_MEDIA_TYPE *pmt) {
480 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
482 TRACE("(%p/%p)->(%p, %p, %p)\n", This, iface, ppinIn, ppinOut, pmt);
484 /* FIXME: check pins are in graph */
486 if (TRACE_ON(quartz))
490 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
494 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
495 IBaseFilter_Release(PinInfo.pFilter);
497 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
501 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
502 IBaseFilter_Release(PinInfo.pFilter);
505 hr = IPin_QueryDirection(ppinIn, &dir);
508 if (dir == PINDIR_INPUT)
509 hr = IPin_Connect(ppinOut, ppinIn, pmt);
511 hr = IPin_Connect(ppinIn, ppinOut, pmt);
517 static HRESULT WINAPI GraphBuilder_Reconnect(IGraphBuilder *iface,
519 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
520 IPin *pConnectedTo = NULL;
522 PIN_DIRECTION pindir;
524 IPin_QueryDirection(ppin, &pindir);
525 hr = IPin_ConnectedTo(ppin, &pConnectedTo);
527 TRACE("Querying connected to failed: %lx\n", hr);
530 IPin_Disconnect(ppin);
531 IPin_Disconnect(pConnectedTo);
532 if (pindir == PINDIR_INPUT)
533 hr = IPin_Connect(pConnectedTo, ppin, NULL);
535 hr = IPin_Connect(ppin, pConnectedTo, NULL);
536 IPin_Release(pConnectedTo);
538 ERR("Reconnecting pins failed, pins are not connected now..\n");
539 TRACE("(%p->%p) -- %p %p -> %lx\n", iface, This, ppin, pConnectedTo, hr);
543 static HRESULT WINAPI GraphBuilder_Disconnect(IGraphBuilder *iface,
545 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
547 TRACE("(%p/%p)->(%p)\n", This, iface, ppin);
549 return IPin_Disconnect(ppin);
552 static HRESULT WINAPI GraphBuilder_SetDefaultSyncSource(IGraphBuilder *iface) {
553 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
555 TRACE("(%p/%p)->(): stub !!!\n", iface, This);
560 static HRESULT GetFilterInfo(IMoniker* pMoniker, GUID* pclsid, VARIANT* pvar)
562 static const WCHAR wszClsidName[] = {'C','L','S','I','D',0};
563 static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
564 IPropertyBag * pPropBagCat = NULL;
568 V_VT(pvar) = VT_BSTR;
570 hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
573 hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL);
576 hr = CLSIDFromString(V_UNION(pvar, bstrVal), pclsid);
579 hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL);
582 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid), debugstr_w(V_UNION(pvar, bstrVal)));
585 IPropertyBag_Release(pPropBagCat);
590 static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPin*** pppins, ULONG* pnb)
595 TRACE("(%p, %p, %p, %p)\n", pfilter, pinputpin, pppins, pnb);
596 hr = IPin_QueryInternalConnections(pinputpin, NULL, &nb);
599 } else if (hr == S_FALSE) {
600 *pppins = CoTaskMemAlloc(sizeof(IPin*)*nb);
601 hr = IPin_QueryInternalConnections(pinputpin, *pppins, &nb);
603 ERR("Error (%lx)\n", hr);
605 } else if (hr == E_NOTIMPL) {
606 /* Input connected to all outputs */
607 IEnumPins* penumpins;
610 TRACE("E_NOTIMPL\n");
611 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
613 ERR("filter Enumpins failed (%lx)\n", hr);
617 /* Count output pins */
618 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
619 PIN_DIRECTION pindir;
620 IPin_QueryDirection(ppin, &pindir);
621 if (pindir == PINDIR_OUTPUT)
625 *pppins = CoTaskMemAlloc(sizeof(IPin*)*i);
626 /* Retrieve output pins */
627 IEnumPins_Reset(penumpins);
629 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
630 PIN_DIRECTION pindir;
631 IPin_QueryDirection(ppin, &pindir);
632 if (pindir == PINDIR_OUTPUT)
633 (*pppins)[i++] = ppin;
639 ERR("Next failed (%lx)\n", hr);
642 IEnumPins_Release(penumpins);
643 } else if (FAILED(hr)) {
644 ERR("Cannot get internal connection (%lx)\n", hr);
652 /*** IGraphBuilder methods ***/
653 static HRESULT WINAPI GraphBuilder_Connect(IGraphBuilder *iface,
656 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
659 IEnumMediaTypes* penummt;
661 IEnumPins* penumpins;
662 IEnumMoniker* pEnumMoniker;
670 TRACE("(%p/%p)->(%p, %p)\n", This, iface, ppinOut, ppinIn);
672 if (TRACE_ON(quartz))
674 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
678 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
679 IBaseFilter_Release(PinInfo.pFilter);
681 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
685 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
686 IBaseFilter_Release(PinInfo.pFilter);
689 /* Try direct connection first */
690 hr = IPin_Connect(ppinOut, ppinIn, NULL);
694 TRACE("Direct connection failed, trying to insert other filters\n");
696 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
700 hr = IBaseFilter_GetClassID(PinInfo.pFilter, &FilterCLSID);
704 IBaseFilter_Release(PinInfo.pFilter);
706 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
707 * filter to the minor mediatype of input pin of the renderer */
708 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
710 ERR("EnumMediaTypes (%lx)\n", hr);
714 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
716 ERR("IEnumMediaTypes_Next (%lx)\n", hr);
721 ERR("No media type found!\n");
724 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
725 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
727 /* Try to find a suitable filter that can connect to the pin to render */
728 tab[0] = mt->majortype;
729 tab[1] = mt->subtype;
730 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
732 ERR("Unable to enum filters (%lx)\n", hr);
736 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
741 IPin* ppinfilter = NULL;
742 IBaseFilter* pfilter = NULL;
744 hr = GetFilterInfo(pMoniker, &clsid, &var);
745 IMoniker_Release(pMoniker);
747 ERR("Unable to retrieve filter info (%lx)\n", hr);
751 if (IsEqualGUID(&clsid, &FilterCLSID)) {
752 /* Skip filter (same as the one the output pin belongs to) */
756 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
758 ERR("Unable to create filter (%lx), trying next one\n", hr);
762 hr = IGraphBuilder_AddFilter(iface, pfilter, NULL);
764 ERR("Unable to add filter (%lx)\n", hr);
765 IBaseFilter_Release(pfilter);
770 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
772 ERR("Enumpins (%lx)\n", hr);
776 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
778 ERR("Next (%lx)\n", hr);
785 IEnumPins_Release(penumpins);
787 hr = IPin_Connect(ppinOut, ppinfilter, NULL);
789 TRACE("Cannot connect to filter (%lx), trying next one\n", hr);
792 TRACE("Successfully connected to filter, follow chain...\n");
794 /* Render all output pins of the filter by calling IGraphBuilder_Render on each of them */
795 hr = GetInternalConnections(pfilter, ppinfilter, &ppins, &nb);
799 TRACE("pins to consider: %ld\n", nb);
800 for(i = 0; i < nb; i++) {
801 TRACE("Processing pin %d\n", i);
802 hr = IGraphBuilder_Connect(iface, ppins[i], ppinIn);
804 TRACE("Cannot render pin %p (%lx)\n", ppinfilter, hr);
806 IPin_Release(ppins[i]);
807 if (SUCCEEDED(hr)) break;
809 while (++i < nb) IPin_Release(ppins[i]);
810 CoTaskMemFree(ppins);
811 IBaseFilter_Release(pfilter);
812 IPin_Release(ppinfilter);
817 if (ppinfilter) IPin_Release(ppinfilter);
819 IGraphBuilder_RemoveFilter(iface, pfilter);
820 IBaseFilter_Release(pfilter);
824 IEnumMediaTypes_Release(penummt);
830 static HRESULT WINAPI GraphBuilder_Render(IGraphBuilder *iface,
832 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
833 IEnumMediaTypes* penummt;
838 IEnumMoniker* pEnumMoniker;
843 TRACE("(%p/%p)->(%p)\n", This, iface, ppinOut);
845 if (TRACE_ON(quartz))
849 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
853 TRACE("Filter owning pin => %p\n", PinInfo.pFilter);
854 IBaseFilter_Release(PinInfo.pFilter);
857 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
859 ERR("EnumMediaTypes (%lx)\n", hr);
865 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
867 ERR("IEnumMediaTypes_Next (%lx)\n", hr);
872 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
873 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
875 /* Try to find a suitable renderer with the same media type */
876 tab[0] = mt->majortype;
878 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL);
880 ERR("Unable to enum filters (%lx)\n", hr);
884 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
889 IBaseFilter* pfilter = NULL;
890 IEnumPins* penumpins;
893 hr = GetFilterInfo(pMoniker, &clsid, &var);
894 IMoniker_Release(pMoniker);
896 ERR("Unable to retrieve filter info (%lx)\n", hr);
900 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
902 ERR("Unable to create filter (%lx), trying next one\n", hr);
906 hr = IGraphBuilder_AddFilter(iface, pfilter, NULL);
908 ERR("Unable to add filter (%lx)\n", hr);
913 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
915 ERR("Splitter Enumpins (%lx)\n", hr);
918 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
920 ERR("Next (%lx)\n", hr);
927 IEnumPins_Release(penumpins);
929 /* Connect the pin to render to the renderer */
930 hr = IGraphBuilder_Connect(iface, ppinOut, ppinfilter);
932 TRACE("Unable to connect to renderer (%lx)\n", hr);
939 IGraphBuilder_RemoveFilter(iface, pfilter);
940 IBaseFilter_Release(pfilter);
948 IEnumMediaTypes_Release(penummt);
953 static HRESULT WINAPI GraphBuilder_RenderFile(IGraphBuilder *iface,
955 LPCWSTR lpcwstrPlayList) {
956 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
957 static const WCHAR string[] = {'R','e','a','d','e','r',0};
958 IBaseFilter* preader = NULL;
959 IBaseFilter* psplitter;
962 IEnumPins* penumpins;
965 IEnumMoniker* pEnumMoniker;
970 IFileSourceFilter* pfile = NULL;
974 TRACE("(%p/%p)->(%s, %s)\n", This, iface, debugstr_w(lpcwstrFile), debugstr_w(lpcwstrPlayList));
976 hr = IGraphBuilder_AddSourceFilter(iface, lpcwstrFile, string, &preader);
978 /* Retrieve file media type */
980 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
982 hr = IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
983 IFileSourceFilter_Release(pfile);
987 tab[0] = mt.majortype;
989 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
995 IGraphBuilder_RemoveFilter(iface, preader);
996 IBaseFilter_Release(preader);
1002 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
1007 hr = GetFilterInfo(pMoniker, &clsid, &var);
1008 IMoniker_Release(pMoniker);
1010 ERR("Unable to retrieve filter info (%lx)\n", hr);
1014 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&psplitter);
1016 ERR("Unable to create filter (%lx), trying next one\n", hr);
1020 hr = IGraphBuilder_AddFilter(iface, psplitter, NULL);
1022 ERR("Unable add filter (%lx)\n", hr);
1026 /* Connect file source and splitter filters together */
1027 /* Make the splitter analyze incoming data */
1028 hr = IBaseFilter_EnumPins(preader, &penumpins);
1030 ERR("Enumpins (%lx)\n", hr);
1033 hr = IEnumPins_Next(penumpins, 1, &ppinreader, &pin);
1035 ERR("Next (%lx)\n", hr);
1042 IEnumPins_Release(penumpins);
1044 hr = IBaseFilter_EnumPins(psplitter, &penumpins);
1046 ERR("Splitter Enumpins (%lx)\n", hr);
1049 hr = IEnumPins_Next(penumpins, 1, &ppinsplitter, &pin);
1051 ERR("Next (%lx)\n", hr);
1058 IEnumPins_Release(penumpins);
1060 hr = IPin_Connect(ppinreader, ppinsplitter, NULL);
1062 IBaseFilter_Release(ppinsplitter);
1063 ppinsplitter = NULL;
1064 TRACE("Cannot connect to filter (%lx), trying next one\n", hr);
1067 TRACE("Successfully connected to filter\n");
1071 /* Render all output pin of the splitter by calling IGraphBuilder_Render on each of them */
1073 hr = GetInternalConnections(psplitter, ppinsplitter, &ppins, &nb);
1075 if (SUCCEEDED(hr)) {
1077 TRACE("pins to consider: %ld\n", nb);
1078 for(i = 0; i < nb; i++) {
1079 TRACE("Processing pin %d\n", i);
1080 hr = IGraphBuilder_Render(iface, ppins[i]);
1082 ERR("Cannot render pin %p (%lx)\n", ppins[i], hr);
1083 /* FIXME: We should clean created things properly */
1087 CoTaskMemFree(ppins);
1093 static HRESULT WINAPI GraphBuilder_AddSourceFilter(IGraphBuilder *iface,
1094 LPCWSTR lpcwstrFileName,
1095 LPCWSTR lpcwstrFilterName,
1096 IBaseFilter **ppFilter) {
1097 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
1099 IBaseFilter* preader;
1100 IFileSourceFilter* pfile = NULL;
1104 TRACE("(%p/%p)->(%s, %s, %p)\n", This, iface, debugstr_w(lpcwstrFileName), debugstr_w(lpcwstrFilterName), ppFilter);
1106 /* Instantiate a file source filter */
1107 hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&preader);
1109 ERR("Unable to create file source filter (%lx)\n", hr);
1113 hr = IGraphBuilder_AddFilter(iface, preader, lpcwstrFilterName);
1115 ERR("Unable add filter (%lx)\n", hr);
1116 IBaseFilter_Release(preader);
1120 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1122 ERR("Unable to get IFileSourceInterface (%lx)\n", hr);
1126 /* Load the file in the file source filter */
1127 hr = IFileSourceFilter_Load(pfile, lpcwstrFileName, NULL);
1129 ERR("Load (%lx)\n", hr);
1133 IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1135 ERR("GetCurFile (%lx)\n", hr);
1138 TRACE("File %s\n", debugstr_w(filename));
1139 TRACE("MajorType %s\n", debugstr_guid(&mt.majortype));
1140 TRACE("SubType %s\n", debugstr_guid(&mt.subtype));
1143 *ppFilter = preader;
1149 IFileSourceFilter_Release(pfile);
1150 IGraphBuilder_RemoveFilter(iface, preader);
1151 IBaseFilter_Release(preader);
1156 static HRESULT WINAPI GraphBuilder_SetLogFile(IGraphBuilder *iface,
1158 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
1160 TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) hFile);
1165 static HRESULT WINAPI GraphBuilder_Abort(IGraphBuilder *iface) {
1166 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
1168 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1173 static HRESULT WINAPI GraphBuilder_ShouldOperationContinue(IGraphBuilder *iface) {
1174 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
1176 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1182 static const IGraphBuilderVtbl IGraphBuilder_VTable =
1184 GraphBuilder_QueryInterface,
1185 GraphBuilder_AddRef,
1186 GraphBuilder_Release,
1187 GraphBuilder_AddFilter,
1188 GraphBuilder_RemoveFilter,
1189 GraphBuilder_EnumFilters,
1190 GraphBuilder_FindFilterByName,
1191 GraphBuilder_ConnectDirect,
1192 GraphBuilder_Reconnect,
1193 GraphBuilder_Disconnect,
1194 GraphBuilder_SetDefaultSyncSource,
1195 GraphBuilder_Connect,
1196 GraphBuilder_Render,
1197 GraphBuilder_RenderFile,
1198 GraphBuilder_AddSourceFilter,
1199 GraphBuilder_SetLogFile,
1201 GraphBuilder_ShouldOperationContinue
1204 /*** IUnknown methods ***/
1205 static HRESULT WINAPI MediaControl_QueryInterface(IMediaControl *iface,
1208 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1210 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1212 return Filtergraph_QueryInterface(This, riid, ppvObj);
1215 static ULONG WINAPI MediaControl_AddRef(IMediaControl *iface) {
1216 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1218 TRACE("(%p/%p)->()\n", This, iface);
1220 return Filtergraph_AddRef(This);
1223 static ULONG WINAPI MediaControl_Release(IMediaControl *iface) {
1224 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1226 TRACE("(%p/%p)->()\n", This, iface);
1228 return Filtergraph_Release(This);
1232 /*** IDispatch methods ***/
1233 static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface,
1235 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1237 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1242 static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface,
1245 ITypeInfo**ppTInfo) {
1246 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1248 TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1253 static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface,
1259 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1261 TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1266 static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface,
1267 DISPID dispIdMember,
1271 DISPPARAMS*pDispParams,
1273 EXCEPINFO*pExepInfo,
1275 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1277 TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1282 typedef HRESULT(WINAPI *fnFoundFilter)(IBaseFilter *);
1284 static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundFilter FoundFilter)
1293 TRACE("%p %p\n", pGraph, pOutputPin);
1294 PinInfo.pFilter = NULL;
1296 hr = IPin_ConnectedTo(pOutputPin, &pInputPin);
1299 hr = IPin_QueryPinInfo(pInputPin, &PinInfo);
1302 hr = GetInternalConnections(PinInfo.pFilter, pInputPin, &ppPins, &nb);
1308 TRACE("Reached a renderer\n");
1309 /* Count renderers for end of stream notification */
1310 pGraph->nRenderers++;
1314 for(i = 0; i < nb; i++)
1316 /* Explore the graph downstream from this pin
1317 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1318 * several input pins are connected to the same output (a MUX for instance). */
1319 ExploreGraph(pGraph, ppPins[i], FoundFilter);
1320 IPin_Release(ppPins[i]);
1323 CoTaskMemFree(ppPins);
1325 TRACE("Doing stuff with filter %p\n", PinInfo.pFilter);
1326 FoundFilter(PinInfo.pFilter);
1329 if (PinInfo.pFilter) IBaseFilter_Release(PinInfo.pFilter);
1333 static HRESULT WINAPI SendRun(IBaseFilter *pFilter) {
1334 return IBaseFilter_Run(pFilter, 0);
1337 static HRESULT WINAPI SendPause(IBaseFilter *pFilter) {
1338 return IBaseFilter_Pause(pFilter);
1341 static HRESULT WINAPI SendStop(IBaseFilter *pFilter) {
1342 return IBaseFilter_Stop(pFilter);
1345 static HRESULT SendFilterMessage(IMediaControl *iface, fnFoundFilter FoundFilter) {
1346 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1348 IBaseFilter* pfilter;
1354 TRACE("(%p/%p)->()\n", This, iface);
1356 /* Explorer the graph from source filters to renderers, determine renderers
1357 * number and run filters from renderers to source filters */
1358 This->nRenderers = 0;
1359 ResetEvent(This->hEventCompletion);
1361 for(i = 0; i < This->nFilters; i++)
1364 pfilter = This->ppFiltersInGraph[i];
1365 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
1368 ERR("Enum pins failed %lx\n", hr);
1371 /* Check if it is a source filter */
1372 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1374 IPin_QueryDirection(pPin, &dir);
1376 if (dir == PINDIR_INPUT)
1384 TRACE("Found a source filter %p\n", pfilter);
1385 IEnumPins_Reset(pEnum);
1386 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1388 /* Explore the graph downstream from this pin */
1389 ExploreGraph(This, pPin, FoundFilter);
1392 FoundFilter(pfilter);
1394 IEnumPins_Release(pEnum);
1400 /*** IMediaControl methods ***/
1401 static HRESULT WINAPI MediaControl_Run(IMediaControl *iface) {
1402 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1403 TRACE("(%p/%p)->()\n", This, iface);
1405 if (This->state == State_Running) return S_OK;
1407 EnterCriticalSection(&This->cs);
1408 SendFilterMessage(iface, SendRun);
1409 This->state = State_Running;
1410 LeaveCriticalSection(&This->cs);
1414 static HRESULT WINAPI MediaControl_Pause(IMediaControl *iface) {
1415 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1416 TRACE("(%p/%p)->()\n", This, iface);
1418 if (This->state == State_Paused) return S_OK;
1420 EnterCriticalSection(&This->cs);
1421 SendFilterMessage(iface, SendPause);
1422 This->state = State_Paused;
1423 LeaveCriticalSection(&This->cs);
1427 static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface) {
1428 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1429 TRACE("(%p/%p)->()\n", This, iface);
1431 if (This->state == State_Stopped) return S_OK;
1433 EnterCriticalSection(&This->cs);
1434 if (This->state == State_Running) SendFilterMessage(iface, SendPause);
1435 SendFilterMessage(iface, SendStop);
1436 This->state = State_Stopped;
1437 LeaveCriticalSection(&This->cs);
1441 static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface,
1443 OAFilterState *pfs) {
1444 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1446 TRACE("(%p/%p)->(%ld, %p): semi-stub !!!\n", This, iface, msTimeout, pfs);
1448 EnterCriticalSection(&This->cs);
1452 LeaveCriticalSection(&This->cs);
1457 static HRESULT WINAPI MediaControl_RenderFile(IMediaControl *iface,
1459 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1461 TRACE("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename);
1466 static HRESULT WINAPI MediaControl_AddSourceFilter(IMediaControl *iface,
1468 IDispatch **ppUnk) {
1469 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1471 TRACE("(%p/%p)->(%s (%p), %p): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename, ppUnk);
1476 static HRESULT WINAPI MediaControl_get_FilterCollection(IMediaControl *iface,
1477 IDispatch **ppUnk) {
1478 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1480 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1485 static HRESULT WINAPI MediaControl_get_RegFilterCollection(IMediaControl *iface,
1486 IDispatch **ppUnk) {
1487 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1489 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1494 static HRESULT WINAPI MediaControl_StopWhenReady(IMediaControl *iface) {
1495 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1497 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1503 static const IMediaControlVtbl IMediaControl_VTable =
1505 MediaControl_QueryInterface,
1506 MediaControl_AddRef,
1507 MediaControl_Release,
1508 MediaControl_GetTypeInfoCount,
1509 MediaControl_GetTypeInfo,
1510 MediaControl_GetIDsOfNames,
1511 MediaControl_Invoke,
1515 MediaControl_GetState,
1516 MediaControl_RenderFile,
1517 MediaControl_AddSourceFilter,
1518 MediaControl_get_FilterCollection,
1519 MediaControl_get_RegFilterCollection,
1520 MediaControl_StopWhenReady
1524 /*** IUnknown methods ***/
1525 static HRESULT WINAPI MediaSeeking_QueryInterface(IMediaSeeking *iface,
1528 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1530 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1532 return Filtergraph_QueryInterface(This, riid, ppvObj);
1535 static ULONG WINAPI MediaSeeking_AddRef(IMediaSeeking *iface) {
1536 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1538 TRACE("(%p/%p)->()\n", This, iface);
1540 return Filtergraph_AddRef(This);
1543 static ULONG WINAPI MediaSeeking_Release(IMediaSeeking *iface) {
1544 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1546 TRACE("(%p/%p)->()\n", This, iface);
1548 return Filtergraph_Release(This);
1551 /*** IMediaSeeking methods ***/
1552 static HRESULT WINAPI MediaSeeking_GetCapabilities(IMediaSeeking *iface,
1553 DWORD *pCapabilities) {
1554 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1556 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCapabilities);
1561 static HRESULT WINAPI MediaSeeking_CheckCapabilities(IMediaSeeking *iface,
1562 DWORD *pCapabilities) {
1563 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1565 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCapabilities);
1570 static HRESULT WINAPI MediaSeeking_IsFormatSupported(IMediaSeeking *iface,
1571 const GUID *pFormat) {
1572 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1574 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1579 static HRESULT WINAPI MediaSeeking_QueryPreferredFormat(IMediaSeeking *iface,
1581 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1583 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1588 static HRESULT WINAPI MediaSeeking_GetTimeFormat(IMediaSeeking *iface,
1590 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1592 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1597 static HRESULT WINAPI MediaSeeking_IsUsingTimeFormat(IMediaSeeking *iface,
1598 const GUID *pFormat) {
1599 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1601 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1606 static HRESULT WINAPI MediaSeeking_SetTimeFormat(IMediaSeeking *iface,
1607 const GUID *pFormat) {
1608 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1610 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1615 static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface,
1616 LONGLONG *pDuration) {
1617 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1619 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDuration);
1624 static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface,
1626 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1628 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pStop);
1633 static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface,
1634 LONGLONG *pCurrent) {
1635 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1637 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCurrent);
1642 static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface,
1644 const GUID *pTargetFormat,
1646 const GUID *pSourceFormat) {
1647 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1649 TRACE("(%p/%p)->(%p, %p, %lld, %p): stub !!!\n", This, iface, pTarget, pTargetFormat, Source, pSourceFormat);
1654 static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface,
1656 DWORD dwCurrentFlags,
1658 DWORD dwStopFlags) {
1659 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1661 TRACE("(%p/%p)->(%p, %08lx, %p, %08lx): stub !!!\n", This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
1666 static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface,
1669 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1671 TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pCurrent, pStop);
1676 static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface,
1677 LONGLONG *pEarliest,
1678 LONGLONG *pLatest) {
1679 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1681 TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
1686 static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface,
1688 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1690 TRACE("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
1695 static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface,
1697 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1699 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
1704 static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface,
1705 LONGLONG *pllPreroll) {
1706 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1708 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
1714 static const IMediaSeekingVtbl IMediaSeeking_VTable =
1716 MediaSeeking_QueryInterface,
1717 MediaSeeking_AddRef,
1718 MediaSeeking_Release,
1719 MediaSeeking_GetCapabilities,
1720 MediaSeeking_CheckCapabilities,
1721 MediaSeeking_IsFormatSupported,
1722 MediaSeeking_QueryPreferredFormat,
1723 MediaSeeking_GetTimeFormat,
1724 MediaSeeking_IsUsingTimeFormat,
1725 MediaSeeking_SetTimeFormat,
1726 MediaSeeking_GetDuration,
1727 MediaSeeking_GetStopPosition,
1728 MediaSeeking_GetCurrentPosition,
1729 MediaSeeking_ConvertTimeFormat,
1730 MediaSeeking_SetPositions,
1731 MediaSeeking_GetPositions,
1732 MediaSeeking_GetAvailable,
1733 MediaSeeking_SetRate,
1734 MediaSeeking_GetRate,
1735 MediaSeeking_GetPreroll
1738 static HRESULT GetTargetInterface(IFilterGraphImpl* pGraph, REFIID riid, LPVOID* ppvObj)
1740 HRESULT hr = E_NOINTERFACE;
1744 /* Check if the interface type is already registered */
1745 for (entry = 0; entry < pGraph->nItfCacheEntries; entry++)
1746 if (riid == pGraph->ItfCacheEntries[entry].riid)
1748 if (pGraph->ItfCacheEntries[entry].iface)
1750 /* Return the interface if available */
1751 *ppvObj = pGraph->ItfCacheEntries[entry].iface;
1757 if (entry >= MAX_ITF_CACHE_ENTRIES)
1759 FIXME("Not enough space to store interface in the cache\n");
1760 return E_OUTOFMEMORY;
1763 /* Find a filter supporting the requested interface */
1764 for (i = 0; i < pGraph->nFilters; i++)
1766 hr = IBaseFilter_QueryInterface(pGraph->ppFiltersInGraph[i], riid, ppvObj);
1769 pGraph->ItfCacheEntries[entry].riid = (IID*)riid;
1770 pGraph->ItfCacheEntries[entry].filter = pGraph->ppFiltersInGraph[i];
1771 pGraph->ItfCacheEntries[entry].iface = (IUnknown*)*ppvObj;
1772 if (entry >= pGraph->nItfCacheEntries)
1773 pGraph->nItfCacheEntries++;
1776 if (hr != E_NOINTERFACE)
1783 /*** IUnknown methods ***/
1784 static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface,
1787 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1789 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1791 return Filtergraph_QueryInterface(This, riid, ppvObj);
1794 static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface) {
1795 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1797 TRACE("(%p/%p)->()\n", This, iface);
1799 return Filtergraph_AddRef(This);
1802 static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface) {
1803 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1805 TRACE("(%p/%p)->()\n", This, iface);
1807 return Filtergraph_Release(This);
1810 /*** IDispatch methods ***/
1811 static HRESULT WINAPI BasicAudio_GetTypeInfoCount(IBasicAudio *iface,
1813 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1814 IBasicAudio* pBasicAudio;
1817 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
1819 EnterCriticalSection(&This->cs);
1821 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1824 hr = IBasicAudio_GetTypeInfoCount(pBasicAudio, pctinfo);
1826 LeaveCriticalSection(&This->cs);
1831 static HRESULT WINAPI BasicAudio_GetTypeInfo(IBasicAudio *iface,
1834 ITypeInfo**ppTInfo) {
1835 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1836 IBasicAudio* pBasicAudio;
1839 TRACE("(%p/%p)->(%d, %ld, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
1841 EnterCriticalSection(&This->cs);
1843 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1846 hr = IBasicAudio_GetTypeInfo(pBasicAudio, iTInfo, lcid, ppTInfo);
1848 LeaveCriticalSection(&This->cs);
1853 static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface,
1859 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1860 IBasicAudio* pBasicAudio;
1863 TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1865 EnterCriticalSection(&This->cs);
1867 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1870 hr = IBasicAudio_GetIDsOfNames(pBasicAudio, riid, rgszNames, cNames, lcid, rgDispId);
1872 LeaveCriticalSection(&This->cs);
1877 static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface,
1878 DISPID dispIdMember,
1882 DISPPARAMS*pDispParams,
1884 EXCEPINFO*pExepInfo,
1886 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1887 IBasicAudio* pBasicAudio;
1890 TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p)\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1892 EnterCriticalSection(&This->cs);
1894 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1897 hr = IBasicAudio_Invoke(pBasicAudio, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1899 LeaveCriticalSection(&This->cs);
1904 /*** IBasicAudio methods ***/
1905 static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface,
1907 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1908 IBasicAudio* pBasicAudio;
1911 TRACE("(%p/%p)->(%ld)\n", This, iface, lVolume);
1913 EnterCriticalSection(&This->cs);
1915 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1918 hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
1920 LeaveCriticalSection(&This->cs);
1925 static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface,
1927 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1928 IBasicAudio* pBasicAudio;
1931 TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
1933 EnterCriticalSection(&This->cs);
1935 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1938 hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
1940 LeaveCriticalSection(&This->cs);
1945 static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface,
1947 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1948 IBasicAudio* pBasicAudio;
1951 TRACE("(%p/%p)->(%ld)\n", This, iface, lBalance);
1953 EnterCriticalSection(&This->cs);
1955 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1958 hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
1960 LeaveCriticalSection(&This->cs);
1965 static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface,
1967 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1968 IBasicAudio* pBasicAudio;
1971 TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
1973 EnterCriticalSection(&This->cs);
1975 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1978 hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
1980 LeaveCriticalSection(&This->cs);
1985 static const IBasicAudioVtbl IBasicAudio_VTable =
1987 BasicAudio_QueryInterface,
1990 BasicAudio_GetTypeInfoCount,
1991 BasicAudio_GetTypeInfo,
1992 BasicAudio_GetIDsOfNames,
1994 BasicAudio_put_Volume,
1995 BasicAudio_get_Volume,
1996 BasicAudio_put_Balance,
1997 BasicAudio_get_Balance
2000 /*** IUnknown methods ***/
2001 static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo *iface,
2004 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2006 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2008 return Filtergraph_QueryInterface(This, riid, ppvObj);
2011 static ULONG WINAPI BasicVideo_AddRef(IBasicVideo *iface) {
2012 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2014 TRACE("(%p/%p)->()\n", This, iface);
2016 return Filtergraph_AddRef(This);
2019 static ULONG WINAPI BasicVideo_Release(IBasicVideo *iface) {
2020 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2022 TRACE("(%p/%p)->()\n", This, iface);
2024 return Filtergraph_Release(This);
2027 /*** IDispatch methods ***/
2028 static HRESULT WINAPI BasicVideo_GetTypeInfoCount(IBasicVideo *iface,
2030 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2031 IBasicVideo* pBasicVideo;
2034 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2036 EnterCriticalSection(&This->cs);
2038 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2041 hr = IBasicVideo_GetTypeInfoCount(pBasicVideo, pctinfo);
2043 LeaveCriticalSection(&This->cs);
2048 static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo *iface,
2051 ITypeInfo**ppTInfo) {
2052 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2053 IBasicVideo* pBasicVideo;
2056 TRACE("(%p/%p)->(%d, %ld, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2058 EnterCriticalSection(&This->cs);
2060 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2063 hr = IBasicVideo_GetTypeInfo(pBasicVideo, iTInfo, lcid, ppTInfo);
2065 LeaveCriticalSection(&This->cs);
2070 static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo *iface,
2076 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2077 IBasicVideo* pBasicVideo;
2080 TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2082 EnterCriticalSection(&This->cs);
2084 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2087 hr = IBasicVideo_GetIDsOfNames(pBasicVideo, riid, rgszNames, cNames, lcid, rgDispId);
2089 LeaveCriticalSection(&This->cs);
2094 static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo *iface,
2095 DISPID dispIdMember,
2099 DISPPARAMS*pDispParams,
2101 EXCEPINFO*pExepInfo,
2103 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2104 IBasicVideo* pBasicVideo;
2107 TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p)\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2109 EnterCriticalSection(&This->cs);
2111 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2114 hr = IBasicVideo_Invoke(pBasicVideo, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2116 LeaveCriticalSection(&This->cs);
2121 /*** IBasicVideo methods ***/
2122 static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo *iface,
2123 REFTIME *pAvgTimePerFrame) {
2124 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2125 IBasicVideo* pBasicVideo;
2128 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
2130 EnterCriticalSection(&This->cs);
2132 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2135 hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
2137 LeaveCriticalSection(&This->cs);
2142 static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo *iface,
2144 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2145 IBasicVideo* pBasicVideo;
2148 TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
2150 EnterCriticalSection(&This->cs);
2152 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2155 hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
2157 LeaveCriticalSection(&This->cs);
2162 static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo *iface,
2163 long *pBitErrorRate) {
2164 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2165 IBasicVideo* pBasicVideo;
2168 TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
2170 EnterCriticalSection(&This->cs);
2172 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2175 hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
2177 LeaveCriticalSection(&This->cs);
2182 static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo *iface,
2183 long *pVideoWidth) {
2184 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2185 IBasicVideo* pBasicVideo;
2188 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
2190 EnterCriticalSection(&This->cs);
2192 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2195 hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
2197 LeaveCriticalSection(&This->cs);
2202 static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo *iface,
2203 long *pVideoHeight) {
2204 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2205 IBasicVideo* pBasicVideo;
2208 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
2210 EnterCriticalSection(&This->cs);
2212 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2215 hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
2217 LeaveCriticalSection(&This->cs);
2222 static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo *iface,
2224 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2225 IBasicVideo* pBasicVideo;
2228 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
2230 EnterCriticalSection(&This->cs);
2232 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2235 hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
2237 LeaveCriticalSection(&This->cs);
2242 static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo *iface,
2243 long *pSourceLeft) {
2244 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2245 IBasicVideo* pBasicVideo;
2248 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
2250 EnterCriticalSection(&This->cs);
2252 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2255 hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
2257 LeaveCriticalSection(&This->cs);
2262 static HRESULT WINAPI BasicVideo_put_SourceWidth(IBasicVideo *iface,
2264 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2265 IBasicVideo* pBasicVideo;
2268 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
2270 EnterCriticalSection(&This->cs);
2272 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2275 hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
2277 LeaveCriticalSection(&This->cs);
2282 static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo *iface,
2283 long *pSourceWidth) {
2284 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2285 IBasicVideo* pBasicVideo;
2288 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
2290 EnterCriticalSection(&This->cs);
2292 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2295 hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
2297 LeaveCriticalSection(&This->cs);
2302 static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo *iface,
2304 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2305 IBasicVideo* pBasicVideo;
2308 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
2310 EnterCriticalSection(&This->cs);
2312 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2315 hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
2317 LeaveCriticalSection(&This->cs);
2322 static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo *iface,
2324 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2325 IBasicVideo* pBasicVideo;
2328 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
2330 EnterCriticalSection(&This->cs);
2332 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2335 hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
2337 LeaveCriticalSection(&This->cs);
2342 static HRESULT WINAPI BasicVideo_put_SourceHeight(IBasicVideo *iface,
2343 long SourceHeight) {
2344 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2345 IBasicVideo* pBasicVideo;
2348 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
2350 EnterCriticalSection(&This->cs);
2352 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2355 hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
2357 LeaveCriticalSection(&This->cs);
2362 static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo *iface,
2363 long *pSourceHeight) {
2364 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2365 IBasicVideo* pBasicVideo;
2368 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
2370 EnterCriticalSection(&This->cs);
2372 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2375 hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
2377 LeaveCriticalSection(&This->cs);
2382 static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo *iface,
2383 long DestinationLeft) {
2384 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2385 IBasicVideo* pBasicVideo;
2388 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
2390 EnterCriticalSection(&This->cs);
2392 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2395 hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
2397 LeaveCriticalSection(&This->cs);
2402 static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo *iface,
2403 long *pDestinationLeft) {
2404 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2405 IBasicVideo* pBasicVideo;
2408 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
2410 EnterCriticalSection(&This->cs);
2412 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2415 hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
2417 LeaveCriticalSection(&This->cs);
2422 static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo *iface,
2423 long DestinationWidth) {
2424 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2425 IBasicVideo* pBasicVideo;
2428 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
2430 EnterCriticalSection(&This->cs);
2432 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2435 hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
2437 LeaveCriticalSection(&This->cs);
2442 static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo *iface,
2443 long *pDestinationWidth) {
2444 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2445 IBasicVideo* pBasicVideo;
2448 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
2450 EnterCriticalSection(&This->cs);
2452 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2455 hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
2457 LeaveCriticalSection(&This->cs);
2462 static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo *iface,
2463 long DestinationTop) {
2464 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2465 IBasicVideo* pBasicVideo;
2468 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
2470 EnterCriticalSection(&This->cs);
2472 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2475 hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
2477 LeaveCriticalSection(&This->cs);
2482 static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo *iface,
2483 long *pDestinationTop) {
2484 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2485 IBasicVideo* pBasicVideo;
2488 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
2490 EnterCriticalSection(&This->cs);
2492 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2495 hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
2497 LeaveCriticalSection(&This->cs);
2502 static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo *iface,
2503 long DestinationHeight) {
2504 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2505 IBasicVideo* pBasicVideo;
2508 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
2510 EnterCriticalSection(&This->cs);
2512 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2515 hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
2517 LeaveCriticalSection(&This->cs);
2522 static HRESULT WINAPI BasicVideo_get_DestinationHeight(IBasicVideo *iface,
2523 long *pDestinationHeight) {
2524 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2525 IBasicVideo* pBasicVideo;
2528 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
2530 EnterCriticalSection(&This->cs);
2532 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2535 hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
2537 LeaveCriticalSection(&This->cs);
2542 static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo *iface,
2547 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2548 IBasicVideo* pBasicVideo;
2551 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2553 EnterCriticalSection(&This->cs);
2555 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2558 hr = IBasicVideo_SetSourcePosition(pBasicVideo, Left, Top, Width, Height);
2560 LeaveCriticalSection(&This->cs);
2565 static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo *iface,
2570 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2571 IBasicVideo* pBasicVideo;
2574 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2576 EnterCriticalSection(&This->cs);
2578 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2581 hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
2583 LeaveCriticalSection(&This->cs);
2588 static HRESULT WINAPI BasicVideo_SetDefaultSourcePosition(IBasicVideo *iface) {
2589 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2590 IBasicVideo* pBasicVideo;
2593 TRACE("(%p/%p)->()\n", This, iface);
2595 EnterCriticalSection(&This->cs);
2597 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2600 hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
2602 LeaveCriticalSection(&This->cs);
2607 static HRESULT WINAPI BasicVideo_SetDestinationPosition(IBasicVideo *iface,
2612 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2613 IBasicVideo* pBasicVideo;
2616 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2618 EnterCriticalSection(&This->cs);
2620 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2623 hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left, Top, Width, Height);
2625 LeaveCriticalSection(&This->cs);
2630 static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo *iface,
2635 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2636 IBasicVideo* pBasicVideo;
2639 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2641 EnterCriticalSection(&This->cs);
2643 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2646 hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
2648 LeaveCriticalSection(&This->cs);
2653 static HRESULT WINAPI BasicVideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
2654 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2655 IBasicVideo* pBasicVideo;
2658 TRACE("(%p/%p)->()\n", This, iface);
2660 EnterCriticalSection(&This->cs);
2662 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2665 hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
2667 LeaveCriticalSection(&This->cs);
2672 static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo *iface,
2675 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2676 IBasicVideo* pBasicVideo;
2679 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
2681 EnterCriticalSection(&This->cs);
2683 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2686 hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
2688 LeaveCriticalSection(&This->cs);
2693 static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo *iface,
2698 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2699 IBasicVideo* pBasicVideo;
2702 TRACE("(%p/%p)->(%ld, %ld, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
2704 EnterCriticalSection(&This->cs);
2706 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2709 hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex, Entries, pRetrieved, pPalette);
2711 LeaveCriticalSection(&This->cs);
2716 static HRESULT WINAPI BasicVideo_GetCurrentImage(IBasicVideo *iface,
2719 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2720 IBasicVideo* pBasicVideo;
2723 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pBufferSize, pDIBImage);
2725 EnterCriticalSection(&This->cs);
2727 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2730 hr = IBasicVideo_GetCurrentImage(pBasicVideo, pBufferSize, pDIBImage);
2732 LeaveCriticalSection(&This->cs);
2737 static HRESULT WINAPI BasicVideo_IsUsingDefaultSource(IBasicVideo *iface) {
2738 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2739 IBasicVideo* pBasicVideo;
2742 TRACE("(%p/%p)->()\n", This, iface);
2744 EnterCriticalSection(&This->cs);
2746 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2749 hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
2751 LeaveCriticalSection(&This->cs);
2756 static HRESULT WINAPI BasicVideo_IsUsingDefaultDestination(IBasicVideo *iface) {
2757 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2758 IBasicVideo* pBasicVideo;
2761 TRACE("(%p/%p)->()\n", This, iface);
2763 EnterCriticalSection(&This->cs);
2765 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2768 hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
2770 LeaveCriticalSection(&This->cs);
2776 static const IBasicVideoVtbl IBasicVideo_VTable =
2778 BasicVideo_QueryInterface,
2781 BasicVideo_GetTypeInfoCount,
2782 BasicVideo_GetTypeInfo,
2783 BasicVideo_GetIDsOfNames,
2785 BasicVideo_get_AvgTimePerFrame,
2786 BasicVideo_get_BitRate,
2787 BasicVideo_get_BitErrorRate,
2788 BasicVideo_get_VideoWidth,
2789 BasicVideo_get_VideoHeight,
2790 BasicVideo_put_SourceLeft,
2791 BasicVideo_get_SourceLeft,
2792 BasicVideo_put_SourceWidth,
2793 BasicVideo_get_SourceWidth,
2794 BasicVideo_put_SourceTop,
2795 BasicVideo_get_SourceTop,
2796 BasicVideo_put_SourceHeight,
2797 BasicVideo_get_SourceHeight,
2798 BasicVideo_put_DestinationLeft,
2799 BasicVideo_get_DestinationLeft,
2800 BasicVideo_put_DestinationWidth,
2801 BasicVideo_get_DestinationWidth,
2802 BasicVideo_put_DestinationTop,
2803 BasicVideo_get_DestinationTop,
2804 BasicVideo_put_DestinationHeight,
2805 BasicVideo_get_DestinationHeight,
2806 BasicVideo_SetSourcePosition,
2807 BasicVideo_GetSourcePosition,
2808 BasicVideo_SetDefaultSourcePosition,
2809 BasicVideo_SetDestinationPosition,
2810 BasicVideo_GetDestinationPosition,
2811 BasicVideo_SetDefaultDestinationPosition,
2812 BasicVideo_GetVideoSize,
2813 BasicVideo_GetVideoPaletteEntries,
2814 BasicVideo_GetCurrentImage,
2815 BasicVideo_IsUsingDefaultSource,
2816 BasicVideo_IsUsingDefaultDestination
2820 /*** IUnknown methods ***/
2821 static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface,
2824 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2826 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2828 return Filtergraph_QueryInterface(This, riid, ppvObj);
2831 static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface) {
2832 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2834 TRACE("(%p/%p)->()\n", This, iface);
2836 return Filtergraph_AddRef(This);
2839 static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface) {
2840 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2842 TRACE("(%p/%p)->()\n", This, iface);
2844 return Filtergraph_Release(This);
2847 /*** IDispatch methods ***/
2848 static HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface,
2850 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2851 IVideoWindow* pVideoWindow;
2854 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2856 EnterCriticalSection(&This->cs);
2858 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2861 hr = IVideoWindow_GetTypeInfoCount(pVideoWindow, pctinfo);
2863 LeaveCriticalSection(&This->cs);
2868 static HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface,
2871 ITypeInfo**ppTInfo) {
2872 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2873 IVideoWindow* pVideoWindow;
2876 TRACE("(%p/%p)->(%d, %ld, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2878 EnterCriticalSection(&This->cs);
2880 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2883 hr = IVideoWindow_GetTypeInfo(pVideoWindow, iTInfo, lcid, ppTInfo);
2885 LeaveCriticalSection(&This->cs);
2890 static HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface,
2896 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2897 IVideoWindow* pVideoWindow;
2900 TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2902 EnterCriticalSection(&This->cs);
2904 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2907 hr = IVideoWindow_GetIDsOfNames(pVideoWindow, riid, rgszNames, cNames, lcid, rgDispId);
2909 LeaveCriticalSection(&This->cs);
2914 static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface,
2915 DISPID dispIdMember,
2919 DISPPARAMS*pDispParams,
2921 EXCEPINFO*pExepInfo,
2923 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2924 IVideoWindow* pVideoWindow;
2927 TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p)\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2929 EnterCriticalSection(&This->cs);
2931 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2934 hr = IVideoWindow_Invoke(pVideoWindow, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2936 LeaveCriticalSection(&This->cs);
2942 /*** IVideoWindow methods ***/
2943 static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface,
2945 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2946 IVideoWindow* pVideoWindow;
2949 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
2951 EnterCriticalSection(&This->cs);
2953 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2956 hr = IVideoWindow_put_Caption(pVideoWindow, strCaption);
2958 LeaveCriticalSection(&This->cs);
2963 static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface,
2965 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2966 IVideoWindow* pVideoWindow;
2969 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
2971 EnterCriticalSection(&This->cs);
2973 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2976 hr = IVideoWindow_get_Caption(pVideoWindow, strCaption);
2978 LeaveCriticalSection(&This->cs);
2983 static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface,
2985 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2986 IVideoWindow* pVideoWindow;
2989 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyle);
2991 EnterCriticalSection(&This->cs);
2993 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2996 hr = IVideoWindow_put_WindowStyle(pVideoWindow, WindowStyle);
2998 LeaveCriticalSection(&This->cs);
3003 static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface,
3004 long *WindowStyle) {
3005 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3006 IVideoWindow* pVideoWindow;
3009 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
3011 EnterCriticalSection(&This->cs);
3013 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3016 hr = IVideoWindow_get_WindowStyle(pVideoWindow, WindowStyle);
3018 LeaveCriticalSection(&This->cs);
3023 static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface,
3024 long WindowStyleEx) {
3025 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3026 IVideoWindow* pVideoWindow;
3029 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
3031 EnterCriticalSection(&This->cs);
3033 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3036 hr = IVideoWindow_put_WindowStyleEx(pVideoWindow, WindowStyleEx);
3038 LeaveCriticalSection(&This->cs);
3043 static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface,
3044 long *WindowStyleEx) {
3045 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3046 IVideoWindow* pVideoWindow;
3049 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
3051 EnterCriticalSection(&This->cs);
3053 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3056 hr = IVideoWindow_get_WindowStyleEx(pVideoWindow, WindowStyleEx);
3058 LeaveCriticalSection(&This->cs);
3063 static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface,
3065 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3066 IVideoWindow* pVideoWindow;
3069 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
3071 EnterCriticalSection(&This->cs);
3073 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3076 hr = IVideoWindow_put_AutoShow(pVideoWindow, AutoShow);
3078 LeaveCriticalSection(&This->cs);
3083 static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface,
3085 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3086 IVideoWindow* pVideoWindow;
3089 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
3091 EnterCriticalSection(&This->cs);
3093 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3096 hr = IVideoWindow_get_AutoShow(pVideoWindow, AutoShow);
3098 LeaveCriticalSection(&This->cs);
3103 static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface,
3105 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3106 IVideoWindow* pVideoWindow;
3109 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowState);
3111 EnterCriticalSection(&This->cs);
3113 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3116 hr = IVideoWindow_put_WindowState(pVideoWindow, WindowState);
3118 LeaveCriticalSection(&This->cs);
3123 static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface,
3124 long *WindowState) {
3125 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3126 IVideoWindow* pVideoWindow;
3129 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
3131 EnterCriticalSection(&This->cs);
3133 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3136 hr = IVideoWindow_get_WindowState(pVideoWindow, WindowState);
3138 LeaveCriticalSection(&This->cs);
3143 static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface,
3144 long BackgroundPalette) {
3145 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3146 IVideoWindow* pVideoWindow;
3149 TRACE("(%p/%p)->(%ld)\n", This, iface, BackgroundPalette);
3151 EnterCriticalSection(&This->cs);
3153 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3156 hr = IVideoWindow_put_BackgroundPalette(pVideoWindow, BackgroundPalette);
3158 LeaveCriticalSection(&This->cs);
3163 static HRESULT WINAPI VideoWindow_get_BackgroundPalette(IVideoWindow *iface,
3164 long *pBackgroundPalette) {
3165 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3166 IVideoWindow* pVideoWindow;
3169 TRACE("(%p/%p)->(%p)\n", This, iface, pBackgroundPalette);
3171 EnterCriticalSection(&This->cs);
3173 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3176 hr = IVideoWindow_get_BackgroundPalette(pVideoWindow, pBackgroundPalette);
3178 LeaveCriticalSection(&This->cs);
3183 static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface,
3185 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3186 IVideoWindow* pVideoWindow;
3189 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
3191 EnterCriticalSection(&This->cs);
3193 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3196 hr = IVideoWindow_put_Visible(pVideoWindow, Visible);
3198 LeaveCriticalSection(&This->cs);
3203 static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface,
3205 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3206 IVideoWindow* pVideoWindow;
3209 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
3211 EnterCriticalSection(&This->cs);
3213 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3216 hr = IVideoWindow_get_Visible(pVideoWindow, pVisible);
3218 LeaveCriticalSection(&This->cs);
3223 static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface,
3225 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3226 IVideoWindow* pVideoWindow;
3229 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
3231 EnterCriticalSection(&This->cs);
3233 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3236 hr = IVideoWindow_put_Left(pVideoWindow, Left);
3238 LeaveCriticalSection(&This->cs);
3243 static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface,
3245 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3246 IVideoWindow* pVideoWindow;
3249 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
3251 EnterCriticalSection(&This->cs);
3253 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3256 hr = IVideoWindow_get_Left(pVideoWindow, pLeft);
3258 LeaveCriticalSection(&This->cs);
3263 static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface,
3265 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3266 IVideoWindow* pVideoWindow;
3269 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
3271 EnterCriticalSection(&This->cs);
3273 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3276 hr = IVideoWindow_put_Width(pVideoWindow, Width);
3278 LeaveCriticalSection(&This->cs);
3283 static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface,
3285 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3286 IVideoWindow* pVideoWindow;
3289 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
3291 EnterCriticalSection(&This->cs);
3293 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3296 hr = IVideoWindow_get_Width(pVideoWindow, pWidth);
3298 LeaveCriticalSection(&This->cs);
3303 static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface,
3305 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3306 IVideoWindow* pVideoWindow;
3309 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
3311 EnterCriticalSection(&This->cs);
3313 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3316 hr = IVideoWindow_put_Top(pVideoWindow, Top);
3318 LeaveCriticalSection(&This->cs);
3323 static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface,
3325 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3326 IVideoWindow* pVideoWindow;
3329 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
3331 EnterCriticalSection(&This->cs);
3333 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3336 hr = IVideoWindow_get_Top(pVideoWindow, pTop);
3338 LeaveCriticalSection(&This->cs);
3343 static HRESULT WINAPI VideoWindow_put_Height(IVideoWindow *iface,
3345 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3346 IVideoWindow* pVideoWindow;
3349 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
3351 EnterCriticalSection(&This->cs);
3353 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3356 hr = IVideoWindow_put_Height(pVideoWindow, Height);
3358 LeaveCriticalSection(&This->cs);
3363 static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface,
3365 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3366 IVideoWindow* pVideoWindow;
3369 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
3371 EnterCriticalSection(&This->cs);
3373 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3376 hr = IVideoWindow_get_Height(pVideoWindow, pHeight);
3378 LeaveCriticalSection(&This->cs);
3383 static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface,
3385 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3386 IVideoWindow* pVideoWindow;
3389 TRACE("(%p/%p)->(%08lx)\n", This, iface, (DWORD) Owner);
3391 EnterCriticalSection(&This->cs);
3393 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3396 hr = IVideoWindow_put_Owner(pVideoWindow, Owner);
3398 LeaveCriticalSection(&This->cs);
3403 static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface,
3405 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3406 IVideoWindow* pVideoWindow;
3409 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
3411 EnterCriticalSection(&This->cs);
3413 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3416 hr = IVideoWindow_get_Owner(pVideoWindow, Owner);
3418 LeaveCriticalSection(&This->cs);
3423 static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface,
3425 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3426 IVideoWindow* pVideoWindow;
3429 TRACE("(%p/%p)->(%08lx)\n", This, iface, (DWORD) Drain);
3431 EnterCriticalSection(&This->cs);
3433 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3436 hr = IVideoWindow_put_MessageDrain(pVideoWindow, Drain);
3438 LeaveCriticalSection(&This->cs);
3443 static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface,
3445 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3446 IVideoWindow* pVideoWindow;
3449 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
3451 EnterCriticalSection(&This->cs);
3453 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3456 hr = IVideoWindow_get_MessageDrain(pVideoWindow, Drain);
3458 LeaveCriticalSection(&This->cs);
3463 static HRESULT WINAPI VideoWindow_get_BorderColor(IVideoWindow *iface,
3465 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3466 IVideoWindow* pVideoWindow;
3469 TRACE("(%p/%p)->(%p)\n", This, iface, Color);
3471 EnterCriticalSection(&This->cs);
3473 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3476 hr = IVideoWindow_get_BorderColor(pVideoWindow, Color);
3478 LeaveCriticalSection(&This->cs);
3483 static HRESULT WINAPI VideoWindow_put_BorderColor(IVideoWindow *iface,
3485 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3486 IVideoWindow* pVideoWindow;
3489 TRACE("(%p/%p)->(%ld)\n", This, iface, Color);
3491 EnterCriticalSection(&This->cs);
3493 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3496 hr = IVideoWindow_put_BorderColor(pVideoWindow, Color);
3498 LeaveCriticalSection(&This->cs);
3503 static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
3504 long *FullScreenMode) {
3505 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3506 IVideoWindow* pVideoWindow;
3509 TRACE("(%p/%p)->(%p)\n", This, iface, FullScreenMode);
3511 EnterCriticalSection(&This->cs);
3513 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3516 hr = IVideoWindow_get_FullScreenMode(pVideoWindow, FullScreenMode);
3518 LeaveCriticalSection(&This->cs);
3523 static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface,
3524 long FullScreenMode) {
3525 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3526 IVideoWindow* pVideoWindow;
3529 TRACE("(%p/%p)->(%ld)\n", This, iface, FullScreenMode);
3531 EnterCriticalSection(&This->cs);
3533 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3536 hr = IVideoWindow_put_FullScreenMode(pVideoWindow, FullScreenMode);
3538 LeaveCriticalSection(&This->cs);
3543 static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface,
3545 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3546 IVideoWindow* pVideoWindow;
3549 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
3551 EnterCriticalSection(&This->cs);
3553 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3556 hr = IVideoWindow_SetWindowForeground(pVideoWindow, Focus);
3558 LeaveCriticalSection(&This->cs);
3563 static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface,
3568 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3569 IVideoWindow* pVideoWindow;
3572 TRACE("(%p/%p)->(%08lx, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
3574 EnterCriticalSection(&This->cs);
3576 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3579 hr = IVideoWindow_NotifyOwnerMessage(pVideoWindow, hwnd, uMsg, wParam, lParam);
3581 LeaveCriticalSection(&This->cs);
3586 static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface,
3591 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3592 IVideoWindow* pVideoWindow;
3595 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
3597 EnterCriticalSection(&This->cs);
3599 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3602 hr = IVideoWindow_SetWindowPosition(pVideoWindow, Left, Top, Width, Height);
3604 LeaveCriticalSection(&This->cs);
3609 static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface,
3614 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3615 IVideoWindow* pVideoWindow;
3618 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3620 EnterCriticalSection(&This->cs);
3622 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3625 hr = IVideoWindow_GetWindowPosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
3627 LeaveCriticalSection(&This->cs);
3632 static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface,
3635 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3636 IVideoWindow* pVideoWindow;
3639 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3641 EnterCriticalSection(&This->cs);
3643 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3646 hr = IVideoWindow_GetMinIdealImageSize(pVideoWindow, pWidth, pHeight);
3648 LeaveCriticalSection(&This->cs);
3653 static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface,
3656 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3657 IVideoWindow* pVideoWindow;
3660 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3662 EnterCriticalSection(&This->cs);
3664 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3667 hr = IVideoWindow_GetMaxIdealImageSize(pVideoWindow, pWidth, pHeight);
3669 LeaveCriticalSection(&This->cs);
3674 static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface,
3679 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3680 IVideoWindow* pVideoWindow;
3683 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3685 EnterCriticalSection(&This->cs);
3687 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3690 hr = IVideoWindow_GetRestorePosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
3692 LeaveCriticalSection(&This->cs);
3697 static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface,
3699 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3700 IVideoWindow* pVideoWindow;
3703 TRACE("(%p/%p)->(%ld)\n", This, iface, HideCursor);
3705 EnterCriticalSection(&This->cs);
3707 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3710 hr = IVideoWindow_HideCursor(pVideoWindow, HideCursor);
3712 LeaveCriticalSection(&This->cs);
3717 static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface,
3718 long *CursorHidden) {
3719 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3720 IVideoWindow* pVideoWindow;
3723 TRACE("(%p/%p)->(%p)\n", This, iface, CursorHidden);
3725 EnterCriticalSection(&This->cs);
3727 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3730 hr = IVideoWindow_IsCursorHidden(pVideoWindow, CursorHidden);
3732 LeaveCriticalSection(&This->cs);
3738 static const IVideoWindowVtbl IVideoWindow_VTable =
3740 VideoWindow_QueryInterface,
3742 VideoWindow_Release,
3743 VideoWindow_GetTypeInfoCount,
3744 VideoWindow_GetTypeInfo,
3745 VideoWindow_GetIDsOfNames,
3747 VideoWindow_put_Caption,
3748 VideoWindow_get_Caption,
3749 VideoWindow_put_WindowStyle,
3750 VideoWindow_get_WindowStyle,
3751 VideoWindow_put_WindowStyleEx,
3752 VideoWindow_get_WindowStyleEx,
3753 VideoWindow_put_AutoShow,
3754 VideoWindow_get_AutoShow,
3755 VideoWindow_put_WindowState,
3756 VideoWindow_get_WindowState,
3757 VideoWindow_put_BackgroundPalette,
3758 VideoWindow_get_BackgroundPalette,
3759 VideoWindow_put_Visible,
3760 VideoWindow_get_Visible,
3761 VideoWindow_put_Left,
3762 VideoWindow_get_Left,
3763 VideoWindow_put_Width,
3764 VideoWindow_get_Width,
3765 VideoWindow_put_Top,
3766 VideoWindow_get_Top,
3767 VideoWindow_put_Height,
3768 VideoWindow_get_Height,
3769 VideoWindow_put_Owner,
3770 VideoWindow_get_Owner,
3771 VideoWindow_put_MessageDrain,
3772 VideoWindow_get_MessageDrain,
3773 VideoWindow_get_BorderColor,
3774 VideoWindow_put_BorderColor,
3775 VideoWindow_get_FullScreenMode,
3776 VideoWindow_put_FullScreenMode,
3777 VideoWindow_SetWindowForeground,
3778 VideoWindow_NotifyOwnerMessage,
3779 VideoWindow_SetWindowPosition,
3780 VideoWindow_GetWindowPosition,
3781 VideoWindow_GetMinIdealImageSize,
3782 VideoWindow_GetMaxIdealImageSize,
3783 VideoWindow_GetRestorePosition,
3784 VideoWindow_HideCursor,
3785 VideoWindow_IsCursorHidden
3789 /*** IUnknown methods ***/
3790 static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface,
3793 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3795 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
3797 return Filtergraph_QueryInterface(This, riid, ppvObj);
3800 static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface) {
3801 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3803 TRACE("(%p/%p)->()\n", This, iface);
3805 return Filtergraph_AddRef(This);
3808 static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface) {
3809 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3811 TRACE("(%p/%p)->()\n", This, iface);
3813 return Filtergraph_Release(This);
3816 /*** IDispatch methods ***/
3817 static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface,
3819 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3821 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
3826 static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface,
3829 ITypeInfo**ppTInfo) {
3830 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3832 TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
3837 static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface,
3843 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3845 TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
3850 static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface,
3851 DISPID dispIdMember,
3855 DISPPARAMS*pDispParams,
3857 EXCEPINFO*pExepInfo,
3859 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3861 TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
3866 /*** IMediaEvent methods ***/
3867 static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface,
3869 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3871 TRACE("(%p/%p)->(%p)\n", This, iface, hEvent);
3873 *hEvent = (OAEVENT)This->evqueue.msg_event;
3878 static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface,
3883 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3886 TRACE("(%p/%p)->(%p, %p, %p, %ld)\n", This, iface, lEventCode, lParam1, lParam2, msTimeout);
3888 if (EventsQueue_GetEvent(&This->evqueue, &evt, msTimeout))
3890 *lEventCode = evt.lEventCode;
3891 *lParam1 = evt.lParam1;
3892 *lParam2 = evt.lParam2;
3900 static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface,
3903 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3905 TRACE("(%p/%p)->(%ld, %p)\n", This, iface, msTimeout, pEvCode);
3907 if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
3909 *pEvCode = This->CompletionStatus;
3917 static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface,
3919 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3921 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
3923 if (lEvCode == EC_COMPLETE)
3924 This->HandleEcComplete = FALSE;
3925 else if (lEvCode == EC_REPAINT)
3926 This->HandleEcRepaint = FALSE;
3933 static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(IMediaEventEx *iface,
3935 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3937 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
3939 if (lEvCode == EC_COMPLETE)
3940 This->HandleEcComplete = TRUE;
3941 else if (lEvCode == EC_REPAINT)
3942 This->HandleEcRepaint = TRUE;
3949 static HRESULT WINAPI MediaEvent_FreeEventParams(IMediaEventEx *iface,
3953 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3955 TRACE("(%p/%p)->(%ld, %08lx, %08lx): stub !!!\n", This, iface, lEvCode, lParam1, lParam2);
3960 /*** IMediaEventEx methods ***/
3961 static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
3964 LONG_PTR lInstanceData) {
3965 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3967 TRACE("(%p/%p)->(%08lx, %ld, %08lx)\n", This, iface, (DWORD) hwnd, lMsg, lInstanceData);
3969 This->notif.hWnd = (HWND)hwnd;
3970 This->notif.msg = lMsg;
3971 This->notif.instance = (long) lInstanceData;
3976 static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface,
3977 long lNoNotifyFlags) {
3978 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3980 TRACE("(%p/%p)->(%ld)\n", This, iface, lNoNotifyFlags);
3982 if ((lNoNotifyFlags != 0) || (lNoNotifyFlags != 1))
3983 return E_INVALIDARG;
3985 This->notif.disabled = lNoNotifyFlags;
3990 static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface,
3991 long *lplNoNotifyFlags) {
3992 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3994 TRACE("(%p/%p)->(%p)\n", This, iface, lplNoNotifyFlags);
3996 if (!lplNoNotifyFlags)
3999 *lplNoNotifyFlags = This->notif.disabled;
4005 static const IMediaEventExVtbl IMediaEventEx_VTable =
4007 MediaEvent_QueryInterface,
4010 MediaEvent_GetTypeInfoCount,
4011 MediaEvent_GetTypeInfo,
4012 MediaEvent_GetIDsOfNames,
4014 MediaEvent_GetEventHandle,
4015 MediaEvent_GetEvent,
4016 MediaEvent_WaitForCompletion,
4017 MediaEvent_CancelDefaultHandling,
4018 MediaEvent_RestoreDefaultHandling,
4019 MediaEvent_FreeEventParams,
4020 MediaEvent_SetNotifyWindow,
4021 MediaEvent_SetNotifyFlags,
4022 MediaEvent_GetNotifyFlags
4026 static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID riid, LPVOID *ppv)
4028 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4030 return Filtergraph_QueryInterface(This, riid, ppv);
4033 static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
4035 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4037 return Filtergraph_AddRef(This);
4040 static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
4042 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4044 return Filtergraph_Release(This);
4047 static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClassID)
4049 FIXME("(%p): stub\n", pClassID);
4054 static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
4056 FIXME("(): stub\n");
4061 static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
4063 FIXME("(): stub\n");
4068 static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME tStart)
4070 FIXME("(%lld): stub\n", tStart);
4075 static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD dwMsTimeout, FILTER_STATE * pState)
4077 FIXME("(%ld, %p): stub\n", dwMsTimeout, pState);
4082 static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
4084 FIXME("(%p): stub\n", pClock);
4089 static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
4091 FIXME("(%p): stub\n", ppClock);
4096 static const IMediaFilterVtbl IMediaFilter_VTable =
4098 MediaFilter_QueryInterface,
4100 MediaFilter_Release,
4101 MediaFilter_GetClassID,
4105 MediaFilter_GetState,
4106 MediaFilter_SetSyncSource,
4107 MediaFilter_GetSyncSource
4110 static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID riid, LPVOID *ppv)
4112 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4114 return Filtergraph_QueryInterface(This, riid, ppv);
4117 static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
4119 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4121 return Filtergraph_AddRef(This);
4124 static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
4126 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4128 return Filtergraph_Release(This);
4131 static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, long EventCode, LONG_PTR EventParam1, LONG_PTR EventParam2)
4133 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4136 TRACE("(%p/%p)->(%ld, %ld, %ld)\n", This, iface, EventCode, EventParam1, EventParam2);
4138 /* We need thread safety here, let's use the events queue's one */
4139 EnterCriticalSection(&This->evqueue.msg_crst);
4141 if ((EventCode == EC_COMPLETE) && This->HandleEcComplete)
4143 TRACE("Process EC_COMPLETE notification\n");
4144 if (++This->EcCompleteCount == This->nRenderers)
4146 evt.lEventCode = EC_COMPLETE;
4149 TRACE("Send EC_COMPLETE to app\n");
4150 EventsQueue_PutEvent(&This->evqueue, &evt);
4151 if (!This->notif.disabled && This->notif.hWnd)
4153 TRACE("Send Window message\n");
4154 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4156 This->CompletionStatus = EC_COMPLETE;
4157 SetEvent(This->hEventCompletion);
4160 else if ((EventCode == EC_REPAINT) && This->HandleEcRepaint)
4162 /* FIXME: Not handled yet */
4166 evt.lEventCode = EventCode;
4167 evt.lParam1 = EventParam1;
4168 evt.lParam2 = EventParam2;
4169 EventsQueue_PutEvent(&This->evqueue, &evt);
4170 if (!This->notif.disabled && This->notif.hWnd)
4171 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4174 LeaveCriticalSection(&This->evqueue.msg_crst);
4178 static const IMediaEventSinkVtbl IMediaEventSink_VTable =
4180 MediaEventSink_QueryInterface,
4181 MediaEventSink_AddRef,
4182 MediaEventSink_Release,
4183 MediaEventSink_Notify
4186 static HRESULT WINAPI GraphConfig_QueryInterface(IGraphConfig *iface, REFIID riid, LPVOID *ppv)
4188 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4190 return Filtergraph_QueryInterface(This, riid, ppv);
4193 static ULONG WINAPI GraphConfig_AddRef(IGraphConfig *iface)
4195 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4197 return Filtergraph_AddRef(This);
4200 static ULONG WINAPI GraphConfig_Release(IGraphConfig *iface)
4202 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4204 return Filtergraph_Release(This);
4207 static HRESULT WINAPI GraphConfig_Reconnect(IGraphConfig *iface,
4210 const AM_MEDIA_TYPE* pmtFirstConnection,
4211 IBaseFilter* pUsingFilter,
4215 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4217 FIXME("(%p)->(%p, %p, %p, %p, %p, %lx): stub!\n", This, pOutputPin, pInputPin, pmtFirstConnection, pUsingFilter, hAbortEvent, dwFlags);
4222 static HRESULT WINAPI GraphConfig_Reconfigure(IGraphConfig *iface,
4223 IGraphConfigCallback* pCallback,
4228 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4230 FIXME("(%p)->(%p, %p, %lx, %p): stub!\n", This, pCallback, pvContext, dwFlags, hAbortEvent);
4235 static HRESULT WINAPI GraphConfig_AddFilterToCache(IGraphConfig *iface,
4236 IBaseFilter* pFilter)
4238 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4240 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4245 static HRESULT WINAPI GraphConfig_EnumCacheFilter(IGraphConfig *iface,
4246 IEnumFilters** pEnum)
4248 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4250 FIXME("(%p)->(%p): stub!\n", This, pEnum);
4255 static HRESULT WINAPI GraphConfig_RemoveFilterFromCache(IGraphConfig *iface,
4256 IBaseFilter* pFilter)
4258 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4260 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4265 static HRESULT WINAPI GraphConfig_GetStartTime(IGraphConfig *iface,
4266 REFERENCE_TIME* prtStart)
4268 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4270 FIXME("(%p)->(%p): stub!\n", This, prtStart);
4275 static HRESULT WINAPI GraphConfig_PushThroughData(IGraphConfig *iface,
4277 IPinConnection* pConnection,
4280 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4282 FIXME("(%p)->(%p, %p, %p): stub!\n", This, pOutputPin, pConnection, hEventAbort);
4287 static HRESULT WINAPI GraphConfig_SetFilterFlags(IGraphConfig *iface,
4288 IBaseFilter* pFilter,
4291 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4293 FIXME("(%p)->(%p, %lx): stub!\n", This, pFilter, dwFlags);
4298 static HRESULT WINAPI GraphConfig_GetFilterFlags(IGraphConfig *iface,
4299 IBaseFilter* pFilter,
4302 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4304 FIXME("(%p)->(%p, %p): stub!\n", This, pFilter, dwFlags);
4309 static HRESULT WINAPI GraphConfig_RemoveFilterEx(IGraphConfig *iface,
4310 IBaseFilter* pFilter,
4313 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4315 FIXME("(%p)->(%p, %lx): stub!\n", This, pFilter, dwFlags);
4320 static const IGraphConfigVtbl IGraphConfig_VTable =
4322 GraphConfig_QueryInterface,
4324 GraphConfig_Release,
4325 GraphConfig_Reconnect,
4326 GraphConfig_Reconfigure,
4327 GraphConfig_AddFilterToCache,
4328 GraphConfig_EnumCacheFilter,
4329 GraphConfig_RemoveFilterFromCache,
4330 GraphConfig_GetStartTime,
4331 GraphConfig_PushThroughData,
4332 GraphConfig_SetFilterFlags,
4333 GraphConfig_GetFilterFlags,
4334 GraphConfig_RemoveFilterEx
4337 /* This is the only function that actually creates a FilterGraph class... */
4338 HRESULT FilterGraph_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4340 IFilterGraphImpl *fimpl;
4343 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
4346 return CLASS_E_NOAGGREGATION;
4348 fimpl = HeapAlloc(GetProcessHeap(), 0, sizeof(*fimpl));
4349 fimpl->IGraphBuilder_vtbl = &IGraphBuilder_VTable;
4350 fimpl->IMediaControl_vtbl = &IMediaControl_VTable;
4351 fimpl->IMediaSeeking_vtbl = &IMediaSeeking_VTable;
4352 fimpl->IBasicAudio_vtbl = &IBasicAudio_VTable;
4353 fimpl->IBasicVideo_vtbl = &IBasicVideo_VTable;
4354 fimpl->IVideoWindow_vtbl = &IVideoWindow_VTable;
4355 fimpl->IMediaEventEx_vtbl = &IMediaEventEx_VTable;
4356 fimpl->IMediaFilter_vtbl = &IMediaFilter_VTable;
4357 fimpl->IMediaEventSink_vtbl = &IMediaEventSink_VTable;
4358 fimpl->IGraphConfig_vtbl = &IGraphConfig_VTable;
4360 fimpl->ppFiltersInGraph = NULL;
4361 fimpl->pFilterNames = NULL;
4362 fimpl->nFilters = 0;
4363 fimpl->filterCapacity = 0;
4364 fimpl->nameIndex = 1;
4365 fimpl->hEventCompletion = CreateEventW(0, TRUE, FALSE, 0);
4366 fimpl->HandleEcComplete = TRUE;
4367 fimpl->HandleEcRepaint = TRUE;
4368 fimpl->notif.hWnd = 0;
4369 fimpl->notif.disabled = FALSE;
4370 fimpl->nRenderers = 0;
4371 fimpl->EcCompleteCount = 0;
4372 fimpl->state = State_Stopped;
4373 EventsQueue_Init(&fimpl->evqueue);
4374 InitializeCriticalSection(&fimpl->cs);
4375 fimpl->nItfCacheEntries = 0;
4377 hr = CoCreateInstance(&CLSID_FilterMapper, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&fimpl->pFilterMapper2);
4379 ERR("Unable to create filter mapper (%lx)\n", hr);
4387 HRESULT FilterGraphNoThread_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4389 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
4390 return FilterGraph_create(pUnkOuter, ppObj);