2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
4 * FILE: dll/directx/ksproxy/input_pin.cpp
5 * PURPOSE: InputPin of Proxy Filter
7 * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
11 const GUID IID_IKsPinPipe
= {0xe539cd90, 0xa8b4, 0x11d1, {0x81, 0x89, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02}};
12 const GUID IID_IKsPinEx
= {0x7bb38260L
, 0xd19c, 0x11d2, {0xb3, 0x8a, 0x00, 0xa0, 0xc9, 0x5e, 0xc2, 0x2e}};
14 const GUID IID_IKsPin
= {0xb61178d1L
, 0xa2d9, 0x11cf, {0x9e, 0x53, 0x00, 0xaa, 0x00, 0xa2, 0x16, 0xa1}};
15 const GUID IID_IKsInterfaceHandler
= {0xD3ABC7E0L
, 0x9A61, 0x11D0, {0xA4, 0x0D, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
19 const GUID KSPROPSETID_Connection
= {0x1D58C920L
, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
21 KSPIN_INTERFACE StandardPinInterface
=
23 {STATIC_KSINTERFACESETID_Standard
},
24 KSINTERFACE_STANDARD_STREAMING
,
28 KSPIN_MEDIUM StandardPinMedium
=
30 {STATIC_KSMEDIUMSETID_Standard
},
31 KSMEDIUM_TYPE_ANYINSTANCE
,
37 KSPIN_INTERFACE StandardPinInterface
=
39 STATIC_KSINTERFACESETID_Standard
,
40 KSINTERFACE_STANDARD_STREAMING
,
44 KSPIN_MEDIUM StandardPinMedium
=
46 STATIC_KSMEDIUMSETID_Standard
,
47 KSMEDIUM_TYPE_ANYINSTANCE
,
53 class CInputPin
: public IPin
,
54 public IKsPropertySet
,
61 public IStreamBuilder
,
62 public IKsAggregateControl
,
63 public IQualityControl
,
64 public ISpecifyPropertyPages
67 typedef std::vector
<IUnknown
*>ProxyPluginVector
;
69 STDMETHODIMP
QueryInterface( REFIID InterfaceId
, PVOID
* Interface
);
71 STDMETHODIMP_(ULONG
) AddRef()
73 InterlockedIncrement(&m_Ref
);
76 STDMETHODIMP_(ULONG
) Release()
78 InterlockedDecrement(&m_Ref
);
88 HRESULT STDMETHODCALLTYPE
KsGetPinFramingCache(PKSALLOCATOR_FRAMING_EX
*FramingEx
, PFRAMING_PROP FramingProp
, FRAMING_CACHE_OPS Option
);
89 HRESULT STDMETHODCALLTYPE
KsSetPinFramingCache(PKSALLOCATOR_FRAMING_EX FramingEx
, PFRAMING_PROP FramingProp
, FRAMING_CACHE_OPS Option
);
90 IPin
* STDMETHODCALLTYPE
KsGetConnectedPin();
91 IKsAllocatorEx
* STDMETHODCALLTYPE
KsGetPipe(KSPEEKOPERATION Operation
);
92 HRESULT STDMETHODCALLTYPE
KsSetPipe(IKsAllocatorEx
*KsAllocator
);
93 ULONG STDMETHODCALLTYPE
KsGetPipeAllocatorFlag();
94 HRESULT STDMETHODCALLTYPE
KsSetPipeAllocatorFlag(ULONG Flag
);
95 GUID STDMETHODCALLTYPE
KsGetPinBusCache();
96 HRESULT STDMETHODCALLTYPE
KsSetPinBusCache(GUID Bus
);
97 PWCHAR STDMETHODCALLTYPE
KsGetPinName();
98 PWCHAR STDMETHODCALLTYPE
KsGetFilterName();
101 HRESULT STDMETHODCALLTYPE
Connect(IPin
*pReceivePin
, const AM_MEDIA_TYPE
*pmt
);
102 HRESULT STDMETHODCALLTYPE
ReceiveConnection(IPin
*pConnector
, const AM_MEDIA_TYPE
*pmt
);
103 HRESULT STDMETHODCALLTYPE
Disconnect();
104 HRESULT STDMETHODCALLTYPE
ConnectedTo(IPin
**pPin
);
105 HRESULT STDMETHODCALLTYPE
ConnectionMediaType(AM_MEDIA_TYPE
*pmt
);
106 HRESULT STDMETHODCALLTYPE
QueryPinInfo(PIN_INFO
*pInfo
);
107 HRESULT STDMETHODCALLTYPE
QueryDirection(PIN_DIRECTION
*pPinDir
);
108 HRESULT STDMETHODCALLTYPE
QueryId(LPWSTR
*Id
);
109 HRESULT STDMETHODCALLTYPE
QueryAccept(const AM_MEDIA_TYPE
*pmt
);
110 HRESULT STDMETHODCALLTYPE
EnumMediaTypes(IEnumMediaTypes
**ppEnum
);
111 HRESULT STDMETHODCALLTYPE
QueryInternalConnections(IPin
**apPin
, ULONG
*nPin
);
112 HRESULT STDMETHODCALLTYPE
EndOfStream();
113 HRESULT STDMETHODCALLTYPE
BeginFlush();
114 HRESULT STDMETHODCALLTYPE
EndFlush();
115 HRESULT STDMETHODCALLTYPE
NewSegment(REFERENCE_TIME tStart
, REFERENCE_TIME tStop
, double dRate
);
117 // ISpecifyPropertyPages
118 HRESULT STDMETHODCALLTYPE
GetPages(CAUUID
*pPages
);
121 HANDLE STDMETHODCALLTYPE
KsGetObjectHandle();
124 HRESULT STDMETHODCALLTYPE
Set(REFGUID guidPropSet
, DWORD dwPropID
, LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
, DWORD cbPropData
);
125 HRESULT STDMETHODCALLTYPE
Get(REFGUID guidPropSet
, DWORD dwPropID
, LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
, DWORD cbPropData
, DWORD
*pcbReturned
);
126 HRESULT STDMETHODCALLTYPE
QuerySupported(REFGUID guidPropSet
, DWORD dwPropID
, DWORD
*pTypeSupport
);
129 HRESULT STDMETHODCALLTYPE
KsProperty(PKSPROPERTY Property
, ULONG PropertyLength
, LPVOID PropertyData
, ULONG DataLength
, ULONG
* BytesReturned
);
130 HRESULT STDMETHODCALLTYPE
KsMethod(PKSMETHOD Method
, ULONG MethodLength
, LPVOID MethodData
, ULONG DataLength
, ULONG
* BytesReturned
);
131 HRESULT STDMETHODCALLTYPE
KsEvent(PKSEVENT Event
, ULONG EventLength
, LPVOID EventData
, ULONG DataLength
, ULONG
* BytesReturned
);
134 HRESULT STDMETHODCALLTYPE
KsQueryMediums(PKSMULTIPLE_ITEM
* MediumList
);
135 HRESULT STDMETHODCALLTYPE
KsQueryInterfaces(PKSMULTIPLE_ITEM
* InterfaceList
);
136 HRESULT STDMETHODCALLTYPE
KsCreateSinkPinHandle(KSPIN_INTERFACE
& Interface
, KSPIN_MEDIUM
& Medium
);
137 HRESULT STDMETHODCALLTYPE
KsGetCurrentCommunication(KSPIN_COMMUNICATION
*Communication
, KSPIN_INTERFACE
*Interface
, KSPIN_MEDIUM
*Medium
);
138 HRESULT STDMETHODCALLTYPE
KsPropagateAcquire();
139 HRESULT STDMETHODCALLTYPE
KsDeliver(IMediaSample
* Sample
, ULONG Flags
);
140 HRESULT STDMETHODCALLTYPE
KsMediaSamplesCompleted(PKSSTREAM_SEGMENT StreamSegment
);
141 IMemAllocator
* STDMETHODCALLTYPE
KsPeekAllocator(KSPEEKOPERATION Operation
);
142 HRESULT STDMETHODCALLTYPE
KsReceiveAllocator(IMemAllocator
*MemAllocator
);
143 HRESULT STDMETHODCALLTYPE
KsRenegotiateAllocator();
144 LONG STDMETHODCALLTYPE
KsIncrementPendingIoCount();
145 LONG STDMETHODCALLTYPE
KsDecrementPendingIoCount();
146 HRESULT STDMETHODCALLTYPE
KsQualityNotify(ULONG Proportion
, REFERENCE_TIME TimeDelta
);
148 VOID STDMETHODCALLTYPE
KsNotifyError(IMediaSample
* Sample
, HRESULT hr
);
151 HRESULT STDMETHODCALLTYPE
GetAllocator(IMemAllocator
**ppAllocator
);
152 HRESULT STDMETHODCALLTYPE
NotifyAllocator(IMemAllocator
*pAllocator
, BOOL bReadOnly
);
153 HRESULT STDMETHODCALLTYPE
GetAllocatorRequirements(ALLOCATOR_PROPERTIES
*pProps
);
154 HRESULT STDMETHODCALLTYPE
Receive(IMediaSample
*pSample
);
155 HRESULT STDMETHODCALLTYPE
ReceiveMultiple(IMediaSample
**pSamples
, long nSamples
, long *nSamplesProcessed
);
156 HRESULT STDMETHODCALLTYPE
ReceiveCanBlock( void);
159 HRESULT STDMETHODCALLTYPE
KsPinFactory(ULONG
* PinFactory
);
162 HRESULT STDMETHODCALLTYPE
Render(IPin
*ppinOut
, IGraphBuilder
*pGraph
);
163 HRESULT STDMETHODCALLTYPE
Backout(IPin
*ppinOut
, IGraphBuilder
*pGraph
);
165 //IKsAggregateControl
166 HRESULT STDMETHODCALLTYPE
KsAddAggregate(IN REFGUID AggregateClass
);
167 HRESULT STDMETHODCALLTYPE
KsRemoveAggregate(REFGUID AggregateClass
);
170 HRESULT STDMETHODCALLTYPE
Notify(IBaseFilter
*pSelf
, Quality q
);
171 HRESULT STDMETHODCALLTYPE
SetSink(IQualityControl
*piqc
);
173 //---------------------------------------------------------------
174 HRESULT STDMETHODCALLTYPE
CheckFormat(const AM_MEDIA_TYPE
*pmt
);
175 HRESULT STDMETHODCALLTYPE
CreatePin(const AM_MEDIA_TYPE
*pmt
);
176 HRESULT STDMETHODCALLTYPE
CreatePinHandle(PKSPIN_MEDIUM Medium
, PKSPIN_INTERFACE Interface
, const AM_MEDIA_TYPE
*pmt
);
177 HRESULT STDMETHODCALLTYPE
GetSupportedSets(LPGUID
* pOutGuid
, PULONG NumGuids
);
178 HRESULT STDMETHODCALLTYPE
LoadProxyPlugins(LPGUID pGuids
, ULONG NumGuids
);
179 CInputPin(IBaseFilter
* ParentFilter
, LPCWSTR PinName
, ULONG PinId
, KSPIN_COMMUNICATION Communication
);
180 virtual ~CInputPin(){};
184 IBaseFilter
* m_ParentFilter
;
188 IMemAllocator
* m_MemAllocator
;
190 KSPIN_COMMUNICATION m_Communication
;
191 KSPIN_INTERFACE m_Interface
;
192 KSPIN_MEDIUM m_Medium
;
193 AM_MEDIA_TYPE m_MediaFormat
;
196 IKsInterfaceHandler
* m_InterfaceHandler
;
197 IKsAllocatorEx
* m_KsAllocatorEx
;
198 ULONG m_PipeAllocatorFlag
;
199 BOOL m_bPinBusCacheInitialized
;
202 FRAMING_PROP m_FramingProp
[4];
203 PKSALLOCATOR_FRAMING_EX m_FramingEx
[4];
204 ProxyPluginVector m_Plugins
;
207 CInputPin::CInputPin(
208 IBaseFilter
* ParentFilter
,
211 KSPIN_COMMUNICATION Communication
) : m_Ref(0),
212 m_ParentFilter(ParentFilter
),
214 m_hPin(INVALID_HANDLE_VALUE
),
218 m_Communication(Communication
),
221 m_InterfaceHandler(0),
223 m_PipeAllocatorFlag(0),
224 m_bPinBusCacheInitialized(0),
228 ZeroMemory(m_FramingProp
, sizeof(m_FramingProp
));
229 ZeroMemory(m_FramingEx
, sizeof(m_FramingEx
));
232 IKsObject
* KsObjectParent
;
235 hr
= m_ParentFilter
->QueryInterface(IID_IKsObject
, (LPVOID
*)&KsObjectParent
);
238 hFilter
= KsObjectParent
->KsGetObjectHandle();
241 KsObjectParent
->Release();
244 ZeroMemory(&m_MediaFormat
, sizeof(AM_MEDIA_TYPE
));
245 hr
= KsGetMediaType(0, &m_MediaFormat
, hFilter
, m_PinId
);
251 CInputPin::QueryInterface(
259 if (IsEqualGUID(refiid
, IID_IUnknown
) ||
260 IsEqualGUID(refiid
, IID_IPin
))
262 *Output
= PVOID(this);
263 reinterpret_cast<IUnknown
*>(*Output
)->AddRef();
266 else if (IsEqualGUID(refiid
, IID_IMemInputPin
))
268 if (m_hPin
== INVALID_HANDLE_VALUE
)
270 HRESULT hr
= CreatePin(&m_MediaFormat
);
275 *Output
= (IMemInputPin
*)(this);
276 reinterpret_cast<IMemInputPin
*>(*Output
)->AddRef();
279 else if (IsEqualGUID(refiid
, IID_IKsObject
))
281 *Output
= (IKsObject
*)(this);
282 reinterpret_cast<IKsObject
*>(*Output
)->AddRef();
285 else if (IsEqualGUID(refiid
, IID_IKsPropertySet
))
287 if (m_hPin
== INVALID_HANDLE_VALUE
)
289 HRESULT hr
= CreatePin(&m_MediaFormat
);
294 *Output
= (IKsPropertySet
*)(this);
295 reinterpret_cast<IKsPropertySet
*>(*Output
)->AddRef();
298 else if (IsEqualGUID(refiid
, IID_IKsControl
))
300 *Output
= (IKsControl
*)(this);
301 reinterpret_cast<IKsControl
*>(*Output
)->AddRef();
304 else if (IsEqualGUID(refiid
, IID_IKsPin
) ||
305 IsEqualGUID(refiid
, IID_IKsPinEx
))
307 *Output
= (IKsPinEx
*)(this);
308 reinterpret_cast<IKsPinEx
*>(*Output
)->AddRef();
311 else if (IsEqualGUID(refiid
, IID_IKsPinPipe
))
313 *Output
= (IKsPinPipe
*)(this);
314 reinterpret_cast<IKsPinPipe
*>(*Output
)->AddRef();
317 else if (IsEqualGUID(refiid
, IID_IKsPinFactory
))
319 *Output
= (IKsPinFactory
*)(this);
320 reinterpret_cast<IKsPinFactory
*>(*Output
)->AddRef();
324 else if (IsEqualGUID(refiid
, IID_IStreamBuilder
))
326 *Output
= (IStreamBuilder
*)(this);
327 reinterpret_cast<IStreamBuilder
*>(*Output
)->AddRef();
331 else if (IsEqualGUID(refiid
, IID_IKsAggregateControl
))
333 *Output
= (IKsAggregateControl
*)(this);
334 reinterpret_cast<IKsAggregateControl
*>(*Output
)->AddRef();
337 else if (IsEqualGUID(refiid
, IID_IQualityControl
))
339 *Output
= (IQualityControl
*)(this);
340 reinterpret_cast<IQualityControl
*>(*Output
)->AddRef();
343 else if (IsEqualGUID(refiid
, IID_ISpecifyPropertyPages
))
345 *Output
= (ISpecifyPropertyPages
*)(this);
346 reinterpret_cast<ISpecifyPropertyPages
*>(*Output
)->AddRef();
351 StringFromCLSID(refiid
, &lpstr
);
352 swprintf(Buffer
, L
"CInputPin::QueryInterface: NoInterface for %s\n", lpstr
);
353 OutputDebugStringW(Buffer
);
354 CoTaskMemFree(lpstr
);
356 return E_NOINTERFACE
;
358 //-------------------------------------------------------------------
359 // IQualityControl interface
368 OutputDebugStringW(L
"CInputPin::Notify NotImplemented\n");
377 IQualityControl
*piqc
)
380 OutputDebugStringW(L
"CInputPin::SetSink NotImplemented\n");
387 //-------------------------------------------------------------------
388 // IKsAggregateControl interface
392 CInputPin::KsAddAggregate(
393 IN REFGUID AggregateClass
)
396 OutputDebugStringW(L
"CInputPin::KsAddAggregate NotImplemented\n");
404 CInputPin::KsRemoveAggregate(
405 REFGUID AggregateClass
)
408 OutputDebugStringW(L
"CInputPin::KsRemoveAggregate NotImplemented\n");
414 //-------------------------------------------------------------------
422 IGraphBuilder
*pGraph
)
424 OutputDebugStringW(L
"CInputPin::Render\n");
432 IGraphBuilder
*pGraph
)
435 OutputDebugStringW(L
"CInputPin::Backout\n");
441 //-------------------------------------------------------------------
447 CInputPin::KsPinFactory(
451 OutputDebugStringW(L
"CInputPin::KsPinFactory\n");
454 *PinFactory
= m_PinId
;
458 //-------------------------------------------------------------------
464 CInputPin::KsGetPinFramingCache(
465 PKSALLOCATOR_FRAMING_EX
*FramingEx
,
466 PFRAMING_PROP FramingProp
,
467 FRAMING_CACHE_OPS Option
)
469 if (Option
> Framing_Cache_Write
|| Option
< Framing_Cache_ReadLast
)
475 // get framing properties
476 *FramingProp
= m_FramingProp
[Option
];
477 *FramingEx
= m_FramingEx
[Option
];
484 CInputPin::KsSetPinFramingCache(
485 PKSALLOCATOR_FRAMING_EX FramingEx
,
486 PFRAMING_PROP FramingProp
,
487 FRAMING_CACHE_OPS Option
)
492 if (m_FramingEx
[Option
])
494 for(Index
= 1; Index
< 4; Index
++)
496 if (m_FramingEx
[Index
] == m_FramingEx
[Option
])
502 // existing framing is only used once
503 CoTaskMemFree(m_FramingEx
[Option
]);
508 m_FramingEx
[Option
] = FramingEx
;
509 m_FramingProp
[Option
] = *FramingProp
;
516 CInputPin::KsGetConnectedPin()
523 CInputPin::KsGetPipe(
524 KSPEEKOPERATION Operation
)
526 if (Operation
== KsPeekOperation_AddRef
)
529 m_KsAllocatorEx
->AddRef();
531 return m_KsAllocatorEx
;
536 CInputPin::KsSetPipe(
537 IKsAllocatorEx
*KsAllocator
)
540 KsAllocator
->AddRef();
543 m_KsAllocatorEx
->Release();
545 m_KsAllocatorEx
= KsAllocator
;
551 CInputPin::KsGetPipeAllocatorFlag()
553 return m_PipeAllocatorFlag
;
559 CInputPin::KsSetPipeAllocatorFlag(
562 m_PipeAllocatorFlag
= Flag
;
568 CInputPin::KsGetPinBusCache()
570 if (!m_bPinBusCacheInitialized
)
572 CopyMemory(&m_PinBusCache
, &m_Medium
.Set
, sizeof(GUID
));
573 m_bPinBusCacheInitialized
= TRUE
;
576 return m_PinBusCache
;
581 CInputPin::KsSetPinBusCache(
584 CopyMemory(&m_PinBusCache
, &Bus
, sizeof(GUID
));
590 CInputPin::KsGetPinName()
592 return (PWCHAR
)m_PinName
;
598 CInputPin::KsGetFilterName()
603 //-------------------------------------------------------------------
604 // ISpecifyPropertyPages
609 CInputPin::GetPages(CAUUID
*pPages
)
615 pPages
->pElems
= NULL
;
620 //-------------------------------------------------------------------
627 CInputPin::GetAllocator(IMemAllocator
**ppAllocator
)
630 OutputDebugStringW(L
"CInputPin::GetAllocator\n");
633 return VFW_E_NO_ALLOCATOR
;
638 CInputPin::NotifyAllocator(IMemAllocator
*pAllocator
, BOOL bReadOnly
)
641 ALLOCATOR_PROPERTIES Properties
;
643 hr
= pAllocator
->GetProperties(&Properties
);
647 swprintf(Buffer
, L
"CInputPin::NotifyAllocator hr %lx bReadOnly, %u cbAlign %u cbBuffer %u cbPrefix %u cBuffers %u\n", hr
, bReadOnly
, Properties
.cbAlign
, Properties
.cbBuffer
, Properties
.cbPrefix
, Properties
.cBuffers
);
648 OutputDebugStringW(Buffer
);
653 pAllocator
->AddRef();
658 m_MemAllocator
->Release();
661 m_MemAllocator
= pAllocator
;
662 m_ReadOnly
= bReadOnly
;
668 CInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES
*pProps
)
670 KSALLOCATOR_FRAMING Framing
;
675 Property
.Set
= KSPROPSETID_Connection
;
676 Property
.Id
= KSPROPERTY_CONNECTION_ALLOCATORFRAMING
;
677 Property
.Flags
= KSPROPERTY_TYPE_SET
;
679 hr
= KsProperty(&Property
, sizeof(KSPROPERTY
), (PVOID
)&Framing
, sizeof(KSALLOCATOR_FRAMING
), &BytesReturned
);
682 pProps
->cBuffers
= Framing
.Frames
;
683 pProps
->cbBuffer
= Framing
.FrameSize
;
684 pProps
->cbAlign
= Framing
.FileAlignment
;
685 pProps
->cbPrefix
= 0;
692 swprintf(Buffer
, L
"CInputPin::GetAllocatorRequirements hr %lx m_hPin %p cBuffers %u cbBuffer %u cbAlign %u cbPrefix %u\n", hr
, m_hPin
, pProps
->cBuffers
, pProps
->cbBuffer
, pProps
->cbAlign
, pProps
->cbPrefix
);
693 OutputDebugStringW(Buffer
);
701 CInputPin::Receive(IMediaSample
*pSample
)
704 OutputDebugStringW(L
"CInputPin::Receive NotImplemented\n");
712 CInputPin::ReceiveMultiple(IMediaSample
**pSamples
, long nSamples
, long *nSamplesProcessed
)
715 OutputDebugStringW(L
"CInputPin::ReceiveMultiple NotImplemented\n");
723 CInputPin::ReceiveCanBlock( void)
726 OutputDebugStringW(L
"CInputPin::ReceiveCanBlock NotImplemented\n");
732 //-------------------------------------------------------------------
738 CInputPin::KsQueryMediums(
739 PKSMULTIPLE_ITEM
* MediumList
)
742 IKsObject
* KsObjectParent
;
745 hr
= m_ParentFilter
->QueryInterface(IID_IKsObject
, (LPVOID
*)&KsObjectParent
);
749 hFilter
= KsObjectParent
->KsGetObjectHandle();
751 KsObjectParent
->Release();
756 return KsGetMultiplePinFactoryItems(hFilter
, m_PinId
, KSPROPERTY_PIN_MEDIUMS
, (PVOID
*)MediumList
);
761 CInputPin::KsQueryInterfaces(
762 PKSMULTIPLE_ITEM
* InterfaceList
)
765 IKsObject
* KsObjectParent
;
768 hr
= m_ParentFilter
->QueryInterface(IID_IKsObject
, (LPVOID
*)&KsObjectParent
);
772 hFilter
= KsObjectParent
->KsGetObjectHandle();
774 KsObjectParent
->Release();
779 return KsGetMultiplePinFactoryItems(hFilter
, m_PinId
, KSPROPERTY_PIN_INTERFACES
, (PVOID
*)InterfaceList
);
784 CInputPin::KsCreateSinkPinHandle(
785 KSPIN_INTERFACE
& Interface
,
786 KSPIN_MEDIUM
& Medium
)
788 return CreatePin(&m_MediaFormat
);
793 CInputPin::KsGetCurrentCommunication(
794 KSPIN_COMMUNICATION
*Communication
,
795 KSPIN_INTERFACE
*Interface
,
796 KSPIN_MEDIUM
*Medium
)
800 *Communication
= m_Communication
;
806 return VFW_E_NOT_CONNECTED
;
808 CopyMemory(Interface
, &m_Interface
, sizeof(KSPIN_INTERFACE
));
814 return VFW_E_NOT_CONNECTED
;
816 CopyMemory(Medium
, &m_Medium
, sizeof(KSPIN_MEDIUM
));
823 CInputPin::KsPropagateAcquire()
830 assert(m_hPin
!= INVALID_HANDLE_VALUE
);
832 Property
.Set
= KSPROPSETID_Connection
;
833 Property
.Id
= KSPROPERTY_CONNECTION_STATE
;
834 Property
.Flags
= KSPROPERTY_TYPE_SET
;
836 State
= KSSTATE_ACQUIRE
;
838 hr
= KsProperty(&Property
, sizeof(KSPROPERTY
), (LPVOID
)&State
, sizeof(KSSTATE
), &BytesReturned
);
841 //propagate to connected pin on the pipe
848 CInputPin::KsDeliver(
849 IMediaSample
* Sample
,
857 CInputPin::KsMediaSamplesCompleted(PKSSTREAM_SEGMENT StreamSegment
)
864 CInputPin::KsPeekAllocator(KSPEEKOPERATION Operation
)
866 if (Operation
== KsPeekOperation_AddRef
)
868 // add reference on allocator
869 m_MemAllocator
->AddRef();
872 return m_MemAllocator
;
877 CInputPin::KsReceiveAllocator(IMemAllocator
*MemAllocator
)
882 MemAllocator
->AddRef();
887 m_MemAllocator
->Release();
890 m_MemAllocator
= MemAllocator
;
896 CInputPin::KsRenegotiateAllocator()
903 CInputPin::KsIncrementPendingIoCount()
905 return InterlockedIncrement((volatile LONG
*)&m_IoCount
);
910 CInputPin::KsDecrementPendingIoCount()
912 return InterlockedDecrement((volatile LONG
*)&m_IoCount
);
917 CInputPin::KsQualityNotify(
919 REFERENCE_TIME TimeDelta
)
922 OutputDebugStringW(L
"CInputPin::KsQualityNotify NotImplemented\n");
928 //-------------------------------------------------------------------
934 CInputPin::KsNotifyError(
935 IMediaSample
* Sample
,
939 OutputDebugStringW(L
"CInputPin::KsNotifyError NotImplemented\n");
944 //-------------------------------------------------------------------
949 CInputPin::KsProperty(
950 PKSPROPERTY Property
,
951 ULONG PropertyLength
,
954 ULONG
* BytesReturned
)
956 assert(m_hPin
!= INVALID_HANDLE_VALUE
);
957 return KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_PROPERTY
, (PVOID
)Property
, PropertyLength
, (PVOID
)PropertyData
, DataLength
, BytesReturned
);
967 ULONG
* BytesReturned
)
969 assert(m_hPin
!= INVALID_HANDLE_VALUE
);
970 return KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_METHOD
, (PVOID
)Method
, MethodLength
, (PVOID
)MethodData
, DataLength
, BytesReturned
);
980 ULONG
* BytesReturned
)
982 assert(m_hPin
!= INVALID_HANDLE_VALUE
);
985 return KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_ENABLE_EVENT
, (PVOID
)Event
, EventLength
, (PVOID
)EventData
, DataLength
, BytesReturned
);
987 return KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_DISABLE_EVENT
, (PVOID
)Event
, EventLength
, NULL
, 0, BytesReturned
);
991 //-------------------------------------------------------------------
999 LPVOID pInstanceData
,
1000 DWORD cbInstanceData
,
1004 ULONG BytesReturned
;
1008 PKSPROPERTY Property
= (PKSPROPERTY
)CoTaskMemAlloc(sizeof(KSPROPERTY
) + cbInstanceData
);
1010 return E_OUTOFMEMORY
;
1012 Property
->Set
= guidPropSet
;
1013 Property
->Id
= dwPropID
;
1014 Property
->Flags
= KSPROPERTY_TYPE_SET
;
1016 CopyMemory((Property
+1), pInstanceData
, cbInstanceData
);
1018 HRESULT hr
= KsProperty(Property
, sizeof(KSPROPERTY
) + cbInstanceData
, pPropData
, cbPropData
, &BytesReturned
);
1019 CoTaskMemFree(Property
);
1024 KSPROPERTY Property
;
1026 Property
.Set
= guidPropSet
;
1027 Property
.Id
= dwPropID
;
1028 Property
.Flags
= KSPROPERTY_TYPE_SET
;
1030 HRESULT hr
= KsProperty(&Property
, sizeof(KSPROPERTY
), pPropData
, cbPropData
, &BytesReturned
);
1038 REFGUID guidPropSet
,
1040 LPVOID pInstanceData
,
1041 DWORD cbInstanceData
,
1046 ULONG BytesReturned
;
1050 PKSPROPERTY Property
= (PKSPROPERTY
)CoTaskMemAlloc(sizeof(KSPROPERTY
) + cbInstanceData
);
1052 return E_OUTOFMEMORY
;
1054 Property
->Set
= guidPropSet
;
1055 Property
->Id
= dwPropID
;
1056 Property
->Flags
= KSPROPERTY_TYPE_GET
;
1058 CopyMemory((Property
+1), pInstanceData
, cbInstanceData
);
1060 HRESULT hr
= KsProperty(Property
, sizeof(KSPROPERTY
) + cbInstanceData
, pPropData
, cbPropData
, &BytesReturned
);
1061 CoTaskMemFree(Property
);
1066 KSPROPERTY Property
;
1068 Property
.Set
= guidPropSet
;
1069 Property
.Id
= dwPropID
;
1070 Property
.Flags
= KSPROPERTY_TYPE_GET
;
1072 HRESULT hr
= KsProperty(&Property
, sizeof(KSPROPERTY
), pPropData
, cbPropData
, &BytesReturned
);
1079 CInputPin::QuerySupported(
1080 REFGUID guidPropSet
,
1082 DWORD
*pTypeSupport
)
1084 KSPROPERTY Property
;
1085 ULONG BytesReturned
;
1087 Property
.Set
= guidPropSet
;
1088 Property
.Id
= dwPropID
;
1089 Property
.Flags
= KSPROPERTY_TYPE_SETSUPPORT
;
1091 return KsProperty(&Property
, sizeof(KSPROPERTY
), pTypeSupport
, sizeof(DWORD
), &BytesReturned
);
1095 //-------------------------------------------------------------------
1100 CInputPin::KsGetObjectHandle()
1106 //-------------------------------------------------------------------
1111 CInputPin::Connect(IPin
*pReceivePin
, const AM_MEDIA_TYPE
*pmt
)
1113 #ifdef KSPROXY_TRACE
1114 OutputDebugStringW(L
"CInputPin::Connect NotImplemented\n");
1121 CInputPin::ReceiveConnection(IPin
*pConnector
, const AM_MEDIA_TYPE
*pmt
)
1127 // already connected
1128 return VFW_E_ALREADY_CONNECTED
;
1131 // first check format
1132 hr
= CheckFormat(pmt
);
1135 // format is not supported
1139 hr
= CreatePin(pmt
);
1152 CInputPin::Disconnect( void)
1156 // pin was not connected
1161 //check if filter is active
1166 #ifdef KSPROXY_TRACE
1167 OutputDebugStringW(L
"CInputPin::Disconnect\n");
1174 CInputPin::ConnectedTo(IPin
**pPin
)
1181 // increment reference count
1188 return VFW_E_NOT_CONNECTED
;
1192 CInputPin::ConnectionMediaType(AM_MEDIA_TYPE
*pmt
)
1195 return VFW_E_NOT_CONNECTED
;
1197 #ifdef KSPROXY_TRACE
1198 OutputDebugStringW(L
"CInputPin::ConnectionMediaType NotImplemented\n");
1205 CInputPin::QueryPinInfo(PIN_INFO
*pInfo
)
1207 wcscpy(pInfo
->achName
, m_PinName
);
1208 pInfo
->dir
= PINDIR_INPUT
;
1209 pInfo
->pFilter
= m_ParentFilter
;
1210 m_ParentFilter
->AddRef();
1216 CInputPin::QueryDirection(PIN_DIRECTION
*pPinDir
)
1220 *pPinDir
= PINDIR_INPUT
;
1228 CInputPin::QueryId(LPWSTR
*Id
)
1230 *Id
= (LPWSTR
)CoTaskMemAlloc((wcslen(m_PinName
)+1)*sizeof(WCHAR
));
1232 return E_OUTOFMEMORY
;
1234 wcscpy(*Id
, m_PinName
);
1240 CInputPin::QueryAccept(
1241 const AM_MEDIA_TYPE
*pmt
)
1243 return CheckFormat(pmt
);
1247 CInputPin::EnumMediaTypes(IEnumMediaTypes
**ppEnum
)
1250 ULONG MediaTypeCount
= 0, Index
;
1251 AM_MEDIA_TYPE
* MediaTypes
;
1252 IKsObject
* KsObjectParent
;
1255 hr
= m_ParentFilter
->QueryInterface(IID_IKsObject
, (LPVOID
*)&KsObjectParent
);
1259 hFilter
= KsObjectParent
->KsGetObjectHandle();
1261 KsObjectParent
->Release();
1267 // query media type count
1268 hr
= KsGetMediaTypeCount(hFilter
, m_PinId
, &MediaTypeCount
);
1269 if (FAILED(hr
) || !MediaTypeCount
)
1272 // allocate media types
1273 MediaTypes
= (AM_MEDIA_TYPE
*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE
) * MediaTypeCount
);
1276 // not enough memory
1277 return E_OUTOFMEMORY
;
1281 ZeroMemory(MediaTypes
, sizeof(AM_MEDIA_TYPE
) * MediaTypeCount
);
1283 for(Index
= 0; Index
< MediaTypeCount
; Index
++)
1286 hr
= KsGetMediaType(Index
, &MediaTypes
[Index
], hFilter
, m_PinId
);
1290 CoTaskMemFree(MediaTypes
);
1295 return CEnumMediaTypes_fnConstructor(MediaTypeCount
, MediaTypes
, IID_IEnumMediaTypes
, (void**)ppEnum
);
1300 CInputPin::QueryInternalConnections(IPin
**apPin
, ULONG
*nPin
)
1302 #ifdef KSPROXY_TRACE
1303 OutputDebugStringW(L
"CInputPin::QueryInternalConnections NotImplemented\n");
1309 CInputPin::EndOfStream( void)
1311 #ifdef KSPROXY_TRACE
1312 OutputDebugStringW(L
"CInputPin::EndOfStream NotImplemented\n");
1318 CInputPin::BeginFlush( void)
1320 #ifdef KSPROXY_TRACE
1321 OutputDebugStringW(L
"CInputPin::BeginFlush NotImplemented\n");
1327 CInputPin::EndFlush( void)
1329 #ifdef KSPROXY_TRACE
1330 OutputDebugStringW(L
"CInputPin::EndFlush NotImplemented\n");
1336 CInputPin::NewSegment(REFERENCE_TIME tStart
, REFERENCE_TIME tStop
, double dRate
)
1338 #ifdef KSPROXY_TRACE
1339 OutputDebugStringW(L
"CInputPin::NewSegment NotImplemented\n");
1345 //-------------------------------------------------------------------
1348 CInputPin::CheckFormat(
1349 const AM_MEDIA_TYPE
*pmt
)
1351 PKSMULTIPLE_ITEM MultipleItem
;
1352 PKSDATAFORMAT DataFormat
;
1354 IKsObject
* KsObjectParent
;
1360 hr
= m_ParentFilter
->QueryInterface(IID_IKsObject
, (LPVOID
*)&KsObjectParent
);
1364 hFilter
= KsObjectParent
->KsGetObjectHandle();
1366 KsObjectParent
->Release();
1372 hr
= KsGetMultiplePinFactoryItems(hFilter
, m_PinId
, KSPROPERTY_PIN_DATARANGES
, (PVOID
*)&MultipleItem
);
1376 DataFormat
= (PKSDATAFORMAT
)(MultipleItem
+ 1);
1377 for(ULONG Index
= 0; Index
< MultipleItem
->Count
; Index
++)
1379 if (IsEqualGUID(pmt
->majortype
, DataFormat
->MajorFormat
) &&
1380 IsEqualGUID(pmt
->subtype
, DataFormat
->SubFormat
) &&
1381 IsEqualGUID(pmt
->formattype
, DataFormat
->Specifier
))
1383 // format is supported
1384 CoTaskMemFree(MultipleItem
);
1385 #ifdef KSPROXY_TRACE
1386 OutputDebugStringW(L
"CInputPin::CheckFormat format OK\n");
1390 DataFormat
= (PKSDATAFORMAT
)((ULONG_PTR
)DataFormat
+ DataFormat
->FormatSize
);
1392 //format is not supported
1393 CoTaskMemFree(MultipleItem
);
1399 CInputPin::CreatePin(
1400 const AM_MEDIA_TYPE
*pmt
)
1402 PKSMULTIPLE_ITEM MediumList
;
1403 PKSMULTIPLE_ITEM InterfaceList
;
1404 PKSPIN_MEDIUM Medium
;
1405 PKSPIN_INTERFACE Interface
;
1406 IKsInterfaceHandler
* InterfaceHandler
;
1409 // query for pin medium
1410 hr
= KsQueryMediums(&MediumList
);
1414 // query for pin interface
1415 hr
= KsQueryInterfaces(&InterfaceList
);
1419 CoTaskMemFree(MediumList
);
1423 if (MediumList
->Count
)
1425 //use first available medium
1426 Medium
= (PKSPIN_MEDIUM
)(MediumList
+ 1);
1430 // default to standard medium
1431 Medium
= &StandardPinMedium
;
1434 if (InterfaceList
->Count
)
1436 //use first available interface
1437 Interface
= (PKSPIN_INTERFACE
)(InterfaceList
+ 1);
1441 // default to standard interface
1442 Interface
= &StandardPinInterface
;
1445 if (m_Communication
!= KSPIN_COMMUNICATION_BRIDGE
&& m_Communication
!= KSPIN_COMMUNICATION_NONE
)
1447 if (!m_InterfaceHandler
)
1449 // now load the IKsInterfaceHandler plugin
1450 hr
= CoCreateInstance(Interface
->Set
, NULL
, CLSCTX_INPROC_SERVER
, IID_IKsInterfaceHandler
, (void**)&InterfaceHandler
);
1453 // failed to load interface handler plugin
1454 #ifdef KSPROXY_TRACE
1455 OutputDebugStringW(L
"CInputPin::CreatePin failed to load InterfaceHandlerPlugin\n");
1457 CoTaskMemFree(MediumList
);
1458 CoTaskMemFree(InterfaceList
);
1464 hr
= InterfaceHandler
->KsSetPin((IKsPin
*)this);
1467 // failed to load interface handler plugin
1468 #ifdef KSPROXY_TRACE
1469 OutputDebugStringW(L
"CInputPin::CreatePin failed to initialize InterfaceHandlerPlugin\n");
1471 InterfaceHandler
->Release();
1472 CoTaskMemFree(MediumList
);
1473 CoTaskMemFree(InterfaceList
);
1477 // store interface handler
1478 m_InterfaceHandler
= InterfaceHandler
;
1482 hr
= CreatePinHandle(Medium
, Interface
, pmt
);
1485 m_InterfaceHandler
->Release();
1486 m_InterfaceHandler
= InterfaceHandler
;
1491 #ifdef KSPROXY_TRACE
1493 swprintf(Buffer
, L
"CInputPin::CreatePin unexpected communication %u %s\n", m_Communication
, m_PinName
);
1494 OutputDebugStringW(Buffer
);
1499 // free medium / interface / dataformat
1500 CoTaskMemFree(MediumList
);
1501 CoTaskMemFree(InterfaceList
);
1508 CInputPin::CreatePinHandle(
1509 PKSPIN_MEDIUM Medium
,
1510 PKSPIN_INTERFACE Interface
,
1511 const AM_MEDIA_TYPE
*pmt
)
1513 PKSPIN_CONNECT PinConnect
;
1514 PKSDATAFORMAT DataFormat
;
1517 IKsObject
* KsObjectParent
;
1523 hr
= m_ParentFilter
->QueryInterface(IID_IKsObject
, (LPVOID
*)&KsObjectParent
);
1527 hFilter
= KsObjectParent
->KsGetObjectHandle();
1529 KsObjectParent
->Release();
1535 if (m_hPin
!= INVALID_HANDLE_VALUE
)
1537 // pin already exists
1538 //CloseHandle(m_hPin);
1539 //m_hPin = INVALID_HANDLE_VALUE;
1545 Length
= sizeof(KSPIN_CONNECT
) + sizeof(KSDATAFORMAT
) + pmt
->cbFormat
;
1547 // allocate pin connect
1548 PinConnect
= (PKSPIN_CONNECT
)CoTaskMemAlloc(Length
);
1552 return E_OUTOFMEMORY
;
1556 CopyMemory(&PinConnect
->Interface
, Interface
, sizeof(KSPIN_INTERFACE
));
1557 CopyMemory(&PinConnect
->Medium
, Medium
, sizeof(KSPIN_MEDIUM
));
1558 PinConnect
->PinId
= m_PinId
;
1559 PinConnect
->PinToHandle
= NULL
;
1560 PinConnect
->Priority
.PriorityClass
= KSPRIORITY_NORMAL
;
1561 PinConnect
->Priority
.PrioritySubClass
= KSPRIORITY_NORMAL
;
1563 // get dataformat offset
1564 DataFormat
= (PKSDATAFORMAT
)(PinConnect
+ 1);
1567 DataFormat
->FormatSize
= sizeof(KSDATAFORMAT
) + pmt
->cbFormat
;
1568 DataFormat
->Flags
= 0;
1569 DataFormat
->SampleSize
= pmt
->lSampleSize
;
1570 DataFormat
->Reserved
= 0;
1571 CopyMemory(&DataFormat
->MajorFormat
, &pmt
->majortype
, sizeof(GUID
));
1572 CopyMemory(&DataFormat
->SubFormat
, &pmt
->subtype
, sizeof(GUID
));
1573 CopyMemory(&DataFormat
->Specifier
, &pmt
->formattype
, sizeof(GUID
));
1577 // copy extended format
1578 CopyMemory((DataFormat
+ 1), pmt
->pbFormat
, pmt
->cbFormat
);
1582 hr
= KsCreatePin(hFilter
, PinConnect
, GENERIC_WRITE
, &m_hPin
);
1586 // store current interface / medium
1587 CopyMemory(&m_Medium
, Medium
, sizeof(KSPIN_MEDIUM
));
1588 CopyMemory(&m_Interface
, Interface
, sizeof(KSPIN_INTERFACE
));
1589 CopyMemory(&m_MediaFormat
, pmt
, sizeof(AM_MEDIA_TYPE
));
1591 #ifdef KSPROXY_TRACE
1592 LPOLESTR pMajor
, pSub
, pFormat
;
1593 StringFromIID(m_MediaFormat
.majortype
, &pMajor
);
1594 StringFromIID(m_MediaFormat
.subtype
, &pSub
);
1595 StringFromIID(m_MediaFormat
.formattype
, &pFormat
);
1598 swprintf(Buffer
, L
"CInputPin::CreatePinHandle Major %s SubType %s Format %s pbFormat %p cbFormat %u\n", pMajor
, pSub
, pFormat
, pmt
->pbFormat
, pmt
->cbFormat
);
1599 CoTaskMemFree(pMajor
);
1600 CoTaskMemFree(pSub
);
1601 CoTaskMemFree(pFormat
);
1602 OutputDebugStringW(Buffer
);
1607 m_MediaFormat
.pbFormat
= (BYTE
*)CoTaskMemAlloc(pmt
->cbFormat
);
1608 if (!m_MediaFormat
.pbFormat
)
1610 CoTaskMemFree(PinConnect
);
1611 m_MediaFormat
.pbFormat
= NULL
;
1612 m_MediaFormat
.cbFormat
= 0;
1613 return E_OUTOFMEMORY
;
1615 CopyMemory(m_MediaFormat
.pbFormat
, pmt
->pbFormat
, pmt
->cbFormat
);
1621 // get all supported sets
1622 hr
= GetSupportedSets(&pGuid
, &NumGuids
);
1625 #ifdef KSPROXY_TRACE
1626 OutputDebugStringW(L
"CInputPin::CreatePinHandle GetSupportedSets failed\n");
1631 // load all proxy plugins
1632 hr
= LoadProxyPlugins(pGuid
, NumGuids
);
1635 #ifdef KSPROXY_TRACE
1636 OutputDebugStringW(L
"CInputPin::CreatePinHandle LoadProxyPlugins failed\n");
1642 CoTaskMemFree(pGuid
);
1646 // connect pin pipes
1651 CoTaskMemFree(PinConnect
);
1658 CInputPin::GetSupportedSets(
1662 KSPROPERTY Property
;
1664 ULONG NumProperty
= 0;
1665 ULONG NumMethods
= 0;
1666 ULONG NumEvents
= 0;
1668 ULONG BytesReturned
;
1671 Property
.Set
= GUID_NULL
;
1673 Property
.Flags
= KSPROPERTY_TYPE_SETSUPPORT
;
1675 KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSPROPERTY
), NULL
, 0, &NumProperty
);
1676 KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_METHOD
, (PVOID
)&Property
, sizeof(KSPROPERTY
), NULL
, 0, &NumMethods
);
1677 KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_ENABLE_EVENT
, (PVOID
)&Property
, sizeof(KSPROPERTY
), NULL
, 0, &NumEvents
);
1679 Length
= NumProperty
+ NumMethods
+ NumEvents
;
1683 // allocate guid buffer
1684 pGuid
= (LPGUID
)CoTaskMemAlloc(Length
);
1688 return E_OUTOFMEMORY
;
1691 NumProperty
/= sizeof(GUID
);
1692 NumMethods
/= sizeof(GUID
);
1693 NumEvents
/= sizeof(GUID
);
1695 #ifdef KSPROXY_TRACE
1697 swprintf(Buffer
, L
"CInputPin::GetSupportedSets NumProperty %lu NumMethods %lu NumEvents %lu\n", NumProperty
, NumMethods
, NumEvents
);
1698 OutputDebugStringW(Buffer
);
1701 // get all properties
1702 hr
= KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSPROPERTY
), (PVOID
)pGuid
, Length
, &BytesReturned
);
1705 CoTaskMemFree(pGuid
);
1708 Length
-= BytesReturned
;
1711 if (Length
&& NumMethods
)
1713 hr
= KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_METHOD
, (PVOID
)&Property
, sizeof(KSPROPERTY
), (PVOID
)&pGuid
[NumProperty
], Length
, &BytesReturned
);
1716 CoTaskMemFree(pGuid
);
1719 Length
-= BytesReturned
;
1723 if (Length
&& NumEvents
)
1725 hr
= KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_ENABLE_EVENT
, (PVOID
)&Property
, sizeof(KSPROPERTY
), (PVOID
)&pGuid
[NumProperty
+NumMethods
], Length
, &BytesReturned
);
1728 CoTaskMemFree(pGuid
);
1731 Length
-= BytesReturned
;
1735 *NumGuids
= NumProperty
+NumEvents
+NumMethods
;
1741 CInputPin::LoadProxyPlugins(
1749 IUnknown
* pUnknown
;
1751 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, L
"SYSTEM\\CurrentControlSet\\Control\\MediaInterfaces", 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
)
1753 OutputDebugStringW(L
"CInputPin::LoadProxyPlugins failed to open MediaInterfaces key\n");
1757 // enumerate all sets
1758 for(Index
= 0; Index
< NumGuids
; Index
++)
1760 // convert to string
1761 hr
= StringFromCLSID(pGuids
[Index
], &pStr
);
1765 // now try open class key
1766 if (RegOpenKeyExW(hKey
, pStr
, 0, KEY_READ
, &hSubKey
) != ERROR_SUCCESS
)
1768 // no plugin for that set exists
1769 CoTaskMemFree(pStr
);
1774 hr
= CoCreateInstance(pGuids
[Index
], (IBaseFilter
*)this, CLSCTX_INPROC_SERVER
, IID_IUnknown
, (void**)&pUnknown
);
1778 m_Plugins
.push_back(pUnknown
);
1781 RegCloseKey(hSubKey
);
1784 // close media interfaces key
1791 CInputPin_Constructor(
1792 IBaseFilter
* ParentFilter
,
1796 KSPIN_COMMUNICATION Communication
,
1800 CInputPin
* handler
= new CInputPin(ParentFilter
, PinName
, PinId
, Communication
);
1803 return E_OUTOFMEMORY
;
1805 if (FAILED(handler
->QueryInterface(riid
, ppv
)))
1809 return E_NOINTERFACE
;