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