1 /* DirectShow FilterGraph object (QUARTZ.DLL)
3 * Copyright 2002 Lionel Ulmer
4 * Copyright 2004 Christian Costa
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
34 #include "quartz_private.h"
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, 0x%s, %p): stub !!!\n", This, iface, pTarget,
1650 pTargetFormat, wine_dbgstr_longlong(Source), pSourceFormat);
1655 static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface,
1657 DWORD dwCurrentFlags,
1659 DWORD dwStopFlags) {
1660 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1662 TRACE("(%p/%p)->(%p, %08lx, %p, %08lx): stub !!!\n", This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
1667 static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface,
1670 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1672 TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pCurrent, pStop);
1677 static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface,
1678 LONGLONG *pEarliest,
1679 LONGLONG *pLatest) {
1680 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1682 TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
1687 static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface,
1689 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1691 TRACE("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
1696 static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface,
1698 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1700 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
1705 static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface,
1706 LONGLONG *pllPreroll) {
1707 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1709 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
1715 static const IMediaSeekingVtbl IMediaSeeking_VTable =
1717 MediaSeeking_QueryInterface,
1718 MediaSeeking_AddRef,
1719 MediaSeeking_Release,
1720 MediaSeeking_GetCapabilities,
1721 MediaSeeking_CheckCapabilities,
1722 MediaSeeking_IsFormatSupported,
1723 MediaSeeking_QueryPreferredFormat,
1724 MediaSeeking_GetTimeFormat,
1725 MediaSeeking_IsUsingTimeFormat,
1726 MediaSeeking_SetTimeFormat,
1727 MediaSeeking_GetDuration,
1728 MediaSeeking_GetStopPosition,
1729 MediaSeeking_GetCurrentPosition,
1730 MediaSeeking_ConvertTimeFormat,
1731 MediaSeeking_SetPositions,
1732 MediaSeeking_GetPositions,
1733 MediaSeeking_GetAvailable,
1734 MediaSeeking_SetRate,
1735 MediaSeeking_GetRate,
1736 MediaSeeking_GetPreroll
1739 static HRESULT GetTargetInterface(IFilterGraphImpl* pGraph, REFIID riid, LPVOID* ppvObj)
1741 HRESULT hr = E_NOINTERFACE;
1745 /* Check if the interface type is already registered */
1746 for (entry = 0; entry < pGraph->nItfCacheEntries; entry++)
1747 if (riid == pGraph->ItfCacheEntries[entry].riid)
1749 if (pGraph->ItfCacheEntries[entry].iface)
1751 /* Return the interface if available */
1752 *ppvObj = pGraph->ItfCacheEntries[entry].iface;
1758 if (entry >= MAX_ITF_CACHE_ENTRIES)
1760 FIXME("Not enough space to store interface in the cache\n");
1761 return E_OUTOFMEMORY;
1764 /* Find a filter supporting the requested interface */
1765 for (i = 0; i < pGraph->nFilters; i++)
1767 hr = IBaseFilter_QueryInterface(pGraph->ppFiltersInGraph[i], riid, ppvObj);
1770 pGraph->ItfCacheEntries[entry].riid = (IID*)riid;
1771 pGraph->ItfCacheEntries[entry].filter = pGraph->ppFiltersInGraph[i];
1772 pGraph->ItfCacheEntries[entry].iface = (IUnknown*)*ppvObj;
1773 if (entry >= pGraph->nItfCacheEntries)
1774 pGraph->nItfCacheEntries++;
1777 if (hr != E_NOINTERFACE)
1784 /*** IUnknown methods ***/
1785 static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface,
1788 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1790 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1792 return Filtergraph_QueryInterface(This, riid, ppvObj);
1795 static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface) {
1796 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1798 TRACE("(%p/%p)->()\n", This, iface);
1800 return Filtergraph_AddRef(This);
1803 static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface) {
1804 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1806 TRACE("(%p/%p)->()\n", This, iface);
1808 return Filtergraph_Release(This);
1811 /*** IDispatch methods ***/
1812 static HRESULT WINAPI BasicAudio_GetTypeInfoCount(IBasicAudio *iface,
1814 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1815 IBasicAudio* pBasicAudio;
1818 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
1820 EnterCriticalSection(&This->cs);
1822 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1825 hr = IBasicAudio_GetTypeInfoCount(pBasicAudio, pctinfo);
1827 LeaveCriticalSection(&This->cs);
1832 static HRESULT WINAPI BasicAudio_GetTypeInfo(IBasicAudio *iface,
1835 ITypeInfo**ppTInfo) {
1836 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1837 IBasicAudio* pBasicAudio;
1840 TRACE("(%p/%p)->(%d, %ld, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
1842 EnterCriticalSection(&This->cs);
1844 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1847 hr = IBasicAudio_GetTypeInfo(pBasicAudio, iTInfo, lcid, ppTInfo);
1849 LeaveCriticalSection(&This->cs);
1854 static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface,
1860 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1861 IBasicAudio* pBasicAudio;
1864 TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1866 EnterCriticalSection(&This->cs);
1868 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1871 hr = IBasicAudio_GetIDsOfNames(pBasicAudio, riid, rgszNames, cNames, lcid, rgDispId);
1873 LeaveCriticalSection(&This->cs);
1878 static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface,
1879 DISPID dispIdMember,
1883 DISPPARAMS*pDispParams,
1885 EXCEPINFO*pExepInfo,
1887 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1888 IBasicAudio* pBasicAudio;
1891 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);
1893 EnterCriticalSection(&This->cs);
1895 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1898 hr = IBasicAudio_Invoke(pBasicAudio, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1900 LeaveCriticalSection(&This->cs);
1905 /*** IBasicAudio methods ***/
1906 static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface,
1908 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1909 IBasicAudio* pBasicAudio;
1912 TRACE("(%p/%p)->(%ld)\n", This, iface, lVolume);
1914 EnterCriticalSection(&This->cs);
1916 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1919 hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
1921 LeaveCriticalSection(&This->cs);
1926 static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface,
1928 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1929 IBasicAudio* pBasicAudio;
1932 TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
1934 EnterCriticalSection(&This->cs);
1936 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1939 hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
1941 LeaveCriticalSection(&This->cs);
1946 static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface,
1948 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1949 IBasicAudio* pBasicAudio;
1952 TRACE("(%p/%p)->(%ld)\n", This, iface, lBalance);
1954 EnterCriticalSection(&This->cs);
1956 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1959 hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
1961 LeaveCriticalSection(&This->cs);
1966 static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface,
1968 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1969 IBasicAudio* pBasicAudio;
1972 TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
1974 EnterCriticalSection(&This->cs);
1976 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1979 hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
1981 LeaveCriticalSection(&This->cs);
1986 static const IBasicAudioVtbl IBasicAudio_VTable =
1988 BasicAudio_QueryInterface,
1991 BasicAudio_GetTypeInfoCount,
1992 BasicAudio_GetTypeInfo,
1993 BasicAudio_GetIDsOfNames,
1995 BasicAudio_put_Volume,
1996 BasicAudio_get_Volume,
1997 BasicAudio_put_Balance,
1998 BasicAudio_get_Balance
2001 /*** IUnknown methods ***/
2002 static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo *iface,
2005 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2007 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2009 return Filtergraph_QueryInterface(This, riid, ppvObj);
2012 static ULONG WINAPI BasicVideo_AddRef(IBasicVideo *iface) {
2013 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2015 TRACE("(%p/%p)->()\n", This, iface);
2017 return Filtergraph_AddRef(This);
2020 static ULONG WINAPI BasicVideo_Release(IBasicVideo *iface) {
2021 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2023 TRACE("(%p/%p)->()\n", This, iface);
2025 return Filtergraph_Release(This);
2028 /*** IDispatch methods ***/
2029 static HRESULT WINAPI BasicVideo_GetTypeInfoCount(IBasicVideo *iface,
2031 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2032 IBasicVideo* pBasicVideo;
2035 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2037 EnterCriticalSection(&This->cs);
2039 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2042 hr = IBasicVideo_GetTypeInfoCount(pBasicVideo, pctinfo);
2044 LeaveCriticalSection(&This->cs);
2049 static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo *iface,
2052 ITypeInfo**ppTInfo) {
2053 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2054 IBasicVideo* pBasicVideo;
2057 TRACE("(%p/%p)->(%d, %ld, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2059 EnterCriticalSection(&This->cs);
2061 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2064 hr = IBasicVideo_GetTypeInfo(pBasicVideo, iTInfo, lcid, ppTInfo);
2066 LeaveCriticalSection(&This->cs);
2071 static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo *iface,
2077 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2078 IBasicVideo* pBasicVideo;
2081 TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2083 EnterCriticalSection(&This->cs);
2085 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2088 hr = IBasicVideo_GetIDsOfNames(pBasicVideo, riid, rgszNames, cNames, lcid, rgDispId);
2090 LeaveCriticalSection(&This->cs);
2095 static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo *iface,
2096 DISPID dispIdMember,
2100 DISPPARAMS*pDispParams,
2102 EXCEPINFO*pExepInfo,
2104 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2105 IBasicVideo* pBasicVideo;
2108 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);
2110 EnterCriticalSection(&This->cs);
2112 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2115 hr = IBasicVideo_Invoke(pBasicVideo, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2117 LeaveCriticalSection(&This->cs);
2122 /*** IBasicVideo methods ***/
2123 static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo *iface,
2124 REFTIME *pAvgTimePerFrame) {
2125 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2126 IBasicVideo* pBasicVideo;
2129 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
2131 EnterCriticalSection(&This->cs);
2133 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2136 hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
2138 LeaveCriticalSection(&This->cs);
2143 static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo *iface,
2145 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2146 IBasicVideo* pBasicVideo;
2149 TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
2151 EnterCriticalSection(&This->cs);
2153 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2156 hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
2158 LeaveCriticalSection(&This->cs);
2163 static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo *iface,
2164 long *pBitErrorRate) {
2165 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2166 IBasicVideo* pBasicVideo;
2169 TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
2171 EnterCriticalSection(&This->cs);
2173 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2176 hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
2178 LeaveCriticalSection(&This->cs);
2183 static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo *iface,
2184 long *pVideoWidth) {
2185 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2186 IBasicVideo* pBasicVideo;
2189 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
2191 EnterCriticalSection(&This->cs);
2193 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2196 hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
2198 LeaveCriticalSection(&This->cs);
2203 static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo *iface,
2204 long *pVideoHeight) {
2205 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2206 IBasicVideo* pBasicVideo;
2209 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
2211 EnterCriticalSection(&This->cs);
2213 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2216 hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
2218 LeaveCriticalSection(&This->cs);
2223 static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo *iface,
2225 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2226 IBasicVideo* pBasicVideo;
2229 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
2231 EnterCriticalSection(&This->cs);
2233 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2236 hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
2238 LeaveCriticalSection(&This->cs);
2243 static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo *iface,
2244 long *pSourceLeft) {
2245 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2246 IBasicVideo* pBasicVideo;
2249 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
2251 EnterCriticalSection(&This->cs);
2253 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2256 hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
2258 LeaveCriticalSection(&This->cs);
2263 static HRESULT WINAPI BasicVideo_put_SourceWidth(IBasicVideo *iface,
2265 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2266 IBasicVideo* pBasicVideo;
2269 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
2271 EnterCriticalSection(&This->cs);
2273 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2276 hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
2278 LeaveCriticalSection(&This->cs);
2283 static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo *iface,
2284 long *pSourceWidth) {
2285 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2286 IBasicVideo* pBasicVideo;
2289 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
2291 EnterCriticalSection(&This->cs);
2293 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2296 hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
2298 LeaveCriticalSection(&This->cs);
2303 static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo *iface,
2305 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2306 IBasicVideo* pBasicVideo;
2309 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
2311 EnterCriticalSection(&This->cs);
2313 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2316 hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
2318 LeaveCriticalSection(&This->cs);
2323 static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo *iface,
2325 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2326 IBasicVideo* pBasicVideo;
2329 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
2331 EnterCriticalSection(&This->cs);
2333 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2336 hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
2338 LeaveCriticalSection(&This->cs);
2343 static HRESULT WINAPI BasicVideo_put_SourceHeight(IBasicVideo *iface,
2344 long SourceHeight) {
2345 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2346 IBasicVideo* pBasicVideo;
2349 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
2351 EnterCriticalSection(&This->cs);
2353 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2356 hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
2358 LeaveCriticalSection(&This->cs);
2363 static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo *iface,
2364 long *pSourceHeight) {
2365 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2366 IBasicVideo* pBasicVideo;
2369 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
2371 EnterCriticalSection(&This->cs);
2373 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2376 hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
2378 LeaveCriticalSection(&This->cs);
2383 static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo *iface,
2384 long DestinationLeft) {
2385 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2386 IBasicVideo* pBasicVideo;
2389 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
2391 EnterCriticalSection(&This->cs);
2393 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2396 hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
2398 LeaveCriticalSection(&This->cs);
2403 static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo *iface,
2404 long *pDestinationLeft) {
2405 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2406 IBasicVideo* pBasicVideo;
2409 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
2411 EnterCriticalSection(&This->cs);
2413 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2416 hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
2418 LeaveCriticalSection(&This->cs);
2423 static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo *iface,
2424 long DestinationWidth) {
2425 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2426 IBasicVideo* pBasicVideo;
2429 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
2431 EnterCriticalSection(&This->cs);
2433 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2436 hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
2438 LeaveCriticalSection(&This->cs);
2443 static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo *iface,
2444 long *pDestinationWidth) {
2445 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2446 IBasicVideo* pBasicVideo;
2449 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
2451 EnterCriticalSection(&This->cs);
2453 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2456 hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
2458 LeaveCriticalSection(&This->cs);
2463 static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo *iface,
2464 long DestinationTop) {
2465 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2466 IBasicVideo* pBasicVideo;
2469 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
2471 EnterCriticalSection(&This->cs);
2473 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2476 hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
2478 LeaveCriticalSection(&This->cs);
2483 static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo *iface,
2484 long *pDestinationTop) {
2485 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2486 IBasicVideo* pBasicVideo;
2489 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
2491 EnterCriticalSection(&This->cs);
2493 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2496 hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
2498 LeaveCriticalSection(&This->cs);
2503 static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo *iface,
2504 long DestinationHeight) {
2505 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2506 IBasicVideo* pBasicVideo;
2509 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
2511 EnterCriticalSection(&This->cs);
2513 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2516 hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
2518 LeaveCriticalSection(&This->cs);
2523 static HRESULT WINAPI BasicVideo_get_DestinationHeight(IBasicVideo *iface,
2524 long *pDestinationHeight) {
2525 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2526 IBasicVideo* pBasicVideo;
2529 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
2531 EnterCriticalSection(&This->cs);
2533 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2536 hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
2538 LeaveCriticalSection(&This->cs);
2543 static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo *iface,
2548 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2549 IBasicVideo* pBasicVideo;
2552 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2554 EnterCriticalSection(&This->cs);
2556 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2559 hr = IBasicVideo_SetSourcePosition(pBasicVideo, Left, Top, Width, Height);
2561 LeaveCriticalSection(&This->cs);
2566 static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo *iface,
2571 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2572 IBasicVideo* pBasicVideo;
2575 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2577 EnterCriticalSection(&This->cs);
2579 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2582 hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
2584 LeaveCriticalSection(&This->cs);
2589 static HRESULT WINAPI BasicVideo_SetDefaultSourcePosition(IBasicVideo *iface) {
2590 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2591 IBasicVideo* pBasicVideo;
2594 TRACE("(%p/%p)->()\n", This, iface);
2596 EnterCriticalSection(&This->cs);
2598 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2601 hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
2603 LeaveCriticalSection(&This->cs);
2608 static HRESULT WINAPI BasicVideo_SetDestinationPosition(IBasicVideo *iface,
2613 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2614 IBasicVideo* pBasicVideo;
2617 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2619 EnterCriticalSection(&This->cs);
2621 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2624 hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left, Top, Width, Height);
2626 LeaveCriticalSection(&This->cs);
2631 static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo *iface,
2636 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2637 IBasicVideo* pBasicVideo;
2640 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2642 EnterCriticalSection(&This->cs);
2644 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2647 hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
2649 LeaveCriticalSection(&This->cs);
2654 static HRESULT WINAPI BasicVideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
2655 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2656 IBasicVideo* pBasicVideo;
2659 TRACE("(%p/%p)->()\n", This, iface);
2661 EnterCriticalSection(&This->cs);
2663 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2666 hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
2668 LeaveCriticalSection(&This->cs);
2673 static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo *iface,
2676 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2677 IBasicVideo* pBasicVideo;
2680 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
2682 EnterCriticalSection(&This->cs);
2684 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2687 hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
2689 LeaveCriticalSection(&This->cs);
2694 static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo *iface,
2699 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2700 IBasicVideo* pBasicVideo;
2703 TRACE("(%p/%p)->(%ld, %ld, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
2705 EnterCriticalSection(&This->cs);
2707 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2710 hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex, Entries, pRetrieved, pPalette);
2712 LeaveCriticalSection(&This->cs);
2717 static HRESULT WINAPI BasicVideo_GetCurrentImage(IBasicVideo *iface,
2720 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2721 IBasicVideo* pBasicVideo;
2724 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pBufferSize, pDIBImage);
2726 EnterCriticalSection(&This->cs);
2728 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2731 hr = IBasicVideo_GetCurrentImage(pBasicVideo, pBufferSize, pDIBImage);
2733 LeaveCriticalSection(&This->cs);
2738 static HRESULT WINAPI BasicVideo_IsUsingDefaultSource(IBasicVideo *iface) {
2739 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2740 IBasicVideo* pBasicVideo;
2743 TRACE("(%p/%p)->()\n", This, iface);
2745 EnterCriticalSection(&This->cs);
2747 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2750 hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
2752 LeaveCriticalSection(&This->cs);
2757 static HRESULT WINAPI BasicVideo_IsUsingDefaultDestination(IBasicVideo *iface) {
2758 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2759 IBasicVideo* pBasicVideo;
2762 TRACE("(%p/%p)->()\n", This, iface);
2764 EnterCriticalSection(&This->cs);
2766 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2769 hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
2771 LeaveCriticalSection(&This->cs);
2777 static const IBasicVideoVtbl IBasicVideo_VTable =
2779 BasicVideo_QueryInterface,
2782 BasicVideo_GetTypeInfoCount,
2783 BasicVideo_GetTypeInfo,
2784 BasicVideo_GetIDsOfNames,
2786 BasicVideo_get_AvgTimePerFrame,
2787 BasicVideo_get_BitRate,
2788 BasicVideo_get_BitErrorRate,
2789 BasicVideo_get_VideoWidth,
2790 BasicVideo_get_VideoHeight,
2791 BasicVideo_put_SourceLeft,
2792 BasicVideo_get_SourceLeft,
2793 BasicVideo_put_SourceWidth,
2794 BasicVideo_get_SourceWidth,
2795 BasicVideo_put_SourceTop,
2796 BasicVideo_get_SourceTop,
2797 BasicVideo_put_SourceHeight,
2798 BasicVideo_get_SourceHeight,
2799 BasicVideo_put_DestinationLeft,
2800 BasicVideo_get_DestinationLeft,
2801 BasicVideo_put_DestinationWidth,
2802 BasicVideo_get_DestinationWidth,
2803 BasicVideo_put_DestinationTop,
2804 BasicVideo_get_DestinationTop,
2805 BasicVideo_put_DestinationHeight,
2806 BasicVideo_get_DestinationHeight,
2807 BasicVideo_SetSourcePosition,
2808 BasicVideo_GetSourcePosition,
2809 BasicVideo_SetDefaultSourcePosition,
2810 BasicVideo_SetDestinationPosition,
2811 BasicVideo_GetDestinationPosition,
2812 BasicVideo_SetDefaultDestinationPosition,
2813 BasicVideo_GetVideoSize,
2814 BasicVideo_GetVideoPaletteEntries,
2815 BasicVideo_GetCurrentImage,
2816 BasicVideo_IsUsingDefaultSource,
2817 BasicVideo_IsUsingDefaultDestination
2821 /*** IUnknown methods ***/
2822 static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface,
2825 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2827 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2829 return Filtergraph_QueryInterface(This, riid, ppvObj);
2832 static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface) {
2833 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2835 TRACE("(%p/%p)->()\n", This, iface);
2837 return Filtergraph_AddRef(This);
2840 static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface) {
2841 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2843 TRACE("(%p/%p)->()\n", This, iface);
2845 return Filtergraph_Release(This);
2848 /*** IDispatch methods ***/
2849 static HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface,
2851 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2852 IVideoWindow* pVideoWindow;
2855 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2857 EnterCriticalSection(&This->cs);
2859 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2862 hr = IVideoWindow_GetTypeInfoCount(pVideoWindow, pctinfo);
2864 LeaveCriticalSection(&This->cs);
2869 static HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface,
2872 ITypeInfo**ppTInfo) {
2873 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2874 IVideoWindow* pVideoWindow;
2877 TRACE("(%p/%p)->(%d, %ld, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2879 EnterCriticalSection(&This->cs);
2881 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2884 hr = IVideoWindow_GetTypeInfo(pVideoWindow, iTInfo, lcid, ppTInfo);
2886 LeaveCriticalSection(&This->cs);
2891 static HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface,
2897 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2898 IVideoWindow* pVideoWindow;
2901 TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2903 EnterCriticalSection(&This->cs);
2905 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2908 hr = IVideoWindow_GetIDsOfNames(pVideoWindow, riid, rgszNames, cNames, lcid, rgDispId);
2910 LeaveCriticalSection(&This->cs);
2915 static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface,
2916 DISPID dispIdMember,
2920 DISPPARAMS*pDispParams,
2922 EXCEPINFO*pExepInfo,
2924 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2925 IVideoWindow* pVideoWindow;
2928 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);
2930 EnterCriticalSection(&This->cs);
2932 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2935 hr = IVideoWindow_Invoke(pVideoWindow, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2937 LeaveCriticalSection(&This->cs);
2943 /*** IVideoWindow methods ***/
2944 static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface,
2946 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2947 IVideoWindow* pVideoWindow;
2950 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
2952 EnterCriticalSection(&This->cs);
2954 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2957 hr = IVideoWindow_put_Caption(pVideoWindow, strCaption);
2959 LeaveCriticalSection(&This->cs);
2964 static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface,
2966 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2967 IVideoWindow* pVideoWindow;
2970 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
2972 EnterCriticalSection(&This->cs);
2974 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2977 hr = IVideoWindow_get_Caption(pVideoWindow, strCaption);
2979 LeaveCriticalSection(&This->cs);
2984 static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface,
2986 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2987 IVideoWindow* pVideoWindow;
2990 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyle);
2992 EnterCriticalSection(&This->cs);
2994 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
2997 hr = IVideoWindow_put_WindowStyle(pVideoWindow, WindowStyle);
2999 LeaveCriticalSection(&This->cs);
3004 static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface,
3005 long *WindowStyle) {
3006 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3007 IVideoWindow* pVideoWindow;
3010 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
3012 EnterCriticalSection(&This->cs);
3014 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3017 hr = IVideoWindow_get_WindowStyle(pVideoWindow, WindowStyle);
3019 LeaveCriticalSection(&This->cs);
3024 static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface,
3025 long WindowStyleEx) {
3026 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3027 IVideoWindow* pVideoWindow;
3030 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
3032 EnterCriticalSection(&This->cs);
3034 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3037 hr = IVideoWindow_put_WindowStyleEx(pVideoWindow, WindowStyleEx);
3039 LeaveCriticalSection(&This->cs);
3044 static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface,
3045 long *WindowStyleEx) {
3046 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3047 IVideoWindow* pVideoWindow;
3050 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
3052 EnterCriticalSection(&This->cs);
3054 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3057 hr = IVideoWindow_get_WindowStyleEx(pVideoWindow, WindowStyleEx);
3059 LeaveCriticalSection(&This->cs);
3064 static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface,
3066 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3067 IVideoWindow* pVideoWindow;
3070 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
3072 EnterCriticalSection(&This->cs);
3074 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3077 hr = IVideoWindow_put_AutoShow(pVideoWindow, AutoShow);
3079 LeaveCriticalSection(&This->cs);
3084 static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface,
3086 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3087 IVideoWindow* pVideoWindow;
3090 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
3092 EnterCriticalSection(&This->cs);
3094 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3097 hr = IVideoWindow_get_AutoShow(pVideoWindow, AutoShow);
3099 LeaveCriticalSection(&This->cs);
3104 static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface,
3106 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3107 IVideoWindow* pVideoWindow;
3110 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowState);
3112 EnterCriticalSection(&This->cs);
3114 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3117 hr = IVideoWindow_put_WindowState(pVideoWindow, WindowState);
3119 LeaveCriticalSection(&This->cs);
3124 static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface,
3125 long *WindowState) {
3126 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3127 IVideoWindow* pVideoWindow;
3130 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
3132 EnterCriticalSection(&This->cs);
3134 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3137 hr = IVideoWindow_get_WindowState(pVideoWindow, WindowState);
3139 LeaveCriticalSection(&This->cs);
3144 static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface,
3145 long BackgroundPalette) {
3146 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3147 IVideoWindow* pVideoWindow;
3150 TRACE("(%p/%p)->(%ld)\n", This, iface, BackgroundPalette);
3152 EnterCriticalSection(&This->cs);
3154 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3157 hr = IVideoWindow_put_BackgroundPalette(pVideoWindow, BackgroundPalette);
3159 LeaveCriticalSection(&This->cs);
3164 static HRESULT WINAPI VideoWindow_get_BackgroundPalette(IVideoWindow *iface,
3165 long *pBackgroundPalette) {
3166 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3167 IVideoWindow* pVideoWindow;
3170 TRACE("(%p/%p)->(%p)\n", This, iface, pBackgroundPalette);
3172 EnterCriticalSection(&This->cs);
3174 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3177 hr = IVideoWindow_get_BackgroundPalette(pVideoWindow, pBackgroundPalette);
3179 LeaveCriticalSection(&This->cs);
3184 static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface,
3186 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3187 IVideoWindow* pVideoWindow;
3190 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
3192 EnterCriticalSection(&This->cs);
3194 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3197 hr = IVideoWindow_put_Visible(pVideoWindow, Visible);
3199 LeaveCriticalSection(&This->cs);
3204 static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface,
3206 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3207 IVideoWindow* pVideoWindow;
3210 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
3212 EnterCriticalSection(&This->cs);
3214 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3217 hr = IVideoWindow_get_Visible(pVideoWindow, pVisible);
3219 LeaveCriticalSection(&This->cs);
3224 static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface,
3226 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3227 IVideoWindow* pVideoWindow;
3230 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
3232 EnterCriticalSection(&This->cs);
3234 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3237 hr = IVideoWindow_put_Left(pVideoWindow, Left);
3239 LeaveCriticalSection(&This->cs);
3244 static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface,
3246 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3247 IVideoWindow* pVideoWindow;
3250 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
3252 EnterCriticalSection(&This->cs);
3254 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3257 hr = IVideoWindow_get_Left(pVideoWindow, pLeft);
3259 LeaveCriticalSection(&This->cs);
3264 static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface,
3266 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3267 IVideoWindow* pVideoWindow;
3270 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
3272 EnterCriticalSection(&This->cs);
3274 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3277 hr = IVideoWindow_put_Width(pVideoWindow, Width);
3279 LeaveCriticalSection(&This->cs);
3284 static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface,
3286 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3287 IVideoWindow* pVideoWindow;
3290 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
3292 EnterCriticalSection(&This->cs);
3294 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3297 hr = IVideoWindow_get_Width(pVideoWindow, pWidth);
3299 LeaveCriticalSection(&This->cs);
3304 static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface,
3306 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3307 IVideoWindow* pVideoWindow;
3310 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
3312 EnterCriticalSection(&This->cs);
3314 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3317 hr = IVideoWindow_put_Top(pVideoWindow, Top);
3319 LeaveCriticalSection(&This->cs);
3324 static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface,
3326 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3327 IVideoWindow* pVideoWindow;
3330 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
3332 EnterCriticalSection(&This->cs);
3334 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3337 hr = IVideoWindow_get_Top(pVideoWindow, pTop);
3339 LeaveCriticalSection(&This->cs);
3344 static HRESULT WINAPI VideoWindow_put_Height(IVideoWindow *iface,
3346 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3347 IVideoWindow* pVideoWindow;
3350 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
3352 EnterCriticalSection(&This->cs);
3354 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3357 hr = IVideoWindow_put_Height(pVideoWindow, Height);
3359 LeaveCriticalSection(&This->cs);
3364 static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface,
3366 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3367 IVideoWindow* pVideoWindow;
3370 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
3372 EnterCriticalSection(&This->cs);
3374 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3377 hr = IVideoWindow_get_Height(pVideoWindow, pHeight);
3379 LeaveCriticalSection(&This->cs);
3384 static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface,
3386 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3387 IVideoWindow* pVideoWindow;
3390 TRACE("(%p/%p)->(%08lx)\n", This, iface, (DWORD) Owner);
3392 EnterCriticalSection(&This->cs);
3394 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3397 hr = IVideoWindow_put_Owner(pVideoWindow, Owner);
3399 LeaveCriticalSection(&This->cs);
3404 static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface,
3406 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3407 IVideoWindow* pVideoWindow;
3410 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
3412 EnterCriticalSection(&This->cs);
3414 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3417 hr = IVideoWindow_get_Owner(pVideoWindow, Owner);
3419 LeaveCriticalSection(&This->cs);
3424 static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface,
3426 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3427 IVideoWindow* pVideoWindow;
3430 TRACE("(%p/%p)->(%08lx)\n", This, iface, (DWORD) Drain);
3432 EnterCriticalSection(&This->cs);
3434 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3437 hr = IVideoWindow_put_MessageDrain(pVideoWindow, Drain);
3439 LeaveCriticalSection(&This->cs);
3444 static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface,
3446 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3447 IVideoWindow* pVideoWindow;
3450 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
3452 EnterCriticalSection(&This->cs);
3454 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3457 hr = IVideoWindow_get_MessageDrain(pVideoWindow, Drain);
3459 LeaveCriticalSection(&This->cs);
3464 static HRESULT WINAPI VideoWindow_get_BorderColor(IVideoWindow *iface,
3466 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3467 IVideoWindow* pVideoWindow;
3470 TRACE("(%p/%p)->(%p)\n", This, iface, Color);
3472 EnterCriticalSection(&This->cs);
3474 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3477 hr = IVideoWindow_get_BorderColor(pVideoWindow, Color);
3479 LeaveCriticalSection(&This->cs);
3484 static HRESULT WINAPI VideoWindow_put_BorderColor(IVideoWindow *iface,
3486 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3487 IVideoWindow* pVideoWindow;
3490 TRACE("(%p/%p)->(%ld)\n", This, iface, Color);
3492 EnterCriticalSection(&This->cs);
3494 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3497 hr = IVideoWindow_put_BorderColor(pVideoWindow, Color);
3499 LeaveCriticalSection(&This->cs);
3504 static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
3505 long *FullScreenMode) {
3506 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3507 IVideoWindow* pVideoWindow;
3510 TRACE("(%p/%p)->(%p)\n", This, iface, FullScreenMode);
3512 EnterCriticalSection(&This->cs);
3514 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3517 hr = IVideoWindow_get_FullScreenMode(pVideoWindow, FullScreenMode);
3519 LeaveCriticalSection(&This->cs);
3524 static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface,
3525 long FullScreenMode) {
3526 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3527 IVideoWindow* pVideoWindow;
3530 TRACE("(%p/%p)->(%ld)\n", This, iface, FullScreenMode);
3532 EnterCriticalSection(&This->cs);
3534 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3537 hr = IVideoWindow_put_FullScreenMode(pVideoWindow, FullScreenMode);
3539 LeaveCriticalSection(&This->cs);
3544 static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface,
3546 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3547 IVideoWindow* pVideoWindow;
3550 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
3552 EnterCriticalSection(&This->cs);
3554 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3557 hr = IVideoWindow_SetWindowForeground(pVideoWindow, Focus);
3559 LeaveCriticalSection(&This->cs);
3564 static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface,
3569 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3570 IVideoWindow* pVideoWindow;
3573 TRACE("(%p/%p)->(%08lx, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
3575 EnterCriticalSection(&This->cs);
3577 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3580 hr = IVideoWindow_NotifyOwnerMessage(pVideoWindow, hwnd, uMsg, wParam, lParam);
3582 LeaveCriticalSection(&This->cs);
3587 static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface,
3592 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3593 IVideoWindow* pVideoWindow;
3596 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
3598 EnterCriticalSection(&This->cs);
3600 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3603 hr = IVideoWindow_SetWindowPosition(pVideoWindow, Left, Top, Width, Height);
3605 LeaveCriticalSection(&This->cs);
3610 static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface,
3615 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3616 IVideoWindow* pVideoWindow;
3619 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3621 EnterCriticalSection(&This->cs);
3623 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3626 hr = IVideoWindow_GetWindowPosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
3628 LeaveCriticalSection(&This->cs);
3633 static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface,
3636 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3637 IVideoWindow* pVideoWindow;
3640 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3642 EnterCriticalSection(&This->cs);
3644 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3647 hr = IVideoWindow_GetMinIdealImageSize(pVideoWindow, pWidth, pHeight);
3649 LeaveCriticalSection(&This->cs);
3654 static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface,
3657 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3658 IVideoWindow* pVideoWindow;
3661 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3663 EnterCriticalSection(&This->cs);
3665 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3668 hr = IVideoWindow_GetMaxIdealImageSize(pVideoWindow, pWidth, pHeight);
3670 LeaveCriticalSection(&This->cs);
3675 static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface,
3680 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3681 IVideoWindow* pVideoWindow;
3684 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3686 EnterCriticalSection(&This->cs);
3688 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3691 hr = IVideoWindow_GetRestorePosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
3693 LeaveCriticalSection(&This->cs);
3698 static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface,
3700 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3701 IVideoWindow* pVideoWindow;
3704 TRACE("(%p/%p)->(%ld)\n", This, iface, HideCursor);
3706 EnterCriticalSection(&This->cs);
3708 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3711 hr = IVideoWindow_HideCursor(pVideoWindow, HideCursor);
3713 LeaveCriticalSection(&This->cs);
3718 static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface,
3719 long *CursorHidden) {
3720 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3721 IVideoWindow* pVideoWindow;
3724 TRACE("(%p/%p)->(%p)\n", This, iface, CursorHidden);
3726 EnterCriticalSection(&This->cs);
3728 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3731 hr = IVideoWindow_IsCursorHidden(pVideoWindow, CursorHidden);
3733 LeaveCriticalSection(&This->cs);
3739 static const IVideoWindowVtbl IVideoWindow_VTable =
3741 VideoWindow_QueryInterface,
3743 VideoWindow_Release,
3744 VideoWindow_GetTypeInfoCount,
3745 VideoWindow_GetTypeInfo,
3746 VideoWindow_GetIDsOfNames,
3748 VideoWindow_put_Caption,
3749 VideoWindow_get_Caption,
3750 VideoWindow_put_WindowStyle,
3751 VideoWindow_get_WindowStyle,
3752 VideoWindow_put_WindowStyleEx,
3753 VideoWindow_get_WindowStyleEx,
3754 VideoWindow_put_AutoShow,
3755 VideoWindow_get_AutoShow,
3756 VideoWindow_put_WindowState,
3757 VideoWindow_get_WindowState,
3758 VideoWindow_put_BackgroundPalette,
3759 VideoWindow_get_BackgroundPalette,
3760 VideoWindow_put_Visible,
3761 VideoWindow_get_Visible,
3762 VideoWindow_put_Left,
3763 VideoWindow_get_Left,
3764 VideoWindow_put_Width,
3765 VideoWindow_get_Width,
3766 VideoWindow_put_Top,
3767 VideoWindow_get_Top,
3768 VideoWindow_put_Height,
3769 VideoWindow_get_Height,
3770 VideoWindow_put_Owner,
3771 VideoWindow_get_Owner,
3772 VideoWindow_put_MessageDrain,
3773 VideoWindow_get_MessageDrain,
3774 VideoWindow_get_BorderColor,
3775 VideoWindow_put_BorderColor,
3776 VideoWindow_get_FullScreenMode,
3777 VideoWindow_put_FullScreenMode,
3778 VideoWindow_SetWindowForeground,
3779 VideoWindow_NotifyOwnerMessage,
3780 VideoWindow_SetWindowPosition,
3781 VideoWindow_GetWindowPosition,
3782 VideoWindow_GetMinIdealImageSize,
3783 VideoWindow_GetMaxIdealImageSize,
3784 VideoWindow_GetRestorePosition,
3785 VideoWindow_HideCursor,
3786 VideoWindow_IsCursorHidden
3790 /*** IUnknown methods ***/
3791 static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface,
3794 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3796 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
3798 return Filtergraph_QueryInterface(This, riid, ppvObj);
3801 static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface) {
3802 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3804 TRACE("(%p/%p)->()\n", This, iface);
3806 return Filtergraph_AddRef(This);
3809 static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface) {
3810 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3812 TRACE("(%p/%p)->()\n", This, iface);
3814 return Filtergraph_Release(This);
3817 /*** IDispatch methods ***/
3818 static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface,
3820 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3822 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
3827 static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface,
3830 ITypeInfo**ppTInfo) {
3831 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3833 TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
3838 static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface,
3844 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3846 TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
3851 static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface,
3852 DISPID dispIdMember,
3856 DISPPARAMS*pDispParams,
3858 EXCEPINFO*pExepInfo,
3860 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3862 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);
3867 /*** IMediaEvent methods ***/
3868 static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface,
3870 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3872 TRACE("(%p/%p)->(%p)\n", This, iface, hEvent);
3874 *hEvent = (OAEVENT)This->evqueue.msg_event;
3879 static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface,
3884 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3887 TRACE("(%p/%p)->(%p, %p, %p, %ld)\n", This, iface, lEventCode, lParam1, lParam2, msTimeout);
3889 if (EventsQueue_GetEvent(&This->evqueue, &evt, msTimeout))
3891 *lEventCode = evt.lEventCode;
3892 *lParam1 = evt.lParam1;
3893 *lParam2 = evt.lParam2;
3901 static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface,
3904 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3906 TRACE("(%p/%p)->(%ld, %p)\n", This, iface, msTimeout, pEvCode);
3908 if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
3910 *pEvCode = This->CompletionStatus;
3918 static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface,
3920 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3922 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
3924 if (lEvCode == EC_COMPLETE)
3925 This->HandleEcComplete = FALSE;
3926 else if (lEvCode == EC_REPAINT)
3927 This->HandleEcRepaint = FALSE;
3934 static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(IMediaEventEx *iface,
3936 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3938 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
3940 if (lEvCode == EC_COMPLETE)
3941 This->HandleEcComplete = TRUE;
3942 else if (lEvCode == EC_REPAINT)
3943 This->HandleEcRepaint = TRUE;
3950 static HRESULT WINAPI MediaEvent_FreeEventParams(IMediaEventEx *iface,
3954 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3956 TRACE("(%p/%p)->(%ld, %08lx, %08lx): stub !!!\n", This, iface, lEvCode, lParam1, lParam2);
3961 /*** IMediaEventEx methods ***/
3962 static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
3965 LONG_PTR lInstanceData) {
3966 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3968 TRACE("(%p/%p)->(%08lx, %ld, %08lx)\n", This, iface, (DWORD) hwnd, lMsg, lInstanceData);
3970 This->notif.hWnd = (HWND)hwnd;
3971 This->notif.msg = lMsg;
3972 This->notif.instance = (long) lInstanceData;
3977 static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface,
3978 long lNoNotifyFlags) {
3979 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3981 TRACE("(%p/%p)->(%ld)\n", This, iface, lNoNotifyFlags);
3983 if ((lNoNotifyFlags != 0) && (lNoNotifyFlags != 1))
3984 return E_INVALIDARG;
3986 This->notif.disabled = lNoNotifyFlags;
3991 static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface,
3992 long *lplNoNotifyFlags) {
3993 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3995 TRACE("(%p/%p)->(%p)\n", This, iface, lplNoNotifyFlags);
3997 if (!lplNoNotifyFlags)
4000 *lplNoNotifyFlags = This->notif.disabled;
4006 static const IMediaEventExVtbl IMediaEventEx_VTable =
4008 MediaEvent_QueryInterface,
4011 MediaEvent_GetTypeInfoCount,
4012 MediaEvent_GetTypeInfo,
4013 MediaEvent_GetIDsOfNames,
4015 MediaEvent_GetEventHandle,
4016 MediaEvent_GetEvent,
4017 MediaEvent_WaitForCompletion,
4018 MediaEvent_CancelDefaultHandling,
4019 MediaEvent_RestoreDefaultHandling,
4020 MediaEvent_FreeEventParams,
4021 MediaEvent_SetNotifyWindow,
4022 MediaEvent_SetNotifyFlags,
4023 MediaEvent_GetNotifyFlags
4027 static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID riid, LPVOID *ppv)
4029 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4031 return Filtergraph_QueryInterface(This, riid, ppv);
4034 static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
4036 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4038 return Filtergraph_AddRef(This);
4041 static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
4043 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4045 return Filtergraph_Release(This);
4048 static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClassID)
4050 FIXME("(%p): stub\n", pClassID);
4055 static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
4057 FIXME("(): stub\n");
4062 static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
4064 FIXME("(): stub\n");
4069 static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME tStart)
4071 FIXME("(0x%s): stub\n", wine_dbgstr_longlong(tStart));
4076 static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD dwMsTimeout, FILTER_STATE * pState)
4078 FIXME("(%ld, %p): stub\n", dwMsTimeout, pState);
4083 static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
4085 FIXME("(%p): stub\n", pClock);
4090 static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
4092 FIXME("(%p): stub\n", ppClock);
4097 static const IMediaFilterVtbl IMediaFilter_VTable =
4099 MediaFilter_QueryInterface,
4101 MediaFilter_Release,
4102 MediaFilter_GetClassID,
4106 MediaFilter_GetState,
4107 MediaFilter_SetSyncSource,
4108 MediaFilter_GetSyncSource
4111 static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID riid, LPVOID *ppv)
4113 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4115 return Filtergraph_QueryInterface(This, riid, ppv);
4118 static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
4120 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4122 return Filtergraph_AddRef(This);
4125 static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
4127 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4129 return Filtergraph_Release(This);
4132 static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, long EventCode, LONG_PTR EventParam1, LONG_PTR EventParam2)
4134 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4137 TRACE("(%p/%p)->(%ld, %ld, %ld)\n", This, iface, EventCode, EventParam1, EventParam2);
4139 /* We need thread safety here, let's use the events queue's one */
4140 EnterCriticalSection(&This->evqueue.msg_crst);
4142 if ((EventCode == EC_COMPLETE) && This->HandleEcComplete)
4144 TRACE("Process EC_COMPLETE notification\n");
4145 if (++This->EcCompleteCount == This->nRenderers)
4147 evt.lEventCode = EC_COMPLETE;
4150 TRACE("Send EC_COMPLETE to app\n");
4151 EventsQueue_PutEvent(&This->evqueue, &evt);
4152 if (!This->notif.disabled && This->notif.hWnd)
4154 TRACE("Send Window message\n");
4155 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4157 This->CompletionStatus = EC_COMPLETE;
4158 SetEvent(This->hEventCompletion);
4161 else if ((EventCode == EC_REPAINT) && This->HandleEcRepaint)
4163 /* FIXME: Not handled yet */
4167 evt.lEventCode = EventCode;
4168 evt.lParam1 = EventParam1;
4169 evt.lParam2 = EventParam2;
4170 EventsQueue_PutEvent(&This->evqueue, &evt);
4171 if (!This->notif.disabled && This->notif.hWnd)
4172 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4175 LeaveCriticalSection(&This->evqueue.msg_crst);
4179 static const IMediaEventSinkVtbl IMediaEventSink_VTable =
4181 MediaEventSink_QueryInterface,
4182 MediaEventSink_AddRef,
4183 MediaEventSink_Release,
4184 MediaEventSink_Notify
4187 static HRESULT WINAPI GraphConfig_QueryInterface(IGraphConfig *iface, REFIID riid, LPVOID *ppv)
4189 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4191 return Filtergraph_QueryInterface(This, riid, ppv);
4194 static ULONG WINAPI GraphConfig_AddRef(IGraphConfig *iface)
4196 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4198 return Filtergraph_AddRef(This);
4201 static ULONG WINAPI GraphConfig_Release(IGraphConfig *iface)
4203 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4205 return Filtergraph_Release(This);
4208 static HRESULT WINAPI GraphConfig_Reconnect(IGraphConfig *iface,
4211 const AM_MEDIA_TYPE* pmtFirstConnection,
4212 IBaseFilter* pUsingFilter,
4216 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4218 FIXME("(%p)->(%p, %p, %p, %p, %p, %lx): stub!\n", This, pOutputPin, pInputPin, pmtFirstConnection, pUsingFilter, hAbortEvent, dwFlags);
4223 static HRESULT WINAPI GraphConfig_Reconfigure(IGraphConfig *iface,
4224 IGraphConfigCallback* pCallback,
4229 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4231 FIXME("(%p)->(%p, %p, %lx, %p): stub!\n", This, pCallback, pvContext, dwFlags, hAbortEvent);
4236 static HRESULT WINAPI GraphConfig_AddFilterToCache(IGraphConfig *iface,
4237 IBaseFilter* pFilter)
4239 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4241 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4246 static HRESULT WINAPI GraphConfig_EnumCacheFilter(IGraphConfig *iface,
4247 IEnumFilters** pEnum)
4249 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4251 FIXME("(%p)->(%p): stub!\n", This, pEnum);
4256 static HRESULT WINAPI GraphConfig_RemoveFilterFromCache(IGraphConfig *iface,
4257 IBaseFilter* pFilter)
4259 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4261 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4266 static HRESULT WINAPI GraphConfig_GetStartTime(IGraphConfig *iface,
4267 REFERENCE_TIME* prtStart)
4269 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4271 FIXME("(%p)->(%p): stub!\n", This, prtStart);
4276 static HRESULT WINAPI GraphConfig_PushThroughData(IGraphConfig *iface,
4278 IPinConnection* pConnection,
4281 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4283 FIXME("(%p)->(%p, %p, %p): stub!\n", This, pOutputPin, pConnection, hEventAbort);
4288 static HRESULT WINAPI GraphConfig_SetFilterFlags(IGraphConfig *iface,
4289 IBaseFilter* pFilter,
4292 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4294 FIXME("(%p)->(%p, %lx): stub!\n", This, pFilter, dwFlags);
4299 static HRESULT WINAPI GraphConfig_GetFilterFlags(IGraphConfig *iface,
4300 IBaseFilter* pFilter,
4303 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4305 FIXME("(%p)->(%p, %p): stub!\n", This, pFilter, dwFlags);
4310 static HRESULT WINAPI GraphConfig_RemoveFilterEx(IGraphConfig *iface,
4311 IBaseFilter* pFilter,
4314 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4316 FIXME("(%p)->(%p, %lx): stub!\n", This, pFilter, dwFlags);
4321 static const IGraphConfigVtbl IGraphConfig_VTable =
4323 GraphConfig_QueryInterface,
4325 GraphConfig_Release,
4326 GraphConfig_Reconnect,
4327 GraphConfig_Reconfigure,
4328 GraphConfig_AddFilterToCache,
4329 GraphConfig_EnumCacheFilter,
4330 GraphConfig_RemoveFilterFromCache,
4331 GraphConfig_GetStartTime,
4332 GraphConfig_PushThroughData,
4333 GraphConfig_SetFilterFlags,
4334 GraphConfig_GetFilterFlags,
4335 GraphConfig_RemoveFilterEx
4338 /* This is the only function that actually creates a FilterGraph class... */
4339 HRESULT FilterGraph_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4341 IFilterGraphImpl *fimpl;
4344 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
4347 return CLASS_E_NOAGGREGATION;
4349 fimpl = HeapAlloc(GetProcessHeap(), 0, sizeof(*fimpl));
4350 fimpl->IGraphBuilder_vtbl = &IGraphBuilder_VTable;
4351 fimpl->IMediaControl_vtbl = &IMediaControl_VTable;
4352 fimpl->IMediaSeeking_vtbl = &IMediaSeeking_VTable;
4353 fimpl->IBasicAudio_vtbl = &IBasicAudio_VTable;
4354 fimpl->IBasicVideo_vtbl = &IBasicVideo_VTable;
4355 fimpl->IVideoWindow_vtbl = &IVideoWindow_VTable;
4356 fimpl->IMediaEventEx_vtbl = &IMediaEventEx_VTable;
4357 fimpl->IMediaFilter_vtbl = &IMediaFilter_VTable;
4358 fimpl->IMediaEventSink_vtbl = &IMediaEventSink_VTable;
4359 fimpl->IGraphConfig_vtbl = &IGraphConfig_VTable;
4361 fimpl->ppFiltersInGraph = NULL;
4362 fimpl->pFilterNames = NULL;
4363 fimpl->nFilters = 0;
4364 fimpl->filterCapacity = 0;
4365 fimpl->nameIndex = 1;
4366 fimpl->hEventCompletion = CreateEventW(0, TRUE, FALSE, 0);
4367 fimpl->HandleEcComplete = TRUE;
4368 fimpl->HandleEcRepaint = TRUE;
4369 fimpl->notif.hWnd = 0;
4370 fimpl->notif.disabled = FALSE;
4371 fimpl->nRenderers = 0;
4372 fimpl->EcCompleteCount = 0;
4373 fimpl->state = State_Stopped;
4374 EventsQueue_Init(&fimpl->evqueue);
4375 InitializeCriticalSection(&fimpl->cs);
4376 fimpl->nItfCacheEntries = 0;
4378 hr = CoCreateInstance(&CLSID_FilterMapper, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&fimpl->pFilterMapper2);
4380 ERR("Unable to create filter mapper (%lx)\n", hr);
4388 HRESULT FilterGraphNoThread_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4390 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
4391 return FilterGraph_create(pUnkOuter, ppObj);