include: Mark imported functions with hidden visibility.
[wine/multimedia.git] / dlls / quartz / pin.c
blob9960dffe82d8e56818a3abfc188c415a199afc30
1 /*
2 * Generic Implementation of IPin Interface
4 * Copyright 2003 Robert Shearman
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.
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.
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
21 #include "quartz_private.h"
22 #include "pin.h"
24 #include "wine/debug.h"
25 #include "wine/unicode.h"
26 #include "uuids.h"
27 #include "vfwmsgs.h"
28 #include <assert.h>
30 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
32 static const IPinVtbl InputPin_Vtbl;
33 static const IPinVtbl OutputPin_Vtbl;
34 static const IMemInputPinVtbl MemInputPin_Vtbl;
35 static const IPinVtbl PullPin_Vtbl;
37 #define ALIGNDOWN(value,boundary) ((value)/(boundary)*(boundary))
38 #define ALIGNUP(value,boundary) (ALIGNDOWN((value)+(boundary)-1, (boundary)))
40 static inline InputPin *impl_from_IMemInputPin( IMemInputPin *iface )
42 return (InputPin *)((char*)iface - FIELD_OFFSET(InputPin, lpVtblMemInput));
46 static void Copy_PinInfo(PIN_INFO * pDest, const PIN_INFO * pSrc)
48 /* Tempting to just do a memcpy, but the name field is
49 128 characters long! We will probably never exceed 10
50 most of the time, so we are better off copying
51 each field manually */
52 strcpyW(pDest->achName, pSrc->achName);
53 pDest->dir = pSrc->dir;
54 pDest->pFilter = pSrc->pFilter;
57 /* Function called as a helper to IPin_Connect */
58 /* specific AM_MEDIA_TYPE - it cannot be NULL */
59 /* NOTE: not part of standard interface */
60 static HRESULT OutputPin_ConnectSpecific(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
62 OutputPin *This = (OutputPin *)iface;
63 HRESULT hr;
64 IMemAllocator * pMemAlloc = NULL;
65 ALLOCATOR_PROPERTIES actual; /* FIXME: should we put the actual props back in to This? */
67 TRACE("(%p, %p)\n", pReceivePin, pmt);
68 dump_AM_MEDIA_TYPE(pmt);
70 /* FIXME: call queryacceptproc */
72 This->pin.pConnectedTo = pReceivePin;
73 IPin_AddRef(pReceivePin);
74 CopyMediaType(&This->pin.mtCurrent, pmt);
76 hr = IPin_ReceiveConnection(pReceivePin, iface, pmt);
78 /* get the IMemInputPin interface we will use to deliver samples to the
79 * connected pin */
80 if (SUCCEEDED(hr))
82 This->pMemInputPin = NULL;
83 hr = IPin_QueryInterface(pReceivePin, &IID_IMemInputPin, (LPVOID)&This->pMemInputPin);
85 if (SUCCEEDED(hr))
87 hr = IMemInputPin_GetAllocator(This->pMemInputPin, &pMemAlloc);
89 if (hr == VFW_E_NO_ALLOCATOR)
91 /* Input pin provides no allocator, use standard memory allocator */
92 hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, &IID_IMemAllocator, (LPVOID*)&pMemAlloc);
94 if (SUCCEEDED(hr))
96 hr = IMemInputPin_NotifyAllocator(This->pMemInputPin, pMemAlloc, FALSE);
100 if (SUCCEEDED(hr))
101 hr = IMemAllocator_SetProperties(pMemAlloc, &This->allocProps, &actual);
103 if (pMemAlloc)
104 IMemAllocator_Release(pMemAlloc);
107 /* break connection if we couldn't get the allocator */
108 if (FAILED(hr))
110 if (This->pMemInputPin)
111 IMemInputPin_Release(This->pMemInputPin);
112 This->pMemInputPin = NULL;
114 IPin_Disconnect(pReceivePin);
118 if (FAILED(hr))
120 IPin_Release(This->pin.pConnectedTo);
121 This->pin.pConnectedTo = NULL;
122 FreeMediaType(&This->pin.mtCurrent);
125 TRACE(" -- %x\n", hr);
126 return hr;
129 HRESULT InputPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin)
131 InputPin * pPinImpl;
133 *ppPin = NULL;
135 if (pPinInfo->dir != PINDIR_INPUT)
137 ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo->dir);
138 return E_INVALIDARG;
141 pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl));
143 if (!pPinImpl)
144 return E_OUTOFMEMORY;
146 if (SUCCEEDED(InputPin_Init(pPinInfo, pSampleProc, pUserData, pQueryAccept, pCritSec, pPinImpl)))
148 pPinImpl->pin.lpVtbl = &InputPin_Vtbl;
149 pPinImpl->lpVtblMemInput = &MemInputPin_Vtbl;
151 *ppPin = (IPin *)(&pPinImpl->pin.lpVtbl);
152 return S_OK;
154 return E_FAIL;
157 /* Note that we don't init the vtables here (like C++ constructor) */
158 HRESULT InputPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, InputPin * pPinImpl)
160 TRACE("\n");
162 /* Common attributes */
163 pPinImpl->pin.refCount = 1;
164 pPinImpl->pin.pConnectedTo = NULL;
165 pPinImpl->pin.fnQueryAccept = pQueryAccept;
166 pPinImpl->pin.pUserData = pUserData;
167 pPinImpl->pin.pCritSec = pCritSec;
168 Copy_PinInfo(&pPinImpl->pin.pinInfo, pPinInfo);
169 ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
171 /* Input pin attributes */
172 pPinImpl->fnSampleProc = pSampleProc;
173 pPinImpl->pAllocator = NULL;
174 pPinImpl->tStart = 0;
175 pPinImpl->tStop = 0;
176 pPinImpl->dRate = 0;
178 return S_OK;
181 HRESULT OutputPin_Init(const PIN_INFO * pPinInfo, const ALLOCATOR_PROPERTIES * props, LPVOID pUserData,
182 QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, OutputPin * pPinImpl)
184 TRACE("\n");
186 /* Common attributes */
187 pPinImpl->pin.lpVtbl = &OutputPin_Vtbl;
188 pPinImpl->pin.refCount = 1;
189 pPinImpl->pin.pConnectedTo = NULL;
190 pPinImpl->pin.fnQueryAccept = pQueryAccept;
191 pPinImpl->pin.pUserData = pUserData;
192 pPinImpl->pin.pCritSec = pCritSec;
193 Copy_PinInfo(&pPinImpl->pin.pinInfo, pPinInfo);
194 ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
196 /* Output pin attributes */
197 pPinImpl->pMemInputPin = NULL;
198 pPinImpl->pConnectSpecific = OutputPin_ConnectSpecific;
199 if (props)
201 memcpy(&pPinImpl->allocProps, props, sizeof(pPinImpl->allocProps));
202 if (pPinImpl->allocProps.cbAlign == 0)
203 pPinImpl->allocProps.cbAlign = 1;
205 else
206 ZeroMemory(&pPinImpl->allocProps, sizeof(pPinImpl->allocProps));
208 return S_OK;
211 HRESULT OutputPin_Construct(const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin)
213 OutputPin * pPinImpl;
215 *ppPin = NULL;
217 if (pPinInfo->dir != PINDIR_OUTPUT)
219 ERR("Pin direction(%x) != PINDIR_OUTPUT\n", pPinInfo->dir);
220 return E_INVALIDARG;
223 pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl));
225 if (!pPinImpl)
226 return E_OUTOFMEMORY;
228 if (SUCCEEDED(OutputPin_Init(pPinInfo, props, pUserData, pQueryAccept, pCritSec, pPinImpl)))
230 pPinImpl->pin.lpVtbl = &OutputPin_Vtbl;
232 *ppPin = (IPin *)(&pPinImpl->pin.lpVtbl);
233 return S_OK;
235 return E_FAIL;
238 /*** Common pin functions ***/
240 ULONG WINAPI IPinImpl_AddRef(IPin * iface)
242 IPinImpl *This = (IPinImpl *)iface;
243 ULONG refCount = InterlockedIncrement(&This->refCount);
245 TRACE("(%p)->() AddRef from %d\n", iface, refCount - 1);
247 return refCount;
250 HRESULT WINAPI IPinImpl_Disconnect(IPin * iface)
252 HRESULT hr;
253 IPinImpl *This = (IPinImpl *)iface;
255 TRACE("()\n");
257 EnterCriticalSection(This->pCritSec);
259 if (This->pConnectedTo)
261 IPin_Release(This->pConnectedTo);
262 This->pConnectedTo = NULL;
263 hr = S_OK;
265 else
266 hr = S_FALSE;
268 LeaveCriticalSection(This->pCritSec);
270 return hr;
273 HRESULT WINAPI IPinImpl_ConnectedTo(IPin * iface, IPin ** ppPin)
275 HRESULT hr;
276 IPinImpl *This = (IPinImpl *)iface;
278 /* TRACE("(%p)\n", ppPin);*/
280 EnterCriticalSection(This->pCritSec);
282 if (This->pConnectedTo)
284 *ppPin = This->pConnectedTo;
285 IPin_AddRef(*ppPin);
286 hr = S_OK;
288 else
289 hr = VFW_E_NOT_CONNECTED;
291 LeaveCriticalSection(This->pCritSec);
293 return hr;
296 HRESULT WINAPI IPinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt)
298 HRESULT hr;
299 IPinImpl *This = (IPinImpl *)iface;
301 TRACE("(%p/%p)->(%p)\n", This, iface, pmt);
303 EnterCriticalSection(This->pCritSec);
305 if (This->pConnectedTo)
307 CopyMediaType(pmt, &This->mtCurrent);
308 hr = S_OK;
310 else
312 ZeroMemory(pmt, sizeof(*pmt));
313 hr = VFW_E_NOT_CONNECTED;
316 LeaveCriticalSection(This->pCritSec);
318 return hr;
321 HRESULT WINAPI IPinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo)
323 IPinImpl *This = (IPinImpl *)iface;
325 TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
327 Copy_PinInfo(pInfo, &This->pinInfo);
328 IBaseFilter_AddRef(pInfo->pFilter);
330 return S_OK;
333 HRESULT WINAPI IPinImpl_QueryDirection(IPin * iface, PIN_DIRECTION * pPinDir)
335 IPinImpl *This = (IPinImpl *)iface;
337 TRACE("(%p/%p)->(%p)\n", This, iface, pPinDir);
339 *pPinDir = This->pinInfo.dir;
341 return S_OK;
344 HRESULT WINAPI IPinImpl_QueryId(IPin * iface, LPWSTR * Id)
346 IPinImpl *This = (IPinImpl *)iface;
348 TRACE("(%p/%p)->(%p)\n", This, iface, Id);
350 *Id = CoTaskMemAlloc((strlenW(This->pinInfo.achName) + 1) * sizeof(WCHAR));
351 if (!*Id)
352 return E_OUTOFMEMORY;
354 strcpyW(*Id, This->pinInfo.achName);
356 return S_OK;
359 HRESULT WINAPI IPinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt)
361 IPinImpl *This = (IPinImpl *)iface;
363 TRACE("(%p/%p)->(%p)\n", This, iface, pmt);
365 return (This->fnQueryAccept(This->pUserData, pmt) == S_OK ? S_OK : S_FALSE);
368 HRESULT WINAPI IPinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
370 IPinImpl *This = (IPinImpl *)iface;
371 ENUMMEDIADETAILS emd;
373 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
375 /* override this method to allow enumeration of your types */
376 emd.cMediaTypes = 0;
377 emd.pMediaTypes = NULL;
379 return IEnumMediaTypesImpl_Construct(&emd, ppEnum);
382 HRESULT WINAPI IPinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin)
384 IPinImpl *This = (IPinImpl *)iface;
386 TRACE("(%p/%p)->(%p, %p)\n", This, iface, apPin, cPin);
388 return E_NOTIMPL; /* to tell caller that all input pins connected to all output pins */
391 /*** IPin implementation for an input pin ***/
393 HRESULT WINAPI InputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
395 InputPin *This = (InputPin *)iface;
397 TRACE("(%p)->(%s, %p)\n", iface, qzdebugstr_guid(riid), ppv);
399 *ppv = NULL;
401 if (IsEqualIID(riid, &IID_IUnknown))
402 *ppv = (LPVOID)iface;
403 else if (IsEqualIID(riid, &IID_IPin))
404 *ppv = (LPVOID)iface;
405 else if (IsEqualIID(riid, &IID_IMemInputPin))
406 *ppv = (LPVOID)&This->lpVtblMemInput;
408 if (*ppv)
410 IUnknown_AddRef((IUnknown *)(*ppv));
411 return S_OK;
414 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
416 return E_NOINTERFACE;
419 ULONG WINAPI InputPin_Release(IPin * iface)
421 InputPin *This = (InputPin *)iface;
422 ULONG refCount = InterlockedDecrement(&This->pin.refCount);
424 TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
426 if (!refCount)
428 FreeMediaType(&This->pin.mtCurrent);
429 if (This->pAllocator)
430 IMemAllocator_Release(This->pAllocator);
431 CoTaskMemFree(This);
432 return 0;
434 else
435 return refCount;
438 HRESULT WINAPI InputPin_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt)
440 ERR("Outgoing connection on an input pin! (%p, %p)\n", pConnector, pmt);
442 return E_UNEXPECTED;
446 HRESULT WINAPI InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
448 InputPin *This = (InputPin *)iface;
449 PIN_DIRECTION pindirReceive;
450 HRESULT hr = S_OK;
452 TRACE("(%p, %p)\n", pReceivePin, pmt);
453 dump_AM_MEDIA_TYPE(pmt);
455 EnterCriticalSection(This->pin.pCritSec);
457 if (This->pin.pConnectedTo)
458 hr = VFW_E_ALREADY_CONNECTED;
460 if (SUCCEEDED(hr) && This->pin.fnQueryAccept(This->pin.pUserData, pmt) != S_OK)
461 hr = VFW_E_TYPE_NOT_ACCEPTED; /* FIXME: shouldn't we just map common errors onto
462 * VFW_E_TYPE_NOT_ACCEPTED and pass the value on otherwise? */
464 if (SUCCEEDED(hr))
466 IPin_QueryDirection(pReceivePin, &pindirReceive);
468 if (pindirReceive != PINDIR_OUTPUT)
470 ERR("Can't connect from non-output pin\n");
471 hr = VFW_E_INVALID_DIRECTION;
475 if (SUCCEEDED(hr))
477 CopyMediaType(&This->pin.mtCurrent, pmt);
478 This->pin.pConnectedTo = pReceivePin;
479 IPin_AddRef(pReceivePin);
482 LeaveCriticalSection(This->pin.pCritSec);
484 return hr;
487 HRESULT WINAPI InputPin_EndOfStream(IPin * iface)
489 TRACE("()\n");
491 return S_OK;
494 HRESULT WINAPI InputPin_BeginFlush(IPin * iface)
496 FIXME("()\n");
497 return E_NOTIMPL;
500 HRESULT WINAPI InputPin_EndFlush(IPin * iface)
502 FIXME("()\n");
503 return E_NOTIMPL;
506 HRESULT WINAPI InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
508 InputPin *This = (InputPin *)iface;
510 TRACE("(%x%08x, %x%08x, %e)\n", (ULONG)(tStart >> 32), (ULONG)tStart, (ULONG)(tStop >> 32), (ULONG)tStop, dRate);
512 This->tStart = tStart;
513 This->tStop = tStop;
514 This->dRate = dRate;
516 return S_OK;
519 static const IPinVtbl InputPin_Vtbl =
521 InputPin_QueryInterface,
522 IPinImpl_AddRef,
523 InputPin_Release,
524 InputPin_Connect,
525 InputPin_ReceiveConnection,
526 IPinImpl_Disconnect,
527 IPinImpl_ConnectedTo,
528 IPinImpl_ConnectionMediaType,
529 IPinImpl_QueryPinInfo,
530 IPinImpl_QueryDirection,
531 IPinImpl_QueryId,
532 IPinImpl_QueryAccept,
533 IPinImpl_EnumMediaTypes,
534 IPinImpl_QueryInternalConnections,
535 InputPin_EndOfStream,
536 InputPin_BeginFlush,
537 InputPin_EndFlush,
538 InputPin_NewSegment
541 /*** IMemInputPin implementation ***/
543 HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin * iface, REFIID riid, LPVOID * ppv)
545 InputPin *This = impl_from_IMemInputPin(iface);
547 return IPin_QueryInterface((IPin *)&This->pin, riid, ppv);
550 ULONG WINAPI MemInputPin_AddRef(IMemInputPin * iface)
552 InputPin *This = impl_from_IMemInputPin(iface);
554 return IPin_AddRef((IPin *)&This->pin);
557 ULONG WINAPI MemInputPin_Release(IMemInputPin * iface)
559 InputPin *This = impl_from_IMemInputPin(iface);
561 return IPin_Release((IPin *)&This->pin);
564 HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** ppAllocator)
566 InputPin *This = impl_from_IMemInputPin(iface);
568 TRACE("(%p/%p)->(%p)\n", This, iface, ppAllocator);
570 *ppAllocator = This->pAllocator;
571 if (*ppAllocator)
572 IMemAllocator_AddRef(*ppAllocator);
574 return *ppAllocator ? S_OK : VFW_E_NO_ALLOCATOR;
577 HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator * pAllocator, BOOL bReadOnly)
579 InputPin *This = impl_from_IMemInputPin(iface);
581 TRACE("(%p/%p)->(%p, %d)\n", This, iface, pAllocator, bReadOnly);
583 if (This->pAllocator)
584 IMemAllocator_Release(This->pAllocator);
585 This->pAllocator = pAllocator;
586 if (This->pAllocator)
587 IMemAllocator_AddRef(This->pAllocator);
589 return S_OK;
592 HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCATOR_PROPERTIES * pProps)
594 InputPin *This = impl_from_IMemInputPin(iface);
596 TRACE("(%p/%p)->(%p)\n", This, iface, pProps);
598 /* override this method if you have any specific requirements */
600 return E_NOTIMPL;
603 HRESULT WINAPI MemInputPin_Receive(IMemInputPin * iface, IMediaSample * pSample)
605 InputPin *This = impl_from_IMemInputPin(iface);
607 /* this trace commented out for performance reasons */
608 /*TRACE("(%p/%p)->(%p)\n", This, iface, pSample);*/
610 return This->fnSampleProc(This->pin.pUserData, pSample);
613 HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample ** pSamples, long nSamples, long *nSamplesProcessed)
615 HRESULT hr = S_OK;
616 InputPin *This = impl_from_IMemInputPin(iface);
618 TRACE("(%p/%p)->(%p, %ld, %p)\n", This, iface, pSamples, nSamples, nSamplesProcessed);
620 for (*nSamplesProcessed = 0; *nSamplesProcessed < nSamples; (*nSamplesProcessed)++)
622 hr = IMemInputPin_Receive(iface, pSamples[*nSamplesProcessed]);
623 if (hr != S_OK)
624 break;
627 return hr;
630 HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin * iface)
632 InputPin *This = impl_from_IMemInputPin(iface);
634 FIXME("(%p/%p)->()\n", This, iface);
636 /* FIXME: we should check whether any output pins will block */
638 return S_OK;
641 static const IMemInputPinVtbl MemInputPin_Vtbl =
643 MemInputPin_QueryInterface,
644 MemInputPin_AddRef,
645 MemInputPin_Release,
646 MemInputPin_GetAllocator,
647 MemInputPin_NotifyAllocator,
648 MemInputPin_GetAllocatorRequirements,
649 MemInputPin_Receive,
650 MemInputPin_ReceiveMultiple,
651 MemInputPin_ReceiveCanBlock
654 HRESULT WINAPI OutputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
656 OutputPin *This = (OutputPin *)iface;
658 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
660 *ppv = NULL;
662 if (IsEqualIID(riid, &IID_IUnknown))
663 *ppv = (LPVOID)iface;
664 else if (IsEqualIID(riid, &IID_IPin))
665 *ppv = (LPVOID)iface;
667 if (*ppv)
669 IUnknown_AddRef((IUnknown *)(*ppv));
670 return S_OK;
673 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
675 return E_NOINTERFACE;
678 ULONG WINAPI OutputPin_Release(IPin * iface)
680 OutputPin *This = (OutputPin *)iface;
681 ULONG refCount = InterlockedDecrement(&This->pin.refCount);
683 TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
685 if (!refCount)
687 FreeMediaType(&This->pin.mtCurrent);
688 CoTaskMemFree(This);
689 return 0;
691 return refCount;
694 HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
696 HRESULT hr;
697 OutputPin *This = (OutputPin *)iface;
699 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt);
700 dump_AM_MEDIA_TYPE(pmt);
702 /* If we try to connect to ourself, we will definitely deadlock.
703 * There are other cases where we could deadlock too, but this
704 * catches the obvious case */
705 assert(pReceivePin != iface);
707 EnterCriticalSection(This->pin.pCritSec);
709 /* if we have been a specific type to connect with, then we can either connect
710 * with that or fail. We cannot choose different AM_MEDIA_TYPE */
711 if (pmt && !IsEqualGUID(&pmt->majortype, &GUID_NULL) && !IsEqualGUID(&pmt->subtype, &GUID_NULL))
712 hr = This->pConnectSpecific(iface, pReceivePin, pmt);
713 else
715 /* negotiate media type */
717 IEnumMediaTypes * pEnumCandidates;
718 AM_MEDIA_TYPE * pmtCandidate; /* Candidate media type */
720 if (SUCCEEDED(hr = IPin_EnumMediaTypes(iface, &pEnumCandidates)))
722 hr = VFW_E_NO_ACCEPTABLE_TYPES; /* Assume the worst, but set to S_OK if connected successfully */
724 /* try this filter's media types first */
725 while (S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, NULL))
727 if (( !pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE) ) &&
728 (This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK))
730 hr = S_OK;
731 CoTaskMemFree(pmtCandidate);
732 break;
734 CoTaskMemFree(pmtCandidate);
736 IEnumMediaTypes_Release(pEnumCandidates);
739 /* then try receiver filter's media types */
740 if (hr != S_OK && SUCCEEDED(hr = IPin_EnumMediaTypes(pReceivePin, &pEnumCandidates))) /* if we haven't already connected successfully */
742 hr = VFW_E_NO_ACCEPTABLE_TYPES; /* Assume the worst, but set to S_OK if connected successfully */
744 while (S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, NULL))
746 if (( !pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE) ) &&
747 (This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK))
749 hr = S_OK;
750 CoTaskMemFree(pmtCandidate);
751 break;
753 CoTaskMemFree(pmtCandidate);
754 } /* while */
755 IEnumMediaTypes_Release(pEnumCandidates);
756 } /* if not found */
757 } /* if negotiate media type */
758 } /* if succeeded */
759 LeaveCriticalSection(This->pin.pCritSec);
761 TRACE(" -- %x\n", hr);
762 return hr;
765 HRESULT WINAPI OutputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
767 ERR("Incoming connection on an output pin! (%p, %p)\n", pReceivePin, pmt);
769 return E_UNEXPECTED;
772 HRESULT WINAPI OutputPin_Disconnect(IPin * iface)
774 HRESULT hr;
775 OutputPin *This = (OutputPin *)iface;
777 TRACE("()\n");
779 EnterCriticalSection(This->pin.pCritSec);
781 if (This->pMemInputPin)
783 IMemInputPin_Release(This->pMemInputPin);
784 This->pMemInputPin = NULL;
786 if (This->pin.pConnectedTo)
788 IPin_Release(This->pin.pConnectedTo);
789 This->pin.pConnectedTo = NULL;
790 hr = S_OK;
792 else
793 hr = S_FALSE;
795 LeaveCriticalSection(This->pin.pCritSec);
797 return hr;
800 HRESULT WINAPI OutputPin_EndOfStream(IPin * iface)
802 TRACE("()\n");
804 /* not supposed to do anything in an output pin */
806 return E_UNEXPECTED;
809 HRESULT WINAPI OutputPin_BeginFlush(IPin * iface)
811 TRACE("(%p)->()\n", iface);
813 /* not supposed to do anything in an output pin */
815 return E_UNEXPECTED;
818 HRESULT WINAPI OutputPin_EndFlush(IPin * iface)
820 TRACE("(%p)->()\n", iface);
822 /* not supposed to do anything in an output pin */
824 return E_UNEXPECTED;
827 HRESULT WINAPI OutputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
829 TRACE("(%p)->(%x%08x, %x%08x, %e)\n", iface, (ULONG)(tStart >> 32), (ULONG)tStart, (ULONG)(tStop >> 32), (ULONG)tStop, dRate);
831 /* not supposed to do anything in an output pin */
833 return E_UNEXPECTED;
836 static const IPinVtbl OutputPin_Vtbl =
838 OutputPin_QueryInterface,
839 IPinImpl_AddRef,
840 OutputPin_Release,
841 OutputPin_Connect,
842 OutputPin_ReceiveConnection,
843 OutputPin_Disconnect,
844 IPinImpl_ConnectedTo,
845 IPinImpl_ConnectionMediaType,
846 IPinImpl_QueryPinInfo,
847 IPinImpl_QueryDirection,
848 IPinImpl_QueryId,
849 IPinImpl_QueryAccept,
850 IPinImpl_EnumMediaTypes,
851 IPinImpl_QueryInternalConnections,
852 OutputPin_EndOfStream,
853 OutputPin_BeginFlush,
854 OutputPin_EndFlush,
855 OutputPin_NewSegment
858 HRESULT OutputPin_GetDeliveryBuffer(OutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags)
860 HRESULT hr;
862 TRACE("(%p, %p, %p, %x)\n", ppSample, tStart, tStop, dwFlags);
864 EnterCriticalSection(This->pin.pCritSec);
866 if (!This->pin.pConnectedTo)
867 hr = VFW_E_NOT_CONNECTED;
868 else
870 IMemAllocator * pAlloc = NULL;
872 hr = IMemInputPin_GetAllocator(This->pMemInputPin, &pAlloc);
874 if (SUCCEEDED(hr))
875 hr = IMemAllocator_GetBuffer(pAlloc, ppSample, tStart, tStop, dwFlags);
877 if (SUCCEEDED(hr))
878 hr = IMediaSample_SetTime(*ppSample, tStart, tStop);
880 if (pAlloc)
881 IMemAllocator_Release(pAlloc);
884 LeaveCriticalSection(This->pin.pCritSec);
886 return hr;
889 HRESULT OutputPin_SendSample(OutputPin * This, IMediaSample * pSample)
891 HRESULT hr = S_OK;
892 IMemInputPin * pMemConnected = NULL;
893 PIN_INFO pinInfo;
895 EnterCriticalSection(This->pin.pCritSec);
897 if (!This->pin.pConnectedTo || !This->pMemInputPin)
898 hr = VFW_E_NOT_CONNECTED;
899 else
901 /* we don't have the lock held when using This->pMemInputPin,
902 * so we need to AddRef it to stop it being deleted while we are
903 * using it. Same with its filter. */
904 pMemConnected = This->pMemInputPin;
905 IMemInputPin_AddRef(pMemConnected);
906 hr = IPin_QueryPinInfo(This->pin.pConnectedTo, &pinInfo);
909 LeaveCriticalSection(This->pin.pCritSec);
911 if (SUCCEEDED(hr))
913 /* NOTE: if we are in a critical section when Receive is called
914 * then it causes some problems (most notably with the native Video
915 * Renderer) if we are re-entered for whatever reason */
916 hr = IMemInputPin_Receive(pMemConnected, pSample);
918 /* If the filter's destroyed, tell upstream to stop sending data */
919 if(IBaseFilter_Release(pinInfo.pFilter) == 0 && SUCCEEDED(hr))
920 hr = S_FALSE;
922 if (pMemConnected)
923 IMemInputPin_Release(pMemConnected);
925 return hr;
928 HRESULT OutputPin_DeliverNewSegment(OutputPin * This, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
930 HRESULT hr;
932 EnterCriticalSection(This->pin.pCritSec);
934 if (!This->pin.pConnectedTo)
935 hr = VFW_E_NOT_CONNECTED;
936 else
937 hr = IPin_NewSegment(This->pin.pConnectedTo, tStart, tStop, dRate);
939 LeaveCriticalSection(This->pin.pCritSec);
941 return hr;
944 HRESULT OutputPin_CommitAllocator(OutputPin * This)
946 HRESULT hr;
948 TRACE("(%p)->()\n", This);
950 EnterCriticalSection(This->pin.pCritSec);
952 if (!This->pin.pConnectedTo || !This->pMemInputPin)
953 hr = VFW_E_NOT_CONNECTED;
954 else
956 IMemAllocator * pAlloc = NULL;
958 hr = IMemInputPin_GetAllocator(This->pMemInputPin, &pAlloc);
960 if (SUCCEEDED(hr))
961 hr = IMemAllocator_Commit(pAlloc);
963 if (pAlloc)
964 IMemAllocator_Release(pAlloc);
967 LeaveCriticalSection(This->pin.pCritSec);
969 return hr;
972 HRESULT OutputPin_DeliverDisconnect(OutputPin * This)
974 HRESULT hr;
976 TRACE("(%p)->()\n", This);
978 EnterCriticalSection(This->pin.pCritSec);
980 if (!This->pin.pConnectedTo || !This->pMemInputPin)
981 hr = VFW_E_NOT_CONNECTED;
982 else
984 IMemAllocator * pAlloc = NULL;
986 hr = IMemInputPin_GetAllocator(This->pMemInputPin, &pAlloc);
988 if (SUCCEEDED(hr))
989 hr = IMemAllocator_Decommit(pAlloc);
991 if (pAlloc)
992 IMemAllocator_Release(pAlloc);
994 if (SUCCEEDED(hr))
995 hr = IPin_Disconnect(This->pin.pConnectedTo);
998 LeaveCriticalSection(This->pin.pCritSec);
1000 return hr;
1004 HRESULT PullPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin)
1006 PullPin * pPinImpl;
1008 *ppPin = NULL;
1010 if (pPinInfo->dir != PINDIR_INPUT)
1012 ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo->dir);
1013 return E_INVALIDARG;
1016 pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl));
1018 if (!pPinImpl)
1019 return E_OUTOFMEMORY;
1021 if (SUCCEEDED(PullPin_Init(pPinInfo, pSampleProc, pUserData, pQueryAccept, pCritSec, pPinImpl)))
1023 pPinImpl->pin.lpVtbl = &PullPin_Vtbl;
1025 *ppPin = (IPin *)(&pPinImpl->pin.lpVtbl);
1026 return S_OK;
1028 return E_FAIL;
1031 HRESULT PullPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, PullPin * pPinImpl)
1033 /* Common attributes */
1034 pPinImpl->pin.refCount = 1;
1035 pPinImpl->pin.pConnectedTo = NULL;
1036 pPinImpl->pin.fnQueryAccept = pQueryAccept;
1037 pPinImpl->pin.pUserData = pUserData;
1038 pPinImpl->pin.pCritSec = pCritSec;
1039 Copy_PinInfo(&pPinImpl->pin.pinInfo, pPinInfo);
1040 ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
1042 /* Input pin attributes */
1043 pPinImpl->fnSampleProc = pSampleProc;
1044 pPinImpl->fnPreConnect = NULL;
1045 pPinImpl->pAlloc = NULL;
1046 pPinImpl->pReader = NULL;
1047 pPinImpl->hThread = NULL;
1048 pPinImpl->hEventStateChanged = CreateEventW(NULL, FALSE, TRUE, NULL);
1050 pPinImpl->rtStart = 0;
1051 pPinImpl->rtCurrent = 0;
1052 pPinImpl->rtStop = ((LONGLONG)0x7fffffff << 32) | 0xffffffff;
1054 return S_OK;
1057 HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
1059 PIN_DIRECTION pindirReceive;
1060 HRESULT hr = S_OK;
1061 PullPin *This = (PullPin *)iface;
1063 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt);
1064 dump_AM_MEDIA_TYPE(pmt);
1066 EnterCriticalSection(This->pin.pCritSec);
1068 if (This->pin.pConnectedTo)
1069 hr = VFW_E_ALREADY_CONNECTED;
1071 if (SUCCEEDED(hr) && (This->pin.fnQueryAccept(This->pin.pUserData, pmt) != S_OK))
1072 hr = VFW_E_TYPE_NOT_ACCEPTED; /* FIXME: shouldn't we just map common errors onto
1073 * VFW_E_TYPE_NOT_ACCEPTED and pass the value on otherwise? */
1075 if (SUCCEEDED(hr))
1077 IPin_QueryDirection(pReceivePin, &pindirReceive);
1079 if (pindirReceive != PINDIR_OUTPUT)
1081 ERR("Can't connect from non-output pin\n");
1082 hr = VFW_E_INVALID_DIRECTION;
1086 This->pReader = NULL;
1087 This->pAlloc = NULL;
1088 if (SUCCEEDED(hr))
1090 hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader);
1093 if (SUCCEEDED(hr))
1095 ALLOCATOR_PROPERTIES props;
1096 props.cBuffers = 3;
1097 props.cbBuffer = 64 * 1024; /* 64k bytes */
1098 props.cbAlign = 1;
1099 props.cbPrefix = 0;
1100 hr = IAsyncReader_RequestAllocator(This->pReader, NULL, &props, &This->pAlloc);
1103 if (SUCCEEDED(hr) && This->fnPreConnect)
1105 hr = This->fnPreConnect(iface, pReceivePin);
1108 if (SUCCEEDED(hr))
1110 CopyMediaType(&This->pin.mtCurrent, pmt);
1111 This->pin.pConnectedTo = pReceivePin;
1112 IPin_AddRef(pReceivePin);
1114 else
1116 if (This->pReader)
1117 IAsyncReader_Release(This->pReader);
1118 This->pReader = NULL;
1119 if (This->pAlloc)
1120 IMemAllocator_Release(This->pAlloc);
1121 This->pAlloc = NULL;
1124 LeaveCriticalSection(This->pin.pCritSec);
1125 return hr;
1128 HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
1130 PullPin *This = (PullPin *)iface;
1132 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
1134 *ppv = NULL;
1136 if (IsEqualIID(riid, &IID_IUnknown))
1137 *ppv = (LPVOID)iface;
1138 else if (IsEqualIID(riid, &IID_IPin))
1139 *ppv = (LPVOID)iface;
1141 if (*ppv)
1143 IUnknown_AddRef((IUnknown *)(*ppv));
1144 return S_OK;
1147 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
1149 return E_NOINTERFACE;
1152 ULONG WINAPI PullPin_Release(IPin * iface)
1154 PullPin *This = (PullPin *)iface;
1155 ULONG refCount = InterlockedDecrement(&This->pin.refCount);
1157 TRACE("(%p)->() Release from %d\n", This, refCount + 1);
1159 if (!refCount)
1161 if(This->pAlloc)
1162 IMemAllocator_Release(This->pAlloc);
1163 if(This->pReader)
1164 IAsyncReader_Release(This->pReader);
1165 CloseHandle(This->hEventStateChanged);
1166 CoTaskMemFree(This);
1167 return 0;
1169 return refCount;
1172 static DWORD WINAPI PullPin_Thread_Main(LPVOID pv)
1174 for (;;)
1175 SleepEx(INFINITE, TRUE);
1178 static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface)
1180 PullPin *This = (PullPin *)iface;
1181 HRESULT hr;
1183 ALLOCATOR_PROPERTIES allocProps;
1185 CoInitializeEx(NULL, COINIT_MULTITHREADED);
1187 SetEvent(This->hEventStateChanged);
1189 hr = IMemAllocator_GetProperties(This->pAlloc, &allocProps);
1191 if (This->rtCurrent < This->rtStart)
1192 This->rtCurrent = MEDIATIME_FROM_BYTES(ALIGNDOWN(BYTES_FROM_MEDIATIME(This->rtStart), allocProps.cbAlign));
1194 TRACE("Start\n");
1196 while (This->rtCurrent < This->rtStop && hr == S_OK)
1198 /* FIXME: to improve performance by quite a bit this should be changed
1199 * so that one sample is processed while one sample is fetched. However,
1200 * it is harder to debug so for the moment it will stay as it is */
1201 IMediaSample * pSample = NULL;
1202 REFERENCE_TIME rtSampleStart;
1203 REFERENCE_TIME rtSampleStop;
1204 DWORD_PTR dwUser;
1206 TRACE("Process sample\n");
1208 hr = IMemAllocator_GetBuffer(This->pAlloc, &pSample, NULL, NULL, 0);
1210 if (SUCCEEDED(hr))
1212 rtSampleStart = This->rtCurrent;
1213 rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(pSample));
1214 if (rtSampleStop > This->rtStop)
1215 rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(This->rtStop), allocProps.cbAlign));
1216 hr = IMediaSample_SetTime(pSample, &rtSampleStart, &rtSampleStop);
1217 This->rtCurrent = rtSampleStop;
1220 if (SUCCEEDED(hr))
1221 hr = IAsyncReader_Request(This->pReader, pSample, (ULONG_PTR)0);
1223 if (SUCCEEDED(hr))
1224 hr = IAsyncReader_WaitForNext(This->pReader, 10000, &pSample, &dwUser);
1226 if (SUCCEEDED(hr))
1228 rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(IMediaSample_GetActualDataLength(pSample));
1229 if (rtSampleStop > This->rtStop)
1230 rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(This->rtStop), allocProps.cbAlign));
1231 hr = IMediaSample_SetTime(pSample, &rtSampleStart, &rtSampleStop);
1234 if (SUCCEEDED(hr))
1235 hr = This->fnSampleProc(This->pin.pUserData, pSample);
1236 else
1237 ERR("Processing error: %x\n", hr);
1239 if (pSample)
1240 IMediaSample_Release(pSample);
1243 CoUninitialize();
1245 TRACE("End\n");
1248 static void CALLBACK PullPin_Thread_Stop(ULONG_PTR iface)
1250 PullPin *This = (PullPin *)iface;
1252 TRACE("(%p/%p)->()\n", This, (LPVOID)iface);
1254 EnterCriticalSection(This->pin.pCritSec);
1256 HRESULT hr;
1258 CloseHandle(This->hThread);
1259 This->hThread = NULL;
1260 if (FAILED(hr = IMemAllocator_Decommit(This->pAlloc)))
1261 ERR("Allocator decommit failed with error %x. Possible memory leak\n", hr);
1263 LeaveCriticalSection(This->pin.pCritSec);
1265 SetEvent(This->hEventStateChanged);
1267 IBaseFilter_Release(This->pin.pinInfo.pFilter);
1269 ExitThread(0);
1272 HRESULT PullPin_InitProcessing(PullPin * This)
1274 HRESULT hr = S_OK;
1276 TRACE("(%p)->()\n", This);
1278 assert(!This->hThread);
1280 /* if we are connected */
1281 if (This->pAlloc)
1283 EnterCriticalSection(This->pin.pCritSec);
1285 DWORD dwThreadId;
1286 assert(!This->hThread);
1288 /* AddRef the filter to make sure it and it's pins will be around
1289 * as long as the thread */
1290 IBaseFilter_AddRef(This->pin.pinInfo.pFilter);
1292 This->hThread = CreateThread(NULL, 0, PullPin_Thread_Main, NULL, 0, &dwThreadId);
1293 if (!This->hThread)
1295 hr = HRESULT_FROM_WIN32(GetLastError());
1296 IBaseFilter_Release(This->pin.pinInfo.pFilter);
1299 if (SUCCEEDED(hr))
1300 hr = IMemAllocator_Commit(This->pAlloc);
1302 LeaveCriticalSection(This->pin.pCritSec);
1305 TRACE(" -- %x\n", hr);
1307 return hr;
1310 HRESULT PullPin_StartProcessing(PullPin * This)
1312 /* if we are connected */
1313 TRACE("(%p)->()\n", This);
1314 if(This->pAlloc)
1316 assert(This->hThread);
1318 ResetEvent(This->hEventStateChanged);
1320 if (!QueueUserAPC(PullPin_Thread_Process, This->hThread, (ULONG_PTR)This))
1321 return HRESULT_FROM_WIN32(GetLastError());
1324 return S_OK;
1327 HRESULT PullPin_PauseProcessing(PullPin * This)
1329 /* make the processing function exit its loop */
1330 This->rtStop = 0;
1332 return S_OK;
1335 HRESULT PullPin_StopProcessing(PullPin * This)
1337 /* if we are connected */
1338 if (This->pAlloc)
1340 assert(This->hThread);
1342 ResetEvent(This->hEventStateChanged);
1344 PullPin_PauseProcessing(This);
1346 if (!QueueUserAPC(PullPin_Thread_Stop, This->hThread, (ULONG_PTR)This))
1347 return HRESULT_FROM_WIN32(GetLastError());
1350 return S_OK;
1353 HRESULT PullPin_WaitForStateChange(PullPin * This, DWORD dwMilliseconds)
1355 if (WaitForSingleObject(This->hEventStateChanged, dwMilliseconds) == WAIT_TIMEOUT)
1356 return S_FALSE;
1357 return S_OK;
1360 HRESULT PullPin_Seek(PullPin * This, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
1362 FIXME("(%p)->(%x%08x, %x%08x)\n", This, (LONG)(rtStart >> 32), (LONG)rtStart, (LONG)(rtStop >> 32), (LONG)rtStop);
1364 PullPin_BeginFlush((IPin *)This);
1365 /* FIXME: need critical section? */
1366 This->rtStart = rtStart;
1367 This->rtStop = rtStop;
1368 PullPin_EndFlush((IPin *)This);
1370 return S_OK;
1373 HRESULT WINAPI PullPin_EndOfStream(IPin * iface)
1375 FIXME("(%p)->()\n", iface);
1376 return E_NOTIMPL;
1379 HRESULT WINAPI PullPin_BeginFlush(IPin * iface)
1381 FIXME("(%p)->()\n", iface);
1382 return E_NOTIMPL;
1385 HRESULT WINAPI PullPin_EndFlush(IPin * iface)
1387 FIXME("(%p)->()\n", iface);
1388 return E_NOTIMPL;
1391 HRESULT WINAPI PullPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
1393 FIXME("(%p)->(%s, %s, %g)\n", iface, wine_dbgstr_longlong(tStart), wine_dbgstr_longlong(tStop), dRate);
1394 return E_NOTIMPL;
1397 static const IPinVtbl PullPin_Vtbl =
1399 PullPin_QueryInterface,
1400 IPinImpl_AddRef,
1401 PullPin_Release,
1402 OutputPin_Connect,
1403 PullPin_ReceiveConnection,
1404 IPinImpl_Disconnect,
1405 IPinImpl_ConnectedTo,
1406 IPinImpl_ConnectionMediaType,
1407 IPinImpl_QueryPinInfo,
1408 IPinImpl_QueryDirection,
1409 IPinImpl_QueryId,
1410 IPinImpl_QueryAccept,
1411 IPinImpl_EnumMediaTypes,
1412 IPinImpl_QueryInternalConnections,
1413 PullPin_EndOfStream,
1414 PullPin_BeginFlush,
1415 PullPin_EndFlush,
1416 PullPin_NewSegment