gdiplus: Implement GdipGetEmHeight.
[wine] / dlls / quartz / transform.c
1 /*
2  * Transform Filter (Base for decoders, etc...)
3  *
4  * Copyright 2005 Christian Costa
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "config.h"
22
23 #include "quartz_private.h"
24 #include "control_private.h"
25 #include "pin.h"
26
27 #include "amvideo.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "dshow.h"
31 #include "strmif.h"
32 #include "vfw.h"
33
34 #include <assert.h>
35
36 #include "wine/unicode.h"
37 #include "wine/debug.h"
38
39 #include "transform.h"
40
41 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
42
43 static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
44 static const WCHAR wcsOutputPinName[] = {'o','u','t','p','u','t',' ','p','i','n',0};
45
46 static const IBaseFilterVtbl TransformFilter_Vtbl;
47 static const IPinVtbl TransformFilter_InputPin_Vtbl;
48 static const IMemInputPinVtbl MemInputPin_Vtbl; 
49 static const IPinVtbl TransformFilter_OutputPin_Vtbl;
50
51 static HRESULT TransformFilter_Sample(LPVOID iface, IMediaSample * pSample)
52 {
53     TransformFilterImpl *This = (TransformFilterImpl *)iface;
54
55     TRACE("%p %p\n", iface, pSample);
56
57     if (This->state == State_Stopped)
58         return S_FALSE;
59
60     return This->pFuncsTable->pfnProcessSampleData(This, pSample);
61 }
62
63 static HRESULT TransformFilter_Input_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt)
64 {
65     TransformFilterImpl* This = (TransformFilterImpl*)iface;
66     TRACE("%p\n", iface);
67     dump_AM_MEDIA_TYPE(pmt);
68
69     if (This->pFuncsTable->pfnQueryConnect)
70         return This->pFuncsTable->pfnQueryConnect(This, pmt);
71     /* Assume OK if there's no query method (the connection will fail if
72        needed) */
73     return S_OK;
74 }
75
76
77 static HRESULT TransformFilter_Output_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt)
78 {
79     TransformFilterImpl* pTransformFilter = (TransformFilterImpl*)iface;
80     AM_MEDIA_TYPE* outpmt = &((OutputPin*)pTransformFilter->ppPins[1])->pin.mtCurrent;
81     TRACE("%p\n", iface);
82
83     if (IsEqualIID(&pmt->majortype, &outpmt->majortype) && IsEqualIID(&pmt->subtype, &outpmt->subtype))
84         return S_OK;
85     return S_FALSE;
86 }
87
88
89 static inline TransformFilterImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
90 {
91     return (TransformFilterImpl *)((char*)iface - FIELD_OFFSET(TransformFilterImpl, mediaSeeking.lpVtbl));
92 }
93
94 static HRESULT WINAPI TransformFilter_Seeking_QueryInterface(IMediaSeeking * iface, REFIID riid, LPVOID * ppv)
95 {
96     TransformFilterImpl *This = impl_from_IMediaSeeking(iface);
97
98     return IUnknown_QueryInterface((IUnknown *)This, riid, ppv);
99 }
100
101 static ULONG WINAPI TransformFilter_Seeking_AddRef(IMediaSeeking * iface)
102 {
103     TransformFilterImpl *This = impl_from_IMediaSeeking(iface);
104
105     return IUnknown_AddRef((IUnknown *)This);
106 }
107
108 static ULONG WINAPI TransformFilter_Seeking_Release(IMediaSeeking * iface)
109 {
110     TransformFilterImpl *This = impl_from_IMediaSeeking(iface);
111
112     return IUnknown_Release((IUnknown *)This);
113 }
114
115 static const IMediaSeekingVtbl TransformFilter_Seeking_Vtbl =
116 {
117     TransformFilter_Seeking_QueryInterface,
118     TransformFilter_Seeking_AddRef,
119     TransformFilter_Seeking_Release,
120     MediaSeekingImpl_GetCapabilities,
121     MediaSeekingImpl_CheckCapabilities,
122     MediaSeekingImpl_IsFormatSupported,
123     MediaSeekingImpl_QueryPreferredFormat,
124     MediaSeekingImpl_GetTimeFormat,
125     MediaSeekingImpl_IsUsingTimeFormat,
126     MediaSeekingImpl_SetTimeFormat,
127     MediaSeekingImpl_GetDuration,
128     MediaSeekingImpl_GetStopPosition,
129     MediaSeekingImpl_GetCurrentPosition,
130     MediaSeekingImpl_ConvertTimeFormat,
131     MediaSeekingImpl_SetPositions,
132     MediaSeekingImpl_GetPositions,
133     MediaSeekingImpl_GetAvailable,
134     MediaSeekingImpl_SetRate,
135     MediaSeekingImpl_GetRate,
136     MediaSeekingImpl_GetPreroll
137 };
138
139 /* These shouldn't be implemented by default.
140  * Usually only source filters should implement these
141  * and even it's not needed all of the time
142  */
143 static HRESULT TransformFilter_ChangeCurrent(IBaseFilter *iface)
144 {
145     TRACE("(%p) filter hasn't implemented current position change!\n", iface);
146     return S_OK;
147 }
148
149 static HRESULT TransformFilter_ChangeStop(IBaseFilter *iface)
150 {
151     TRACE("(%p) filter hasn't implemented stop position change!\n", iface);
152     return S_OK;
153 }
154
155 static HRESULT TransformFilter_ChangeRate(IBaseFilter *iface)
156 {
157     TRACE("(%p) filter hasn't implemented rate change!\n", iface);
158     return S_OK;
159 }
160
161 HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSID* pClsid, const TransformFuncsTable* pFuncsTable, CHANGEPROC stop, CHANGEPROC current, CHANGEPROC rate)
162 {
163     HRESULT hr;
164     PIN_INFO piInput;
165     PIN_INFO piOutput;
166
167     /* pTransformFilter is already allocated */
168     pTransformFilter->clsid = *pClsid;
169     pTransformFilter->pFuncsTable = pFuncsTable;
170
171     pTransformFilter->lpVtbl = &TransformFilter_Vtbl;
172
173     pTransformFilter->refCount = 1;
174     InitializeCriticalSection(&pTransformFilter->csFilter);
175     pTransformFilter->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": TransformFilterImpl.csFilter");
176     pTransformFilter->state = State_Stopped;
177     pTransformFilter->pClock = NULL;
178     ZeroMemory(&pTransformFilter->filterInfo, sizeof(FILTER_INFO));
179
180     pTransformFilter->ppPins = CoTaskMemAlloc(2 * sizeof(IPin *));
181
182     /* construct input pin */
183     piInput.dir = PINDIR_INPUT;
184     piInput.pFilter = (IBaseFilter *)pTransformFilter;
185     lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
186     piOutput.dir = PINDIR_OUTPUT;
187     piOutput.pFilter = (IBaseFilter *)pTransformFilter;
188     lstrcpynW(piOutput.achName, wcsOutputPinName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0]));
189
190     hr = InputPin_Construct(&TransformFilter_InputPin_Vtbl, &piInput, TransformFilter_Sample, pTransformFilter, TransformFilter_Input_QueryAccept, NULL, &pTransformFilter->csFilter, NULL, &pTransformFilter->ppPins[0]);
191
192     if (SUCCEEDED(hr))
193     {
194         ALLOCATOR_PROPERTIES props;
195         props.cbAlign = 1;
196         props.cbPrefix = 0;
197         props.cbBuffer = 0; /* Will be updated at connection time */
198         props.cBuffers = 2;
199
200         hr = OutputPin_Construct(&TransformFilter_OutputPin_Vtbl, sizeof(OutputPin), &piOutput, &props, pTransformFilter, TransformFilter_Output_QueryAccept, &pTransformFilter->csFilter, &pTransformFilter->ppPins[1]);
201
202         if (FAILED(hr))
203             ERR("Cannot create output pin (%x)\n", hr);
204         else
205         {
206             if (!stop)
207                 stop = TransformFilter_ChangeStop;
208             if (!current)
209                 current = TransformFilter_ChangeCurrent;
210             if (!rate)
211                 rate = TransformFilter_ChangeRate;
212
213             MediaSeekingImpl_Init((IBaseFilter*)pTransformFilter, stop, current, rate, &pTransformFilter->mediaSeeking, &pTransformFilter->csFilter);
214             pTransformFilter->mediaSeeking.lpVtbl = &TransformFilter_Seeking_Vtbl;
215         }
216     }
217     else
218     {
219         CoTaskMemFree(pTransformFilter->ppPins);
220         pTransformFilter->csFilter.DebugInfo->Spare[0] = 0;
221         DeleteCriticalSection(&pTransformFilter->csFilter);
222         CoTaskMemFree(pTransformFilter);
223     }
224
225     return hr;
226 }
227
228 static HRESULT WINAPI TransformFilter_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
229 {
230     TransformFilterImpl *This = (TransformFilterImpl *)iface;
231     TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
232
233     *ppv = NULL;
234
235     if (IsEqualIID(riid, &IID_IUnknown))
236         *ppv = (LPVOID)This;
237     else if (IsEqualIID(riid, &IID_IPersist))
238         *ppv = (LPVOID)This;
239     else if (IsEqualIID(riid, &IID_IMediaFilter))
240         *ppv = (LPVOID)This;
241     else if (IsEqualIID(riid, &IID_IBaseFilter))
242         *ppv = (LPVOID)This;
243     else if (IsEqualIID(riid, &IID_IMediaSeeking))
244         *ppv = &This->mediaSeeking;
245
246     if (*ppv)
247     {
248         IUnknown_AddRef((IUnknown *)(*ppv));
249         return S_OK;
250     }
251
252     if (!IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow))
253         FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
254
255     return E_NOINTERFACE;
256 }
257
258 static ULONG WINAPI TransformFilter_AddRef(IBaseFilter * iface)
259 {
260     TransformFilterImpl *This = (TransformFilterImpl *)iface;
261     ULONG refCount = InterlockedIncrement(&This->refCount);
262
263     TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
264
265     return refCount;
266 }
267
268 static ULONG WINAPI TransformFilter_Release(IBaseFilter * iface)
269 {
270     TransformFilterImpl *This = (TransformFilterImpl *)iface;
271     ULONG refCount = InterlockedDecrement(&This->refCount);
272
273     TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
274
275     if (!refCount)
276     {
277         ULONG i;
278
279         if (This->pClock)
280             IReferenceClock_Release(This->pClock);
281
282         for (i = 0; i < 2; i++)
283         {
284             IPin *pConnectedTo;
285
286             if (SUCCEEDED(IPin_ConnectedTo(This->ppPins[i], &pConnectedTo)))
287             {
288                 IPin_Disconnect(pConnectedTo);
289                 IPin_Release(pConnectedTo);
290             }
291             IPin_Disconnect(This->ppPins[i]);
292
293             IPin_Release(This->ppPins[i]);
294         }
295
296         CoTaskMemFree(This->ppPins);
297         This->lpVtbl = NULL;
298
299         This->csFilter.DebugInfo->Spare[0] = 0;
300         DeleteCriticalSection(&This->csFilter);
301
302         TRACE("Destroying transform filter\n");
303         CoTaskMemFree(This);
304
305         return 0;
306     }
307     else
308         return refCount;
309 }
310
311 /** IPersist methods **/
312
313 static HRESULT WINAPI TransformFilter_GetClassID(IBaseFilter * iface, CLSID * pClsid)
314 {
315     TransformFilterImpl *This = (TransformFilterImpl *)iface;
316
317     TRACE("(%p/%p)->(%p)\n", This, iface, pClsid);
318
319     *pClsid = This->clsid;
320
321     return S_OK;
322 }
323
324 /** IMediaFilter methods **/
325
326 static HRESULT WINAPI TransformFilter_Stop(IBaseFilter * iface)
327 {
328     TransformFilterImpl *This = (TransformFilterImpl *)iface;
329
330     TRACE("(%p/%p)\n", This, iface);
331
332     EnterCriticalSection(&This->csFilter);
333     {
334         This->state = State_Stopped;
335         if (This->pFuncsTable->pfnProcessEnd)
336             This->pFuncsTable->pfnProcessEnd(This);
337     }
338     LeaveCriticalSection(&This->csFilter);
339
340     return S_OK;
341 }
342
343 static HRESULT WINAPI TransformFilter_Pause(IBaseFilter * iface)
344 {
345     TransformFilterImpl *This = (TransformFilterImpl *)iface;
346
347     TRACE("(%p/%p)->()\n", This, iface);
348
349     EnterCriticalSection(&This->csFilter);
350     {
351         if (This->state == State_Stopped)
352             ((InputPin *)This->ppPins[0])->end_of_stream = 0;
353
354         This->state = State_Paused;
355     }
356     LeaveCriticalSection(&This->csFilter);
357
358     return S_OK;
359 }
360
361 static HRESULT WINAPI TransformFilter_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
362 {
363     HRESULT hr = S_OK;
364     TransformFilterImpl *This = (TransformFilterImpl *)iface;
365
366     TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
367
368     EnterCriticalSection(&This->csFilter);
369     {
370         if (This->state == State_Stopped)
371         {
372             ((InputPin *)This->ppPins[0])->end_of_stream = 0;
373             if (This->pFuncsTable->pfnProcessBegin)
374                 This->pFuncsTable->pfnProcessBegin(This);
375             OutputPin_CommitAllocator((OutputPin *)This->ppPins[1]);
376         }
377
378         This->rtStreamStart = tStart;
379         This->state = State_Running;
380     }
381     LeaveCriticalSection(&This->csFilter);
382
383     return hr;
384 }
385
386 static HRESULT WINAPI TransformFilter_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
387 {
388     TransformFilterImpl *This = (TransformFilterImpl *)iface;
389
390     TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
391
392     EnterCriticalSection(&This->csFilter);
393     {
394         *pState = This->state;
395     }
396     LeaveCriticalSection(&This->csFilter);
397
398     return S_OK;
399 }
400
401 static HRESULT WINAPI TransformFilter_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
402 {
403     TransformFilterImpl *This = (TransformFilterImpl *)iface;
404
405     TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
406
407     EnterCriticalSection(&This->csFilter);
408     {
409         if (This->pClock)
410             IReferenceClock_Release(This->pClock);
411         This->pClock = pClock;
412         if (This->pClock)
413             IReferenceClock_AddRef(This->pClock);
414     }
415     LeaveCriticalSection(&This->csFilter);
416
417     return S_OK;
418 }
419
420 static HRESULT WINAPI TransformFilter_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
421 {
422     TransformFilterImpl *This = (TransformFilterImpl *)iface;
423
424     TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
425
426     EnterCriticalSection(&This->csFilter);
427     {
428         *ppClock = This->pClock;
429         if (This->pClock)
430             IReferenceClock_AddRef(This->pClock);
431     }
432     LeaveCriticalSection(&This->csFilter);
433
434     return S_OK;
435 }
436
437 /** IBaseFilter implementation **/
438
439 static HRESULT TransformFilter_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
440 {
441     TransformFilterImpl *This = (TransformFilterImpl *)iface;
442
443     /* Our pins are static, not changing so setting static tick count is ok */
444     *lastsynctick = 0;
445
446     if (pos >= 2)
447         return S_FALSE;
448
449     *pin = This->ppPins[pos];
450     IPin_AddRef(*pin);
451     return S_OK;
452 }
453
454 static HRESULT WINAPI TransformFilter_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
455 {
456     TransformFilterImpl *This = (TransformFilterImpl *)iface;
457
458     TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
459
460     return IEnumPinsImpl_Construct(ppEnum, TransformFilter_GetPin, iface);
461 }
462
463 static HRESULT WINAPI TransformFilter_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
464 {
465     TransformFilterImpl *This = (TransformFilterImpl *)iface;
466
467     TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
468
469     return E_NOTIMPL;
470 }
471
472 static HRESULT WINAPI TransformFilter_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
473 {
474     TransformFilterImpl *This = (TransformFilterImpl *)iface;
475
476     TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
477
478     strcpyW(pInfo->achName, This->filterInfo.achName);
479     pInfo->pGraph = This->filterInfo.pGraph;
480
481     if (pInfo->pGraph)
482         IFilterGraph_AddRef(pInfo->pGraph);
483
484     return S_OK;
485 }
486
487 static HRESULT WINAPI TransformFilter_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
488 {
489     HRESULT hr = S_OK;
490     TransformFilterImpl *This = (TransformFilterImpl *)iface;
491
492     TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
493
494     EnterCriticalSection(&This->csFilter);
495     {
496         if (pName)
497             strcpyW(This->filterInfo.achName, pName);
498         else
499             *This->filterInfo.achName = '\0';
500         This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
501     }
502     LeaveCriticalSection(&This->csFilter);
503
504     return hr;
505 }
506
507 static HRESULT WINAPI TransformFilter_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
508 {
509     TransformFilterImpl *This = (TransformFilterImpl *)iface;
510     TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo);
511     return E_NOTIMPL;
512 }
513
514 static const IBaseFilterVtbl TransformFilter_Vtbl =
515 {
516     TransformFilter_QueryInterface,
517     TransformFilter_AddRef,
518     TransformFilter_Release,
519     TransformFilter_GetClassID,
520     TransformFilter_Stop,
521     TransformFilter_Pause,
522     TransformFilter_Run,
523     TransformFilter_GetState,
524     TransformFilter_SetSyncSource,
525     TransformFilter_GetSyncSource,
526     TransformFilter_EnumPins,
527     TransformFilter_FindPin,
528     TransformFilter_QueryFilterInfo,
529     TransformFilter_JoinFilterGraph,
530     TransformFilter_QueryVendorInfo
531 };
532
533 static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface)
534 {
535     InputPin* This = (InputPin*) iface;
536     TransformFilterImpl* pTransform;
537     IPin* ppin;
538     HRESULT hr;
539     
540     TRACE("(%p)->()\n", iface);
541
542     /* Since we process samples synchronously, just forward notification downstream */
543     pTransform = (TransformFilterImpl*)This->pin.pinInfo.pFilter;
544     if (!pTransform)
545         hr = E_FAIL;
546     else
547         hr = IPin_ConnectedTo(pTransform->ppPins[1], &ppin);
548     if (SUCCEEDED(hr))
549     {
550         hr = IPin_EndOfStream(ppin);
551         IPin_Release(ppin);
552     }
553
554     if (FAILED(hr))
555         ERR("%x\n", hr);
556     return hr;
557 }
558
559 static HRESULT WINAPI TransformFilter_InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
560 {
561     InputPin* This = (InputPin*) iface;
562     TransformFilterImpl* pTransform;
563     HRESULT hr;
564
565     TRACE("(%p)->(%p, %p)\n", iface, pReceivePin, pmt);
566
567     pTransform = (TransformFilterImpl*)This->pin.pinInfo.pFilter;
568
569     hr = pTransform->pFuncsTable->pfnConnectInput(pTransform, pmt);
570     if (SUCCEEDED(hr))
571     {
572         hr = InputPin_ReceiveConnection(iface, pReceivePin, pmt);
573         if (FAILED(hr))
574             pTransform->pFuncsTable->pfnCleanup(pTransform);
575     }
576
577     return hr;
578 }
579
580 static HRESULT WINAPI TransformFilter_InputPin_Disconnect(IPin * iface)
581 {
582     InputPin* This = (InputPin*) iface;
583     TransformFilterImpl* pTransform;
584
585     TRACE("(%p)->()\n", iface);
586
587     pTransform = (TransformFilterImpl*)This->pin.pinInfo.pFilter;
588     pTransform->pFuncsTable->pfnCleanup(pTransform);
589
590     return IPinImpl_Disconnect(iface);
591 }
592
593 static const IPinVtbl TransformFilter_InputPin_Vtbl = 
594 {
595     InputPin_QueryInterface,
596     IPinImpl_AddRef,
597     InputPin_Release,
598     InputPin_Connect,
599     TransformFilter_InputPin_ReceiveConnection,
600     TransformFilter_InputPin_Disconnect,
601     IPinImpl_ConnectedTo,
602     IPinImpl_ConnectionMediaType,
603     IPinImpl_QueryPinInfo,
604     IPinImpl_QueryDirection,
605     IPinImpl_QueryId,
606     IPinImpl_QueryAccept,
607     IPinImpl_EnumMediaTypes,
608     IPinImpl_QueryInternalConnections,
609     TransformFilter_InputPin_EndOfStream,
610     InputPin_BeginFlush,
611     InputPin_EndFlush,
612     InputPin_NewSegment
613 };
614
615 static HRESULT WINAPI TransformFilter_Output_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
616 {
617     IPinImpl *This = (IPinImpl *)iface;
618     ENUMMEDIADETAILS emd;
619
620     TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
621
622     emd.cMediaTypes = 1;
623     emd.pMediaTypes = &This->mtCurrent;
624
625     return IEnumMediaTypesImpl_Construct(&emd, ppEnum);
626 }
627
628 static const IPinVtbl TransformFilter_OutputPin_Vtbl =
629 {
630     OutputPin_QueryInterface,
631     IPinImpl_AddRef,
632     OutputPin_Release,
633     OutputPin_Connect,
634     OutputPin_ReceiveConnection,
635     OutputPin_Disconnect,
636     IPinImpl_ConnectedTo,
637     IPinImpl_ConnectionMediaType,
638     IPinImpl_QueryPinInfo,
639     IPinImpl_QueryDirection,
640     IPinImpl_QueryId,
641     IPinImpl_QueryAccept,
642     TransformFilter_Output_EnumMediaTypes,
643     IPinImpl_QueryInternalConnections,
644     OutputPin_EndOfStream,
645     OutputPin_BeginFlush,
646     OutputPin_EndFlush,
647     OutputPin_NewSegment
648 };
649
650 static const IMemInputPinVtbl MemInputPin_Vtbl = 
651 {
652     MemInputPin_QueryInterface,
653     MemInputPin_AddRef,
654     MemInputPin_Release,
655     MemInputPin_GetAllocator,
656     MemInputPin_NotifyAllocator,
657     MemInputPin_GetAllocatorRequirements,
658     MemInputPin_Receive,
659     MemInputPin_ReceiveMultiple,
660     MemInputPin_ReceiveCanBlock
661 };