Calculate the size of BI_BITFIELDS dib sections via the width and
[wine] / dlls / quartz / filtergraph.c
1 /*              DirectShow FilterGraph object (QUARTZ.DLL)
2  *
3  * Copyright 2002 Lionel Ulmer
4  * Copyright 2004 Christian Costa
5  *
6  * This file contains the (internal) driver registration functions,
7  * driver enumeration APIs and DirectDraw creation functions.
8  *
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.
13  *
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.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #include "config.h"
25 #include <stdarg.h>
26
27 #include "windef.h"
28 #include "winbase.h"
29 #include "dshow.h"
30 #include "wine/debug.h"
31 #include "strmif.h"
32 #include "vfwmsgs.h"
33 #include "evcode.h"
34 #include "wine/unicode.h"
35
36 #include "quartz_private.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
39
40 typedef struct {
41     HWND hWnd;      /* Target window */
42     long msg;       /* User window message */
43     long instance;  /* User data */
44     int  disabled;  /* Disabled messages posting */
45 } WndNotify;
46
47 typedef struct {
48     long lEventCode;   /* Event code */
49     LONG_PTR lParam1;  /* Param1 */
50     LONG_PTR lParam2;  /* Param2 */
51 } Event;
52
53 /* messages ring implementation for queuing events (taken from winmm) */
54 #define EVENTS_RING_BUFFER_INCREMENT      64
55 typedef struct {
56     Event* messages;
57     int ring_buffer_size;
58     int msg_tosave;
59     int msg_toget;
60     CRITICAL_SECTION msg_crst;
61     HANDLE msg_event; /* Signaled for no empty queue */
62 } EventsQueue;
63
64 static int EventsQueue_Init(EventsQueue* omr)
65 {
66     omr->msg_toget = 0;
67     omr->msg_tosave = 0;
68     omr->msg_event = CreateEventW(NULL, TRUE, FALSE, NULL);
69     omr->ring_buffer_size = EVENTS_RING_BUFFER_INCREMENT;
70     omr->messages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,omr->ring_buffer_size * sizeof(Event));
71
72     InitializeCriticalSection(&omr->msg_crst);
73     return TRUE;
74 }
75
76 static int EventsQueue_Destroy(EventsQueue* omr)
77 {
78     CloseHandle(omr->msg_event);
79     HeapFree(GetProcessHeap(),0,omr->messages);
80     DeleteCriticalSection(&omr->msg_crst);
81     return TRUE;
82 }
83
84 static int EventsQueue_PutEvent(EventsQueue* omr, Event* evt)
85 {
86     EnterCriticalSection(&omr->msg_crst);
87     if ((omr->msg_toget == ((omr->msg_tosave + 1) % omr->ring_buffer_size)))
88     {
89         int old_ring_buffer_size = omr->ring_buffer_size;
90         omr->ring_buffer_size += EVENTS_RING_BUFFER_INCREMENT;
91         TRACE("omr->ring_buffer_size=%d\n",omr->ring_buffer_size);
92         omr->messages = HeapReAlloc(GetProcessHeap(),0,omr->messages, omr->ring_buffer_size * sizeof(Event));
93         /* Now we need to rearrange the ring buffer so that the new
94            buffers just allocated are in between omr->msg_tosave and
95            omr->msg_toget.
96         */
97         if (omr->msg_tosave < omr->msg_toget)
98         {
99             memmove(&(omr->messages[omr->msg_toget + EVENTS_RING_BUFFER_INCREMENT]),
100                     &(omr->messages[omr->msg_toget]),
101                     sizeof(Event)*(old_ring_buffer_size - omr->msg_toget)
102                     );
103             omr->msg_toget += EVENTS_RING_BUFFER_INCREMENT;
104         }
105     }
106     omr->messages[omr->msg_tosave] = *evt;
107     SetEvent(omr->msg_event);
108     omr->msg_tosave = (omr->msg_tosave + 1) % omr->ring_buffer_size;
109     LeaveCriticalSection(&omr->msg_crst);
110     return TRUE;
111 }
112
113 static int EventsQueue_GetEvent(EventsQueue* omr, Event* evt, long msTimeOut)
114 {
115     if (WaitForSingleObject(omr->msg_event, msTimeOut) != WAIT_OBJECT_0)
116         return FALSE;
117         
118     EnterCriticalSection(&omr->msg_crst);
119
120     if (omr->msg_toget == omr->msg_tosave) /* buffer empty ? */
121     {
122         LeaveCriticalSection(&omr->msg_crst);
123         return FALSE;
124     }
125
126     *evt = omr->messages[omr->msg_toget];
127     omr->msg_toget = (omr->msg_toget + 1) % omr->ring_buffer_size;
128
129     /* Mark the buffer as empty if needed */
130     if (omr->msg_toget == omr->msg_tosave) /* buffer empty ? */
131         ResetEvent(omr->msg_event);
132
133     LeaveCriticalSection(&omr->msg_crst);
134     return TRUE;
135 }
136
137 typedef struct _IFilterGraphImpl {
138     ICOM_VTABLE(IGraphBuilder) *IGraphBuilder_vtbl;
139     ICOM_VTABLE(IMediaControl) *IMediaControl_vtbl;
140     ICOM_VTABLE(IMediaSeeking) *IMediaSeeking_vtbl;
141     ICOM_VTABLE(IBasicAudio) *IBasicAudio_vtbl;
142     ICOM_VTABLE(IBasicVideo) *IBasicVideo_vtbl;
143     ICOM_VTABLE(IVideoWindow) *IVideoWindow_vtbl;
144     ICOM_VTABLE(IMediaEventEx) *IMediaEventEx_vtbl;
145     ICOM_VTABLE(IMediaFilter) *IMediaFilter_vtbl;
146     ICOM_VTABLE(IMediaEventSink) *IMediaEventSink_vtbl;
147     /* IAMGraphStreams */
148     /* IAMStats */
149     /* IBasicVideo2 */
150     /* IFilterChain */
151     /* IFilterGraph2 */
152     /* IFilterMapper2 */
153     /* IGraphConfig */
154     /* IGraphVersion */
155     /* IMediaPosition */
156     /* IQueueCommand */
157     /* IRegisterServiceProvider */
158     /* IResourceMananger */
159     /* IServiceProvider */
160     /* IVideoFrameStep */
161
162     ULONG ref;
163     IBaseFilter ** ppFiltersInGraph;
164     LPWSTR * pFilterNames;
165     int nFilters;
166     int filterCapacity;
167     long nameIndex;
168     EventsQueue evqueue;
169     HANDLE hEventCompletion;
170     int CompletionStatus;
171     WndNotify notif;
172     int nRenderers;
173     int EcCompleteCount;
174     int HandleEcComplete;
175     int HandleEcRepaint;
176 } IFilterGraphImpl;
177
178
179 static HRESULT Filtergraph_QueryInterface(IFilterGraphImpl *This,
180                                           REFIID riid,
181                                           LPVOID *ppvObj) {
182     TRACE("(%p)->(%s (%p), %p)\n", This, debugstr_guid(riid), riid, ppvObj);
183     
184     if (IsEqualGUID(&IID_IUnknown, riid) ||
185         IsEqualGUID(&IID_IGraphBuilder, riid)) {
186         *ppvObj = &(This->IGraphBuilder_vtbl);
187         TRACE("   returning IGraphBuilder interface (%p)\n", *ppvObj);
188     } else if (IsEqualGUID(&IID_IMediaControl, riid)) {
189         *ppvObj = &(This->IMediaControl_vtbl);
190         TRACE("   returning IMediaControl interface (%p)\n", *ppvObj);
191     } else if (IsEqualGUID(&IID_IMediaSeeking, riid)) {
192         *ppvObj = &(This->IMediaSeeking_vtbl);
193         TRACE("   returning IMediaSeeking interface (%p)\n", *ppvObj);
194     } else if (IsEqualGUID(&IID_IBasicAudio, riid)) {
195         *ppvObj = &(This->IBasicAudio_vtbl);
196         TRACE("   returning IBasicAudio interface (%p)\n", *ppvObj);
197     } else if (IsEqualGUID(&IID_IBasicVideo, riid)) {
198         *ppvObj = &(This->IBasicVideo_vtbl);
199         TRACE("   returning IBasicVideo interface (%p)\n", *ppvObj);
200     } else if (IsEqualGUID(&IID_IVideoWindow, riid)) {
201         *ppvObj = &(This->IVideoWindow_vtbl);
202         TRACE("   returning IVideoWindow interface (%p)\n", *ppvObj);
203     } else if (IsEqualGUID(&IID_IMediaEvent, riid) ||
204            IsEqualGUID(&IID_IMediaEventEx, riid)) {
205         *ppvObj = &(This->IMediaEventEx_vtbl);
206         TRACE("   returning IMediaEvent(Ex) interface (%p)\n", *ppvObj);
207     } else if (IsEqualGUID(&IID_IMediaFilter, riid) ||
208           IsEqualGUID(&IID_IPersist, riid)) {
209         *ppvObj = &(This->IMediaFilter_vtbl);
210         TRACE("   returning IMediaFilter interface (%p)\n", *ppvObj);
211     } else if (IsEqualGUID(&IID_IMediaEventSink, riid)) {
212         *ppvObj = &(This->IMediaEventSink_vtbl);
213         TRACE("   returning IMediaEventSink interface (%p)\n", *ppvObj);
214     } else {
215         *ppvObj = NULL;
216         FIXME("unknown interface %s\n", debugstr_guid(riid));
217         return E_NOINTERFACE;
218     }
219
220     This->ref++;
221     return S_OK;
222 }
223
224 static ULONG Filtergraph_AddRef(IFilterGraphImpl *This) {
225     TRACE("(%p)->(): new ref = %ld\n", This, This->ref + 1);
226     
227     return ++This->ref;
228 }
229
230 static ULONG Filtergraph_Release(IFilterGraphImpl *This) {
231     static ULONG ref;
232     
233     TRACE("(%p)->(): new ref = %ld\n", This, This->ref - 1);
234     
235     ref = --This->ref;
236     if (ref == 0) {
237         CloseHandle(This->hEventCompletion);
238         EventsQueue_Destroy(&This->evqueue);
239         HeapFree(GetProcessHeap(), 0, This->ppFiltersInGraph);
240         HeapFree(GetProcessHeap(), 0, This->pFilterNames);
241         HeapFree(GetProcessHeap(), 0, This);
242     }
243     return ref;
244 }
245
246
247 /*** IUnknown methods ***/
248 static HRESULT WINAPI Graphbuilder_QueryInterface(IGraphBuilder *iface,
249                                                   REFIID riid,
250                                                   LPVOID*ppvObj) {
251     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
252     
253     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
254     return Filtergraph_QueryInterface(This, riid, ppvObj);
255 }
256
257 static ULONG WINAPI Graphbuilder_AddRef(IGraphBuilder *iface) {
258     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
259     
260     TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This, iface);
261     
262     return Filtergraph_AddRef(This);
263 }
264
265 static ULONG WINAPI Graphbuilder_Release(IGraphBuilder *iface) {
266     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
267     
268     TRACE("(%p/%p)->() calling FilterGraph Release\n", This, iface);
269
270     return Filtergraph_Release(This);
271 }
272
273 /*** IFilterGraph methods ***/
274 static HRESULT WINAPI Graphbuilder_AddFilter(IGraphBuilder *iface,
275                                              IBaseFilter *pFilter,
276                                              LPCWSTR pName) {
277     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
278     HRESULT hr;
279     int i,j;
280     WCHAR* wszFilterName = NULL;
281     int duplicate_name = FALSE;
282     
283     TRACE("(%p/%p)->(%p, %s (%p))\n", This, iface, pFilter, debugstr_w(pName), pName);
284
285     wszFilterName = (WCHAR*) CoTaskMemAlloc( (pName ? strlenW(pName) + 6 : 5) * sizeof(WCHAR) );
286     
287     if (pName)
288     {
289         /* Check if name already exists */
290         for(i = 0; i < This->nFilters; i++)
291             if (!strcmpW(This->pFilterNames[i], pName))
292             {
293                 duplicate_name = TRUE;
294                 break;
295             }
296     }
297
298     /* If no name given or name already existing, generate one */
299     if (!pName || duplicate_name)
300     {
301         static const WCHAR wszFmt1[] = {'%','s',' ','%','0','4','d',0};
302         static const WCHAR wszFmt2[] = {'%','0','4','d',0};
303
304         for (j = 0; j < 10000 ; j++)
305         {
306             /* Create name */
307             if (pName)
308                 sprintfW(wszFilterName, wszFmt1, pName, This->nameIndex);
309             else
310                 sprintfW(wszFilterName, wszFmt2, This->nameIndex);
311             TRACE("Generated name %s\n", debugstr_w(wszFilterName));
312
313             /* Check if the generated name already exists */
314             for(i = 0; i < This->nFilters; i++)
315                 if (!strcmpW(This->pFilterNames[i], pName))
316                     break;
317
318             /* Compute next index and exit if generated name is suitable */
319             if (This->nameIndex++ == 10000)
320                 This->nameIndex = 1;
321             if (i == This->nFilters)
322                 break;
323         }
324         /* Unable to find a suitable name */
325         if (j == 10000)
326         {
327             CoTaskMemFree(wszFilterName);
328             return VFW_E_DUPLICATE_NAME;
329         }
330     }
331     else
332         memcpy(wszFilterName, pName, (strlenW(pName) + 1) * sizeof(WCHAR));
333
334
335     if (This->nFilters + 1 > This->filterCapacity)
336     {
337         int newCapacity = 2*This->filterCapacity;
338         IBaseFilter ** ppNewFilters = CoTaskMemAlloc(newCapacity * sizeof(IBaseFilter*));
339         LPWSTR * pNewNames = CoTaskMemAlloc(newCapacity * sizeof(LPWSTR));
340         memcpy(ppNewFilters, This->ppFiltersInGraph, This->nFilters * sizeof(IBaseFilter*));
341         memcpy(pNewNames, This->pFilterNames, This->nFilters * sizeof(LPWSTR));
342         CoTaskMemFree(This->ppFiltersInGraph);
343         CoTaskMemFree(This->pFilterNames);
344         This->ppFiltersInGraph = ppNewFilters;
345         This->pFilterNames = pNewNames;
346         This->filterCapacity = newCapacity;
347     }
348
349     hr = IBaseFilter_JoinFilterGraph(pFilter, (IFilterGraph *)This, wszFilterName);
350
351     if (SUCCEEDED(hr))
352     {
353         IBaseFilter_AddRef(pFilter);
354         This->ppFiltersInGraph[This->nFilters] = pFilter;
355         This->pFilterNames[This->nFilters] = wszFilterName;
356         This->nFilters++;
357     }
358     else
359         CoTaskMemFree(wszFilterName);
360
361     if (SUCCEEDED(hr) && duplicate_name)
362         return VFW_S_DUPLICATE_NAME;
363         
364     return hr;
365 }
366
367 static HRESULT WINAPI Graphbuilder_RemoveFilter(IGraphBuilder *iface,
368                                                 IBaseFilter *pFilter) {
369     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
370     int i;
371     HRESULT hr = E_FAIL;
372
373     TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
374
375     /* FIXME: check graph is stopped */
376
377     for (i = 0; i < This->nFilters; i++)
378     {
379         if (This->ppFiltersInGraph[i] == pFilter)
380         {
381             /* FIXME: disconnect pins */
382             hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, This->pFilterNames[i]);
383             if (SUCCEEDED(hr))
384             {
385                 IPin_Release(pFilter);
386                 CoTaskMemFree(This->pFilterNames[i]);
387                 memmove(This->ppFiltersInGraph+i, This->ppFiltersInGraph+i+1, sizeof(IBaseFilter*)*(This->nFilters - 1 - i));
388                 memmove(This->pFilterNames+i, This->pFilterNames+i+1, sizeof(LPWSTR)*(This->nFilters - 1 - i));
389                 This->nFilters--;
390                 return S_OK;
391             }
392             break;
393         }
394     }
395
396     return hr; /* FIXME: check this error code */
397 }
398
399 static HRESULT WINAPI Graphbuilder_EnumFilters(IGraphBuilder *iface,
400                                               IEnumFilters **ppEnum) {
401     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
402
403     TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
404
405     return IEnumFiltersImpl_Construct(This->ppFiltersInGraph, This->nFilters, ppEnum);
406 }
407
408 static HRESULT WINAPI Graphbuilder_FindFilterByName(IGraphBuilder *iface,
409                                                     LPCWSTR pName,
410                                                     IBaseFilter **ppFilter) {
411     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
412     int i;
413
414     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_w(pName), pName, ppFilter);
415
416     *ppFilter = NULL;
417
418     for (i = 0; i < This->nFilters; i++)
419     {
420         if (!strcmpW(pName, This->pFilterNames[i]))
421         {
422             *ppFilter = This->ppFiltersInGraph[i];
423             IBaseFilter_AddRef(*ppFilter);
424             return S_OK;
425         }
426     }
427
428     return E_FAIL; /* FIXME: check this error code */
429 }
430
431 /* NOTE: despite the implication, it doesn't matter which
432  * way round you put in the input and output pins */
433 static HRESULT WINAPI Graphbuilder_ConnectDirect(IGraphBuilder *iface,
434                                                  IPin *ppinIn,
435                                                  IPin *ppinOut,
436                                                  const AM_MEDIA_TYPE *pmt) {
437     PIN_DIRECTION dir;
438     HRESULT hr;
439
440     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
441
442     TRACE("(%p/%p)->(%p, %p, %p)\n", This, iface, ppinIn, ppinOut, pmt);
443
444     /* FIXME: check pins are in graph */
445
446     hr = IPin_QueryDirection(ppinIn, &dir);
447     if (SUCCEEDED(hr))
448     {
449         if (dir == PINDIR_INPUT)
450             hr = IPin_Connect(ppinOut, ppinIn, pmt);
451         else
452             hr = IPin_Connect(ppinIn, ppinOut, pmt);
453     }
454
455     return hr;
456 }
457
458 static HRESULT WINAPI Graphbuilder_Reconnect(IGraphBuilder *iface,
459                                              IPin *ppin) {
460     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
461
462     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppin);
463
464     return S_OK;
465 }
466
467 static HRESULT WINAPI Graphbuilder_Disconnect(IGraphBuilder *iface,
468                                               IPin *ppin) {
469     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
470
471     TRACE("(%p/%p)->(%p)\n", This, iface, ppin);
472
473     return IPin_Disconnect(ppin);
474 }
475
476 static HRESULT WINAPI Graphbuilder_SetDefaultSyncSource(IGraphBuilder *iface) {
477     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
478
479     TRACE("(%p/%p)->(): stub !!!\n", iface, This);
480
481     return S_OK;
482 }
483
484 /*** IGraphBuilder methods ***/
485 static HRESULT WINAPI Graphbuilder_Connect(IGraphBuilder *iface,
486                                            IPin *ppinOut,
487                                            IPin *ppinIn) {
488     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
489
490     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, ppinOut, ppinIn);
491
492     return S_OK;
493 }
494
495 static HRESULT WINAPI Graphbuilder_Render(IGraphBuilder *iface,
496                                           IPin *ppinOut) {
497     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
498
499     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppinOut);
500
501     return S_OK;
502 }
503
504 static HRESULT WINAPI Graphbuilder_RenderFile(IGraphBuilder *iface,
505                                               LPCWSTR lpcwstrFile,
506                                               LPCWSTR lpcwstrPlayList) {
507     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
508
509     TRACE("(%p/%p)->(%s (%p), %s (%p)): stub !!!\n", This, iface, debugstr_w(lpcwstrFile), lpcwstrFile, debugstr_w(lpcwstrPlayList), lpcwstrPlayList);
510
511     return S_OK;
512 }
513
514 static HRESULT WINAPI Graphbuilder_AddSourceFilter(IGraphBuilder *iface,
515                                                    LPCWSTR lpcwstrFileName,
516                                                    LPCWSTR lpcwstrFilterName,
517                                                    IBaseFilter **ppFilter) {
518     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
519
520     TRACE("(%p/%p)->(%s (%p), %s (%p), %p): stub !!!\n", This, iface, debugstr_w(lpcwstrFileName), lpcwstrFileName, debugstr_w(lpcwstrFilterName), lpcwstrFilterName, ppFilter);
521
522     return S_OK;
523 }
524
525 static HRESULT WINAPI Graphbuilder_SetLogFile(IGraphBuilder *iface,
526                                               DWORD_PTR hFile) {
527     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
528
529     TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) hFile);
530
531     return S_OK;
532 }
533
534 static HRESULT WINAPI Graphbuilder_Abort(IGraphBuilder *iface) {
535     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
536
537     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
538
539     return S_OK;
540 }
541
542 static HRESULT WINAPI Graphbuilder_ShouldOperationContinue(IGraphBuilder *iface) {
543     ICOM_THIS_MULTI(IFilterGraphImpl, IGraphBuilder_vtbl, iface);
544
545     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
546
547     return S_OK;
548 }
549
550
551 static ICOM_VTABLE(IGraphBuilder) IGraphBuilder_VTable =
552 {
553     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
554     Graphbuilder_QueryInterface,
555     Graphbuilder_AddRef,
556     Graphbuilder_Release,
557     Graphbuilder_AddFilter,
558     Graphbuilder_RemoveFilter,
559     Graphbuilder_EnumFilters,
560     Graphbuilder_FindFilterByName,
561     Graphbuilder_ConnectDirect,
562     Graphbuilder_Reconnect,
563     Graphbuilder_Disconnect,
564     Graphbuilder_SetDefaultSyncSource,
565     Graphbuilder_Connect,
566     Graphbuilder_Render,
567     Graphbuilder_RenderFile,
568     Graphbuilder_AddSourceFilter,
569     Graphbuilder_SetLogFile,
570     Graphbuilder_Abort,
571     Graphbuilder_ShouldOperationContinue
572 };
573
574 /*** IUnknown methods ***/
575 static HRESULT WINAPI Mediacontrol_QueryInterface(IMediaControl *iface,
576                                                   REFIID riid,
577                                                   LPVOID*ppvObj) {
578     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
579
580     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
581
582     return Filtergraph_QueryInterface(This, riid, ppvObj);
583 }
584
585 static ULONG WINAPI Mediacontrol_AddRef(IMediaControl *iface) {
586     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
587
588     TRACE("(%p/%p)->()\n", This, iface);
589
590     return Filtergraph_AddRef(This);
591 }
592
593 static ULONG WINAPI Mediacontrol_Release(IMediaControl *iface) {
594     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
595
596     TRACE("(%p/%p)->()\n", This, iface);
597
598     return Filtergraph_Release(This);
599
600 }
601
602 /*** IDispatch methods ***/
603 static HRESULT WINAPI Mediacontrol_GetTypeInfoCount(IMediaControl *iface,
604                                                     UINT*pctinfo) {
605     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
606
607     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
608
609     return S_OK;
610 }
611
612 static HRESULT WINAPI Mediacontrol_GetTypeInfo(IMediaControl *iface,
613                                                UINT iTInfo,
614                                                LCID lcid,
615                                                ITypeInfo**ppTInfo) {
616     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
617
618     TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
619
620     return S_OK;
621 }
622
623 static HRESULT WINAPI Mediacontrol_GetIDsOfNames(IMediaControl *iface,
624                                                  REFIID riid,
625                                                  LPOLESTR*rgszNames,
626                                                  UINT cNames,
627                                                  LCID lcid,
628                                                  DISPID*rgDispId) {
629     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
630
631     TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
632
633     return S_OK;
634 }
635
636 static HRESULT WINAPI Mediacontrol_Invoke(IMediaControl *iface,
637                                           DISPID dispIdMember,
638                                           REFIID riid,
639                                           LCID lcid,
640                                           WORD wFlags,
641                                           DISPPARAMS*pDispParams,
642                                           VARIANT*pVarResult,
643                                           EXCEPINFO*pExepInfo,
644                                           UINT*puArgErr) {
645     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
646
647     TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
648
649     return S_OK;
650 }
651
652 /*** IMediaControl methods ***/
653 static HRESULT WINAPI Mediacontrol_Run(IMediaControl *iface) {
654     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
655
656     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
657
658     ResetEvent(This->hEventCompletion);
659
660     return S_OK;
661 }
662
663 static HRESULT WINAPI Mediacontrol_Pause(IMediaControl *iface) {
664     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
665
666     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
667
668     return S_OK;
669 }
670
671 static HRESULT WINAPI Mediacontrol_Stop(IMediaControl *iface) {
672     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
673
674     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
675
676     return S_OK;
677 }
678
679 static HRESULT WINAPI Mediacontrol_GetState(IMediaControl *iface,
680                                             LONG msTimeout,
681                                             OAFilterState *pfs) {
682     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
683
684     TRACE("(%p/%p)->(%ld, %p): stub !!!\n", This, iface, msTimeout, pfs);
685
686     return S_OK;
687 }
688
689 static HRESULT WINAPI Mediacontrol_RenderFile(IMediaControl *iface,
690                                               BSTR strFilename) {
691     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
692
693     TRACE("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename);
694
695     return S_OK;
696 }
697
698 static HRESULT WINAPI Mediacontrol_AddSourceFilter(IMediaControl *iface,
699                                                    BSTR strFilename,
700                                                    IDispatch **ppUnk) {
701     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
702
703     TRACE("(%p/%p)->(%s (%p), %p): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename, ppUnk);
704
705     return S_OK;
706 }
707
708 static HRESULT WINAPI Mediacontrol_get_FilterCollection(IMediaControl *iface,
709                                                         IDispatch **ppUnk) {
710     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
711
712     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
713
714     return S_OK;
715 }
716
717 static HRESULT WINAPI Mediacontrol_get_RegFilterCollection(IMediaControl *iface,
718                                                            IDispatch **ppUnk) {
719     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
720
721     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
722
723     return S_OK;
724 }
725
726 static HRESULT WINAPI Mediacontrol_StopWhenReady(IMediaControl *iface) {
727     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaControl_vtbl, iface);
728
729     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
730
731     return S_OK;
732 }
733
734
735 static ICOM_VTABLE(IMediaControl) IMediaControl_VTable =
736 {
737     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
738     Mediacontrol_QueryInterface,
739     Mediacontrol_AddRef,
740     Mediacontrol_Release,
741     Mediacontrol_GetTypeInfoCount,
742     Mediacontrol_GetTypeInfo,
743     Mediacontrol_GetIDsOfNames,
744     Mediacontrol_Invoke,
745     Mediacontrol_Run,
746     Mediacontrol_Pause,
747     Mediacontrol_Stop,
748     Mediacontrol_GetState,
749     Mediacontrol_RenderFile,
750     Mediacontrol_AddSourceFilter,
751     Mediacontrol_get_FilterCollection,
752     Mediacontrol_get_RegFilterCollection,
753     Mediacontrol_StopWhenReady
754 };
755
756
757 /*** IUnknown methods ***/
758 static HRESULT WINAPI Mediaseeking_QueryInterface(IMediaSeeking *iface,
759                                                   REFIID riid,
760                                                   LPVOID*ppvObj) {
761     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
762
763     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
764
765     return Filtergraph_QueryInterface(This, riid, ppvObj);
766 }
767
768 static ULONG WINAPI Mediaseeking_AddRef(IMediaSeeking *iface) {
769     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
770
771     TRACE("(%p/%p)->()\n", This, iface);
772
773     return Filtergraph_AddRef(This);
774 }
775
776 static ULONG WINAPI Mediaseeking_Release(IMediaSeeking *iface) {
777     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
778
779     TRACE("(%p/%p)->()\n", This, iface);
780
781     return Filtergraph_Release(This);
782 }
783
784 /*** IMediaSeeking methods ***/
785 static HRESULT WINAPI Mediaseeking_GetCapabilities(IMediaSeeking *iface,
786                                                    DWORD *pCapabilities) {
787     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
788
789     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCapabilities);
790
791     return S_OK;
792 }
793
794 static HRESULT WINAPI Mediaseeking_CheckCapabilities(IMediaSeeking *iface,
795                                                      DWORD *pCapabilities) {
796     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
797
798     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCapabilities);
799
800     return S_OK;
801 }
802
803 static HRESULT WINAPI Mediaseeking_IsFormatSupported(IMediaSeeking *iface,
804                                                      const GUID *pFormat) {
805     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
806
807     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
808
809     return S_OK;
810 }
811
812 static HRESULT WINAPI Mediaseeking_QueryPreferredFormat(IMediaSeeking *iface,
813                                                         GUID *pFormat) {
814     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
815
816     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
817
818     return S_OK;
819 }
820
821 static HRESULT WINAPI Mediaseeking_GetTimeFormat(IMediaSeeking *iface,
822                                                  GUID *pFormat) {
823     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
824
825     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
826
827     return S_OK;
828 }
829
830 static HRESULT WINAPI Mediaseeking_IsUsingTimeFormat(IMediaSeeking *iface,
831                                                      const GUID *pFormat) {
832     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
833
834     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
835
836     return S_OK;
837 }
838
839 static HRESULT WINAPI Mediaseeking_SetTimeFormat(IMediaSeeking *iface,
840                                                  const GUID *pFormat) {
841     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
842
843     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pFormat);
844
845     return S_OK;
846 }
847
848 static HRESULT WINAPI Mediaseeking_GetDuration(IMediaSeeking *iface,
849                                                LONGLONG *pDuration) {
850     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
851
852     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDuration);
853
854     return S_OK;
855 }
856
857 static HRESULT WINAPI Mediaseeking_GetStopPosition(IMediaSeeking *iface,
858                                                    LONGLONG *pStop) {
859     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
860
861     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pStop);
862
863     return S_OK;
864 }
865
866 static HRESULT WINAPI Mediaseeking_GetCurrentPosition(IMediaSeeking *iface,
867                                                       LONGLONG *pCurrent) {
868     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
869
870     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pCurrent);
871
872     return S_OK;
873 }
874
875 static HRESULT WINAPI Mediaseeking_ConvertTimeFormat(IMediaSeeking *iface,
876                                                      LONGLONG *pTarget,
877                                                      const GUID *pTargetFormat,
878                                                      LONGLONG Source,
879                                                      const GUID *pSourceFormat) {
880     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
881
882     TRACE("(%p/%p)->(%p, %p, %lld, %p): stub !!!\n", This, iface, pTarget, pTargetFormat, Source, pSourceFormat);
883
884     return S_OK;
885 }
886
887 static HRESULT WINAPI Mediaseeking_SetPositions(IMediaSeeking *iface,
888                                                 LONGLONG *pCurrent,
889                                                 DWORD dwCurrentFlags,
890                                                 LONGLONG *pStop,
891                                                 DWORD dwStopFlags) {
892     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
893
894     TRACE("(%p/%p)->(%p, %08lx, %p, %08lx): stub !!!\n", This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
895
896     return S_OK;
897 }
898
899 static HRESULT WINAPI Mediaseeking_GetPositions(IMediaSeeking *iface,
900                                                 LONGLONG *pCurrent,
901                                                 LONGLONG *pStop) {
902     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
903
904     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pCurrent, pStop);
905
906     return S_OK;
907 }
908
909 static HRESULT WINAPI Mediaseeking_GetAvailable(IMediaSeeking *iface,
910                                                 LONGLONG *pEarliest,
911                                                 LONGLONG *pLatest) {
912     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
913
914     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
915
916     return S_OK;
917 }
918
919 static HRESULT WINAPI Mediaseeking_SetRate(IMediaSeeking *iface,
920                                            double dRate) {
921     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
922
923     TRACE("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
924
925     return S_OK;
926 }
927
928 static HRESULT WINAPI Mediaseeking_GetRate(IMediaSeeking *iface,
929                                            double *pdRate) {
930     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
931
932     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
933
934     return S_OK;
935 }
936
937 static HRESULT WINAPI Mediaseeking_GetPreroll(IMediaSeeking *iface,
938                                               LONGLONG *pllPreroll) {
939     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
940
941     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
942
943     return S_OK;
944 }
945
946
947 static ICOM_VTABLE(IMediaSeeking) IMediaSeeking_VTable =
948 {
949     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
950     Mediaseeking_QueryInterface,
951     Mediaseeking_AddRef,
952     Mediaseeking_Release,
953     Mediaseeking_GetCapabilities,
954     Mediaseeking_CheckCapabilities,
955     Mediaseeking_IsFormatSupported,
956     Mediaseeking_QueryPreferredFormat,
957     Mediaseeking_GetTimeFormat,
958     Mediaseeking_IsUsingTimeFormat,
959     Mediaseeking_SetTimeFormat,
960     Mediaseeking_GetDuration,
961     Mediaseeking_GetStopPosition,
962     Mediaseeking_GetCurrentPosition,
963     Mediaseeking_ConvertTimeFormat,
964     Mediaseeking_SetPositions,
965     Mediaseeking_GetPositions,
966     Mediaseeking_GetAvailable,
967     Mediaseeking_SetRate,
968     Mediaseeking_GetRate,
969     Mediaseeking_GetPreroll
970 };
971
972 /*** IUnknown methods ***/
973 static HRESULT WINAPI Basicaudio_QueryInterface(IBasicAudio *iface,
974                                                 REFIID riid,
975                                                 LPVOID*ppvObj) {
976     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
977
978     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
979
980     return Filtergraph_QueryInterface(This, riid, ppvObj);
981 }
982
983 static ULONG WINAPI Basicaudio_AddRef(IBasicAudio *iface) {
984     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
985
986     TRACE("(%p/%p)->()\n", This, iface);
987
988     return Filtergraph_AddRef(This);
989 }
990
991 static ULONG WINAPI Basicaudio_Release(IBasicAudio *iface) {
992     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
993
994     TRACE("(%p/%p)->()\n", This, iface);
995
996     return Filtergraph_Release(This);
997 }
998
999 /*** IDispatch methods ***/
1000 static HRESULT WINAPI Basicaudio_GetTypeInfoCount(IBasicAudio *iface,
1001                                                   UINT*pctinfo) {
1002     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1003
1004     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1005
1006     return S_OK;
1007 }
1008
1009 static HRESULT WINAPI Basicaudio_GetTypeInfo(IBasicAudio *iface,
1010                                              UINT iTInfo,
1011                                              LCID lcid,
1012                                              ITypeInfo**ppTInfo) {
1013     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1014
1015     TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1016
1017     return S_OK;
1018 }
1019
1020 static HRESULT WINAPI Basicaudio_GetIDsOfNames(IBasicAudio *iface,
1021                                                REFIID riid,
1022                                                LPOLESTR*rgszNames,
1023                                                UINT cNames,
1024                                                LCID lcid,
1025                                                DISPID*rgDispId) {
1026     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1027
1028     TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1029
1030     return S_OK;
1031 }
1032
1033 static HRESULT WINAPI Basicaudio_Invoke(IBasicAudio *iface,
1034                                         DISPID dispIdMember,
1035                                         REFIID riid,
1036                                         LCID lcid,
1037                                         WORD wFlags,
1038                                         DISPPARAMS*pDispParams,
1039                                         VARIANT*pVarResult,
1040                                         EXCEPINFO*pExepInfo,
1041                                         UINT*puArgErr) {
1042     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1043
1044     TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1045
1046     return S_OK;
1047 }
1048
1049 /*** IBasicAudio methods ***/
1050 static HRESULT WINAPI Basicaudio_put_Volume(IBasicAudio *iface,
1051                                             long lVolume) {
1052     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1053
1054     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, lVolume);
1055
1056     return S_OK;
1057 }
1058
1059 static HRESULT WINAPI Basicaudio_get_Volume(IBasicAudio *iface,
1060                                             long *plVolume) {
1061     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1062
1063     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, plVolume);
1064
1065     return S_OK;
1066 }
1067
1068 static HRESULT WINAPI Basicaudio_put_Balance(IBasicAudio *iface,
1069                                              long lBalance) {
1070     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1071
1072     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, lBalance);
1073
1074     return S_OK;
1075 }
1076
1077 static HRESULT WINAPI Basicaudio_get_Balance(IBasicAudio *iface,
1078                                              long *plBalance) {
1079     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicAudio_vtbl, iface);
1080
1081     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, plBalance);
1082
1083     return S_OK;
1084 }
1085
1086 static ICOM_VTABLE(IBasicAudio) IBasicAudio_VTable =
1087 {
1088     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1089     Basicaudio_QueryInterface,
1090     Basicaudio_AddRef,
1091     Basicaudio_Release,
1092     Basicaudio_GetTypeInfoCount,
1093     Basicaudio_GetTypeInfo,
1094     Basicaudio_GetIDsOfNames,
1095     Basicaudio_Invoke,
1096     Basicaudio_put_Volume,
1097     Basicaudio_get_Volume,
1098     Basicaudio_put_Balance,
1099     Basicaudio_get_Balance
1100 };
1101
1102 /*** IUnknown methods ***/
1103 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
1104                                                 REFIID riid,
1105                                                 LPVOID*ppvObj) {
1106     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1107
1108     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1109
1110     return Filtergraph_QueryInterface(This, riid, ppvObj);
1111 }
1112
1113 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
1114     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1115
1116     TRACE("(%p/%p)->()\n", This, iface);
1117
1118     return Filtergraph_AddRef(This);
1119 }
1120
1121 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
1122     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1123
1124     TRACE("(%p/%p)->()\n", This, iface);
1125
1126     return Filtergraph_Release(This);
1127 }
1128
1129 /*** IDispatch methods ***/
1130 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
1131                                                   UINT*pctinfo) {
1132     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1133
1134     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1135
1136     return S_OK;
1137 }
1138
1139 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
1140                                              UINT iTInfo,
1141                                              LCID lcid,
1142                                              ITypeInfo**ppTInfo) {
1143     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1144
1145     TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1146
1147     return S_OK;
1148 }
1149
1150 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
1151                                                REFIID riid,
1152                                                LPOLESTR*rgszNames,
1153                                                UINT cNames,
1154                                                LCID lcid,
1155                                                DISPID*rgDispId) {
1156     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1157
1158     TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1159
1160     return S_OK;
1161 }
1162
1163 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
1164                                         DISPID dispIdMember,
1165                                         REFIID riid,
1166                                         LCID lcid,
1167                                         WORD wFlags,
1168                                         DISPPARAMS*pDispParams,
1169                                         VARIANT*pVarResult,
1170                                         EXCEPINFO*pExepInfo,
1171                                         UINT*puArgErr) {
1172     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1173
1174     TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1175
1176     return S_OK;
1177 }
1178
1179 /*** IBasicVideo methods ***/
1180 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
1181                                                      REFTIME *pAvgTimePerFrame) {
1182     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1183
1184     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
1185
1186     return S_OK;
1187 }
1188
1189 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
1190                                              long *pBitRate) {
1191     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1192
1193     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
1194
1195     return S_OK;
1196 }
1197
1198 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
1199                                                   long *pBitErrorRate) {
1200     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1201
1202     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
1203
1204     return S_OK;
1205 }
1206
1207 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
1208                                                 long *pVideoWidth) {
1209     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1210
1211     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pVideoWidth);
1212
1213     return S_OK;
1214 }
1215
1216 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1217                                                  long *pVideoHeight) {
1218     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1219
1220     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pVideoHeight);
1221
1222     return S_OK;
1223 }
1224
1225 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1226                                                 long SourceLeft) {
1227     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1228
1229     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceLeft);
1230
1231     return S_OK;
1232 }
1233
1234 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1235                                                 long *pSourceLeft) {
1236     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1237
1238     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceLeft);
1239
1240     return S_OK;
1241 }
1242
1243 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1244                                                  long SourceWidth) {
1245     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1246
1247     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceWidth);
1248
1249     return S_OK;
1250 }
1251
1252 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1253                                                  long *pSourceWidth) {
1254     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1255
1256     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceWidth);
1257
1258     return S_OK;
1259 }
1260
1261 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1262                                                long SourceTop) {
1263     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1264
1265     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceTop);
1266
1267     return S_OK;
1268 }
1269
1270 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1271                                                long *pSourceTop) {
1272     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1273
1274     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceTop);
1275
1276     return S_OK;
1277 }
1278
1279 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1280                                                   long SourceHeight) {
1281     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1282
1283     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceHeight);
1284
1285     return S_OK;
1286 }
1287
1288 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1289                                                   long *pSourceHeight) {
1290     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1291
1292     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceHeight);
1293
1294     return S_OK;
1295 }
1296
1297 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1298                                                      long DestinationLeft) {
1299     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1300
1301     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationLeft);
1302
1303     return S_OK;
1304 }
1305
1306 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1307                                                      long *pDestinationLeft) {
1308     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1309
1310     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationLeft);
1311
1312     return S_OK;
1313 }
1314
1315 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1316                                                       long DestinationWidth) {
1317     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1318
1319     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationWidth);
1320
1321     return S_OK;
1322 }
1323
1324 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1325                                                       long *pDestinationWidth) {
1326     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1327
1328     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationWidth);
1329
1330     return S_OK;
1331 }
1332
1333 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1334                                                     long DestinationTop) {
1335     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1336
1337     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationTop);
1338
1339     return S_OK;
1340 }
1341
1342 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1343                                                     long *pDestinationTop) {
1344     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1345
1346     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationTop);
1347
1348     return S_OK;
1349 }
1350
1351 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1352                                                        long DestinationHeight) {
1353     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1354
1355     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationHeight);
1356
1357     return S_OK;
1358 }
1359
1360 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1361                                                        long *pDestinationHeight) {
1362     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1363
1364     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationHeight);
1365
1366     return S_OK;
1367 }
1368
1369 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1370                                                    long Left,
1371                                                    long Top,
1372                                                    long Width,
1373                                                    long Height) {
1374     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1375
1376     TRACE("(%p/%p)->(%ld, %ld, %ld, %ld): stub !!!\n", This, iface, Left, Top, Width, Height);
1377
1378     return S_OK;
1379 }
1380
1381 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1382                                                    long *pLeft,
1383                                                    long *pTop,
1384                                                    long *pWidth,
1385                                                    long *pHeight) {
1386     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1387
1388     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1389
1390     return S_OK;
1391 }
1392
1393 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1394     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1395
1396     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1397
1398     return S_OK;
1399 }
1400
1401 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1402                                                         long Left,
1403                                                         long Top,
1404                                                         long Width,
1405                                                         long Height) {
1406     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1407
1408     TRACE("(%p/%p)->(%ld, %ld, %ld, %ld): stub !!!\n", This, iface, Left, Top, Width, Height);
1409
1410     return S_OK;
1411 }
1412
1413 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1414                                                         long *pLeft,
1415                                                         long *pTop,
1416                                                         long *pWidth,
1417                                                         long *pHeight) {
1418     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1419
1420     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1421
1422     return S_OK;
1423 }
1424
1425 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1426     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1427
1428     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1429
1430     return S_OK;
1431 }
1432
1433 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1434                                               long *pWidth,
1435                                               long *pHeight) {
1436     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1437
1438     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pWidth, pHeight);
1439
1440     return S_OK;
1441 }
1442
1443 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1444                                                         long StartIndex,
1445                                                         long Entries,
1446                                                         long *pRetrieved,
1447                                                         long *pPalette) {
1448     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1449
1450     TRACE("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1451
1452     return S_OK;
1453 }
1454
1455 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1456                                                  long *pBufferSize,
1457                                                  long *pDIBImage) {
1458     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1459
1460     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pBufferSize, pDIBImage);
1461
1462     return S_OK;
1463 }
1464
1465 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1466     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1467
1468     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1469
1470     return S_OK;
1471 }
1472
1473 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1474     ICOM_THIS_MULTI(IFilterGraphImpl, IBasicVideo_vtbl, iface);
1475
1476     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1477
1478     return S_OK;
1479 }
1480
1481
1482 static ICOM_VTABLE(IBasicVideo) IBasicVideo_VTable =
1483 {
1484     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1485     Basicvideo_QueryInterface,
1486     Basicvideo_AddRef,
1487     Basicvideo_Release,
1488     Basicvideo_GetTypeInfoCount,
1489     Basicvideo_GetTypeInfo,
1490     Basicvideo_GetIDsOfNames,
1491     Basicvideo_Invoke,
1492     Basicvideo_get_AvgTimePerFrame,
1493     Basicvideo_get_BitRate,
1494     Basicvideo_get_BitErrorRate,
1495     Basicvideo_get_VideoWidth,
1496     Basicvideo_get_VideoHeight,
1497     Basicvideo_put_SourceLeft,
1498     Basicvideo_get_SourceLeft,
1499     Basicvideo_put_SourceWidth,
1500     Basicvideo_get_SourceWidth,
1501     Basicvideo_put_SourceTop,
1502     Basicvideo_get_SourceTop,
1503     Basicvideo_put_SourceHeight,
1504     Basicvideo_get_SourceHeight,
1505     Basicvideo_put_DestinationLeft,
1506     Basicvideo_get_DestinationLeft,
1507     Basicvideo_put_DestinationWidth,
1508     Basicvideo_get_DestinationWidth,
1509     Basicvideo_put_DestinationTop,
1510     Basicvideo_get_DestinationTop,
1511     Basicvideo_put_DestinationHeight,
1512     Basicvideo_get_DestinationHeight,
1513     Basicvideo_SetSourcePosition,
1514     Basicvideo_GetSourcePosition,
1515     Basicvideo_SetDefaultSourcePosition,
1516     Basicvideo_SetDestinationPosition,
1517     Basicvideo_GetDestinationPosition,
1518     Basicvideo_SetDefaultDestinationPosition,
1519     Basicvideo_GetVideoSize,
1520     Basicvideo_GetVideoPaletteEntries,
1521     Basicvideo_GetCurrentImage,
1522     Basicvideo_IsUsingDefaultSource,
1523     Basicvideo_IsUsingDefaultDestination
1524 };
1525
1526
1527 /*** IUnknown methods ***/
1528 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1529                                                  REFIID riid,
1530                                                  LPVOID*ppvObj) {
1531     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1532
1533     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1534
1535     return Filtergraph_QueryInterface(This, riid, ppvObj);
1536 }
1537
1538 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1539     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1540
1541     TRACE("(%p/%p)->()\n", This, iface);
1542
1543     return Filtergraph_AddRef(This);
1544 }
1545
1546 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1547     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1548
1549     TRACE("(%p/%p)->()\n", This, iface);
1550
1551     return Filtergraph_Release(This);
1552 }
1553
1554 /*** IDispatch methods ***/
1555 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1556                                                    UINT*pctinfo) {
1557     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1558
1559     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1560
1561     return S_OK;
1562 }
1563
1564 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1565                                               UINT iTInfo,
1566                                               LCID lcid,
1567                                               ITypeInfo**ppTInfo) {
1568     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1569
1570     TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1571
1572     return S_OK;
1573 }
1574
1575 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1576                                                 REFIID riid,
1577                                                 LPOLESTR*rgszNames,
1578                                                 UINT cNames,
1579                                                 LCID lcid,
1580                                                 DISPID*rgDispId) {
1581     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1582
1583     TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1584
1585     return S_OK;
1586 }
1587
1588 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1589                                          DISPID dispIdMember,
1590                                          REFIID riid,
1591                                          LCID lcid,
1592                                          WORD wFlags,
1593                                          DISPPARAMS*pDispParams,
1594                                          VARIANT*pVarResult,
1595                                          EXCEPINFO*pExepInfo,
1596                                          UINT*puArgErr) {
1597     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1598
1599     TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1600
1601     return S_OK;
1602 }
1603
1604 /*** IVideoWindow methods ***/
1605 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1606                                               BSTR strCaption) {
1607     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1608
1609     TRACE("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strCaption), strCaption);
1610
1611     return S_OK;
1612 }
1613
1614 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1615                                               BSTR *strCaption) {
1616     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1617
1618     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, strCaption);
1619
1620     return S_OK;
1621 }
1622
1623 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1624                                                   long WindowStyle) {
1625     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1626
1627     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowStyle);
1628
1629     return S_OK;
1630 }
1631
1632 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1633                                                   long *WindowStyle) {
1634     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1635
1636     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, WindowStyle);
1637
1638     return S_OK;
1639 }
1640
1641 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1642                                                     long WindowStyleEx) {
1643     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1644
1645     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowStyleEx);
1646
1647     return S_OK;
1648 }
1649
1650 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1651                                                     long *WindowStyleEx) {
1652     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1653
1654     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, WindowStyleEx);
1655
1656     return S_OK;
1657 }
1658
1659 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1660                                                long AutoShow) {
1661     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1662
1663     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, AutoShow);
1664
1665     return S_OK;
1666 }
1667
1668 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1669                                                long *AutoShow) {
1670     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1671
1672     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, AutoShow);
1673
1674     return S_OK;
1675 }
1676
1677 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1678                                                   long WindowState) {
1679     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1680
1681     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowState);
1682
1683     return S_OK;
1684 }
1685
1686 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1687                                                   long *WindowState) {
1688     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1689
1690     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState);
1691
1692     return S_OK;
1693 }
1694
1695 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1696                                                         long BackgroundPalette) {
1697     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1698
1699     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, BackgroundPalette);
1700
1701     return S_OK;
1702 }
1703
1704 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1705                                                         long *pBackgroundPalette) {
1706     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1707
1708     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1709
1710     return S_OK;
1711 }
1712
1713 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1714                                               long Visible) {
1715     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1716
1717     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Visible);
1718
1719     return S_OK;
1720 }
1721
1722 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1723                                               long *pVisible) {
1724     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1725
1726     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pVisible);
1727
1728     return S_OK;
1729 }
1730
1731 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1732                                            long Left) {
1733     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1734
1735     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Left);
1736
1737     return S_OK;
1738 }
1739
1740 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1741                                            long *pLeft) {
1742     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1743
1744     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pLeft);
1745
1746     return S_OK;
1747 }
1748
1749 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1750                                             long Width) {
1751     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1752
1753     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Width);
1754
1755     return S_OK;
1756 }
1757
1758 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1759                                             long *pWidth) {
1760     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1761
1762     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pWidth);
1763
1764     return S_OK;
1765 }
1766
1767 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1768                                           long Top) {
1769     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1770
1771     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Top);
1772
1773     return S_OK;
1774 }
1775
1776 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1777                                           long *pTop) {
1778     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1779
1780     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pTop);
1781
1782     return S_OK;
1783 }
1784
1785 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1786                                              long Height) {
1787     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1788
1789     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Height);
1790
1791     return S_OK;
1792 }
1793
1794 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1795                                              long *pHeight) {
1796     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1797
1798     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pHeight);
1799
1800     return S_OK;
1801 }
1802
1803 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1804                                             OAHWND Owner) {
1805     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1806
1807     TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) Owner);
1808
1809     return S_OK;
1810 }
1811
1812 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1813                                             OAHWND *Owner) {
1814     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1815
1816     TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) Owner);
1817
1818     return S_OK;
1819 }
1820
1821 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1822                                                    OAHWND Drain) {
1823     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1824
1825     TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) Drain);
1826
1827     return S_OK;
1828 }
1829
1830 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1831                                                    OAHWND *Drain) {
1832     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1833
1834     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, Drain);
1835
1836     return S_OK;
1837 }
1838
1839 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1840                                                   long *Color) {
1841     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1842
1843     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1844
1845     return S_OK;
1846 }
1847
1848 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1849                                                   long Color) {
1850     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1851
1852     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Color);
1853
1854     return S_OK;
1855 }
1856
1857 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1858                                                      long *FullScreenMode) {
1859     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1860
1861     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1862
1863     return S_OK;
1864 }
1865
1866 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1867                                                      long FullScreenMode) {
1868     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1869
1870     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, FullScreenMode);
1871
1872     return S_OK;
1873 }
1874
1875 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1876                                                       long Focus) {
1877     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1878
1879     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Focus);
1880
1881     return S_OK;
1882 }
1883
1884 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
1885                                                      OAHWND hwnd,
1886                                                      long uMsg,
1887                                                      LONG_PTR wParam,
1888                                                      LONG_PTR lParam) {
1889     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1890
1891     TRACE("(%p/%p)->(%08lx, %ld, %08lx, %08lx): stub !!!\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
1892
1893     return S_OK;
1894 }
1895
1896 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
1897                                                     long Left,
1898                                                     long Top,
1899                                                     long Width,
1900                                                     long Height) {
1901     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1902     
1903     TRACE("(%p/%p)->(%ld, %ld, %ld, %ld): stub !!!\n", This, iface, Left, Top, Width, Height);
1904
1905     return S_OK;
1906 }
1907
1908 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
1909                                                     long *pLeft,
1910                                                     long *pTop,
1911                                                     long *pWidth,
1912                                                     long *pHeight) {
1913     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1914
1915     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1916
1917     return S_OK;
1918 }
1919
1920 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
1921                                                        long *pWidth,
1922                                                        long *pHeight) {
1923     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1924
1925     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pWidth, pHeight);
1926
1927     return S_OK;
1928 }
1929
1930 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
1931                                                        long *pWidth,
1932                                                        long *pHeight) {
1933     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1934
1935     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pWidth, pHeight);
1936
1937     return S_OK;
1938 }
1939
1940 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
1941                                                      long *pLeft,
1942                                                      long *pTop,
1943                                                      long *pWidth,
1944                                                      long *pHeight) {
1945     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1946
1947     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1948
1949     return S_OK;
1950 }
1951
1952 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
1953                                              long HideCursor) {
1954     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1955
1956     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, HideCursor);
1957
1958     return S_OK;
1959 }
1960
1961 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
1962                                                  long *CursorHidden) {
1963     ICOM_THIS_MULTI(IFilterGraphImpl, IVideoWindow_vtbl, iface);
1964
1965     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
1966
1967     return S_OK;
1968 }
1969
1970
1971 static ICOM_VTABLE(IVideoWindow) IVideoWindow_VTable =
1972 {
1973     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1974     Videowindow_QueryInterface,
1975     Videowindow_AddRef,
1976     Videowindow_Release,
1977     Videowindow_GetTypeInfoCount,
1978     Videowindow_GetTypeInfo,
1979     Videowindow_GetIDsOfNames,
1980     Videowindow_Invoke,
1981     Videowindow_put_Caption,
1982     Videowindow_get_Caption,
1983     Videowindow_put_WindowStyle,
1984     Videowindow_get_WindowStyle,
1985     Videowindow_put_WindowStyleEx,
1986     Videowindow_get_WindowStyleEx,
1987     Videowindow_put_AutoShow,
1988     Videowindow_get_AutoShow,
1989     Videowindow_put_WindowState,
1990     Videowindow_get_WindowState,
1991     Videowindow_put_BackgroundPalette,
1992     Videowindow_get_BackgroundPalette,
1993     Videowindow_put_Visible,
1994     Videowindow_get_Visible,
1995     Videowindow_put_Left,
1996     Videowindow_get_Left,
1997     Videowindow_put_Width,
1998     Videowindow_get_Width,
1999     Videowindow_put_Top,
2000     Videowindow_get_Top,
2001     Videowindow_put_Height,
2002     Videowindow_get_Height,
2003     Videowindow_put_Owner,
2004     Videowindow_get_Owner,
2005     Videowindow_put_MessageDrain,
2006     Videowindow_get_MessageDrain,
2007     Videowindow_get_BorderColor,
2008     Videowindow_put_BorderColor,
2009     Videowindow_get_FullScreenMode,
2010     Videowindow_put_FullScreenMode,
2011     Videowindow_SetWindowForeground,
2012     Videowindow_NotifyOwnerMessage,
2013     Videowindow_SetWindowPosition,
2014     Videowindow_GetWindowPosition,
2015     Videowindow_GetMinIdealImageSize,
2016     Videowindow_GetMaxIdealImageSize,
2017     Videowindow_GetRestorePosition,
2018     Videowindow_HideCursor,
2019     Videowindow_IsCursorHidden
2020 };
2021
2022
2023 /*** IUnknown methods ***/
2024 static HRESULT WINAPI Mediaevent_QueryInterface(IMediaEventEx *iface,
2025                                                 REFIID riid,
2026                                                 LPVOID*ppvObj) {
2027     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2028
2029     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
2030
2031     return Filtergraph_QueryInterface(This, riid, ppvObj);
2032 }
2033
2034 static ULONG WINAPI Mediaevent_AddRef(IMediaEventEx *iface) {
2035     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2036
2037     TRACE("(%p/%p)->()\n", This, iface);
2038
2039     return Filtergraph_AddRef(This);
2040 }
2041
2042 static ULONG WINAPI Mediaevent_Release(IMediaEventEx *iface) {
2043     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2044
2045     TRACE("(%p/%p)->()\n", This, iface);
2046
2047     return Filtergraph_Release(This);
2048 }
2049
2050 /*** IDispatch methods ***/
2051 static HRESULT WINAPI Mediaevent_GetTypeInfoCount(IMediaEventEx *iface,
2052                                                   UINT*pctinfo) {
2053     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2054
2055     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
2056
2057     return S_OK;
2058 }
2059
2060 static HRESULT WINAPI Mediaevent_GetTypeInfo(IMediaEventEx *iface,
2061                                              UINT iTInfo,
2062                                              LCID lcid,
2063                                              ITypeInfo**ppTInfo) {
2064     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2065
2066     TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
2067
2068     return S_OK;
2069 }
2070
2071 static HRESULT WINAPI Mediaevent_GetIDsOfNames(IMediaEventEx *iface,
2072                                                REFIID riid,
2073                                                LPOLESTR*rgszNames,
2074                                                UINT cNames,
2075                                                LCID lcid,
2076                                                DISPID*rgDispId) {
2077     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2078
2079     TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
2080
2081     return S_OK;
2082 }
2083
2084 static HRESULT WINAPI Mediaevent_Invoke(IMediaEventEx *iface,
2085                                         DISPID dispIdMember,
2086                                         REFIID riid,
2087                                         LCID lcid,
2088                                         WORD wFlags,
2089                                         DISPPARAMS*pDispParams,
2090                                         VARIANT*pVarResult,
2091                                         EXCEPINFO*pExepInfo,
2092                                         UINT*puArgErr) {
2093     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2094
2095     TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
2096
2097     return S_OK;
2098 }
2099
2100 /*** IMediaEvent methods ***/
2101 static HRESULT WINAPI Mediaevent_GetEventHandle(IMediaEventEx *iface,
2102                                                 OAEVENT *hEvent) {
2103     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2104
2105     TRACE("(%p/%p)->(%p)\n", This, iface, hEvent);
2106
2107     *hEvent = (OAEVENT)This->evqueue.msg_event;
2108
2109     return S_OK;
2110 }
2111
2112 static HRESULT WINAPI Mediaevent_GetEvent(IMediaEventEx *iface,
2113                                           long *lEventCode,
2114                                           LONG_PTR *lParam1,
2115                                           LONG_PTR *lParam2,
2116                                           long msTimeout) {
2117     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2118     Event evt;
2119
2120     TRACE("(%p/%p)->(%p, %p, %p, %ld)\n", This, iface, lEventCode, lParam1, lParam2, msTimeout);
2121
2122     if (EventsQueue_GetEvent(&This->evqueue, &evt, msTimeout))
2123     {
2124         *lEventCode = evt.lEventCode;
2125         *lParam1 = evt.lParam1;
2126         *lParam2 = evt.lParam2;
2127         return S_OK;
2128     }
2129
2130     *lEventCode = 0;
2131     return E_ABORT;
2132 }
2133
2134 static HRESULT WINAPI Mediaevent_WaitForCompletion(IMediaEventEx *iface,
2135                                                    long msTimeout,
2136                                                    long *pEvCode) {
2137     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2138
2139     TRACE("(%p/%p)->(%ld, %p)\n", This, iface, msTimeout, pEvCode);
2140
2141     if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
2142     {
2143         *pEvCode = This->CompletionStatus;
2144         return S_OK;
2145     }
2146
2147     *pEvCode = 0;
2148     return E_ABORT;
2149 }
2150
2151 static HRESULT WINAPI Mediaevent_CancelDefaultHandling(IMediaEventEx *iface,
2152                                                        long lEvCode) {
2153     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2154
2155     TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
2156
2157     if (lEvCode == EC_COMPLETE)
2158         This->HandleEcComplete = FALSE;
2159     else if (lEvCode == EC_REPAINT)
2160         This->HandleEcRepaint = FALSE;
2161     else
2162         return S_FALSE;
2163
2164     return S_OK;
2165 }
2166
2167 static HRESULT WINAPI Mediaevent_RestoreDefaultHandling(IMediaEventEx *iface,
2168                                                         long lEvCode) {
2169     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2170
2171     TRACE("(%p/%p)->(%ld)\n", This, iface, lEvCode);
2172
2173     if (lEvCode == EC_COMPLETE)
2174         This->HandleEcComplete = TRUE;
2175     else if (lEvCode == EC_REPAINT)
2176         This->HandleEcRepaint = TRUE;
2177     else
2178         return S_FALSE;
2179
2180     return S_OK;
2181 }
2182
2183 static HRESULT WINAPI Mediaevent_FreeEventParams(IMediaEventEx *iface,
2184                                                  long lEvCode,
2185                                                  LONG_PTR lParam1,
2186                                                  LONG_PTR lParam2) {
2187     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2188
2189     TRACE("(%p/%p)->(%ld, %08lx, %08lx): stub !!!\n", This, iface, lEvCode, lParam1, lParam2);
2190
2191     return S_OK;
2192 }
2193
2194 /*** IMediaEventEx methods ***/
2195 static HRESULT WINAPI Mediaevent_SetNotifyWindow(IMediaEventEx *iface,
2196                                                  OAHWND hwnd,
2197                                                  long lMsg,
2198                                                  LONG_PTR lInstanceData) {
2199     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2200
2201     TRACE("(%p/%p)->(%08lx, %ld, %08lx)\n", This, iface, (DWORD) hwnd, lMsg, lInstanceData);
2202
2203     This->notif.hWnd = (HWND)hwnd;
2204     This->notif.msg = lMsg;
2205     This->notif.instance = (long) lInstanceData;
2206
2207     return S_OK;
2208 }
2209
2210 static HRESULT WINAPI Mediaevent_SetNotifyFlags(IMediaEventEx *iface,
2211                                                 long lNoNotifyFlags) {
2212     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2213
2214     TRACE("(%p/%p)->(%ld)\n", This, iface, lNoNotifyFlags);
2215
2216     if ((lNoNotifyFlags != 0) || (lNoNotifyFlags != 1))
2217         return E_INVALIDARG;
2218
2219     This->notif.disabled = lNoNotifyFlags;
2220
2221     return S_OK;
2222 }
2223
2224 static HRESULT WINAPI Mediaevent_GetNotifyFlags(IMediaEventEx *iface,
2225                                                 long *lplNoNotifyFlags) {
2226     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2227
2228     TRACE("(%p/%p)->(%p)\n", This, iface, lplNoNotifyFlags);
2229
2230     if (!lplNoNotifyFlags)
2231         return E_POINTER;
2232
2233     *lplNoNotifyFlags = This->notif.disabled;
2234
2235     return S_OK;
2236 }
2237
2238
2239 static ICOM_VTABLE(IMediaEventEx) IMediaEventEx_VTable =
2240 {
2241     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
2242     Mediaevent_QueryInterface,
2243     Mediaevent_AddRef,
2244     Mediaevent_Release,
2245     Mediaevent_GetTypeInfoCount,
2246     Mediaevent_GetTypeInfo,
2247     Mediaevent_GetIDsOfNames,
2248     Mediaevent_Invoke,
2249     Mediaevent_GetEventHandle,
2250     Mediaevent_GetEvent,
2251     Mediaevent_WaitForCompletion,
2252     Mediaevent_CancelDefaultHandling,
2253     Mediaevent_RestoreDefaultHandling,
2254     Mediaevent_FreeEventParams,
2255     Mediaevent_SetNotifyWindow,
2256     Mediaevent_SetNotifyFlags,
2257     Mediaevent_GetNotifyFlags
2258 };
2259
2260
2261 static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID riid, LPVOID *ppv)
2262 {
2263     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2264
2265     return Filtergraph_QueryInterface(This, riid, ppv);
2266 }
2267
2268 static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
2269 {
2270     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2271
2272     return Filtergraph_AddRef(This);
2273 }
2274
2275 static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
2276 {
2277     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventEx_vtbl, iface);
2278
2279     return Filtergraph_Release(This);
2280 }
2281
2282 static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClassID)
2283 {
2284     FIXME("(%p): stub\n", pClassID);
2285
2286     return E_NOTIMPL;
2287 }
2288
2289 static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
2290 {
2291     FIXME("(): stub\n");
2292
2293     return E_NOTIMPL;
2294 }
2295
2296 static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
2297 {
2298     FIXME("(): stub\n");
2299
2300     return E_NOTIMPL;
2301 }
2302
2303 static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME tStart)
2304 {
2305     FIXME("(%lld): stub\n", tStart);
2306
2307     return E_NOTIMPL;
2308 }
2309
2310 static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD dwMsTimeout, FILTER_STATE * pState)
2311 {
2312     FIXME("(%ld, %p): stub\n", dwMsTimeout, pState);
2313
2314     return E_NOTIMPL;
2315 }
2316
2317 static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
2318 {
2319     FIXME("(%p): stub\n", pClock);
2320
2321     return E_NOTIMPL;
2322 }
2323
2324 static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
2325 {
2326     FIXME("(%p): stub\n", ppClock);
2327
2328     return E_NOTIMPL;
2329 }
2330
2331 static ICOM_VTABLE(IMediaFilter) IMediaFilter_VTable =
2332 {
2333     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
2334     MediaFilter_QueryInterface,
2335     MediaFilter_AddRef,
2336     MediaFilter_Release,
2337     MediaFilter_GetClassID,
2338     MediaFilter_Stop,
2339     MediaFilter_Pause,
2340     MediaFilter_Run,
2341     MediaFilter_GetState,
2342     MediaFilter_SetSyncSource,
2343     MediaFilter_GetSyncSource
2344 };
2345
2346 static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID riid, LPVOID *ppv)
2347 {
2348     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
2349
2350     return Filtergraph_QueryInterface(This, riid, ppv);
2351 }
2352
2353 static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
2354 {
2355     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
2356
2357     return Filtergraph_AddRef(This);
2358 }
2359
2360 static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
2361 {
2362     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
2363
2364     return Filtergraph_Release(This);
2365 }
2366
2367 static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, long EventCode, LONG_PTR EventParam1, LONG_PTR EventParam2)
2368 {
2369     ICOM_THIS_MULTI(IFilterGraphImpl, IMediaEventSink_vtbl, iface);
2370     Event evt;
2371
2372     TRACE("(%p/%p)->(%ld, %ld, %ld)\n", This, iface, EventCode, EventParam1, EventParam2);
2373
2374     /* We need thread safety here, let's use the events queue's one */
2375     EnterCriticalSection(&This->evqueue.msg_crst);
2376     
2377     if ((EventCode == EC_COMPLETE) && This->HandleEcComplete)
2378     {
2379         if (++This->EcCompleteCount == This->nRenderers)
2380         {
2381             evt.lEventCode = EC_COMPLETE;
2382             evt.lParam1 = S_OK;
2383             evt.lParam2 = 0;
2384             EventsQueue_PutEvent(&This->evqueue, &evt);
2385             if (!This->notif.disabled && This->notif.hWnd)
2386                 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
2387             This->CompletionStatus = EC_COMPLETE;
2388             SetEvent(This->hEventCompletion);
2389         }
2390     }
2391     else if ((EventCode == EC_REPAINT) && This->HandleEcRepaint)
2392     {
2393         /* FIXME: Not handled yet */
2394     }
2395     else
2396     {
2397         evt.lEventCode = EventCode;
2398         evt.lParam1 = EventParam1;
2399         evt.lParam2 = EventParam2;
2400         EventsQueue_PutEvent(&This->evqueue, &evt);
2401         if (!This->notif.disabled && This->notif.hWnd)
2402             PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
2403     }
2404
2405     EnterCriticalSection(&This->evqueue.msg_crst);
2406     return S_OK;
2407 }
2408
2409 static ICOM_VTABLE(IMediaEventSink) IMediaEventSink_VTable =
2410 {
2411     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
2412     MediaEventSink_QueryInterface,
2413     MediaEventSink_AddRef,
2414     MediaEventSink_Release,
2415     MediaEventSink_Notify
2416 };
2417
2418 /* This is the only function that actually creates a FilterGraph class... */
2419 HRESULT FILTERGRAPH_create(IUnknown *pUnkOuter, LPVOID *ppObj) {
2420     IFilterGraphImpl *fimpl;
2421
2422     TRACE("(%p,%p)\n", pUnkOuter, ppObj);
2423
2424     fimpl = (IFilterGraphImpl *) HeapAlloc(GetProcessHeap(), 0, sizeof(*fimpl));
2425     fimpl->IGraphBuilder_vtbl = &IGraphBuilder_VTable;
2426     fimpl->IMediaControl_vtbl = &IMediaControl_VTable;
2427     fimpl->IMediaSeeking_vtbl = &IMediaSeeking_VTable;
2428     fimpl->IBasicAudio_vtbl = &IBasicAudio_VTable;
2429     fimpl->IBasicVideo_vtbl = &IBasicVideo_VTable;
2430     fimpl->IVideoWindow_vtbl = &IVideoWindow_VTable;
2431     fimpl->IMediaEventEx_vtbl = &IMediaEventEx_VTable;
2432     fimpl->IMediaFilter_vtbl = &IMediaFilter_VTable;
2433     fimpl->IMediaEventSink_vtbl = &IMediaEventSink_VTable;
2434     fimpl->ref = 1;
2435     fimpl->ppFiltersInGraph = NULL;
2436     fimpl->pFilterNames = NULL;
2437     fimpl->nFilters = 0;
2438     fimpl->filterCapacity = 0;
2439     fimpl->nameIndex = 1;
2440     fimpl->hEventCompletion = CreateEventW(0, TRUE, FALSE,0);
2441     fimpl->HandleEcComplete = TRUE;
2442     fimpl->HandleEcRepaint = TRUE;
2443     fimpl->notif.hWnd = 0;
2444     fimpl->notif.disabled = TRUE;
2445     fimpl->nRenderers = 0;
2446     fimpl->EcCompleteCount = 0;
2447     EventsQueue_Init(&fimpl->evqueue);
2448
2449     *ppObj = fimpl;
2450     return S_OK;
2451 }