quartz: Disconnect pins when their filter is removed.
[wine.git] / dlls / quartz / filtergraph.c
blob044ff0118644e661ef48a642e032a30857e238e0
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
24 #include "config.h"
25 #include <stdarg.h>
27 #define COBJMACROS
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winuser.h"
32 #include "dshow.h"
33 #include "wine/debug.h"
34 #include "quartz_private.h"
35 #include "ole2.h"
36 #include "olectl.h"
37 #include "strmif.h"
38 #include "vfwmsgs.h"
39 #include "evcode.h"
40 #include "wine/unicode.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
45 typedef struct {
46 HWND hWnd; /* Target window */
47 long msg; /* User window message */
48 long instance; /* User data */
49 int disabled; /* Disabled messages posting */
50 } WndNotify;
52 typedef struct {
53 long lEventCode; /* Event code */
54 LONG_PTR lParam1; /* Param1 */
55 LONG_PTR lParam2; /* Param2 */
56 } Event;
58 /* messages ring implementation for queuing events (taken from winmm) */
59 #define EVENTS_RING_BUFFER_INCREMENT 64
60 typedef struct {
61 Event* messages;
62 int ring_buffer_size;
63 int msg_tosave;
64 int msg_toget;
65 CRITICAL_SECTION msg_crst;
66 HANDLE msg_event; /* Signaled for no empty queue */
67 } EventsQueue;
69 static int EventsQueue_Init(EventsQueue* omr)
71 omr->msg_toget = 0;
72 omr->msg_tosave = 0;
73 omr->msg_event = CreateEventW(NULL, TRUE, FALSE, NULL);
74 omr->ring_buffer_size = EVENTS_RING_BUFFER_INCREMENT;
75 omr->messages = CoTaskMemAlloc(omr->ring_buffer_size * sizeof(Event));
76 ZeroMemory(omr->messages, omr->ring_buffer_size * sizeof(Event));
78 InitializeCriticalSection(&omr->msg_crst);
79 omr->msg_crst.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": EventsQueue.msg_crst");
80 return TRUE;
83 static int EventsQueue_Destroy(EventsQueue* omr)
85 CloseHandle(omr->msg_event);
86 CoTaskMemFree(omr->messages);
87 omr->msg_crst.DebugInfo->Spare[0] = 0;
88 DeleteCriticalSection(&omr->msg_crst);
89 return TRUE;
92 static int EventsQueue_PutEvent(EventsQueue* omr, Event* evt)
94 EnterCriticalSection(&omr->msg_crst);
95 if ((omr->msg_toget == ((omr->msg_tosave + 1) % omr->ring_buffer_size)))
97 int old_ring_buffer_size = omr->ring_buffer_size;
98 omr->ring_buffer_size += EVENTS_RING_BUFFER_INCREMENT;
99 TRACE("omr->ring_buffer_size=%d\n",omr->ring_buffer_size);
100 omr->messages = HeapReAlloc(GetProcessHeap(),0,omr->messages, omr->ring_buffer_size * sizeof(Event));
101 /* Now we need to rearrange the ring buffer so that the new
102 buffers just allocated are in between omr->msg_tosave and
103 omr->msg_toget.
105 if (omr->msg_tosave < omr->msg_toget)
107 memmove(&(omr->messages[omr->msg_toget + EVENTS_RING_BUFFER_INCREMENT]),
108 &(omr->messages[omr->msg_toget]),
109 sizeof(Event)*(old_ring_buffer_size - omr->msg_toget)
111 omr->msg_toget += EVENTS_RING_BUFFER_INCREMENT;
114 omr->messages[omr->msg_tosave] = *evt;
115 SetEvent(omr->msg_event);
116 omr->msg_tosave = (omr->msg_tosave + 1) % omr->ring_buffer_size;
117 LeaveCriticalSection(&omr->msg_crst);
118 return TRUE;
121 static int EventsQueue_GetEvent(EventsQueue* omr, Event* evt, long msTimeOut)
123 if (WaitForSingleObject(omr->msg_event, msTimeOut) != WAIT_OBJECT_0)
124 return FALSE;
126 EnterCriticalSection(&omr->msg_crst);
128 if (omr->msg_toget == omr->msg_tosave) /* buffer empty ? */
130 LeaveCriticalSection(&omr->msg_crst);
131 return FALSE;
134 *evt = omr->messages[omr->msg_toget];
135 omr->msg_toget = (omr->msg_toget + 1) % omr->ring_buffer_size;
137 /* Mark the buffer as empty if needed */
138 if (omr->msg_toget == omr->msg_tosave) /* buffer empty ? */
139 ResetEvent(omr->msg_event);
141 LeaveCriticalSection(&omr->msg_crst);
142 return TRUE;
145 #define MAX_ITF_CACHE_ENTRIES 3
146 typedef struct _ITF_CACHE_ENTRY {
147 const IID* riid;
148 IBaseFilter* filter;
149 IUnknown* iface;
150 } ITF_CACHE_ENTRY;
152 typedef struct _IFilterGraphImpl {
153 const IGraphBuilderVtbl *IGraphBuilder_vtbl;
154 const IMediaControlVtbl *IMediaControl_vtbl;
155 const IMediaSeekingVtbl *IMediaSeeking_vtbl;
156 const IBasicAudioVtbl *IBasicAudio_vtbl;
157 const IBasicVideoVtbl *IBasicVideo_vtbl;
158 const IVideoWindowVtbl *IVideoWindow_vtbl;
159 const IMediaEventExVtbl *IMediaEventEx_vtbl;
160 const IMediaFilterVtbl *IMediaFilter_vtbl;
161 const IMediaEventSinkVtbl *IMediaEventSink_vtbl;
162 const IGraphConfigVtbl *IGraphConfig_vtbl;
163 const IMediaPositionVtbl *IMediaPosition_vtbl;
164 /* IAMGraphStreams */
165 /* IAMStats */
166 /* IBasicVideo2 */
167 /* IFilterChain */
168 /* IFilterGraph2 */
169 /* IFilterMapper2 */
170 /* IGraphVersion */
171 /* IQueueCommand */
172 /* IRegisterServiceProvider */
173 /* IResourceMananger */
174 /* IServiceProvider */
175 /* IVideoFrameStep */
177 LONG ref;
178 IFilterMapper2 * pFilterMapper2;
179 IBaseFilter ** ppFiltersInGraph;
180 LPWSTR * pFilterNames;
181 int nFilters;
182 int filterCapacity;
183 long nameIndex;
184 EventsQueue evqueue;
185 HANDLE hEventCompletion;
186 int CompletionStatus;
187 WndNotify notif;
188 int nRenderers;
189 int EcCompleteCount;
190 int HandleEcComplete;
191 int HandleEcRepaint;
192 OAFilterState state;
193 CRITICAL_SECTION cs;
194 ITF_CACHE_ENTRY ItfCacheEntries[MAX_ITF_CACHE_ENTRIES];
195 int nItfCacheEntries;
196 } IFilterGraphImpl;
199 static HRESULT Filtergraph_QueryInterface(IFilterGraphImpl *This,
200 REFIID riid,
201 LPVOID *ppvObj) {
202 TRACE("(%p)->(%s (%p), %p)\n", This, debugstr_guid(riid), riid, ppvObj);
204 if (IsEqualGUID(&IID_IUnknown, riid) ||
205 IsEqualGUID(&IID_IFilterGraph, riid) ||
206 IsEqualGUID(&IID_IGraphBuilder, riid)) {
207 *ppvObj = &(This->IGraphBuilder_vtbl);
208 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj);
209 } else if (IsEqualGUID(&IID_IMediaControl, riid)) {
210 *ppvObj = &(This->IMediaControl_vtbl);
211 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj);
212 } else if (IsEqualGUID(&IID_IMediaSeeking, riid)) {
213 *ppvObj = &(This->IMediaSeeking_vtbl);
214 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj);
215 } else if (IsEqualGUID(&IID_IBasicAudio, riid)) {
216 *ppvObj = &(This->IBasicAudio_vtbl);
217 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj);
218 } else if (IsEqualGUID(&IID_IBasicVideo, riid)) {
219 *ppvObj = &(This->IBasicVideo_vtbl);
220 TRACE(" returning IBasicVideo interface (%p)\n", *ppvObj);
221 } else if (IsEqualGUID(&IID_IVideoWindow, riid)) {
222 *ppvObj = &(This->IVideoWindow_vtbl);
223 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj);
224 } else if (IsEqualGUID(&IID_IMediaEvent, riid) ||
225 IsEqualGUID(&IID_IMediaEventEx, riid)) {
226 *ppvObj = &(This->IMediaEventEx_vtbl);
227 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj);
228 } else if (IsEqualGUID(&IID_IMediaFilter, riid) ||
229 IsEqualGUID(&IID_IPersist, riid)) {
230 *ppvObj = &(This->IMediaFilter_vtbl);
231 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj);
232 } else if (IsEqualGUID(&IID_IMediaEventSink, riid)) {
233 *ppvObj = &(This->IMediaEventSink_vtbl);
234 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj);
235 } else if (IsEqualGUID(&IID_IGraphConfig, riid)) {
236 *ppvObj = &(This->IGraphConfig_vtbl);
237 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj);
238 } else if (IsEqualGUID(&IID_IMediaPosition, riid)) {
239 *ppvObj = &(This->IMediaPosition_vtbl);
240 TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj);
241 } else {
242 *ppvObj = NULL;
243 FIXME("unknown interface %s\n", debugstr_guid(riid));
244 return E_NOINTERFACE;
247 InterlockedIncrement(&This->ref);
248 return S_OK;
251 static ULONG Filtergraph_AddRef(IFilterGraphImpl *This) {
252 ULONG ref = InterlockedIncrement(&This->ref);
254 TRACE("(%p)->(): new ref = %d\n", This, ref);
256 return ref;
259 static ULONG Filtergraph_Release(IFilterGraphImpl *This) {
260 ULONG ref = InterlockedDecrement(&This->ref);
262 TRACE("(%p)->(): new ref = %d\n", This, ref);
264 if (ref == 0) {
265 int i;
266 for (i = 0; i < This->nFilters; i++)
267 IBaseFilter_Release(This->ppFiltersInGraph[i]);
268 for (i = 0; i < This->nItfCacheEntries; i++)
269 IUnknown_Release(This->ItfCacheEntries[i].iface);
270 IFilterMapper2_Release(This->pFilterMapper2);
271 CloseHandle(This->hEventCompletion);
272 EventsQueue_Destroy(&This->evqueue);
273 This->cs.DebugInfo->Spare[0] = 0;
274 DeleteCriticalSection(&This->cs);
275 CoTaskMemFree(This->ppFiltersInGraph);
276 CoTaskMemFree(This->pFilterNames);
277 CoTaskMemFree(This);
279 return ref;
283 /*** IUnknown methods ***/
284 static HRESULT WINAPI GraphBuilder_QueryInterface(IGraphBuilder *iface,
285 REFIID riid,
286 LPVOID*ppvObj) {
287 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
289 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
290 return Filtergraph_QueryInterface(This, riid, ppvObj);
293 static ULONG WINAPI GraphBuilder_AddRef(IGraphBuilder *iface) {
294 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
296 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This, iface);
298 return Filtergraph_AddRef(This);
301 static ULONG WINAPI GraphBuilder_Release(IGraphBuilder *iface) {
302 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
304 TRACE("(%p/%p)->() calling FilterGraph Release\n", This, iface);
306 return Filtergraph_Release(This);
309 /*** IFilterGraph methods ***/
310 static HRESULT WINAPI GraphBuilder_AddFilter(IGraphBuilder *iface,
311 IBaseFilter *pFilter,
312 LPCWSTR pName) {
313 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
314 HRESULT hr;
315 int i,j;
316 WCHAR* wszFilterName = NULL;
317 int duplicate_name = FALSE;
319 TRACE("(%p/%p)->(%p, %s (%p))\n", This, iface, pFilter, debugstr_w(pName), pName);
321 wszFilterName = (WCHAR*) CoTaskMemAlloc( (pName ? strlenW(pName) + 6 : 5) * sizeof(WCHAR) );
323 if (pName)
325 /* Check if name already exists */
326 for(i = 0; i < This->nFilters; i++)
327 if (!strcmpW(This->pFilterNames[i], pName))
329 duplicate_name = TRUE;
330 break;
334 /* If no name given or name already existing, generate one */
335 if (!pName || duplicate_name)
337 static const WCHAR wszFmt1[] = {'%','s',' ','%','0','4','d',0};
338 static const WCHAR wszFmt2[] = {'%','0','4','d',0};
340 for (j = 0; j < 10000 ; j++)
342 /* Create name */
343 if (pName)
344 sprintfW(wszFilterName, wszFmt1, pName, This->nameIndex);
345 else
346 sprintfW(wszFilterName, wszFmt2, This->nameIndex);
347 TRACE("Generated name %s\n", debugstr_w(wszFilterName));
349 /* Check if the generated name already exists */
350 for(i = 0; i < This->nFilters; i++)
351 if (!strcmpW(This->pFilterNames[i], wszFilterName))
352 break;
354 /* Compute next index and exit if generated name is suitable */
355 if (This->nameIndex++ == 10000)
356 This->nameIndex = 1;
357 if (i == This->nFilters)
358 break;
360 /* Unable to find a suitable name */
361 if (j == 10000)
363 CoTaskMemFree(wszFilterName);
364 return VFW_E_DUPLICATE_NAME;
367 else
368 memcpy(wszFilterName, pName, (strlenW(pName) + 1) * sizeof(WCHAR));
370 if (This->nFilters + 1 > This->filterCapacity)
372 int newCapacity = This->filterCapacity ? 2 * This->filterCapacity : 1;
373 IBaseFilter ** ppNewFilters = CoTaskMemAlloc(newCapacity * sizeof(IBaseFilter*));
374 LPWSTR * pNewNames = CoTaskMemAlloc(newCapacity * sizeof(LPWSTR));
375 memcpy(ppNewFilters, This->ppFiltersInGraph, This->nFilters * sizeof(IBaseFilter*));
376 memcpy(pNewNames, This->pFilterNames, This->nFilters * sizeof(LPWSTR));
377 if (!This->filterCapacity)
379 CoTaskMemFree(This->ppFiltersInGraph);
380 CoTaskMemFree(This->pFilterNames);
382 This->ppFiltersInGraph = ppNewFilters;
383 This->pFilterNames = pNewNames;
384 This->filterCapacity = newCapacity;
387 hr = IBaseFilter_JoinFilterGraph(pFilter, (IFilterGraph *)This, wszFilterName);
389 if (SUCCEEDED(hr))
391 IBaseFilter_AddRef(pFilter);
392 This->ppFiltersInGraph[This->nFilters] = pFilter;
393 This->pFilterNames[This->nFilters] = wszFilterName;
394 This->nFilters++;
396 else
397 CoTaskMemFree(wszFilterName);
399 if (SUCCEEDED(hr) && duplicate_name)
400 return VFW_S_DUPLICATE_NAME;
402 return hr;
405 static HRESULT WINAPI GraphBuilder_RemoveFilter(IGraphBuilder *iface,
406 IBaseFilter *pFilter) {
407 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
408 int i;
409 HRESULT hr = E_FAIL;
411 TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
413 /* FIXME: check graph is stopped */
415 for (i = 0; i < This->nFilters; i++)
417 if (This->ppFiltersInGraph[i] == pFilter)
419 IEnumPins *penumpins;
420 hr = IBaseFilter_EnumPins(pFilter, &penumpins);
421 if (SUCCEEDED(hr)) {
422 IPin *ppin;
423 while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK) {
424 IPin_Disconnect(ppin);
425 IPin_Release(ppin);
427 IEnumPins_Release(penumpins);
430 hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, This->pFilterNames[i]);
431 if (SUCCEEDED(hr))
433 IPin_Release(pFilter);
434 CoTaskMemFree(This->pFilterNames[i]);
435 memmove(This->ppFiltersInGraph+i, This->ppFiltersInGraph+i+1, sizeof(IBaseFilter*)*(This->nFilters - 1 - i));
436 memmove(This->pFilterNames+i, This->pFilterNames+i+1, sizeof(LPWSTR)*(This->nFilters - 1 - i));
437 This->nFilters--;
438 /* Invalidate interfaces in the cache */
439 for (i = 0; i < This->nItfCacheEntries; i++)
440 if (pFilter == This->ItfCacheEntries[i].filter)
442 IUnknown_Release(This->ItfCacheEntries[i].iface);
443 This->ItfCacheEntries[i].iface = NULL;
444 This->ItfCacheEntries[i].filter = NULL;
446 return S_OK;
448 break;
452 return hr; /* FIXME: check this error code */
455 static HRESULT WINAPI GraphBuilder_EnumFilters(IGraphBuilder *iface,
456 IEnumFilters **ppEnum) {
457 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
459 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
461 return IEnumFiltersImpl_Construct(This->ppFiltersInGraph, This->nFilters, ppEnum);
464 static HRESULT WINAPI GraphBuilder_FindFilterByName(IGraphBuilder *iface,
465 LPCWSTR pName,
466 IBaseFilter **ppFilter) {
467 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
468 int i;
470 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_w(pName), pName, ppFilter);
472 *ppFilter = NULL;
474 for (i = 0; i < This->nFilters; i++)
476 if (!strcmpW(pName, This->pFilterNames[i]))
478 *ppFilter = This->ppFiltersInGraph[i];
479 IBaseFilter_AddRef(*ppFilter);
480 return S_OK;
484 return E_FAIL; /* FIXME: check this error code */
487 /* NOTE: despite the implication, it doesn't matter which
488 * way round you put in the input and output pins */
489 static HRESULT WINAPI GraphBuilder_ConnectDirect(IGraphBuilder *iface,
490 IPin *ppinIn,
491 IPin *ppinOut,
492 const AM_MEDIA_TYPE *pmt) {
493 PIN_DIRECTION dir;
494 HRESULT hr;
496 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
498 TRACE("(%p/%p)->(%p, %p, %p)\n", This, iface, ppinIn, ppinOut, pmt);
500 /* FIXME: check pins are in graph */
502 if (TRACE_ON(quartz))
504 PIN_INFO PinInfo;
506 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
507 if (FAILED(hr))
508 return hr;
510 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
511 IBaseFilter_Release(PinInfo.pFilter);
513 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
514 if (FAILED(hr))
515 return hr;
517 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
518 IBaseFilter_Release(PinInfo.pFilter);
521 hr = IPin_QueryDirection(ppinIn, &dir);
522 if (SUCCEEDED(hr))
524 if (dir == PINDIR_INPUT)
525 hr = IPin_Connect(ppinOut, ppinIn, pmt);
526 else
527 hr = IPin_Connect(ppinIn, ppinOut, pmt);
530 return hr;
533 static HRESULT WINAPI GraphBuilder_Reconnect(IGraphBuilder *iface,
534 IPin *ppin) {
535 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
536 IPin *pConnectedTo = NULL;
537 HRESULT hr;
538 PIN_DIRECTION pindir;
540 IPin_QueryDirection(ppin, &pindir);
541 hr = IPin_ConnectedTo(ppin, &pConnectedTo);
542 if (FAILED(hr)) {
543 TRACE("Querying connected to failed: %x\n", hr);
544 return hr;
546 IPin_Disconnect(ppin);
547 IPin_Disconnect(pConnectedTo);
548 if (pindir == PINDIR_INPUT)
549 hr = IPin_Connect(pConnectedTo, ppin, NULL);
550 else
551 hr = IPin_Connect(ppin, pConnectedTo, NULL);
552 IPin_Release(pConnectedTo);
553 if (FAILED(hr))
554 ERR("Reconnecting pins failed, pins are not connected now..\n");
555 TRACE("(%p->%p) -- %p %p -> %x\n", iface, This, ppin, pConnectedTo, hr);
556 return hr;
559 static HRESULT WINAPI GraphBuilder_Disconnect(IGraphBuilder *iface,
560 IPin *ppin) {
561 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
563 TRACE("(%p/%p)->(%p)\n", This, iface, ppin);
565 return IPin_Disconnect(ppin);
568 static HRESULT WINAPI GraphBuilder_SetDefaultSyncSource(IGraphBuilder *iface) {
569 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
571 TRACE("(%p/%p)->(): stub !!!\n", iface, This);
573 return S_OK;
576 static HRESULT GetFilterInfo(IMoniker* pMoniker, GUID* pclsid, VARIANT* pvar)
578 static const WCHAR wszClsidName[] = {'C','L','S','I','D',0};
579 static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
580 IPropertyBag * pPropBagCat = NULL;
581 HRESULT hr;
583 VariantInit(pvar);
584 V_VT(pvar) = VT_BSTR;
586 hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
588 if (SUCCEEDED(hr))
589 hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL);
591 if (SUCCEEDED(hr))
592 hr = CLSIDFromString(V_UNION(pvar, bstrVal), pclsid);
594 if (SUCCEEDED(hr))
595 hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL);
597 if (SUCCEEDED(hr))
598 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid), debugstr_w(V_UNION(pvar, bstrVal)));
600 if (pPropBagCat)
601 IPropertyBag_Release(pPropBagCat);
603 return hr;
606 static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPin*** pppins, ULONG* pnb)
608 HRESULT hr;
609 ULONG nb = 0;
611 TRACE("(%p, %p, %p, %p)\n", pfilter, pinputpin, pppins, pnb);
612 hr = IPin_QueryInternalConnections(pinputpin, NULL, &nb);
613 if (hr == S_OK) {
614 /* Rendered input */
615 } else if (hr == S_FALSE) {
616 *pppins = CoTaskMemAlloc(sizeof(IPin*)*nb);
617 hr = IPin_QueryInternalConnections(pinputpin, *pppins, &nb);
618 if (hr != S_OK) {
619 ERR("Error (%x)\n", hr);
621 } else if (hr == E_NOTIMPL) {
622 /* Input connected to all outputs */
623 IEnumPins* penumpins;
624 IPin* ppin;
625 int i = 0;
626 TRACE("E_NOTIMPL\n");
627 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
628 if (FAILED(hr)) {
629 ERR("filter Enumpins failed (%x)\n", hr);
630 return hr;
632 i = 0;
633 /* Count output pins */
634 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
635 PIN_DIRECTION pindir;
636 IPin_QueryDirection(ppin, &pindir);
637 if (pindir == PINDIR_OUTPUT)
638 i++;
639 IPin_Release(ppin);
641 *pppins = CoTaskMemAlloc(sizeof(IPin*)*i);
642 /* Retrieve output pins */
643 IEnumPins_Reset(penumpins);
644 i = 0;
645 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
646 PIN_DIRECTION pindir;
647 IPin_QueryDirection(ppin, &pindir);
648 if (pindir == PINDIR_OUTPUT)
649 (*pppins)[i++] = ppin;
650 else
651 IPin_Release(ppin);
653 nb = i;
654 if (FAILED(hr)) {
655 ERR("Next failed (%x)\n", hr);
656 return hr;
658 IEnumPins_Release(penumpins);
659 } else if (FAILED(hr)) {
660 ERR("Cannot get internal connection (%x)\n", hr);
661 return hr;
664 *pnb = nb;
665 return S_OK;
668 /*** IGraphBuilder methods ***/
669 static HRESULT WINAPI GraphBuilder_Connect(IGraphBuilder *iface,
670 IPin *ppinOut,
671 IPin *ppinIn) {
672 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
673 HRESULT hr;
674 AM_MEDIA_TYPE* mt;
675 IEnumMediaTypes* penummt;
676 ULONG nbmt;
677 IEnumPins* penumpins;
678 IEnumMoniker* pEnumMoniker;
679 GUID tab[2];
680 ULONG nb;
681 IMoniker* pMoniker;
682 ULONG pin;
683 PIN_INFO PinInfo;
684 CLSID FilterCLSID;
686 TRACE("(%p/%p)->(%p, %p)\n", This, iface, ppinOut, ppinIn);
688 if (TRACE_ON(quartz))
690 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
691 if (FAILED(hr))
692 return hr;
694 TRACE("Filter owning first pin => %p\n", PinInfo.pFilter);
695 IBaseFilter_Release(PinInfo.pFilter);
697 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
698 if (FAILED(hr))
699 return hr;
701 TRACE("Filter owning second pin => %p\n", PinInfo.pFilter);
702 IBaseFilter_Release(PinInfo.pFilter);
705 /* Try direct connection first */
706 hr = IPin_Connect(ppinOut, ppinIn, NULL);
707 if (SUCCEEDED(hr)) {
708 return S_OK;
710 TRACE("Direct connection failed, trying to insert other filters\n");
712 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
713 if (FAILED(hr))
714 return hr;
716 hr = IBaseFilter_GetClassID(PinInfo.pFilter, &FilterCLSID);
717 if (FAILED(hr))
718 return hr;
720 IBaseFilter_Release(PinInfo.pFilter);
722 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
723 * filter to the minor mediatype of input pin of the renderer */
724 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
725 if (FAILED(hr)) {
726 ERR("EnumMediaTypes (%x)\n", hr);
727 return hr;
730 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
731 if (FAILED(hr)) {
732 ERR("IEnumMediaTypes_Next (%x)\n", hr);
733 return hr;
736 if (!nbmt) {
737 ERR("No media type found!\n");
738 return S_OK;
740 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
741 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
743 /* Try to find a suitable filter that can connect to the pin to render */
744 tab[0] = mt->majortype;
745 tab[1] = mt->subtype;
746 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
747 if (FAILED(hr)) {
748 ERR("Unable to enum filters (%x)\n", hr);
749 return hr;
752 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
754 VARIANT var;
755 GUID clsid;
756 IPin** ppins;
757 IPin* ppinfilter = NULL;
758 IBaseFilter* pfilter = NULL;
760 hr = GetFilterInfo(pMoniker, &clsid, &var);
761 IMoniker_Release(pMoniker);
762 if (FAILED(hr)) {
763 ERR("Unable to retrieve filter info (%x)\n", hr);
764 goto error;
767 if (IsEqualGUID(&clsid, &FilterCLSID)) {
768 /* Skip filter (same as the one the output pin belongs to) */
769 goto error;
772 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
773 if (FAILED(hr)) {
774 ERR("Unable to create filter (%x), trying next one\n", hr);
775 goto error;
778 hr = IGraphBuilder_AddFilter(iface, pfilter, NULL);
779 if (FAILED(hr)) {
780 ERR("Unable to add filter (%x)\n", hr);
781 IBaseFilter_Release(pfilter);
782 pfilter = NULL;
783 goto error;
786 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
787 if (FAILED(hr)) {
788 ERR("Enumpins (%x)\n", hr);
789 goto error;
792 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
793 IEnumPins_Release(penumpins);
795 if (FAILED(hr)) {
796 ERR("Next (%x)\n", hr);
797 goto error;
799 if (pin == 0) {
800 ERR("No Pin\n");
801 goto error;
804 hr = IPin_Connect(ppinOut, ppinfilter, NULL);
805 if (FAILED(hr)) {
806 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
807 goto error;
809 TRACE("Successfully connected to filter, follow chain...\n");
811 /* Render all output pins of the filter by calling IGraphBuilder_Render on each of them */
812 hr = GetInternalConnections(pfilter, ppinfilter, &ppins, &nb);
814 if (SUCCEEDED(hr)) {
815 int i;
816 if (nb == 0) {
817 IPin_Disconnect(ppinOut);
818 goto error;
820 TRACE("pins to consider: %d\n", nb);
821 for(i = 0; i < nb; i++) {
822 TRACE("Processing pin %d\n", i);
823 hr = IGraphBuilder_Connect(iface, ppins[i], ppinIn);
824 if (FAILED(hr)) {
825 TRACE("Cannot render pin %p (%x)\n", ppinfilter, hr);
827 IPin_Release(ppins[i]);
828 if (SUCCEEDED(hr)) break;
830 while (++i < nb) IPin_Release(ppins[i]);
831 CoTaskMemFree(ppins);
832 IPin_Release(ppinfilter);
833 break;
836 error:
837 if (ppinfilter) IPin_Release(ppinfilter);
838 if (pfilter) {
839 IGraphBuilder_RemoveFilter(iface, pfilter);
840 IBaseFilter_Release(pfilter);
844 IEnumMediaTypes_Release(penummt);
845 DeleteMediaType(mt);
847 return S_OK;
850 static HRESULT WINAPI GraphBuilder_Render(IGraphBuilder *iface,
851 IPin *ppinOut) {
852 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
853 IEnumMediaTypes* penummt;
854 AM_MEDIA_TYPE* mt;
855 ULONG nbmt;
856 HRESULT hr;
858 IEnumMoniker* pEnumMoniker;
859 GUID tab[2];
860 ULONG nb;
861 IMoniker* pMoniker;
863 TRACE("(%p/%p)->(%p)\n", This, iface, ppinOut);
865 if (TRACE_ON(quartz))
867 PIN_INFO PinInfo;
869 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
870 if (FAILED(hr))
871 return hr;
873 TRACE("Filter owning pin => %p\n", PinInfo.pFilter);
874 IBaseFilter_Release(PinInfo.pFilter);
877 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
878 if (FAILED(hr)) {
879 ERR("EnumMediaTypes (%x)\n", hr);
880 return hr;
883 while(1)
885 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
886 if (FAILED(hr)) {
887 ERR("IEnumMediaTypes_Next (%x)\n", hr);
888 return hr;
890 if (!nbmt)
891 break;
892 TRACE("MajorType %s\n", debugstr_guid(&mt->majortype));
893 TRACE("SubType %s\n", debugstr_guid(&mt->subtype));
895 /* Try to find a suitable renderer with the same media type */
896 tab[0] = mt->majortype;
897 tab[1] = GUID_NULL;
898 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL);
899 if (FAILED(hr)) {
900 ERR("Unable to enum filters (%x)\n", hr);
901 return hr;
904 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
906 VARIANT var;
907 GUID clsid;
908 IPin* ppinfilter;
909 IBaseFilter* pfilter = NULL;
910 IEnumPins* penumpins;
911 ULONG pin;
913 hr = GetFilterInfo(pMoniker, &clsid, &var);
914 IMoniker_Release(pMoniker);
915 if (FAILED(hr)) {
916 ERR("Unable to retrieve filter info (%x)\n", hr);
917 goto error;
920 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pfilter);
921 if (FAILED(hr)) {
922 ERR("Unable to create filter (%x), trying next one\n", hr);
923 goto error;
926 hr = IGraphBuilder_AddFilter(iface, pfilter, NULL);
927 if (FAILED(hr)) {
928 ERR("Unable to add filter (%x)\n", hr);
929 pfilter = NULL;
930 goto error;
933 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
934 if (FAILED(hr)) {
935 ERR("Splitter Enumpins (%x)\n", hr);
936 goto error;
938 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
939 if (FAILED(hr)) {
940 ERR("Next (%x)\n", hr);
941 goto error;
943 if (pin == 0) {
944 ERR("No Pin\n");
945 goto error;
947 IEnumPins_Release(penumpins);
949 /* Connect the pin to render to the renderer */
950 hr = IGraphBuilder_Connect(iface, ppinOut, ppinfilter);
951 if (FAILED(hr)) {
952 TRACE("Unable to connect to renderer (%x)\n", hr);
953 goto error;
955 break;
957 error:
958 if (pfilter) {
959 IGraphBuilder_RemoveFilter(iface, pfilter);
960 IBaseFilter_Release(pfilter);
964 DeleteMediaType(mt);
965 break;
968 IEnumMediaTypes_Release(penummt);
970 return S_OK;
973 static HRESULT WINAPI GraphBuilder_RenderFile(IGraphBuilder *iface,
974 LPCWSTR lpcwstrFile,
975 LPCWSTR lpcwstrPlayList) {
976 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
977 static const WCHAR string[] = {'R','e','a','d','e','r',0};
978 IBaseFilter* preader = NULL;
979 IBaseFilter* psplitter = NULL;
980 IPin* ppinreader;
981 IPin* ppinsplitter;
982 IEnumPins* penumpins;
983 ULONG pin;
984 HRESULT hr;
985 IEnumMoniker* pEnumMoniker = NULL;
986 GUID tab[2];
987 IPin** ppins = NULL;
988 ULONG nb;
989 IMoniker* pMoniker;
990 IFileSourceFilter* pfile = NULL;
991 AM_MEDIA_TYPE mt;
992 WCHAR* filename;
994 TRACE("(%p/%p)->(%s, %s)\n", This, iface, debugstr_w(lpcwstrFile), debugstr_w(lpcwstrPlayList));
996 if (lpcwstrPlayList != NULL)
997 return E_INVALIDARG;
999 hr = IGraphBuilder_AddSourceFilter(iface, lpcwstrFile, string, &preader);
1001 /* Retrieve file media type */
1002 if (SUCCEEDED(hr))
1003 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1004 if (SUCCEEDED(hr)) {
1005 hr = IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1006 IFileSourceFilter_Release(pfile);
1009 if (SUCCEEDED(hr))
1010 hr = IBaseFilter_EnumPins(preader, &penumpins);
1011 if (SUCCEEDED(hr)) {
1012 hr = IEnumPins_Next(penumpins, 1, &ppinreader, &pin);
1013 IEnumPins_Release(penumpins);
1016 if (SUCCEEDED(hr)) {
1017 tab[0] = mt.majortype;
1018 tab[1] = mt.subtype;
1019 hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
1022 if (FAILED(hr))
1024 if (pEnumMoniker)
1025 IEnumMoniker_Release(pEnumMoniker);
1026 if (preader) {
1027 IGraphBuilder_RemoveFilter(iface, preader);
1028 IBaseFilter_Release(preader);
1030 return hr;
1033 hr = VFW_E_CANNOT_RENDER;
1034 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
1036 VARIANT var;
1037 GUID clsid;
1039 hr = GetFilterInfo(pMoniker, &clsid, &var);
1040 IMoniker_Release(pMoniker);
1041 if (FAILED(hr)) {
1042 ERR("Unable to retrieve filter info (%x)\n", hr);
1043 continue;
1046 hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&psplitter);
1047 if (FAILED(hr)) {
1048 ERR("Unable to create filter (%x), trying next one\n", hr);
1049 continue;
1052 hr = IGraphBuilder_AddFilter(iface, psplitter, NULL);
1053 if (FAILED(hr)) {
1054 ERR("Unable add filter (%x)\n", hr);
1055 IBaseFilter_Release(psplitter);
1056 continue;
1059 /* Connect file source and splitter filters together */
1060 /* Make the splitter analyze incoming data */
1062 hr = IBaseFilter_EnumPins(psplitter, &penumpins);
1063 if (SUCCEEDED(hr)) {
1064 hr = IEnumPins_Next(penumpins, 1, &ppinsplitter, &pin);
1065 IEnumPins_Release(penumpins);
1068 if (SUCCEEDED(hr))
1069 hr = IPin_Connect(ppinreader, ppinsplitter, NULL);
1071 /* Make sure there's some output pins in the filter */
1072 if (SUCCEEDED(hr))
1073 hr = GetInternalConnections(psplitter, ppinsplitter, &ppins, &nb);
1074 if (SUCCEEDED(hr)) {
1075 if(nb == 0) {
1076 IPin_Disconnect(ppinreader);
1077 TRACE("No output pins found in filter\n");
1078 hr = VFW_E_CANNOT_RENDER;
1082 IPin_Release(ppinsplitter);
1083 ppinsplitter = NULL;
1085 if (SUCCEEDED(hr)) {
1086 TRACE("Successfully connected to filter\n");
1087 break;
1090 TRACE("Cannot connect to filter (%x), trying next one\n", hr);
1092 if (ppins) {
1093 CoTaskMemFree(ppins);
1094 ppins = NULL;
1096 IGraphBuilder_RemoveFilter(iface, psplitter);
1097 IBaseFilter_Release(psplitter);
1098 psplitter = NULL;
1101 /* Render all output pin of the splitter by calling IGraphBuilder_Render on each of them */
1102 if (SUCCEEDED(hr)) {
1103 int partial = 0;
1104 int i;
1105 TRACE("pins to consider: %d\n", nb);
1106 for(i = 0; i < nb; i++) {
1107 TRACE("Processing pin %d\n", i);
1108 hr = IGraphBuilder_Render(iface, ppins[i]);
1109 if (FAILED(hr)) {
1110 ERR("Cannot render pin %p (%x)\n", ppins[i], hr);
1111 partial = 1;
1113 IPin_Release(ppins[i]);
1115 CoTaskMemFree(ppins);
1117 hr = (partial ? VFW_S_PARTIAL_RENDER : S_OK);
1120 return hr;
1123 static HRESULT WINAPI GraphBuilder_AddSourceFilter(IGraphBuilder *iface,
1124 LPCWSTR lpcwstrFileName,
1125 LPCWSTR lpcwstrFilterName,
1126 IBaseFilter **ppFilter) {
1127 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
1128 HRESULT hr;
1129 IBaseFilter* preader;
1130 IFileSourceFilter* pfile = NULL;
1131 AM_MEDIA_TYPE mt;
1132 WCHAR* filename;
1134 TRACE("(%p/%p)->(%s, %s, %p)\n", This, iface, debugstr_w(lpcwstrFileName), debugstr_w(lpcwstrFilterName), ppFilter);
1136 /* Instantiate a file source filter */
1137 hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&preader);
1138 if (FAILED(hr)) {
1139 ERR("Unable to create file source filter (%x)\n", hr);
1140 return hr;
1143 hr = IGraphBuilder_AddFilter(iface, preader, lpcwstrFilterName);
1144 if (FAILED(hr)) {
1145 ERR("Unable add filter (%x)\n", hr);
1146 IBaseFilter_Release(preader);
1147 return hr;
1150 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (LPVOID*)&pfile);
1151 if (FAILED(hr)) {
1152 ERR("Unable to get IFileSourceInterface (%x)\n", hr);
1153 goto error;
1156 /* Load the file in the file source filter */
1157 hr = IFileSourceFilter_Load(pfile, lpcwstrFileName, NULL);
1158 if (FAILED(hr)) {
1159 ERR("Load (%x)\n", hr);
1160 goto error;
1163 IFileSourceFilter_GetCurFile(pfile, &filename, &mt);
1164 if (FAILED(hr)) {
1165 ERR("GetCurFile (%x)\n", hr);
1166 goto error;
1168 TRACE("File %s\n", debugstr_w(filename));
1169 TRACE("MajorType %s\n", debugstr_guid(&mt.majortype));
1170 TRACE("SubType %s\n", debugstr_guid(&mt.subtype));
1172 if (ppFilter)
1173 *ppFilter = preader;
1175 return S_OK;
1177 error:
1178 if (pfile)
1179 IFileSourceFilter_Release(pfile);
1180 IGraphBuilder_RemoveFilter(iface, preader);
1181 IBaseFilter_Release(preader);
1183 return hr;
1186 static HRESULT WINAPI GraphBuilder_SetLogFile(IGraphBuilder *iface,
1187 DWORD_PTR hFile) {
1188 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
1190 TRACE("(%p/%p)->(%08x): stub !!!\n", This, iface, (DWORD) hFile);
1192 return S_OK;
1195 static HRESULT WINAPI GraphBuilder_Abort(IGraphBuilder *iface) {
1196 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
1198 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1200 return S_OK;
1203 static HRESULT WINAPI GraphBuilder_ShouldOperationContinue(IGraphBuilder *iface) {
1204 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
1206 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1208 return S_OK;
1212 static const IGraphBuilderVtbl IGraphBuilder_VTable =
1214 GraphBuilder_QueryInterface,
1215 GraphBuilder_AddRef,
1216 GraphBuilder_Release,
1217 GraphBuilder_AddFilter,
1218 GraphBuilder_RemoveFilter,
1219 GraphBuilder_EnumFilters,
1220 GraphBuilder_FindFilterByName,
1221 GraphBuilder_ConnectDirect,
1222 GraphBuilder_Reconnect,
1223 GraphBuilder_Disconnect,
1224 GraphBuilder_SetDefaultSyncSource,
1225 GraphBuilder_Connect,
1226 GraphBuilder_Render,
1227 GraphBuilder_RenderFile,
1228 GraphBuilder_AddSourceFilter,
1229 GraphBuilder_SetLogFile,
1230 GraphBuilder_Abort,
1231 GraphBuilder_ShouldOperationContinue
1234 /*** IUnknown methods ***/
1235 static HRESULT WINAPI MediaControl_QueryInterface(IMediaControl *iface,
1236 REFIID riid,
1237 LPVOID*ppvObj) {
1238 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1240 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1242 return Filtergraph_QueryInterface(This, riid, ppvObj);
1245 static ULONG WINAPI MediaControl_AddRef(IMediaControl *iface) {
1246 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1248 TRACE("(%p/%p)->()\n", This, iface);
1250 return Filtergraph_AddRef(This);
1253 static ULONG WINAPI MediaControl_Release(IMediaControl *iface) {
1254 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1256 TRACE("(%p/%p)->()\n", This, iface);
1258 return Filtergraph_Release(This);
1262 /*** IDispatch methods ***/
1263 static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface,
1264 UINT*pctinfo) {
1265 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1267 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1269 return S_OK;
1272 static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface,
1273 UINT iTInfo,
1274 LCID lcid,
1275 ITypeInfo**ppTInfo) {
1276 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1278 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1280 return S_OK;
1283 static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface,
1284 REFIID riid,
1285 LPOLESTR*rgszNames,
1286 UINT cNames,
1287 LCID lcid,
1288 DISPID*rgDispId) {
1289 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1291 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1293 return S_OK;
1296 static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface,
1297 DISPID dispIdMember,
1298 REFIID riid,
1299 LCID lcid,
1300 WORD wFlags,
1301 DISPPARAMS*pDispParams,
1302 VARIANT*pVarResult,
1303 EXCEPINFO*pExepInfo,
1304 UINT*puArgErr) {
1305 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1307 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1309 return S_OK;
1312 typedef HRESULT(WINAPI *fnFoundFilter)(IBaseFilter *);
1314 static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundFilter FoundFilter)
1316 HRESULT hr;
1317 IPin* pInputPin;
1318 IPin** ppPins;
1319 ULONG nb;
1320 ULONG i;
1321 PIN_INFO PinInfo;
1323 TRACE("%p %p\n", pGraph, pOutputPin);
1324 PinInfo.pFilter = NULL;
1326 hr = IPin_ConnectedTo(pOutputPin, &pInputPin);
1328 if (SUCCEEDED(hr))
1329 hr = IPin_QueryPinInfo(pInputPin, &PinInfo);
1331 if (SUCCEEDED(hr))
1332 hr = GetInternalConnections(PinInfo.pFilter, pInputPin, &ppPins, &nb);
1334 if (SUCCEEDED(hr))
1336 if (nb == 0)
1338 TRACE("Reached a renderer\n");
1339 /* Count renderers for end of stream notification */
1340 pGraph->nRenderers++;
1342 else
1344 for(i = 0; i < nb; i++)
1346 /* Explore the graph downstream from this pin
1347 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1348 * several input pins are connected to the same output (a MUX for instance). */
1349 ExploreGraph(pGraph, ppPins[i], FoundFilter);
1350 IPin_Release(ppPins[i]);
1353 CoTaskMemFree(ppPins);
1355 TRACE("Doing stuff with filter %p\n", PinInfo.pFilter);
1356 FoundFilter(PinInfo.pFilter);
1359 if (PinInfo.pFilter) IBaseFilter_Release(PinInfo.pFilter);
1360 return hr;
1363 static HRESULT WINAPI SendRun(IBaseFilter *pFilter) {
1364 return IBaseFilter_Run(pFilter, 0);
1367 static HRESULT WINAPI SendPause(IBaseFilter *pFilter) {
1368 return IBaseFilter_Pause(pFilter);
1371 static HRESULT WINAPI SendStop(IBaseFilter *pFilter) {
1372 return IBaseFilter_Stop(pFilter);
1375 static HRESULT SendFilterMessage(IMediaControl *iface, fnFoundFilter FoundFilter) {
1376 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1377 int i;
1378 IBaseFilter* pfilter;
1379 IEnumPins* pEnum;
1380 HRESULT hr;
1381 IPin* pPin;
1382 DWORD dummy;
1383 PIN_DIRECTION dir;
1384 TRACE("(%p/%p)->()\n", This, iface);
1386 /* Explorer the graph from source filters to renderers, determine renderers
1387 * number and run filters from renderers to source filters */
1388 This->nRenderers = 0;
1389 ResetEvent(This->hEventCompletion);
1391 for(i = 0; i < This->nFilters; i++)
1393 BOOL source = TRUE;
1394 pfilter = This->ppFiltersInGraph[i];
1395 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
1396 if (hr != S_OK)
1398 ERR("Enum pins failed %x\n", hr);
1399 continue;
1401 /* Check if it is a source filter */
1402 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1404 IPin_QueryDirection(pPin, &dir);
1405 IPin_Release(pPin);
1406 if (dir == PINDIR_INPUT)
1408 source = FALSE;
1409 break;
1412 if (source)
1414 TRACE("Found a source filter %p\n", pfilter);
1415 IEnumPins_Reset(pEnum);
1416 while(IEnumPins_Next(pEnum, 1, &pPin, &dummy) == S_OK)
1418 /* Explore the graph downstream from this pin */
1419 ExploreGraph(This, pPin, FoundFilter);
1420 IPin_Release(pPin);
1422 FoundFilter(pfilter);
1424 IEnumPins_Release(pEnum);
1427 return S_FALSE;
1430 /*** IMediaControl methods ***/
1431 static HRESULT WINAPI MediaControl_Run(IMediaControl *iface) {
1432 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1433 TRACE("(%p/%p)->()\n", This, iface);
1435 if (This->state == State_Running) return S_OK;
1437 EnterCriticalSection(&This->cs);
1438 SendFilterMessage(iface, SendRun);
1439 This->state = State_Running;
1440 LeaveCriticalSection(&This->cs);
1441 return S_FALSE;
1444 static HRESULT WINAPI MediaControl_Pause(IMediaControl *iface) {
1445 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1446 TRACE("(%p/%p)->()\n", This, iface);
1448 if (This->state == State_Paused) return S_OK;
1450 EnterCriticalSection(&This->cs);
1451 SendFilterMessage(iface, SendPause);
1452 This->state = State_Paused;
1453 LeaveCriticalSection(&This->cs);
1454 return S_FALSE;
1457 static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface) {
1458 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1459 TRACE("(%p/%p)->()\n", This, iface);
1461 if (This->state == State_Stopped) return S_OK;
1463 EnterCriticalSection(&This->cs);
1464 if (This->state == State_Running) SendFilterMessage(iface, SendPause);
1465 SendFilterMessage(iface, SendStop);
1466 This->state = State_Stopped;
1467 LeaveCriticalSection(&This->cs);
1468 return S_FALSE;
1471 static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface,
1472 LONG msTimeout,
1473 OAFilterState *pfs) {
1474 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1476 TRACE("(%p/%p)->(%d, %p): semi-stub !!!\n", This, iface, msTimeout, pfs);
1478 EnterCriticalSection(&This->cs);
1480 *pfs = This->state;
1482 LeaveCriticalSection(&This->cs);
1484 return S_OK;
1487 static HRESULT WINAPI MediaControl_RenderFile(IMediaControl *iface,
1488 BSTR strFilename) {
1489 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1491 TRACE("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename);
1493 return S_OK;
1496 static HRESULT WINAPI MediaControl_AddSourceFilter(IMediaControl *iface,
1497 BSTR strFilename,
1498 IDispatch **ppUnk) {
1499 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1501 TRACE("(%p/%p)->(%s (%p), %p): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename, ppUnk);
1503 return S_OK;
1506 static HRESULT WINAPI MediaControl_get_FilterCollection(IMediaControl *iface,
1507 IDispatch **ppUnk) {
1508 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1510 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1512 return S_OK;
1515 static HRESULT WINAPI MediaControl_get_RegFilterCollection(IMediaControl *iface,
1516 IDispatch **ppUnk) {
1517 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1519 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
1521 return S_OK;
1524 static HRESULT WINAPI MediaControl_StopWhenReady(IMediaControl *iface) {
1525 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
1527 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1529 return S_OK;
1533 static const IMediaControlVtbl IMediaControl_VTable =
1535 MediaControl_QueryInterface,
1536 MediaControl_AddRef,
1537 MediaControl_Release,
1538 MediaControl_GetTypeInfoCount,
1539 MediaControl_GetTypeInfo,
1540 MediaControl_GetIDsOfNames,
1541 MediaControl_Invoke,
1542 MediaControl_Run,
1543 MediaControl_Pause,
1544 MediaControl_Stop,
1545 MediaControl_GetState,
1546 MediaControl_RenderFile,
1547 MediaControl_AddSourceFilter,
1548 MediaControl_get_FilterCollection,
1549 MediaControl_get_RegFilterCollection,
1550 MediaControl_StopWhenReady
1554 /*** IUnknown methods ***/
1555 static HRESULT WINAPI MediaSeeking_QueryInterface(IMediaSeeking *iface,
1556 REFIID riid,
1557 LPVOID*ppvObj) {
1558 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1560 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1562 return Filtergraph_QueryInterface(This, riid, ppvObj);
1565 static ULONG WINAPI MediaSeeking_AddRef(IMediaSeeking *iface) {
1566 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1568 TRACE("(%p/%p)->()\n", This, iface);
1570 return Filtergraph_AddRef(This);
1573 static ULONG WINAPI MediaSeeking_Release(IMediaSeeking *iface) {
1574 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1576 TRACE("(%p/%p)->()\n", This, iface);
1578 return Filtergraph_Release(This);
1581 /*** IMediaSeeking methods ***/
1582 static HRESULT WINAPI MediaSeeking_GetCapabilities(IMediaSeeking *iface,
1583 DWORD *pCapabilities) {
1584 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1586 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCapabilities);
1588 return S_OK;
1591 static HRESULT WINAPI MediaSeeking_CheckCapabilities(IMediaSeeking *iface,
1592 DWORD *pCapabilities) {
1593 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1595 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCapabilities);
1597 return S_OK;
1600 static HRESULT WINAPI MediaSeeking_IsFormatSupported(IMediaSeeking *iface,
1601 const GUID *pFormat) {
1602 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1604 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1606 return S_OK;
1609 static HRESULT WINAPI MediaSeeking_QueryPreferredFormat(IMediaSeeking *iface,
1610 GUID *pFormat) {
1611 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1613 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1615 return S_OK;
1618 static HRESULT WINAPI MediaSeeking_GetTimeFormat(IMediaSeeking *iface,
1619 GUID *pFormat) {
1620 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1622 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1624 return S_OK;
1627 static HRESULT WINAPI MediaSeeking_IsUsingTimeFormat(IMediaSeeking *iface,
1628 const GUID *pFormat) {
1629 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1631 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1633 return S_OK;
1636 static HRESULT WINAPI MediaSeeking_SetTimeFormat(IMediaSeeking *iface,
1637 const GUID *pFormat) {
1638 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1640 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
1642 return S_OK;
1645 static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface,
1646 LONGLONG *pDuration) {
1647 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1649 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDuration);
1651 return S_OK;
1654 static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface,
1655 LONGLONG *pStop) {
1656 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1658 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pStop);
1660 return S_OK;
1663 static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface,
1664 LONGLONG *pCurrent) {
1665 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1667 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCurrent);
1669 return S_OK;
1672 static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface,
1673 LONGLONG *pTarget,
1674 const GUID *pTargetFormat,
1675 LONGLONG Source,
1676 const GUID *pSourceFormat) {
1677 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1679 TRACE("(%p/%p)->(%p, %p, 0x%s, %p): stub !!!\n", This, iface, pTarget,
1680 pTargetFormat, wine_dbgstr_longlong(Source), pSourceFormat);
1682 return S_OK;
1685 static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface,
1686 LONGLONG *pCurrent,
1687 DWORD dwCurrentFlags,
1688 LONGLONG *pStop,
1689 DWORD dwStopFlags) {
1690 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1692 TRACE("(%p/%p)->(%p, %08x, %p, %08x): stub !!!\n", This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
1694 return S_OK;
1697 static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface,
1698 LONGLONG *pCurrent,
1699 LONGLONG *pStop) {
1700 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1702 TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pCurrent, pStop);
1704 return S_OK;
1707 static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface,
1708 LONGLONG *pEarliest,
1709 LONGLONG *pLatest) {
1710 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1712 TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
1714 return S_OK;
1717 static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface,
1718 double dRate) {
1719 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1721 TRACE("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
1723 return S_OK;
1726 static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface,
1727 double *pdRate) {
1728 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1730 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
1732 return S_OK;
1735 static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface,
1736 LONGLONG *pllPreroll) {
1737 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
1739 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
1741 return S_OK;
1745 static const IMediaSeekingVtbl IMediaSeeking_VTable =
1747 MediaSeeking_QueryInterface,
1748 MediaSeeking_AddRef,
1749 MediaSeeking_Release,
1750 MediaSeeking_GetCapabilities,
1751 MediaSeeking_CheckCapabilities,
1752 MediaSeeking_IsFormatSupported,
1753 MediaSeeking_QueryPreferredFormat,
1754 MediaSeeking_GetTimeFormat,
1755 MediaSeeking_IsUsingTimeFormat,
1756 MediaSeeking_SetTimeFormat,
1757 MediaSeeking_GetDuration,
1758 MediaSeeking_GetStopPosition,
1759 MediaSeeking_GetCurrentPosition,
1760 MediaSeeking_ConvertTimeFormat,
1761 MediaSeeking_SetPositions,
1762 MediaSeeking_GetPositions,
1763 MediaSeeking_GetAvailable,
1764 MediaSeeking_SetRate,
1765 MediaSeeking_GetRate,
1766 MediaSeeking_GetPreroll
1769 /*** IUnknown methods ***/
1770 static HRESULT WINAPI MediaPosition_QueryInterface(IMediaPosition* iface, REFIID riid, void** ppvObj){
1771 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
1773 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1775 return Filtergraph_QueryInterface(This, riid, ppvObj);
1778 static ULONG WINAPI MediaPosition_AddRef(IMediaPosition *iface){
1779 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
1781 TRACE("(%p/%p)->()\n", This, iface);
1783 return Filtergraph_AddRef(This);
1786 static ULONG WINAPI MediaPosition_Release(IMediaPosition *iface){
1787 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaPosition_vtbl, iface);
1789 TRACE("(%p/%p)->()\n", This, iface);
1791 return Filtergraph_Release(This);
1794 /*** IDispatch methods ***/
1795 static HRESULT WINAPI MediaPosition_GetTypeInfoCount(IMediaPosition *iface, UINT* pctinfo){
1796 FIXME("(%p) stub!\n", iface);
1797 return E_NOTIMPL;
1800 static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo){
1801 FIXME("(%p) stub!\n", iface);
1802 return E_NOTIMPL;
1805 static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition* iface, REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId){
1806 FIXME("(%p) stub!\n", iface);
1807 return E_NOTIMPL;
1810 static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition* iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr){
1811 FIXME("(%p) stub!\n", iface);
1812 return E_NOTIMPL;
1815 /*** IMediaPosition methods ***/
1816 static HRESULT WINAPI MediaPosition_get_Duration(IMediaPosition * iface, REFTIME *plength){
1817 FIXME("(%p)->(%p) stub!\n", iface, plength);
1818 return E_NOTIMPL;
1821 static HRESULT WINAPI MediaPosition_put_CurrentPosition(IMediaPosition * iface, REFTIME llTime){
1822 FIXME("(%p)->(%f) stub!\n", iface, llTime);
1823 return E_NOTIMPL;
1826 static HRESULT WINAPI MediaPosition_get_CurrentPosition(IMediaPosition * iface, REFTIME *pllTime){
1827 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
1828 return E_NOTIMPL;
1831 static HRESULT WINAPI MediaPosition_get_StopTime(IMediaPosition * iface, REFTIME *pllTime){
1832 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
1833 return E_NOTIMPL;
1836 static HRESULT WINAPI MediaPosition_put_StopTime(IMediaPosition * iface, REFTIME llTime){
1837 FIXME("(%p)->(%f) stub!\n", iface, llTime);
1838 return E_NOTIMPL;
1841 static HRESULT WINAPI MediaPosition_get_PrerollTime(IMediaPosition * iface, REFTIME *pllTime){
1842 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
1843 return E_NOTIMPL;
1846 static HRESULT WINAPI MediaPosition_put_PrerollTime(IMediaPosition * iface, REFTIME llTime){
1847 FIXME("(%p)->(%f) stub!\n", iface, llTime);
1848 return E_NOTIMPL;
1851 static HRESULT WINAPI MediaPosition_put_Rate(IMediaPosition * iface, double dRate){
1852 FIXME("(%p)->(%f) stub!\n", iface, dRate);
1853 return E_NOTIMPL;
1856 static HRESULT WINAPI MediaPosition_get_Rate(IMediaPosition * iface, double *pdRate){
1857 FIXME("(%p)->(%p) stub!\n", iface, pdRate);
1858 return E_NOTIMPL;
1861 static HRESULT WINAPI MediaPosition_CanSeekForward(IMediaPosition * iface, LONG *pCanSeekForward){
1862 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekForward);
1863 return E_NOTIMPL;
1866 static HRESULT WINAPI MediaPosition_CanSeekBackward(IMediaPosition * iface, LONG *pCanSeekBackward){
1867 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekBackward);
1868 return E_NOTIMPL;
1872 static const IMediaPositionVtbl IMediaPosition_VTable =
1874 MediaPosition_QueryInterface,
1875 MediaPosition_AddRef,
1876 MediaPosition_Release,
1877 MediaPosition_GetTypeInfoCount,
1878 MediaPosition_GetTypeInfo,
1879 MediaPosition_GetIDsOfNames,
1880 MediaPosition_Invoke,
1881 MediaPosition_get_Duration,
1882 MediaPosition_put_CurrentPosition,
1883 MediaPosition_get_CurrentPosition,
1884 MediaPosition_get_StopTime,
1885 MediaPosition_put_StopTime,
1886 MediaPosition_get_PrerollTime,
1887 MediaPosition_put_PrerollTime,
1888 MediaPosition_put_Rate,
1889 MediaPosition_get_Rate,
1890 MediaPosition_CanSeekForward,
1891 MediaPosition_CanSeekBackward
1894 static HRESULT GetTargetInterface(IFilterGraphImpl* pGraph, REFIID riid, LPVOID* ppvObj)
1896 HRESULT hr = E_NOINTERFACE;
1897 int i;
1898 int entry;
1900 /* Check if the interface type is already registered */
1901 for (entry = 0; entry < pGraph->nItfCacheEntries; entry++)
1902 if (riid == pGraph->ItfCacheEntries[entry].riid)
1904 if (pGraph->ItfCacheEntries[entry].iface)
1906 /* Return the interface if available */
1907 *ppvObj = pGraph->ItfCacheEntries[entry].iface;
1908 return S_OK;
1910 break;
1913 if (entry >= MAX_ITF_CACHE_ENTRIES)
1915 FIXME("Not enough space to store interface in the cache\n");
1916 return E_OUTOFMEMORY;
1919 /* Find a filter supporting the requested interface */
1920 for (i = 0; i < pGraph->nFilters; i++)
1922 hr = IBaseFilter_QueryInterface(pGraph->ppFiltersInGraph[i], riid, ppvObj);
1923 if (hr == S_OK)
1925 pGraph->ItfCacheEntries[entry].riid = riid;
1926 pGraph->ItfCacheEntries[entry].filter = pGraph->ppFiltersInGraph[i];
1927 pGraph->ItfCacheEntries[entry].iface = (IUnknown*)*ppvObj;
1928 if (entry >= pGraph->nItfCacheEntries)
1929 pGraph->nItfCacheEntries++;
1930 return S_OK;
1932 if (hr != E_NOINTERFACE)
1933 return hr;
1936 return hr;
1939 /*** IUnknown methods ***/
1940 static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface,
1941 REFIID riid,
1942 LPVOID*ppvObj) {
1943 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1945 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1947 return Filtergraph_QueryInterface(This, riid, ppvObj);
1950 static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface) {
1951 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1953 TRACE("(%p/%p)->()\n", This, iface);
1955 return Filtergraph_AddRef(This);
1958 static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface) {
1959 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1961 TRACE("(%p/%p)->()\n", This, iface);
1963 return Filtergraph_Release(This);
1966 /*** IDispatch methods ***/
1967 static HRESULT WINAPI BasicAudio_GetTypeInfoCount(IBasicAudio *iface,
1968 UINT*pctinfo) {
1969 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1970 IBasicAudio* pBasicAudio;
1971 HRESULT hr;
1973 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
1975 EnterCriticalSection(&This->cs);
1977 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
1979 if (hr == S_OK)
1980 hr = IBasicAudio_GetTypeInfoCount(pBasicAudio, pctinfo);
1982 LeaveCriticalSection(&This->cs);
1984 return hr;
1987 static HRESULT WINAPI BasicAudio_GetTypeInfo(IBasicAudio *iface,
1988 UINT iTInfo,
1989 LCID lcid,
1990 ITypeInfo**ppTInfo) {
1991 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1992 IBasicAudio* pBasicAudio;
1993 HRESULT hr;
1995 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
1997 EnterCriticalSection(&This->cs);
1999 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2001 if (hr == S_OK)
2002 hr = IBasicAudio_GetTypeInfo(pBasicAudio, iTInfo, lcid, ppTInfo);
2004 LeaveCriticalSection(&This->cs);
2006 return hr;
2009 static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface,
2010 REFIID riid,
2011 LPOLESTR*rgszNames,
2012 UINT cNames,
2013 LCID lcid,
2014 DISPID*rgDispId) {
2015 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2016 IBasicAudio* pBasicAudio;
2017 HRESULT hr;
2019 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2021 EnterCriticalSection(&This->cs);
2023 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2025 if (hr == S_OK)
2026 hr = IBasicAudio_GetIDsOfNames(pBasicAudio, riid, rgszNames, cNames, lcid, rgDispId);
2028 LeaveCriticalSection(&This->cs);
2030 return hr;
2033 static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface,
2034 DISPID dispIdMember,
2035 REFIID riid,
2036 LCID lcid,
2037 WORD wFlags,
2038 DISPPARAMS*pDispParams,
2039 VARIANT*pVarResult,
2040 EXCEPINFO*pExepInfo,
2041 UINT*puArgErr) {
2042 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2043 IBasicAudio* pBasicAudio;
2044 HRESULT hr;
2046 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p)\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2048 EnterCriticalSection(&This->cs);
2050 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2052 if (hr == S_OK)
2053 hr = IBasicAudio_Invoke(pBasicAudio, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2055 LeaveCriticalSection(&This->cs);
2057 return hr;
2060 /*** IBasicAudio methods ***/
2061 static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface,
2062 long lVolume) {
2063 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2064 IBasicAudio* pBasicAudio;
2065 HRESULT hr;
2067 TRACE("(%p/%p)->(%ld)\n", This, iface, lVolume);
2069 EnterCriticalSection(&This->cs);
2071 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2073 if (hr == S_OK)
2074 hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
2076 LeaveCriticalSection(&This->cs);
2078 return hr;
2081 static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface,
2082 long *plVolume) {
2083 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2084 IBasicAudio* pBasicAudio;
2085 HRESULT hr;
2087 TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
2089 EnterCriticalSection(&This->cs);
2091 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2093 if (hr == S_OK)
2094 hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
2096 LeaveCriticalSection(&This->cs);
2098 return hr;
2101 static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface,
2102 long lBalance) {
2103 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2104 IBasicAudio* pBasicAudio;
2105 HRESULT hr;
2107 TRACE("(%p/%p)->(%ld)\n", This, iface, lBalance);
2109 EnterCriticalSection(&This->cs);
2111 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2113 if (hr == S_OK)
2114 hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
2116 LeaveCriticalSection(&This->cs);
2118 return hr;
2121 static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface,
2122 long *plBalance) {
2123 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
2124 IBasicAudio* pBasicAudio;
2125 HRESULT hr;
2127 TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
2129 EnterCriticalSection(&This->cs);
2131 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2133 if (hr == S_OK)
2134 hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
2136 LeaveCriticalSection(&This->cs);
2138 return hr;
2141 static const IBasicAudioVtbl IBasicAudio_VTable =
2143 BasicAudio_QueryInterface,
2144 BasicAudio_AddRef,
2145 BasicAudio_Release,
2146 BasicAudio_GetTypeInfoCount,
2147 BasicAudio_GetTypeInfo,
2148 BasicAudio_GetIDsOfNames,
2149 BasicAudio_Invoke,
2150 BasicAudio_put_Volume,
2151 BasicAudio_get_Volume,
2152 BasicAudio_put_Balance,
2153 BasicAudio_get_Balance
2156 /*** IUnknown methods ***/
2157 static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo *iface,
2158 REFIID riid,
2159 LPVOID*ppvObj) {
2160 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2162 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2164 return Filtergraph_QueryInterface(This, riid, ppvObj);
2167 static ULONG WINAPI BasicVideo_AddRef(IBasicVideo *iface) {
2168 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2170 TRACE("(%p/%p)->()\n", This, iface);
2172 return Filtergraph_AddRef(This);
2175 static ULONG WINAPI BasicVideo_Release(IBasicVideo *iface) {
2176 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2178 TRACE("(%p/%p)->()\n", This, iface);
2180 return Filtergraph_Release(This);
2183 /*** IDispatch methods ***/
2184 static HRESULT WINAPI BasicVideo_GetTypeInfoCount(IBasicVideo *iface,
2185 UINT*pctinfo) {
2186 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2187 IBasicVideo* pBasicVideo;
2188 HRESULT hr;
2190 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
2192 EnterCriticalSection(&This->cs);
2194 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2196 if (hr == S_OK)
2197 hr = IBasicVideo_GetTypeInfoCount(pBasicVideo, pctinfo);
2199 LeaveCriticalSection(&This->cs);
2201 return hr;
2204 static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo *iface,
2205 UINT iTInfo,
2206 LCID lcid,
2207 ITypeInfo**ppTInfo) {
2208 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2209 IBasicVideo* pBasicVideo;
2210 HRESULT hr;
2212 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
2214 EnterCriticalSection(&This->cs);
2216 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2218 if (hr == S_OK)
2219 hr = IBasicVideo_GetTypeInfo(pBasicVideo, iTInfo, lcid, ppTInfo);
2221 LeaveCriticalSection(&This->cs);
2223 return hr;
2226 static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo *iface,
2227 REFIID riid,
2228 LPOLESTR*rgszNames,
2229 UINT cNames,
2230 LCID lcid,
2231 DISPID*rgDispId) {
2232 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2233 IBasicVideo* pBasicVideo;
2234 HRESULT hr;
2236 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2238 EnterCriticalSection(&This->cs);
2240 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2242 if (hr == S_OK)
2243 hr = IBasicVideo_GetIDsOfNames(pBasicVideo, riid, rgszNames, cNames, lcid, rgDispId);
2245 LeaveCriticalSection(&This->cs);
2247 return hr;
2250 static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo *iface,
2251 DISPID dispIdMember,
2252 REFIID riid,
2253 LCID lcid,
2254 WORD wFlags,
2255 DISPPARAMS*pDispParams,
2256 VARIANT*pVarResult,
2257 EXCEPINFO*pExepInfo,
2258 UINT*puArgErr) {
2259 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2260 IBasicVideo* pBasicVideo;
2261 HRESULT hr;
2263 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p)\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2265 EnterCriticalSection(&This->cs);
2267 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2269 if (hr == S_OK)
2270 hr = IBasicVideo_Invoke(pBasicVideo, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2272 LeaveCriticalSection(&This->cs);
2274 return hr;
2277 /*** IBasicVideo methods ***/
2278 static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo *iface,
2279 REFTIME *pAvgTimePerFrame) {
2280 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2281 IBasicVideo* pBasicVideo;
2282 HRESULT hr;
2284 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
2286 EnterCriticalSection(&This->cs);
2288 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2290 if (hr == S_OK)
2291 hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
2293 LeaveCriticalSection(&This->cs);
2295 return hr;
2298 static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo *iface,
2299 long *pBitRate) {
2300 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2301 IBasicVideo* pBasicVideo;
2302 HRESULT hr;
2304 TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
2306 EnterCriticalSection(&This->cs);
2308 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2310 if (hr == S_OK)
2311 hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
2313 LeaveCriticalSection(&This->cs);
2315 return hr;
2318 static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo *iface,
2319 long *pBitErrorRate) {
2320 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2321 IBasicVideo* pBasicVideo;
2322 HRESULT hr;
2324 TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
2326 EnterCriticalSection(&This->cs);
2328 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2330 if (hr == S_OK)
2331 hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
2333 LeaveCriticalSection(&This->cs);
2335 return hr;
2338 static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo *iface,
2339 long *pVideoWidth) {
2340 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2341 IBasicVideo* pBasicVideo;
2342 HRESULT hr;
2344 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
2346 EnterCriticalSection(&This->cs);
2348 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2350 if (hr == S_OK)
2351 hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
2353 LeaveCriticalSection(&This->cs);
2355 return hr;
2358 static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo *iface,
2359 long *pVideoHeight) {
2360 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2361 IBasicVideo* pBasicVideo;
2362 HRESULT hr;
2364 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
2366 EnterCriticalSection(&This->cs);
2368 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2370 if (hr == S_OK)
2371 hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
2373 LeaveCriticalSection(&This->cs);
2375 return hr;
2378 static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo *iface,
2379 long SourceLeft) {
2380 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2381 IBasicVideo* pBasicVideo;
2382 HRESULT hr;
2384 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
2386 EnterCriticalSection(&This->cs);
2388 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2390 if (hr == S_OK)
2391 hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
2393 LeaveCriticalSection(&This->cs);
2395 return hr;
2398 static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo *iface,
2399 long *pSourceLeft) {
2400 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2401 IBasicVideo* pBasicVideo;
2402 HRESULT hr;
2404 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
2406 EnterCriticalSection(&This->cs);
2408 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2410 if (hr == S_OK)
2411 hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
2413 LeaveCriticalSection(&This->cs);
2415 return hr;
2418 static HRESULT WINAPI BasicVideo_put_SourceWidth(IBasicVideo *iface,
2419 long SourceWidth) {
2420 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2421 IBasicVideo* pBasicVideo;
2422 HRESULT hr;
2424 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
2426 EnterCriticalSection(&This->cs);
2428 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2430 if (hr == S_OK)
2431 hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
2433 LeaveCriticalSection(&This->cs);
2435 return hr;
2438 static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo *iface,
2439 long *pSourceWidth) {
2440 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2441 IBasicVideo* pBasicVideo;
2442 HRESULT hr;
2444 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
2446 EnterCriticalSection(&This->cs);
2448 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2450 if (hr == S_OK)
2451 hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
2453 LeaveCriticalSection(&This->cs);
2455 return hr;
2458 static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo *iface,
2459 long SourceTop) {
2460 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2461 IBasicVideo* pBasicVideo;
2462 HRESULT hr;
2464 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
2466 EnterCriticalSection(&This->cs);
2468 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2470 if (hr == S_OK)
2471 hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
2473 LeaveCriticalSection(&This->cs);
2475 return hr;
2478 static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo *iface,
2479 long *pSourceTop) {
2480 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2481 IBasicVideo* pBasicVideo;
2482 HRESULT hr;
2484 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
2486 EnterCriticalSection(&This->cs);
2488 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2490 if (hr == S_OK)
2491 hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
2493 LeaveCriticalSection(&This->cs);
2495 return hr;
2498 static HRESULT WINAPI BasicVideo_put_SourceHeight(IBasicVideo *iface,
2499 long SourceHeight) {
2500 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2501 IBasicVideo* pBasicVideo;
2502 HRESULT hr;
2504 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
2506 EnterCriticalSection(&This->cs);
2508 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2510 if (hr == S_OK)
2511 hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
2513 LeaveCriticalSection(&This->cs);
2515 return hr;
2518 static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo *iface,
2519 long *pSourceHeight) {
2520 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2521 IBasicVideo* pBasicVideo;
2522 HRESULT hr;
2524 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
2526 EnterCriticalSection(&This->cs);
2528 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2530 if (hr == S_OK)
2531 hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
2533 LeaveCriticalSection(&This->cs);
2535 return hr;
2538 static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo *iface,
2539 long DestinationLeft) {
2540 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2541 IBasicVideo* pBasicVideo;
2542 HRESULT hr;
2544 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
2546 EnterCriticalSection(&This->cs);
2548 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2550 if (hr == S_OK)
2551 hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
2553 LeaveCriticalSection(&This->cs);
2555 return hr;
2558 static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo *iface,
2559 long *pDestinationLeft) {
2560 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2561 IBasicVideo* pBasicVideo;
2562 HRESULT hr;
2564 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
2566 EnterCriticalSection(&This->cs);
2568 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2570 if (hr == S_OK)
2571 hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
2573 LeaveCriticalSection(&This->cs);
2575 return hr;
2578 static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo *iface,
2579 long DestinationWidth) {
2580 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2581 IBasicVideo* pBasicVideo;
2582 HRESULT hr;
2584 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
2586 EnterCriticalSection(&This->cs);
2588 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2590 if (hr == S_OK)
2591 hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
2593 LeaveCriticalSection(&This->cs);
2595 return hr;
2598 static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo *iface,
2599 long *pDestinationWidth) {
2600 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2601 IBasicVideo* pBasicVideo;
2602 HRESULT hr;
2604 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
2606 EnterCriticalSection(&This->cs);
2608 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2610 if (hr == S_OK)
2611 hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
2613 LeaveCriticalSection(&This->cs);
2615 return hr;
2618 static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo *iface,
2619 long DestinationTop) {
2620 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2621 IBasicVideo* pBasicVideo;
2622 HRESULT hr;
2624 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
2626 EnterCriticalSection(&This->cs);
2628 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2630 if (hr == S_OK)
2631 hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
2633 LeaveCriticalSection(&This->cs);
2635 return hr;
2638 static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo *iface,
2639 long *pDestinationTop) {
2640 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2641 IBasicVideo* pBasicVideo;
2642 HRESULT hr;
2644 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
2646 EnterCriticalSection(&This->cs);
2648 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2650 if (hr == S_OK)
2651 hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
2653 LeaveCriticalSection(&This->cs);
2655 return hr;
2658 static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo *iface,
2659 long DestinationHeight) {
2660 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2661 IBasicVideo* pBasicVideo;
2662 HRESULT hr;
2664 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
2666 EnterCriticalSection(&This->cs);
2668 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2670 if (hr == S_OK)
2671 hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
2673 LeaveCriticalSection(&This->cs);
2675 return hr;
2678 static HRESULT WINAPI BasicVideo_get_DestinationHeight(IBasicVideo *iface,
2679 long *pDestinationHeight) {
2680 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2681 IBasicVideo* pBasicVideo;
2682 HRESULT hr;
2684 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
2686 EnterCriticalSection(&This->cs);
2688 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2690 if (hr == S_OK)
2691 hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
2693 LeaveCriticalSection(&This->cs);
2695 return hr;
2698 static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo *iface,
2699 long Left,
2700 long Top,
2701 long Width,
2702 long Height) {
2703 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2704 IBasicVideo* pBasicVideo;
2705 HRESULT hr;
2707 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2709 EnterCriticalSection(&This->cs);
2711 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2713 if (hr == S_OK)
2714 hr = IBasicVideo_SetSourcePosition(pBasicVideo, Left, Top, Width, Height);
2716 LeaveCriticalSection(&This->cs);
2718 return hr;
2721 static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo *iface,
2722 long *pLeft,
2723 long *pTop,
2724 long *pWidth,
2725 long *pHeight) {
2726 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2727 IBasicVideo* pBasicVideo;
2728 HRESULT hr;
2730 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2732 EnterCriticalSection(&This->cs);
2734 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2736 if (hr == S_OK)
2737 hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
2739 LeaveCriticalSection(&This->cs);
2741 return hr;
2744 static HRESULT WINAPI BasicVideo_SetDefaultSourcePosition(IBasicVideo *iface) {
2745 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2746 IBasicVideo* pBasicVideo;
2747 HRESULT hr;
2749 TRACE("(%p/%p)->()\n", This, iface);
2751 EnterCriticalSection(&This->cs);
2753 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2755 if (hr == S_OK)
2756 hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
2758 LeaveCriticalSection(&This->cs);
2760 return hr;
2763 static HRESULT WINAPI BasicVideo_SetDestinationPosition(IBasicVideo *iface,
2764 long Left,
2765 long Top,
2766 long Width,
2767 long Height) {
2768 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2769 IBasicVideo* pBasicVideo;
2770 HRESULT hr;
2772 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
2774 EnterCriticalSection(&This->cs);
2776 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2778 if (hr == S_OK)
2779 hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left, Top, Width, Height);
2781 LeaveCriticalSection(&This->cs);
2783 return hr;
2786 static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo *iface,
2787 long *pLeft,
2788 long *pTop,
2789 long *pWidth,
2790 long *pHeight) {
2791 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2792 IBasicVideo* pBasicVideo;
2793 HRESULT hr;
2795 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2797 EnterCriticalSection(&This->cs);
2799 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2801 if (hr == S_OK)
2802 hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
2804 LeaveCriticalSection(&This->cs);
2806 return hr;
2809 static HRESULT WINAPI BasicVideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
2810 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2811 IBasicVideo* pBasicVideo;
2812 HRESULT hr;
2814 TRACE("(%p/%p)->()\n", This, iface);
2816 EnterCriticalSection(&This->cs);
2818 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2820 if (hr == S_OK)
2821 hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
2823 LeaveCriticalSection(&This->cs);
2825 return hr;
2828 static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo *iface,
2829 long *pWidth,
2830 long *pHeight) {
2831 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2832 IBasicVideo* pBasicVideo;
2833 HRESULT hr;
2835 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
2837 EnterCriticalSection(&This->cs);
2839 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2841 if (hr == S_OK)
2842 hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
2844 LeaveCriticalSection(&This->cs);
2846 return hr;
2849 static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo *iface,
2850 long StartIndex,
2851 long Entries,
2852 long *pRetrieved,
2853 long *pPalette) {
2854 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2855 IBasicVideo* pBasicVideo;
2856 HRESULT hr;
2858 TRACE("(%p/%p)->(%ld, %ld, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
2860 EnterCriticalSection(&This->cs);
2862 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2864 if (hr == S_OK)
2865 hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex, Entries, pRetrieved, pPalette);
2867 LeaveCriticalSection(&This->cs);
2869 return hr;
2872 static HRESULT WINAPI BasicVideo_GetCurrentImage(IBasicVideo *iface,
2873 long *pBufferSize,
2874 long *pDIBImage) {
2875 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2876 IBasicVideo* pBasicVideo;
2877 HRESULT hr;
2879 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pBufferSize, pDIBImage);
2881 EnterCriticalSection(&This->cs);
2883 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2885 if (hr == S_OK)
2886 hr = IBasicVideo_GetCurrentImage(pBasicVideo, pBufferSize, pDIBImage);
2888 LeaveCriticalSection(&This->cs);
2890 return hr;
2893 static HRESULT WINAPI BasicVideo_IsUsingDefaultSource(IBasicVideo *iface) {
2894 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2895 IBasicVideo* pBasicVideo;
2896 HRESULT hr;
2898 TRACE("(%p/%p)->()\n", This, iface);
2900 EnterCriticalSection(&This->cs);
2902 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2904 if (hr == S_OK)
2905 hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
2907 LeaveCriticalSection(&This->cs);
2909 return hr;
2912 static HRESULT WINAPI BasicVideo_IsUsingDefaultDestination(IBasicVideo *iface) {
2913 ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
2914 IBasicVideo* pBasicVideo;
2915 HRESULT hr;
2917 TRACE("(%p/%p)->()\n", This, iface);
2919 EnterCriticalSection(&This->cs);
2921 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
2923 if (hr == S_OK)
2924 hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
2926 LeaveCriticalSection(&This->cs);
2928 return hr;
2932 static const IBasicVideoVtbl IBasicVideo_VTable =
2934 BasicVideo_QueryInterface,
2935 BasicVideo_AddRef,
2936 BasicVideo_Release,
2937 BasicVideo_GetTypeInfoCount,
2938 BasicVideo_GetTypeInfo,
2939 BasicVideo_GetIDsOfNames,
2940 BasicVideo_Invoke,
2941 BasicVideo_get_AvgTimePerFrame,
2942 BasicVideo_get_BitRate,
2943 BasicVideo_get_BitErrorRate,
2944 BasicVideo_get_VideoWidth,
2945 BasicVideo_get_VideoHeight,
2946 BasicVideo_put_SourceLeft,
2947 BasicVideo_get_SourceLeft,
2948 BasicVideo_put_SourceWidth,
2949 BasicVideo_get_SourceWidth,
2950 BasicVideo_put_SourceTop,
2951 BasicVideo_get_SourceTop,
2952 BasicVideo_put_SourceHeight,
2953 BasicVideo_get_SourceHeight,
2954 BasicVideo_put_DestinationLeft,
2955 BasicVideo_get_DestinationLeft,
2956 BasicVideo_put_DestinationWidth,
2957 BasicVideo_get_DestinationWidth,
2958 BasicVideo_put_DestinationTop,
2959 BasicVideo_get_DestinationTop,
2960 BasicVideo_put_DestinationHeight,
2961 BasicVideo_get_DestinationHeight,
2962 BasicVideo_SetSourcePosition,
2963 BasicVideo_GetSourcePosition,
2964 BasicVideo_SetDefaultSourcePosition,
2965 BasicVideo_SetDestinationPosition,
2966 BasicVideo_GetDestinationPosition,
2967 BasicVideo_SetDefaultDestinationPosition,
2968 BasicVideo_GetVideoSize,
2969 BasicVideo_GetVideoPaletteEntries,
2970 BasicVideo_GetCurrentImage,
2971 BasicVideo_IsUsingDefaultSource,
2972 BasicVideo_IsUsingDefaultDestination
2976 /*** IUnknown methods ***/
2977 static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface,
2978 REFIID riid,
2979 LPVOID*ppvObj) {
2980 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2982 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2984 return Filtergraph_QueryInterface(This, riid, ppvObj);
2987 static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface) {
2988 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2990 TRACE("(%p/%p)->()\n", This, iface);
2992 return Filtergraph_AddRef(This);
2995 static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface) {
2996 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
2998 TRACE("(%p/%p)->()\n", This, iface);
3000 return Filtergraph_Release(This);
3003 /*** IDispatch methods ***/
3004 static HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface,
3005 UINT*pctinfo) {
3006 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3007 IVideoWindow* pVideoWindow;
3008 HRESULT hr;
3010 TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo);
3012 EnterCriticalSection(&This->cs);
3014 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3016 if (hr == S_OK)
3017 hr = IVideoWindow_GetTypeInfoCount(pVideoWindow, pctinfo);
3019 LeaveCriticalSection(&This->cs);
3021 return hr;
3024 static HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface,
3025 UINT iTInfo,
3026 LCID lcid,
3027 ITypeInfo**ppTInfo) {
3028 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3029 IVideoWindow* pVideoWindow;
3030 HRESULT hr;
3032 TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo);
3034 EnterCriticalSection(&This->cs);
3036 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3038 if (hr == S_OK)
3039 hr = IVideoWindow_GetTypeInfo(pVideoWindow, iTInfo, lcid, ppTInfo);
3041 LeaveCriticalSection(&This->cs);
3043 return hr;
3046 static HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface,
3047 REFIID riid,
3048 LPOLESTR*rgszNames,
3049 UINT cNames,
3050 LCID lcid,
3051 DISPID*rgDispId) {
3052 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3053 IVideoWindow* pVideoWindow;
3054 HRESULT hr;
3056 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
3058 EnterCriticalSection(&This->cs);
3060 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3062 if (hr == S_OK)
3063 hr = IVideoWindow_GetIDsOfNames(pVideoWindow, riid, rgszNames, cNames, lcid, rgDispId);
3065 LeaveCriticalSection(&This->cs);
3067 return hr;
3070 static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface,
3071 DISPID dispIdMember,
3072 REFIID riid,
3073 LCID lcid,
3074 WORD wFlags,
3075 DISPPARAMS*pDispParams,
3076 VARIANT*pVarResult,
3077 EXCEPINFO*pExepInfo,
3078 UINT*puArgErr) {
3079 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3080 IVideoWindow* pVideoWindow;
3081 HRESULT hr;
3083 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p)\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
3085 EnterCriticalSection(&This->cs);
3087 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3089 if (hr == S_OK)
3090 hr = IVideoWindow_Invoke(pVideoWindow, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
3092 LeaveCriticalSection(&This->cs);
3094 return hr;
3098 /*** IVideoWindow methods ***/
3099 static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface,
3100 BSTR strCaption) {
3101 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3102 IVideoWindow* pVideoWindow;
3103 HRESULT hr;
3105 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
3107 EnterCriticalSection(&This->cs);
3109 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3111 if (hr == S_OK)
3112 hr = IVideoWindow_put_Caption(pVideoWindow, strCaption);
3114 LeaveCriticalSection(&This->cs);
3116 return hr;
3119 static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface,
3120 BSTR *strCaption) {
3121 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3122 IVideoWindow* pVideoWindow;
3123 HRESULT hr;
3125 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
3127 EnterCriticalSection(&This->cs);
3129 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3131 if (hr == S_OK)
3132 hr = IVideoWindow_get_Caption(pVideoWindow, strCaption);
3134 LeaveCriticalSection(&This->cs);
3136 return hr;
3139 static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface,
3140 long WindowStyle) {
3141 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3142 IVideoWindow* pVideoWindow;
3143 HRESULT hr;
3145 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyle);
3147 EnterCriticalSection(&This->cs);
3149 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3151 if (hr == S_OK)
3152 hr = IVideoWindow_put_WindowStyle(pVideoWindow, WindowStyle);
3154 LeaveCriticalSection(&This->cs);
3156 return hr;
3159 static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface,
3160 long *WindowStyle) {
3161 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3162 IVideoWindow* pVideoWindow;
3163 HRESULT hr;
3165 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
3167 EnterCriticalSection(&This->cs);
3169 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3171 if (hr == S_OK)
3172 hr = IVideoWindow_get_WindowStyle(pVideoWindow, WindowStyle);
3174 LeaveCriticalSection(&This->cs);
3176 return hr;
3179 static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface,
3180 long WindowStyleEx) {
3181 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3182 IVideoWindow* pVideoWindow;
3183 HRESULT hr;
3185 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
3187 EnterCriticalSection(&This->cs);
3189 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3191 if (hr == S_OK)
3192 hr = IVideoWindow_put_WindowStyleEx(pVideoWindow, WindowStyleEx);
3194 LeaveCriticalSection(&This->cs);
3196 return hr;
3199 static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface,
3200 long *WindowStyleEx) {
3201 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3202 IVideoWindow* pVideoWindow;
3203 HRESULT hr;
3205 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
3207 EnterCriticalSection(&This->cs);
3209 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3211 if (hr == S_OK)
3212 hr = IVideoWindow_get_WindowStyleEx(pVideoWindow, WindowStyleEx);
3214 LeaveCriticalSection(&This->cs);
3216 return hr;
3219 static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface,
3220 long AutoShow) {
3221 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3222 IVideoWindow* pVideoWindow;
3223 HRESULT hr;
3225 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
3227 EnterCriticalSection(&This->cs);
3229 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3231 if (hr == S_OK)
3232 hr = IVideoWindow_put_AutoShow(pVideoWindow, AutoShow);
3234 LeaveCriticalSection(&This->cs);
3236 return hr;
3239 static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface,
3240 long *AutoShow) {
3241 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3242 IVideoWindow* pVideoWindow;
3243 HRESULT hr;
3245 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
3247 EnterCriticalSection(&This->cs);
3249 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3251 if (hr == S_OK)
3252 hr = IVideoWindow_get_AutoShow(pVideoWindow, AutoShow);
3254 LeaveCriticalSection(&This->cs);
3256 return hr;
3259 static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface,
3260 long WindowState) {
3261 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3262 IVideoWindow* pVideoWindow;
3263 HRESULT hr;
3265 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowState);
3267 EnterCriticalSection(&This->cs);
3269 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3271 if (hr == S_OK)
3272 hr = IVideoWindow_put_WindowState(pVideoWindow, WindowState);
3274 LeaveCriticalSection(&This->cs);
3276 return hr;
3279 static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface,
3280 long *WindowState) {
3281 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3282 IVideoWindow* pVideoWindow;
3283 HRESULT hr;
3285 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
3287 EnterCriticalSection(&This->cs);
3289 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3291 if (hr == S_OK)
3292 hr = IVideoWindow_get_WindowState(pVideoWindow, WindowState);
3294 LeaveCriticalSection(&This->cs);
3296 return hr;
3299 static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface,
3300 long BackgroundPalette) {
3301 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3302 IVideoWindow* pVideoWindow;
3303 HRESULT hr;
3305 TRACE("(%p/%p)->(%ld)\n", This, iface, BackgroundPalette);
3307 EnterCriticalSection(&This->cs);
3309 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3311 if (hr == S_OK)
3312 hr = IVideoWindow_put_BackgroundPalette(pVideoWindow, BackgroundPalette);
3314 LeaveCriticalSection(&This->cs);
3316 return hr;
3319 static HRESULT WINAPI VideoWindow_get_BackgroundPalette(IVideoWindow *iface,
3320 long *pBackgroundPalette) {
3321 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3322 IVideoWindow* pVideoWindow;
3323 HRESULT hr;
3325 TRACE("(%p/%p)->(%p)\n", This, iface, pBackgroundPalette);
3327 EnterCriticalSection(&This->cs);
3329 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3331 if (hr == S_OK)
3332 hr = IVideoWindow_get_BackgroundPalette(pVideoWindow, pBackgroundPalette);
3334 LeaveCriticalSection(&This->cs);
3336 return hr;
3339 static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface,
3340 long Visible) {
3341 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3342 IVideoWindow* pVideoWindow;
3343 HRESULT hr;
3345 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
3347 EnterCriticalSection(&This->cs);
3349 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3351 if (hr == S_OK)
3352 hr = IVideoWindow_put_Visible(pVideoWindow, Visible);
3354 LeaveCriticalSection(&This->cs);
3356 return hr;
3359 static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface,
3360 long *pVisible) {
3361 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3362 IVideoWindow* pVideoWindow;
3363 HRESULT hr;
3365 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
3367 EnterCriticalSection(&This->cs);
3369 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3371 if (hr == S_OK)
3372 hr = IVideoWindow_get_Visible(pVideoWindow, pVisible);
3374 LeaveCriticalSection(&This->cs);
3376 return hr;
3379 static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface,
3380 long Left) {
3381 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3382 IVideoWindow* pVideoWindow;
3383 HRESULT hr;
3385 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
3387 EnterCriticalSection(&This->cs);
3389 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3391 if (hr == S_OK)
3392 hr = IVideoWindow_put_Left(pVideoWindow, Left);
3394 LeaveCriticalSection(&This->cs);
3396 return hr;
3399 static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface,
3400 long *pLeft) {
3401 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3402 IVideoWindow* pVideoWindow;
3403 HRESULT hr;
3405 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
3407 EnterCriticalSection(&This->cs);
3409 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3411 if (hr == S_OK)
3412 hr = IVideoWindow_get_Left(pVideoWindow, pLeft);
3414 LeaveCriticalSection(&This->cs);
3416 return hr;
3419 static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface,
3420 long Width) {
3421 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3422 IVideoWindow* pVideoWindow;
3423 HRESULT hr;
3425 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
3427 EnterCriticalSection(&This->cs);
3429 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3431 if (hr == S_OK)
3432 hr = IVideoWindow_put_Width(pVideoWindow, Width);
3434 LeaveCriticalSection(&This->cs);
3436 return hr;
3439 static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface,
3440 long *pWidth) {
3441 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3442 IVideoWindow* pVideoWindow;
3443 HRESULT hr;
3445 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
3447 EnterCriticalSection(&This->cs);
3449 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3451 if (hr == S_OK)
3452 hr = IVideoWindow_get_Width(pVideoWindow, pWidth);
3454 LeaveCriticalSection(&This->cs);
3456 return hr;
3459 static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface,
3460 long Top) {
3461 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3462 IVideoWindow* pVideoWindow;
3463 HRESULT hr;
3465 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
3467 EnterCriticalSection(&This->cs);
3469 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3471 if (hr == S_OK)
3472 hr = IVideoWindow_put_Top(pVideoWindow, Top);
3474 LeaveCriticalSection(&This->cs);
3476 return hr;
3479 static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface,
3480 long *pTop) {
3481 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3482 IVideoWindow* pVideoWindow;
3483 HRESULT hr;
3485 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
3487 EnterCriticalSection(&This->cs);
3489 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3491 if (hr == S_OK)
3492 hr = IVideoWindow_get_Top(pVideoWindow, pTop);
3494 LeaveCriticalSection(&This->cs);
3496 return hr;
3499 static HRESULT WINAPI VideoWindow_put_Height(IVideoWindow *iface,
3500 long Height) {
3501 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3502 IVideoWindow* pVideoWindow;
3503 HRESULT hr;
3505 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
3507 EnterCriticalSection(&This->cs);
3509 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3511 if (hr == S_OK)
3512 hr = IVideoWindow_put_Height(pVideoWindow, Height);
3514 LeaveCriticalSection(&This->cs);
3516 return hr;
3519 static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface,
3520 long *pHeight) {
3521 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3522 IVideoWindow* pVideoWindow;
3523 HRESULT hr;
3525 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
3527 EnterCriticalSection(&This->cs);
3529 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3531 if (hr == S_OK)
3532 hr = IVideoWindow_get_Height(pVideoWindow, pHeight);
3534 LeaveCriticalSection(&This->cs);
3536 return hr;
3539 static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface,
3540 OAHWND Owner) {
3541 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3542 IVideoWindow* pVideoWindow;
3543 HRESULT hr;
3545 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
3547 EnterCriticalSection(&This->cs);
3549 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3551 if (hr == S_OK)
3552 hr = IVideoWindow_put_Owner(pVideoWindow, Owner);
3554 LeaveCriticalSection(&This->cs);
3556 return hr;
3559 static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface,
3560 OAHWND *Owner) {
3561 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3562 IVideoWindow* pVideoWindow;
3563 HRESULT hr;
3565 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
3567 EnterCriticalSection(&This->cs);
3569 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3571 if (hr == S_OK)
3572 hr = IVideoWindow_get_Owner(pVideoWindow, Owner);
3574 LeaveCriticalSection(&This->cs);
3576 return hr;
3579 static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface,
3580 OAHWND Drain) {
3581 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3582 IVideoWindow* pVideoWindow;
3583 HRESULT hr;
3585 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
3587 EnterCriticalSection(&This->cs);
3589 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3591 if (hr == S_OK)
3592 hr = IVideoWindow_put_MessageDrain(pVideoWindow, Drain);
3594 LeaveCriticalSection(&This->cs);
3596 return hr;
3599 static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface,
3600 OAHWND *Drain) {
3601 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3602 IVideoWindow* pVideoWindow;
3603 HRESULT hr;
3605 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
3607 EnterCriticalSection(&This->cs);
3609 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3611 if (hr == S_OK)
3612 hr = IVideoWindow_get_MessageDrain(pVideoWindow, Drain);
3614 LeaveCriticalSection(&This->cs);
3616 return hr;
3619 static HRESULT WINAPI VideoWindow_get_BorderColor(IVideoWindow *iface,
3620 long *Color) {
3621 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3622 IVideoWindow* pVideoWindow;
3623 HRESULT hr;
3625 TRACE("(%p/%p)->(%p)\n", This, iface, Color);
3627 EnterCriticalSection(&This->cs);
3629 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3631 if (hr == S_OK)
3632 hr = IVideoWindow_get_BorderColor(pVideoWindow, Color);
3634 LeaveCriticalSection(&This->cs);
3636 return hr;
3639 static HRESULT WINAPI VideoWindow_put_BorderColor(IVideoWindow *iface,
3640 long Color) {
3641 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3642 IVideoWindow* pVideoWindow;
3643 HRESULT hr;
3645 TRACE("(%p/%p)->(%ld)\n", This, iface, Color);
3647 EnterCriticalSection(&This->cs);
3649 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3651 if (hr == S_OK)
3652 hr = IVideoWindow_put_BorderColor(pVideoWindow, Color);
3654 LeaveCriticalSection(&This->cs);
3656 return hr;
3659 static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
3660 long *FullScreenMode) {
3661 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3662 IVideoWindow* pVideoWindow;
3663 HRESULT hr;
3665 TRACE("(%p/%p)->(%p)\n", This, iface, FullScreenMode);
3667 EnterCriticalSection(&This->cs);
3669 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3671 if (hr == S_OK)
3672 hr = IVideoWindow_get_FullScreenMode(pVideoWindow, FullScreenMode);
3674 LeaveCriticalSection(&This->cs);
3676 return hr;
3679 static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface,
3680 long FullScreenMode) {
3681 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3682 IVideoWindow* pVideoWindow;
3683 HRESULT hr;
3685 TRACE("(%p/%p)->(%ld)\n", This, iface, FullScreenMode);
3687 EnterCriticalSection(&This->cs);
3689 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3691 if (hr == S_OK)
3692 hr = IVideoWindow_put_FullScreenMode(pVideoWindow, FullScreenMode);
3694 LeaveCriticalSection(&This->cs);
3696 return hr;
3699 static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface,
3700 long Focus) {
3701 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3702 IVideoWindow* pVideoWindow;
3703 HRESULT hr;
3705 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
3707 EnterCriticalSection(&This->cs);
3709 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3711 if (hr == S_OK)
3712 hr = IVideoWindow_SetWindowForeground(pVideoWindow, Focus);
3714 LeaveCriticalSection(&This->cs);
3716 return hr;
3719 static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface,
3720 OAHWND hwnd,
3721 long uMsg,
3722 LONG_PTR wParam,
3723 LONG_PTR lParam) {
3724 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3725 IVideoWindow* pVideoWindow;
3726 HRESULT hr;
3728 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
3730 EnterCriticalSection(&This->cs);
3732 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3734 if (hr == S_OK)
3735 hr = IVideoWindow_NotifyOwnerMessage(pVideoWindow, hwnd, uMsg, wParam, lParam);
3737 LeaveCriticalSection(&This->cs);
3739 return hr;
3742 static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface,
3743 long Left,
3744 long Top,
3745 long Width,
3746 long Height) {
3747 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3748 IVideoWindow* pVideoWindow;
3749 HRESULT hr;
3751 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
3753 EnterCriticalSection(&This->cs);
3755 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3757 if (hr == S_OK)
3758 hr = IVideoWindow_SetWindowPosition(pVideoWindow, Left, Top, Width, Height);
3760 LeaveCriticalSection(&This->cs);
3762 return hr;
3765 static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface,
3766 long *pLeft,
3767 long *pTop,
3768 long *pWidth,
3769 long *pHeight) {
3770 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3771 IVideoWindow* pVideoWindow;
3772 HRESULT hr;
3774 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3776 EnterCriticalSection(&This->cs);
3778 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3780 if (hr == S_OK)
3781 hr = IVideoWindow_GetWindowPosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
3783 LeaveCriticalSection(&This->cs);
3785 return hr;
3788 static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface,
3789 long *pWidth,
3790 long *pHeight) {
3791 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3792 IVideoWindow* pVideoWindow;
3793 HRESULT hr;
3795 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3797 EnterCriticalSection(&This->cs);
3799 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3801 if (hr == S_OK)
3802 hr = IVideoWindow_GetMinIdealImageSize(pVideoWindow, pWidth, pHeight);
3804 LeaveCriticalSection(&This->cs);
3806 return hr;
3809 static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface,
3810 long *pWidth,
3811 long *pHeight) {
3812 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3813 IVideoWindow* pVideoWindow;
3814 HRESULT hr;
3816 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3818 EnterCriticalSection(&This->cs);
3820 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3822 if (hr == S_OK)
3823 hr = IVideoWindow_GetMaxIdealImageSize(pVideoWindow, pWidth, pHeight);
3825 LeaveCriticalSection(&This->cs);
3827 return hr;
3830 static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface,
3831 long *pLeft,
3832 long *pTop,
3833 long *pWidth,
3834 long *pHeight) {
3835 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3836 IVideoWindow* pVideoWindow;
3837 HRESULT hr;
3839 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3841 EnterCriticalSection(&This->cs);
3843 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3845 if (hr == S_OK)
3846 hr = IVideoWindow_GetRestorePosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
3848 LeaveCriticalSection(&This->cs);
3850 return hr;
3853 static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface,
3854 long HideCursor) {
3855 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3856 IVideoWindow* pVideoWindow;
3857 HRESULT hr;
3859 TRACE("(%p/%p)->(%ld)\n", This, iface, HideCursor);
3861 EnterCriticalSection(&This->cs);
3863 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3865 if (hr == S_OK)
3866 hr = IVideoWindow_HideCursor(pVideoWindow, HideCursor);
3868 LeaveCriticalSection(&This->cs);
3870 return hr;
3873 static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface,
3874 long *CursorHidden) {
3875 ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
3876 IVideoWindow* pVideoWindow;
3877 HRESULT hr;
3879 TRACE("(%p/%p)->(%p)\n", This, iface, CursorHidden);
3881 EnterCriticalSection(&This->cs);
3883 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3885 if (hr == S_OK)
3886 hr = IVideoWindow_IsCursorHidden(pVideoWindow, CursorHidden);
3888 LeaveCriticalSection(&This->cs);
3890 return hr;
3894 static const IVideoWindowVtbl IVideoWindow_VTable =
3896 VideoWindow_QueryInterface,
3897 VideoWindow_AddRef,
3898 VideoWindow_Release,
3899 VideoWindow_GetTypeInfoCount,
3900 VideoWindow_GetTypeInfo,
3901 VideoWindow_GetIDsOfNames,
3902 VideoWindow_Invoke,
3903 VideoWindow_put_Caption,
3904 VideoWindow_get_Caption,
3905 VideoWindow_put_WindowStyle,
3906 VideoWindow_get_WindowStyle,
3907 VideoWindow_put_WindowStyleEx,
3908 VideoWindow_get_WindowStyleEx,
3909 VideoWindow_put_AutoShow,
3910 VideoWindow_get_AutoShow,
3911 VideoWindow_put_WindowState,
3912 VideoWindow_get_WindowState,
3913 VideoWindow_put_BackgroundPalette,
3914 VideoWindow_get_BackgroundPalette,
3915 VideoWindow_put_Visible,
3916 VideoWindow_get_Visible,
3917 VideoWindow_put_Left,
3918 VideoWindow_get_Left,
3919 VideoWindow_put_Width,
3920 VideoWindow_get_Width,
3921 VideoWindow_put_Top,
3922 VideoWindow_get_Top,
3923 VideoWindow_put_Height,
3924 VideoWindow_get_Height,
3925 VideoWindow_put_Owner,
3926 VideoWindow_get_Owner,
3927 VideoWindow_put_MessageDrain,
3928 VideoWindow_get_MessageDrain,
3929 VideoWindow_get_BorderColor,
3930 VideoWindow_put_BorderColor,
3931 VideoWindow_get_FullScreenMode,
3932 VideoWindow_put_FullScreenMode,
3933 VideoWindow_SetWindowForeground,
3934 VideoWindow_NotifyOwnerMessage,
3935 VideoWindow_SetWindowPosition,
3936 VideoWindow_GetWindowPosition,
3937 VideoWindow_GetMinIdealImageSize,
3938 VideoWindow_GetMaxIdealImageSize,
3939 VideoWindow_GetRestorePosition,
3940 VideoWindow_HideCursor,
3941 VideoWindow_IsCursorHidden
3945 /*** IUnknown methods ***/
3946 static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface,
3947 REFIID riid,
3948 LPVOID*ppvObj) {
3949 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3951 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
3953 return Filtergraph_QueryInterface(This, riid, ppvObj);
3956 static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface) {
3957 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3959 TRACE("(%p/%p)->()\n", This, iface);
3961 return Filtergraph_AddRef(This);
3964 static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface) {
3965 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3967 TRACE("(%p/%p)->()\n", This, iface);
3969 return Filtergraph_Release(This);
3972 /*** IDispatch methods ***/
3973 static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface,
3974 UINT*pctinfo) {
3975 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3977 TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
3979 return S_OK;
3982 static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface,
3983 UINT iTInfo,
3984 LCID lcid,
3985 ITypeInfo**ppTInfo) {
3986 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
3988 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
3990 return S_OK;
3993 static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface,
3994 REFIID riid,
3995 LPOLESTR*rgszNames,
3996 UINT cNames,
3997 LCID lcid,
3998 DISPID*rgDispId) {
3999 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4001 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
4003 return S_OK;
4006 static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface,
4007 DISPID dispIdMember,
4008 REFIID riid,
4009 LCID lcid,
4010 WORD wFlags,
4011 DISPPARAMS*pDispParams,
4012 VARIANT*pVarResult,
4013 EXCEPINFO*pExepInfo,
4014 UINT*puArgErr) {
4015 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4017 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
4019 return S_OK;
4022 /*** IMediaEvent methods ***/
4023 static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface,
4024 OAEVENT *hEvent) {
4025 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4027 TRACE("(%p/%p)->(%p)\n", This, iface, hEvent);
4029 *hEvent = (OAEVENT)This->evqueue.msg_event;
4031 return S_OK;
4034 static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface,
4035 long *lEventCode,
4036 LONG_PTR *lParam1,
4037 LONG_PTR *lParam2,
4038 long msTimeout) {
4039 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4040 Event evt;
4042 TRACE("(%p/%p)->(%p, %p, %p, %ld)\n", This, iface, lEventCode, lParam1, lParam2, msTimeout);
4044 if (EventsQueue_GetEvent(&This->evqueue, &evt, msTimeout))
4046 *lEventCode = evt.lEventCode;
4047 *lParam1 = evt.lParam1;
4048 *lParam2 = evt.lParam2;
4049 return S_OK;
4052 *lEventCode = 0;
4053 return E_ABORT;
4056 static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface,
4057 long msTimeout,
4058 long *pEvCode) {
4059 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4061 TRACE("(%p/%p)->(%ld, %p)\n", This, iface, msTimeout, pEvCode);
4063 if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
4065 *pEvCode = This->CompletionStatus;
4066 return S_OK;
4069 *pEvCode = 0;
4070 return E_ABORT;
4073 static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface,
4074 long lEvCode) {
4075 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4077 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4079 if (lEvCode == EC_COMPLETE)
4080 This->HandleEcComplete = FALSE;
4081 else if (lEvCode == EC_REPAINT)
4082 This->HandleEcRepaint = FALSE;
4083 else
4084 return S_FALSE;
4086 return S_OK;
4089 static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(IMediaEventEx *iface,
4090 long lEvCode) {
4091 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4093 TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
4095 if (lEvCode == EC_COMPLETE)
4096 This->HandleEcComplete = TRUE;
4097 else if (lEvCode == EC_REPAINT)
4098 This->HandleEcRepaint = TRUE;
4099 else
4100 return S_FALSE;
4102 return S_OK;
4105 static HRESULT WINAPI MediaEvent_FreeEventParams(IMediaEventEx *iface,
4106 long lEvCode,
4107 LONG_PTR lParam1,
4108 LONG_PTR lParam2) {
4109 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4111 TRACE("(%p/%p)->(%ld, %08lx, %08lx): stub !!!\n", This, iface, lEvCode, lParam1, lParam2);
4113 return S_OK;
4116 /*** IMediaEventEx methods ***/
4117 static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
4118 OAHWND hwnd,
4119 long lMsg,
4120 LONG_PTR lInstanceData) {
4121 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4123 TRACE("(%p/%p)->(%08x, %ld, %08lx)\n", This, iface, (DWORD) hwnd, lMsg, lInstanceData);
4125 This->notif.hWnd = (HWND)hwnd;
4126 This->notif.msg = lMsg;
4127 This->notif.instance = (long) lInstanceData;
4129 return S_OK;
4132 static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface,
4133 long lNoNotifyFlags) {
4134 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4136 TRACE("(%p/%p)->(%ld)\n", This, iface, lNoNotifyFlags);
4138 if ((lNoNotifyFlags != 0) && (lNoNotifyFlags != 1))
4139 return E_INVALIDARG;
4141 This->notif.disabled = lNoNotifyFlags;
4143 return S_OK;
4146 static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface,
4147 long *lplNoNotifyFlags) {
4148 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
4150 TRACE("(%p/%p)->(%p)\n", This, iface, lplNoNotifyFlags);
4152 if (!lplNoNotifyFlags)
4153 return E_POINTER;
4155 *lplNoNotifyFlags = This->notif.disabled;
4157 return S_OK;
4161 static const IMediaEventExVtbl IMediaEventEx_VTable =
4163 MediaEvent_QueryInterface,
4164 MediaEvent_AddRef,
4165 MediaEvent_Release,
4166 MediaEvent_GetTypeInfoCount,
4167 MediaEvent_GetTypeInfo,
4168 MediaEvent_GetIDsOfNames,
4169 MediaEvent_Invoke,
4170 MediaEvent_GetEventHandle,
4171 MediaEvent_GetEvent,
4172 MediaEvent_WaitForCompletion,
4173 MediaEvent_CancelDefaultHandling,
4174 MediaEvent_RestoreDefaultHandling,
4175 MediaEvent_FreeEventParams,
4176 MediaEvent_SetNotifyWindow,
4177 MediaEvent_SetNotifyFlags,
4178 MediaEvent_GetNotifyFlags
4182 static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID riid, LPVOID *ppv)
4184 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4186 return Filtergraph_QueryInterface(This, riid, ppv);
4189 static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
4191 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4193 return Filtergraph_AddRef(This);
4196 static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
4198 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
4200 return Filtergraph_Release(This);
4203 static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClassID)
4205 FIXME("(%p): stub\n", pClassID);
4207 return E_NOTIMPL;
4210 static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
4212 FIXME("(): stub\n");
4214 return E_NOTIMPL;
4217 static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
4219 FIXME("(): stub\n");
4221 return E_NOTIMPL;
4224 static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME tStart)
4226 FIXME("(0x%s): stub\n", wine_dbgstr_longlong(tStart));
4228 return E_NOTIMPL;
4231 static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD dwMsTimeout, FILTER_STATE * pState)
4233 FIXME("(%d, %p): stub\n", dwMsTimeout, pState);
4235 return E_NOTIMPL;
4238 static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
4240 FIXME("(%p): stub\n", pClock);
4242 return E_NOTIMPL;
4245 static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
4247 FIXME("(%p): stub\n", ppClock);
4249 return E_NOTIMPL;
4252 static const IMediaFilterVtbl IMediaFilter_VTable =
4254 MediaFilter_QueryInterface,
4255 MediaFilter_AddRef,
4256 MediaFilter_Release,
4257 MediaFilter_GetClassID,
4258 MediaFilter_Stop,
4259 MediaFilter_Pause,
4260 MediaFilter_Run,
4261 MediaFilter_GetState,
4262 MediaFilter_SetSyncSource,
4263 MediaFilter_GetSyncSource
4266 static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID riid, LPVOID *ppv)
4268 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4270 return Filtergraph_QueryInterface(This, riid, ppv);
4273 static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
4275 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4277 return Filtergraph_AddRef(This);
4280 static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
4282 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4284 return Filtergraph_Release(This);
4287 static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, long EventCode, LONG_PTR EventParam1, LONG_PTR EventParam2)
4289 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4290 Event evt;
4292 TRACE("(%p/%p)->(%ld, %ld, %ld)\n", This, iface, EventCode, EventParam1, EventParam2);
4294 /* We need thread safety here, let's use the events queue's one */
4295 EnterCriticalSection(&This->evqueue.msg_crst);
4297 if ((EventCode == EC_COMPLETE) && This->HandleEcComplete)
4299 TRACE("Process EC_COMPLETE notification\n");
4300 if (++This->EcCompleteCount == This->nRenderers)
4302 evt.lEventCode = EC_COMPLETE;
4303 evt.lParam1 = S_OK;
4304 evt.lParam2 = 0;
4305 TRACE("Send EC_COMPLETE to app\n");
4306 EventsQueue_PutEvent(&This->evqueue, &evt);
4307 if (!This->notif.disabled && This->notif.hWnd)
4309 TRACE("Send Window message\n");
4310 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4312 This->CompletionStatus = EC_COMPLETE;
4313 SetEvent(This->hEventCompletion);
4316 else if ((EventCode == EC_REPAINT) && This->HandleEcRepaint)
4318 /* FIXME: Not handled yet */
4320 else
4322 evt.lEventCode = EventCode;
4323 evt.lParam1 = EventParam1;
4324 evt.lParam2 = EventParam2;
4325 EventsQueue_PutEvent(&This->evqueue, &evt);
4326 if (!This->notif.disabled && This->notif.hWnd)
4327 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
4330 LeaveCriticalSection(&This->evqueue.msg_crst);
4331 return S_OK;
4334 static const IMediaEventSinkVtbl IMediaEventSink_VTable =
4336 MediaEventSink_QueryInterface,
4337 MediaEventSink_AddRef,
4338 MediaEventSink_Release,
4339 MediaEventSink_Notify
4342 static HRESULT WINAPI GraphConfig_QueryInterface(IGraphConfig *iface, REFIID riid, LPVOID *ppv)
4344 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4346 return Filtergraph_QueryInterface(This, riid, ppv);
4349 static ULONG WINAPI GraphConfig_AddRef(IGraphConfig *iface)
4351 ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
4353 return Filtergraph_AddRef(This);
4356 static ULONG WINAPI GraphConfig_Release(IGraphConfig *iface)
4358 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4360 return Filtergraph_Release(This);
4363 static HRESULT WINAPI GraphConfig_Reconnect(IGraphConfig *iface,
4364 IPin* pOutputPin,
4365 IPin* pInputPin,
4366 const AM_MEDIA_TYPE* pmtFirstConnection,
4367 IBaseFilter* pUsingFilter,
4368 HANDLE hAbortEvent,
4369 DWORD dwFlags)
4371 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4373 FIXME("(%p)->(%p, %p, %p, %p, %p, %x): stub!\n", This, pOutputPin, pInputPin, pmtFirstConnection, pUsingFilter, hAbortEvent, dwFlags);
4375 return E_NOTIMPL;
4378 static HRESULT WINAPI GraphConfig_Reconfigure(IGraphConfig *iface,
4379 IGraphConfigCallback* pCallback,
4380 PVOID pvContext,
4381 DWORD dwFlags,
4382 HANDLE hAbortEvent)
4384 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4386 FIXME("(%p)->(%p, %p, %x, %p): stub!\n", This, pCallback, pvContext, dwFlags, hAbortEvent);
4388 return E_NOTIMPL;
4391 static HRESULT WINAPI GraphConfig_AddFilterToCache(IGraphConfig *iface,
4392 IBaseFilter* pFilter)
4394 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4396 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4398 return E_NOTIMPL;
4401 static HRESULT WINAPI GraphConfig_EnumCacheFilter(IGraphConfig *iface,
4402 IEnumFilters** pEnum)
4404 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4406 FIXME("(%p)->(%p): stub!\n", This, pEnum);
4408 return E_NOTIMPL;
4411 static HRESULT WINAPI GraphConfig_RemoveFilterFromCache(IGraphConfig *iface,
4412 IBaseFilter* pFilter)
4414 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4416 FIXME("(%p)->(%p): stub!\n", This, pFilter);
4418 return E_NOTIMPL;
4421 static HRESULT WINAPI GraphConfig_GetStartTime(IGraphConfig *iface,
4422 REFERENCE_TIME* prtStart)
4424 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4426 FIXME("(%p)->(%p): stub!\n", This, prtStart);
4428 return E_NOTIMPL;
4431 static HRESULT WINAPI GraphConfig_PushThroughData(IGraphConfig *iface,
4432 IPin* pOutputPin,
4433 IPinConnection* pConnection,
4434 HANDLE hEventAbort)
4436 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4438 FIXME("(%p)->(%p, %p, %p): stub!\n", This, pOutputPin, pConnection, hEventAbort);
4440 return E_NOTIMPL;
4443 static HRESULT WINAPI GraphConfig_SetFilterFlags(IGraphConfig *iface,
4444 IBaseFilter* pFilter,
4445 DWORD dwFlags)
4447 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4449 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
4451 return E_NOTIMPL;
4454 static HRESULT WINAPI GraphConfig_GetFilterFlags(IGraphConfig *iface,
4455 IBaseFilter* pFilter,
4456 DWORD* dwFlags)
4458 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4460 FIXME("(%p)->(%p, %p): stub!\n", This, pFilter, dwFlags);
4462 return E_NOTIMPL;
4465 static HRESULT WINAPI GraphConfig_RemoveFilterEx(IGraphConfig *iface,
4466 IBaseFilter* pFilter,
4467 DWORD dwFlags)
4469 ICOM_THIS_MULTI(IFilterGraphImpl, IGraphConfig_vtbl, iface);
4471 FIXME("(%p)->(%p, %x): stub!\n", This, pFilter, dwFlags);
4473 return E_NOTIMPL;
4476 static const IGraphConfigVtbl IGraphConfig_VTable =
4478 GraphConfig_QueryInterface,
4479 GraphConfig_AddRef,
4480 GraphConfig_Release,
4481 GraphConfig_Reconnect,
4482 GraphConfig_Reconfigure,
4483 GraphConfig_AddFilterToCache,
4484 GraphConfig_EnumCacheFilter,
4485 GraphConfig_RemoveFilterFromCache,
4486 GraphConfig_GetStartTime,
4487 GraphConfig_PushThroughData,
4488 GraphConfig_SetFilterFlags,
4489 GraphConfig_GetFilterFlags,
4490 GraphConfig_RemoveFilterEx
4493 /* This is the only function that actually creates a FilterGraph class... */
4494 HRESULT FilterGraph_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4496 IFilterGraphImpl *fimpl;
4497 HRESULT hr;
4499 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
4501 if( pUnkOuter )
4502 return CLASS_E_NOAGGREGATION;
4504 fimpl = CoTaskMemAlloc(sizeof(*fimpl));
4505 fimpl->IGraphBuilder_vtbl = &IGraphBuilder_VTable;
4506 fimpl->IMediaControl_vtbl = &IMediaControl_VTable;
4507 fimpl->IMediaSeeking_vtbl = &IMediaSeeking_VTable;
4508 fimpl->IBasicAudio_vtbl = &IBasicAudio_VTable;
4509 fimpl->IBasicVideo_vtbl = &IBasicVideo_VTable;
4510 fimpl->IVideoWindow_vtbl = &IVideoWindow_VTable;
4511 fimpl->IMediaEventEx_vtbl = &IMediaEventEx_VTable;
4512 fimpl->IMediaFilter_vtbl = &IMediaFilter_VTable;
4513 fimpl->IMediaEventSink_vtbl = &IMediaEventSink_VTable;
4514 fimpl->IGraphConfig_vtbl = &IGraphConfig_VTable;
4515 fimpl->IMediaPosition_vtbl = &IMediaPosition_VTable;
4516 fimpl->ref = 1;
4517 fimpl->ppFiltersInGraph = NULL;
4518 fimpl->pFilterNames = NULL;
4519 fimpl->nFilters = 0;
4520 fimpl->filterCapacity = 0;
4521 fimpl->nameIndex = 1;
4522 fimpl->hEventCompletion = CreateEventW(0, TRUE, FALSE, 0);
4523 fimpl->HandleEcComplete = TRUE;
4524 fimpl->HandleEcRepaint = TRUE;
4525 fimpl->notif.hWnd = 0;
4526 fimpl->notif.disabled = FALSE;
4527 fimpl->nRenderers = 0;
4528 fimpl->EcCompleteCount = 0;
4529 fimpl->state = State_Stopped;
4530 EventsQueue_Init(&fimpl->evqueue);
4531 InitializeCriticalSection(&fimpl->cs);
4532 fimpl->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IFilterGraphImpl.cs");
4533 fimpl->nItfCacheEntries = 0;
4535 hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&fimpl->pFilterMapper2);
4536 if (FAILED(hr)) {
4537 ERR("Unable to create filter mapper (%x)\n", hr);
4538 return hr;
4541 *ppObj = fimpl;
4542 return S_OK;
4545 HRESULT FilterGraphNoThread_create(IUnknown *pUnkOuter, LPVOID *ppObj)
4547 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
4548 return FilterGraph_create(pUnkOuter, ppObj);