2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
4 * FILE: dll/directx/ksproxy/output_pin.cpp
5 * PURPOSE: OutputPin of Proxy Filter
7 * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
11 class COutputPin
: public IPin
,
13 public IKsPropertySet
,
14 public IStreamBuilder
,
16 public ISpecifyPropertyPages
,
20 public IKsAggregateControl
,
21 public IQualityControl
,
23 public IAMBufferNegotiation
,
24 public IAMStreamConfig
,
25 public IMemAllocatorNotifyCallbackTemp
29 STDMETHODIMP
QueryInterface( REFIID InterfaceId
, PVOID
* Interface
);
31 STDMETHODIMP_(ULONG
) AddRef()
33 InterlockedIncrement(&m_Ref
);
36 STDMETHODIMP_(ULONG
) Release()
38 InterlockedDecrement(&m_Ref
);
48 HRESULT STDMETHODCALLTYPE
KsQueryMediums(PKSMULTIPLE_ITEM
* MediumList
);
49 HRESULT STDMETHODCALLTYPE
KsQueryInterfaces(PKSMULTIPLE_ITEM
* InterfaceList
);
50 HRESULT STDMETHODCALLTYPE
KsCreateSinkPinHandle(KSPIN_INTERFACE
& Interface
, KSPIN_MEDIUM
& Medium
);
51 HRESULT STDMETHODCALLTYPE
KsGetCurrentCommunication(KSPIN_COMMUNICATION
*Communication
, KSPIN_INTERFACE
*Interface
, KSPIN_MEDIUM
*Medium
);
52 HRESULT STDMETHODCALLTYPE
KsPropagateAcquire();
53 HRESULT STDMETHODCALLTYPE
KsDeliver(IMediaSample
* Sample
, ULONG Flags
);
54 HRESULT STDMETHODCALLTYPE
KsMediaSamplesCompleted(PKSSTREAM_SEGMENT StreamSegment
);
55 IMemAllocator
* STDMETHODCALLTYPE
KsPeekAllocator(KSPEEKOPERATION Operation
);
56 HRESULT STDMETHODCALLTYPE
KsReceiveAllocator(IMemAllocator
*MemAllocator
);
57 HRESULT STDMETHODCALLTYPE
KsRenegotiateAllocator();
58 LONG STDMETHODCALLTYPE
KsIncrementPendingIoCount();
59 LONG STDMETHODCALLTYPE
KsDecrementPendingIoCount();
60 HRESULT STDMETHODCALLTYPE
KsQualityNotify(ULONG Proportion
, REFERENCE_TIME TimeDelta
);
62 VOID STDMETHODCALLTYPE
KsNotifyError(IMediaSample
* Sample
, HRESULT hr
);
65 HRESULT STDMETHODCALLTYPE
KsGetPinFramingCache(PKSALLOCATOR_FRAMING_EX
*FramingEx
, PFRAMING_PROP FramingProp
, FRAMING_CACHE_OPS Option
);
66 HRESULT STDMETHODCALLTYPE
KsSetPinFramingCache(PKSALLOCATOR_FRAMING_EX FramingEx
, PFRAMING_PROP FramingProp
, FRAMING_CACHE_OPS Option
);
67 IPin
* STDMETHODCALLTYPE
KsGetConnectedPin();
68 IKsAllocatorEx
* STDMETHODCALLTYPE
KsGetPipe(KSPEEKOPERATION Operation
);
69 HRESULT STDMETHODCALLTYPE
KsSetPipe(IKsAllocatorEx
*KsAllocator
);
70 ULONG STDMETHODCALLTYPE
KsGetPipeAllocatorFlag();
71 HRESULT STDMETHODCALLTYPE
KsSetPipeAllocatorFlag(ULONG Flag
);
72 GUID STDMETHODCALLTYPE
KsGetPinBusCache();
73 HRESULT STDMETHODCALLTYPE
KsSetPinBusCache(GUID Bus
);
74 PWCHAR STDMETHODCALLTYPE
KsGetPinName();
75 PWCHAR STDMETHODCALLTYPE
KsGetFilterName();
78 HRESULT STDMETHODCALLTYPE
Connect(IPin
*pReceivePin
, const AM_MEDIA_TYPE
*pmt
);
79 HRESULT STDMETHODCALLTYPE
ReceiveConnection(IPin
*pConnector
, const AM_MEDIA_TYPE
*pmt
);
80 HRESULT STDMETHODCALLTYPE
Disconnect();
81 HRESULT STDMETHODCALLTYPE
ConnectedTo(IPin
**pPin
);
82 HRESULT STDMETHODCALLTYPE
ConnectionMediaType(AM_MEDIA_TYPE
*pmt
);
83 HRESULT STDMETHODCALLTYPE
QueryPinInfo(PIN_INFO
*pInfo
);
84 HRESULT STDMETHODCALLTYPE
QueryDirection(PIN_DIRECTION
*pPinDir
);
85 HRESULT STDMETHODCALLTYPE
QueryId(LPWSTR
*Id
);
86 HRESULT STDMETHODCALLTYPE
QueryAccept(const AM_MEDIA_TYPE
*pmt
);
87 HRESULT STDMETHODCALLTYPE
EnumMediaTypes(IEnumMediaTypes
**ppEnum
);
88 HRESULT STDMETHODCALLTYPE
QueryInternalConnections(IPin
**apPin
, ULONG
*nPin
);
89 HRESULT STDMETHODCALLTYPE
EndOfStream();
90 HRESULT STDMETHODCALLTYPE
BeginFlush();
91 HRESULT STDMETHODCALLTYPE
EndFlush();
92 HRESULT STDMETHODCALLTYPE
NewSegment(REFERENCE_TIME tStart
, REFERENCE_TIME tStop
, double dRate
);
94 // ISpecifyPropertyPages
95 HRESULT STDMETHODCALLTYPE
GetPages(CAUUID
*pPages
);
98 HANDLE STDMETHODCALLTYPE
KsGetObjectHandle();
101 HRESULT STDMETHODCALLTYPE
Set(REFGUID guidPropSet
, DWORD dwPropID
, LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
, DWORD cbPropData
);
102 HRESULT STDMETHODCALLTYPE
Get(REFGUID guidPropSet
, DWORD dwPropID
, LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
, DWORD cbPropData
, DWORD
*pcbReturned
);
103 HRESULT STDMETHODCALLTYPE
QuerySupported(REFGUID guidPropSet
, DWORD dwPropID
, DWORD
*pTypeSupport
);
106 HRESULT STDMETHODCALLTYPE
KsProperty(PKSPROPERTY Property
, ULONG PropertyLength
, LPVOID PropertyData
, ULONG DataLength
, ULONG
* BytesReturned
);
107 HRESULT STDMETHODCALLTYPE
KsMethod(PKSMETHOD Method
, ULONG MethodLength
, LPVOID MethodData
, ULONG DataLength
, ULONG
* BytesReturned
);
108 HRESULT STDMETHODCALLTYPE
KsEvent(PKSEVENT Event
, ULONG EventLength
, LPVOID EventData
, ULONG DataLength
, ULONG
* BytesReturned
);
111 HRESULT STDMETHODCALLTYPE
Render(IPin
*ppinOut
, IGraphBuilder
*pGraph
);
112 HRESULT STDMETHODCALLTYPE
Backout(IPin
*ppinOut
, IGraphBuilder
*pGraph
);
115 HRESULT STDMETHODCALLTYPE
KsPinFactory(ULONG
* PinFactory
);
117 //IKsAggregateControl
118 HRESULT STDMETHODCALLTYPE
KsAddAggregate(IN REFGUID AggregateClass
);
119 HRESULT STDMETHODCALLTYPE
KsRemoveAggregate(REFGUID AggregateClass
);
122 HRESULT STDMETHODCALLTYPE
Notify(IBaseFilter
*pSelf
, Quality q
);
123 HRESULT STDMETHODCALLTYPE
SetSink(IQualityControl
*piqc
);
126 HRESULT STDMETHODCALLTYPE
GetCapabilities(DWORD
*pCapabilities
);
127 HRESULT STDMETHODCALLTYPE
CheckCapabilities(DWORD
*pCapabilities
);
128 HRESULT STDMETHODCALLTYPE
IsFormatSupported(const GUID
*pFormat
);
129 HRESULT STDMETHODCALLTYPE
QueryPreferredFormat(GUID
*pFormat
);
130 HRESULT STDMETHODCALLTYPE
GetTimeFormat(GUID
*pFormat
);
131 HRESULT STDMETHODCALLTYPE
IsUsingTimeFormat(const GUID
*pFormat
);
132 HRESULT STDMETHODCALLTYPE
SetTimeFormat(const GUID
*pFormat
);
133 HRESULT STDMETHODCALLTYPE
GetDuration(LONGLONG
*pDuration
);
134 HRESULT STDMETHODCALLTYPE
GetStopPosition(LONGLONG
*pStop
);
135 HRESULT STDMETHODCALLTYPE
GetCurrentPosition(LONGLONG
*pCurrent
);
136 HRESULT STDMETHODCALLTYPE
ConvertTimeFormat(LONGLONG
*pTarget
, const GUID
*pTargetFormat
, LONGLONG Source
, const GUID
*pSourceFormat
);
137 HRESULT STDMETHODCALLTYPE
SetPositions(LONGLONG
*pCurrent
, DWORD dwCurrentFlags
, LONGLONG
*pStop
, DWORD dwStopFlags
);
138 HRESULT STDMETHODCALLTYPE
GetPositions(LONGLONG
*pCurrent
, LONGLONG
*pStop
);
139 HRESULT STDMETHODCALLTYPE
GetAvailable(LONGLONG
*pEarliest
, LONGLONG
*pLatest
);
140 HRESULT STDMETHODCALLTYPE
SetRate(double dRate
);
141 HRESULT STDMETHODCALLTYPE
GetRate(double *pdRate
);
142 HRESULT STDMETHODCALLTYPE
GetPreroll(LONGLONG
*pllPreroll
);
144 //IAMBufferNegotiation
145 HRESULT STDMETHODCALLTYPE
SuggestAllocatorProperties(const ALLOCATOR_PROPERTIES
*pprop
);
146 HRESULT STDMETHODCALLTYPE
GetAllocatorProperties(ALLOCATOR_PROPERTIES
*pprop
);
149 HRESULT STDMETHODCALLTYPE
SetFormat(AM_MEDIA_TYPE
*pmt
);
150 HRESULT STDMETHODCALLTYPE
GetFormat(AM_MEDIA_TYPE
**ppmt
);
151 HRESULT STDMETHODCALLTYPE
GetNumberOfCapabilities(int *piCount
, int *piSize
);
152 HRESULT STDMETHODCALLTYPE
GetStreamCaps(int iIndex
, AM_MEDIA_TYPE
**ppmt
, BYTE
*pSCC
);
154 //IMemAllocatorNotifyCallbackTemp
155 HRESULT STDMETHODCALLTYPE
NotifyRelease();
157 COutputPin(IBaseFilter
* ParentFilter
, LPCWSTR PinName
, ULONG PinId
);
158 virtual ~COutputPin();
162 IBaseFilter
* m_ParentFilter
;
166 IKsObject
* m_KsObjectParent
;
168 IKsAllocatorEx
* m_KsAllocatorEx
;
169 ULONG m_PipeAllocatorFlag
;
170 BOOL m_bPinBusCacheInitialized
;
173 FRAMING_PROP m_FramingProp
[4];
174 PKSALLOCATOR_FRAMING_EX m_FramingEx
[4];
176 IMemAllocator
* m_MemAllocator
;
178 KSPIN_COMMUNICATION m_Communication
;
179 KSPIN_INTERFACE m_Interface
;
180 KSPIN_MEDIUM m_Medium
;
181 IMediaSeeking
* m_FilterMediaSeeking
;
184 COutputPin::~COutputPin()
186 if (m_KsObjectParent
)
187 m_KsObjectParent
->Release();
190 COutputPin::COutputPin(
191 IBaseFilter
* ParentFilter
,
193 ULONG PinId
) : m_Ref(0),
194 m_ParentFilter(ParentFilter
),
196 m_hPin(INVALID_HANDLE_VALUE
),
201 m_PipeAllocatorFlag(0),
202 m_bPinBusCacheInitialized(0),
206 m_Communication(KSPIN_COMMUNICATION_NONE
),
207 m_FilterMediaSeeking(0)
211 hr
= m_ParentFilter
->QueryInterface(IID_IKsObject
, (LPVOID
*)&m_KsObjectParent
);
214 hr
= m_ParentFilter
->QueryInterface(IID_IMediaSeeking
, (LPVOID
*)&m_FilterMediaSeeking
);
217 ZeroMemory(m_FramingProp
, sizeof(m_FramingProp
));
218 ZeroMemory(m_FramingEx
, sizeof(m_FramingEx
));
223 COutputPin::QueryInterface(
228 if (IsEqualGUID(refiid
, IID_IUnknown
) ||
229 IsEqualGUID(refiid
, IID_IPin
))
231 OutputDebugStringW(L
"COutputPin::QueryInterface IID_IPin\n");
232 *Output
= PVOID(this);
233 reinterpret_cast<IUnknown
*>(*Output
)->AddRef();
236 else if (IsEqualGUID(refiid
, IID_IKsObject
))
238 OutputDebugStringW(L
"COutputPin::QueryInterface IID_IKsObject\n");
239 *Output
= (IKsObject
*)(this);
240 reinterpret_cast<IKsObject
*>(*Output
)->AddRef();
243 else if (IsEqualGUID(refiid
, IID_IKsPin
) || IsEqualGUID(refiid
, IID_IKsPinEx
))
245 *Output
= (IKsPinEx
*)(this);
246 reinterpret_cast<IKsPinEx
*>(*Output
)->AddRef();
249 else if (IsEqualGUID(refiid
, IID_IKsPinPipe
))
251 *Output
= (IKsPinPipe
*)(this);
252 reinterpret_cast<IKsPinPipe
*>(*Output
)->AddRef();
255 else if (IsEqualGUID(refiid
, IID_IKsAggregateControl
))
257 *Output
= (IKsAggregateControl
*)(this);
258 reinterpret_cast<IKsAggregateControl
*>(*Output
)->AddRef();
261 else if (IsEqualGUID(refiid
, IID_IQualityControl
))
263 *Output
= (IQualityControl
*)(this);
264 reinterpret_cast<IQualityControl
*>(*Output
)->AddRef();
267 else if (IsEqualGUID(refiid
, IID_IKsPropertySet
))
269 OutputDebugStringW(L
"COutputPin::QueryInterface IID_IKsPropertySet\n");
271 *Output
= (IKsPropertySet
*)(this);
272 reinterpret_cast<IKsPropertySet
*>(*Output
)->AddRef();
275 else if (IsEqualGUID(refiid
, IID_IKsControl
))
277 OutputDebugStringW(L
"COutputPin::QueryInterface IID_IKsControl\n");
278 *Output
= (IKsControl
*)(this);
279 reinterpret_cast<IKsControl
*>(*Output
)->AddRef();
283 else if (IsEqualGUID(refiid
, IID_IStreamBuilder
))
285 *Output
= (IStreamBuilder
*)(this);
286 reinterpret_cast<IStreamBuilder
*>(*Output
)->AddRef();
290 else if (IsEqualGUID(refiid
, IID_IKsPinFactory
))
292 OutputDebugStringW(L
"COutputPin::QueryInterface IID_IKsPinFactory\n");
293 *Output
= (IKsPinFactory
*)(this);
294 reinterpret_cast<IKsPinFactory
*>(*Output
)->AddRef();
297 else if (IsEqualGUID(refiid
, IID_ISpecifyPropertyPages
))
299 OutputDebugStringW(L
"COutputPin::QueryInterface IID_ISpecifyPropertyPages\n");
300 *Output
= (ISpecifyPropertyPages
*)(this);
301 reinterpret_cast<ISpecifyPropertyPages
*>(*Output
)->AddRef();
304 else if (IsEqualGUID(refiid
, IID_IMediaSeeking
))
306 *Output
= (IMediaSeeking
*)(this);
307 reinterpret_cast<IMediaSeeking
*>(*Output
)->AddRef();
310 else if (IsEqualGUID(refiid
, IID_IAMBufferNegotiation
))
312 *Output
= (IAMBufferNegotiation
*)(this);
313 reinterpret_cast<IAMBufferNegotiation
*>(*Output
)->AddRef();
316 else if (IsEqualGUID(refiid
, IID_IAMStreamConfig
))
318 *Output
= (IAMStreamConfig
*)(this);
319 reinterpret_cast<IAMStreamConfig
*>(*Output
)->AddRef();
322 else if (IsEqualGUID(refiid
, IID_IMemAllocatorNotifyCallbackTemp
))
324 *Output
= (IMemAllocatorNotifyCallbackTemp
*)(this);
325 reinterpret_cast<IMemAllocatorNotifyCallbackTemp
*>(*Output
)->AddRef();
329 WCHAR Buffer
[MAX_PATH
];
331 StringFromCLSID(refiid
, &lpstr
);
332 swprintf(Buffer
, L
"COutputPin::QueryInterface: NoInterface for %s\n", lpstr
);
333 OutputDebugStringW(Buffer
);
334 CoTaskMemFree(lpstr
);
336 return E_NOINTERFACE
;
339 //-------------------------------------------------------------------
340 // IAMBufferNegotiation interface
344 COutputPin::SuggestAllocatorProperties(
345 const ALLOCATOR_PROPERTIES
*pprop
)
347 OutputDebugStringW(L
"COutputPin::SuggestAllocatorProperties NotImplemented\n");
353 COutputPin::GetAllocatorProperties(
354 ALLOCATOR_PROPERTIES
*pprop
)
356 OutputDebugStringW(L
"COutputPin::GetAllocatorProperties NotImplemented\n");
360 //-------------------------------------------------------------------
361 // IAMStreamConfig interface
365 COutputPin::SetFormat(
368 OutputDebugStringW(L
"COutputPin::SetFormat NotImplemented\n");
374 COutputPin::GetFormat(AM_MEDIA_TYPE
**ppmt
)
376 OutputDebugStringW(L
"COutputPin::GetFormat NotImplemented\n");
382 COutputPin::GetNumberOfCapabilities(
386 OutputDebugStringW(L
"COutputPin::GetNumberOfCapabilities NotImplemented\n");
392 COutputPin::GetStreamCaps(
394 AM_MEDIA_TYPE
**ppmt
,
397 OutputDebugStringW(L
"COutputPin::GetStreamCaps NotImplemented\n");
401 //-------------------------------------------------------------------
402 // IMemAllocatorNotifyCallbackTemp interface
406 COutputPin::NotifyRelease()
408 OutputDebugStringW(L
"COutputPin::NotifyRelease NotImplemented\n");
412 //-------------------------------------------------------------------
413 // IMediaSeeking interface
417 COutputPin::GetCapabilities(
418 DWORD
*pCapabilities
)
420 return m_FilterMediaSeeking
->GetCapabilities(pCapabilities
);
425 COutputPin::CheckCapabilities(
426 DWORD
*pCapabilities
)
428 return m_FilterMediaSeeking
->CheckCapabilities(pCapabilities
);
433 COutputPin::IsFormatSupported(
436 return m_FilterMediaSeeking
->IsFormatSupported(pFormat
);
441 COutputPin::QueryPreferredFormat(
444 return m_FilterMediaSeeking
->QueryPreferredFormat(pFormat
);
449 COutputPin::GetTimeFormat(
452 return m_FilterMediaSeeking
->GetTimeFormat(pFormat
);
457 COutputPin::IsUsingTimeFormat(
460 return m_FilterMediaSeeking
->IsUsingTimeFormat(pFormat
);
465 COutputPin::SetTimeFormat(
468 return m_FilterMediaSeeking
->SetTimeFormat(pFormat
);
473 COutputPin::GetDuration(
476 return m_FilterMediaSeeking
->GetDuration(pDuration
);
481 COutputPin::GetStopPosition(
484 return m_FilterMediaSeeking
->GetStopPosition(pStop
);
490 COutputPin::GetCurrentPosition(
493 return m_FilterMediaSeeking
->GetCurrentPosition(pCurrent
);
498 COutputPin::ConvertTimeFormat(
500 const GUID
*pTargetFormat
,
502 const GUID
*pSourceFormat
)
504 return m_FilterMediaSeeking
->ConvertTimeFormat(pTarget
, pTargetFormat
, Source
, pSourceFormat
);
509 COutputPin::SetPositions(
511 DWORD dwCurrentFlags
,
515 return m_FilterMediaSeeking
->SetPositions(pCurrent
, dwCurrentFlags
, pStop
, dwStopFlags
);
520 COutputPin::GetPositions(
524 return m_FilterMediaSeeking
->GetPositions(pCurrent
, pStop
);
529 COutputPin::GetAvailable(
533 return m_FilterMediaSeeking
->GetAvailable(pEarliest
, pLatest
);
541 return m_FilterMediaSeeking
->SetRate(dRate
);
549 return m_FilterMediaSeeking
->GetRate(pdRate
);
554 COutputPin::GetPreroll(
555 LONGLONG
*pllPreroll
)
557 return m_FilterMediaSeeking
->GetPreroll(pllPreroll
);
560 //-------------------------------------------------------------------
561 // IQualityControl interface
569 OutputDebugStringW(L
"COutputPin::Notify NotImplemented\n");
576 IQualityControl
*piqc
)
578 OutputDebugStringW(L
"COutputPin::SetSink NotImplemented\n");
583 //-------------------------------------------------------------------
584 // IKsAggregateControl interface
588 COutputPin::KsAddAggregate(
589 IN REFGUID AggregateClass
)
591 OutputDebugStringW(L
"COutputPin::KsAddAggregate NotImplemented\n");
597 COutputPin::KsRemoveAggregate(
598 REFGUID AggregateClass
)
600 OutputDebugStringW(L
"COutputPin::KsRemoveAggregate NotImplemented\n");
605 //-------------------------------------------------------------------
611 COutputPin::KsQueryMediums(
612 PKSMULTIPLE_ITEM
* MediumList
)
614 HANDLE hFilter
= m_KsObjectParent
->KsGetObjectHandle();
615 return KsGetMultiplePinFactoryItems(hFilter
, m_PinId
, KSPROPERTY_PIN_MEDIUMS
, (PVOID
*)MediumList
);
620 COutputPin::KsQueryInterfaces(
621 PKSMULTIPLE_ITEM
* InterfaceList
)
623 HANDLE hFilter
= m_KsObjectParent
->KsGetObjectHandle();
625 return KsGetMultiplePinFactoryItems(hFilter
, m_PinId
, KSPROPERTY_PIN_INTERFACES
, (PVOID
*)InterfaceList
);
630 COutputPin::KsCreateSinkPinHandle(
631 KSPIN_INTERFACE
& Interface
,
632 KSPIN_MEDIUM
& Medium
)
634 OutputDebugStringW(L
"COutputPin::KsCreateSinkPinHandle NotImplemented\n");
640 COutputPin::KsGetCurrentCommunication(
641 KSPIN_COMMUNICATION
*Communication
,
642 KSPIN_INTERFACE
*Interface
,
643 KSPIN_MEDIUM
*Medium
)
647 *Communication
= m_Communication
;
653 return VFW_E_NOT_CONNECTED
;
655 CopyMemory(Interface
, &m_Interface
, sizeof(KSPIN_INTERFACE
));
661 return VFW_E_NOT_CONNECTED
;
663 CopyMemory(Medium
, &m_Medium
, sizeof(KSPIN_MEDIUM
));
670 COutputPin::KsPropagateAcquire()
672 OutputDebugStringW(L
"COutputPin::KsPropagateAcquire NotImplemented\n");
678 COutputPin::KsDeliver(
679 IMediaSample
* Sample
,
687 COutputPin::KsMediaSamplesCompleted(PKSSTREAM_SEGMENT StreamSegment
)
694 COutputPin::KsPeekAllocator(KSPEEKOPERATION Operation
)
696 if (Operation
== KsPeekOperation_AddRef
)
698 // add reference on allocator
699 m_MemAllocator
->AddRef();
702 return m_MemAllocator
;
707 COutputPin::KsReceiveAllocator(IMemAllocator
*MemAllocator
)
711 MemAllocator
->AddRef();
716 m_MemAllocator
->Release();
719 m_MemAllocator
= MemAllocator
;
725 COutputPin::KsRenegotiateAllocator()
732 COutputPin::KsIncrementPendingIoCount()
734 return InterlockedIncrement((volatile LONG
*)&m_IoCount
);
739 COutputPin::KsDecrementPendingIoCount()
741 return InterlockedDecrement((volatile LONG
*)&m_IoCount
);
746 COutputPin::KsQualityNotify(
748 REFERENCE_TIME TimeDelta
)
750 OutputDebugStringW(L
"COutputPin::KsQualityNotify NotImplemented\n");
754 //-------------------------------------------------------------------
760 COutputPin::KsNotifyError(
761 IMediaSample
* Sample
,
764 OutputDebugStringW(L
"COutputPin::KsNotifyError NotImplemented\n");
768 //-------------------------------------------------------------------
774 COutputPin::KsGetPinFramingCache(
775 PKSALLOCATOR_FRAMING_EX
*FramingEx
,
776 PFRAMING_PROP FramingProp
,
777 FRAMING_CACHE_OPS Option
)
779 if (Option
> Framing_Cache_Write
|| Option
< Framing_Cache_ReadLast
)
785 // get framing properties
786 *FramingProp
= m_FramingProp
[Option
];
787 *FramingEx
= m_FramingEx
[Option
];
794 COutputPin::KsSetPinFramingCache(
795 PKSALLOCATOR_FRAMING_EX FramingEx
,
796 PFRAMING_PROP FramingProp
,
797 FRAMING_CACHE_OPS Option
)
802 if (m_FramingEx
[Option
])
804 for(Index
= 1; Index
< 4; Index
++)
806 if (m_FramingEx
[Index
] == m_FramingEx
[Option
])
812 // existing framing is only used once
813 CoTaskMemFree(m_FramingEx
[Option
]);
818 m_FramingEx
[Option
] = FramingEx
;
819 m_FramingProp
[Option
] = *FramingProp
;
826 COutputPin::KsGetConnectedPin()
833 COutputPin::KsGetPipe(
834 KSPEEKOPERATION Operation
)
836 if (Operation
== KsPeekOperation_AddRef
)
839 m_KsAllocatorEx
->AddRef();
841 return m_KsAllocatorEx
;
846 COutputPin::KsSetPipe(
847 IKsAllocatorEx
*KsAllocator
)
850 KsAllocator
->AddRef();
853 m_KsAllocatorEx
->Release();
855 m_KsAllocatorEx
= KsAllocator
;
861 COutputPin::KsGetPipeAllocatorFlag()
863 return m_PipeAllocatorFlag
;
869 COutputPin::KsSetPipeAllocatorFlag(
872 m_PipeAllocatorFlag
= Flag
;
878 COutputPin::KsGetPinBusCache()
880 if (!m_bPinBusCacheInitialized
)
882 CopyMemory(&m_PinBusCache
, &m_Medium
.Set
, sizeof(GUID
));
883 m_bPinBusCacheInitialized
= TRUE
;
886 return m_PinBusCache
;
891 COutputPin::KsSetPinBusCache(
894 CopyMemory(&m_PinBusCache
, &Bus
, sizeof(GUID
));
900 COutputPin::KsGetPinName()
902 return (PWCHAR
)m_PinName
;
908 COutputPin::KsGetFilterName()
913 //-------------------------------------------------------------------
914 // ISpecifyPropertyPages
919 COutputPin::GetPages(CAUUID
*pPages
)
921 OutputDebugStringW(L
"COutputPin::GetPages NotImplemented\n");
927 pPages
->pElems
= NULL
;
932 //-------------------------------------------------------------------
938 COutputPin::KsPinFactory(
941 OutputDebugStringW(L
"COutputPin::KsPinFactory\n");
942 *PinFactory
= m_PinId
;
947 //-------------------------------------------------------------------
955 IGraphBuilder
*pGraph
)
957 OutputDebugStringW(L
"COutputPin::Render\n");
965 IGraphBuilder
*pGraph
)
967 OutputDebugStringW(L
"COutputPin::Backout\n");
970 //-------------------------------------------------------------------
975 COutputPin::KsGetObjectHandle()
977 OutputDebugStringW(L
"COutputPin::KsGetObjectHandle\n");
982 //-------------------------------------------------------------------
987 COutputPin::KsProperty(
988 PKSPROPERTY Property
,
989 ULONG PropertyLength
,
992 ULONG
* BytesReturned
)
995 OutputDebugStringW(L
"COutputPin::KsProperty\n");
996 return KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_PROPERTY
, (PVOID
)Property
, PropertyLength
, (PVOID
)PropertyData
, DataLength
, BytesReturned
);
1001 COutputPin::KsMethod(
1006 ULONG
* BytesReturned
)
1008 assert(m_hPin
!= 0);
1009 OutputDebugStringW(L
"COutputPin::KsMethod\n");
1010 return KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_METHOD
, (PVOID
)Method
, MethodLength
, (PVOID
)MethodData
, DataLength
, BytesReturned
);
1015 COutputPin::KsEvent(
1020 ULONG
* BytesReturned
)
1022 assert(m_hPin
!= 0);
1024 OutputDebugStringW(L
"COutputPin::KsEvent\n");
1027 return KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_ENABLE_EVENT
, (PVOID
)Event
, EventLength
, (PVOID
)EventData
, DataLength
, BytesReturned
);
1029 return KsSynchronousDeviceControl(m_hPin
, IOCTL_KS_DISABLE_EVENT
, (PVOID
)Event
, EventLength
, NULL
, 0, BytesReturned
);
1033 //-------------------------------------------------------------------
1039 REFGUID guidPropSet
,
1041 LPVOID pInstanceData
,
1042 DWORD cbInstanceData
,
1046 ULONG BytesReturned
;
1048 OutputDebugStringW(L
"COutputPin::Set\n");
1052 PKSPROPERTY Property
= (PKSPROPERTY
)CoTaskMemAlloc(sizeof(KSPROPERTY
) + cbInstanceData
);
1054 return E_OUTOFMEMORY
;
1056 Property
->Set
= guidPropSet
;
1057 Property
->Id
= dwPropID
;
1058 Property
->Flags
= KSPROPERTY_TYPE_SET
;
1060 CopyMemory((Property
+1), pInstanceData
, cbInstanceData
);
1062 HRESULT hr
= KsProperty(Property
, sizeof(KSPROPERTY
) + cbInstanceData
, pPropData
, cbPropData
, &BytesReturned
);
1063 CoTaskMemFree(Property
);
1068 KSPROPERTY Property
;
1070 Property
.Set
= guidPropSet
;
1071 Property
.Id
= dwPropID
;
1072 Property
.Flags
= KSPROPERTY_TYPE_SET
;
1074 HRESULT hr
= KsProperty(&Property
, sizeof(KSPROPERTY
), pPropData
, cbPropData
, &BytesReturned
);
1082 REFGUID guidPropSet
,
1084 LPVOID pInstanceData
,
1085 DWORD cbInstanceData
,
1090 ULONG BytesReturned
;
1092 OutputDebugStringW(L
"COutputPin::Get\n");
1096 PKSPROPERTY Property
= (PKSPROPERTY
)CoTaskMemAlloc(sizeof(KSPROPERTY
) + cbInstanceData
);
1098 return E_OUTOFMEMORY
;
1100 Property
->Set
= guidPropSet
;
1101 Property
->Id
= dwPropID
;
1102 Property
->Flags
= KSPROPERTY_TYPE_GET
;
1104 CopyMemory((Property
+1), pInstanceData
, cbInstanceData
);
1106 HRESULT hr
= KsProperty(Property
, sizeof(KSPROPERTY
) + cbInstanceData
, pPropData
, cbPropData
, &BytesReturned
);
1107 CoTaskMemFree(Property
);
1112 KSPROPERTY Property
;
1114 Property
.Set
= guidPropSet
;
1115 Property
.Id
= dwPropID
;
1116 Property
.Flags
= KSPROPERTY_TYPE_GET
;
1118 HRESULT hr
= KsProperty(&Property
, sizeof(KSPROPERTY
), pPropData
, cbPropData
, &BytesReturned
);
1125 COutputPin::QuerySupported(
1126 REFGUID guidPropSet
,
1128 DWORD
*pTypeSupport
)
1130 KSPROPERTY Property
;
1131 ULONG BytesReturned
;
1133 OutputDebugStringW(L
"COutputPin::QuerySupported\n");
1135 Property
.Set
= guidPropSet
;
1136 Property
.Id
= dwPropID
;
1137 Property
.Flags
= KSPROPERTY_TYPE_SETSUPPORT
;
1139 return KsProperty(&Property
, sizeof(KSPROPERTY
), pTypeSupport
, sizeof(DWORD
), &BytesReturned
);
1143 //-------------------------------------------------------------------
1148 COutputPin::Connect(IPin
*pReceivePin
, const AM_MEDIA_TYPE
*pmt
)
1150 AM_MEDIA_TYPE MediaType
;
1154 OutputDebugStringW(L
"COutputPin::Connect called\n");
1157 hr
= pReceivePin
->QueryAccept(pmt
);
1163 // get parent filter handle
1164 hFilter
= m_KsObjectParent
->KsGetObjectHandle();
1166 // get media type count
1167 ZeroMemory(&MediaType
, sizeof(AM_MEDIA_TYPE
));
1168 hr
= KsGetMediaType(0, &MediaType
, hFilter
, m_PinId
);
1173 hr
= pReceivePin
->QueryAccept(&MediaType
);
1180 //FIXME create pin handle
1182 // receive connection;
1183 hr
= pReceivePin
->ReceiveConnection((IPin
*)this, pmt
);
1186 // increment reference count
1187 pReceivePin
->AddRef();
1188 m_Pin
= pReceivePin
;
1189 OutputDebugStringW(L
"COutputPin::Connect success\n");
1197 COutputPin::ReceiveConnection(IPin
*pConnector
, const AM_MEDIA_TYPE
*pmt
)
1199 OutputDebugStringW(L
"COutputPin::ReceiveConnection\n");
1200 return E_UNEXPECTED
;
1204 COutputPin::Disconnect( void)
1206 OutputDebugStringW(L
"COutputPin::Disconnect\n");
1210 // pin was not connected
1215 //check if filter is active
1220 OutputDebugStringW(L
"COutputPin::Disconnect\n");
1225 COutputPin::ConnectedTo(IPin
**pPin
)
1227 OutputDebugStringW(L
"COutputPin::ConnectedTo\n");
1234 // increment reference count
1241 return VFW_E_NOT_CONNECTED
;
1245 COutputPin::ConnectionMediaType(AM_MEDIA_TYPE
*pmt
)
1247 OutputDebugStringW(L
"COutputPin::ConnectionMediaType called\n");
1252 COutputPin::QueryPinInfo(PIN_INFO
*pInfo
)
1254 OutputDebugStringW(L
"COutputPin::QueryPinInfo\n");
1256 wcscpy(pInfo
->achName
, m_PinName
);
1257 pInfo
->dir
= PINDIR_OUTPUT
;
1258 pInfo
->pFilter
= m_ParentFilter
;
1259 m_ParentFilter
->AddRef();
1265 COutputPin::QueryDirection(PIN_DIRECTION
*pPinDir
)
1267 OutputDebugStringW(L
"COutputPin::QueryDirection\n");
1271 *pPinDir
= PINDIR_OUTPUT
;
1279 COutputPin::QueryId(LPWSTR
*Id
)
1281 OutputDebugStringW(L
"COutputPin::QueryId\n");
1283 *Id
= (LPWSTR
)CoTaskMemAlloc((wcslen(m_PinName
)+1)*sizeof(WCHAR
));
1285 return E_OUTOFMEMORY
;
1287 wcscpy(*Id
, m_PinName
);
1292 COutputPin::QueryAccept(const AM_MEDIA_TYPE
*pmt
)
1294 OutputDebugStringW(L
"COutputPin::QueryAccept called\n");
1299 COutputPin::EnumMediaTypes(IEnumMediaTypes
**ppEnum
)
1302 ULONG MediaTypeCount
= 0, Index
;
1303 AM_MEDIA_TYPE
* MediaTypes
;
1306 OutputDebugStringW(L
"COutputPin::EnumMediaTypes called\n");
1308 if (!m_KsObjectParent
)
1311 return E_NOINTERFACE
;
1314 // get parent filter handle
1315 hFilter
= m_KsObjectParent
->KsGetObjectHandle();
1317 // query media type count
1318 hr
= KsGetMediaTypeCount(hFilter
, m_PinId
, &MediaTypeCount
);
1319 if (FAILED(hr
) || !MediaTypeCount
)
1321 OutputDebugStringW(L
"COutputPin::EnumMediaTypes failed1\n");
1325 // allocate media types
1326 MediaTypes
= (AM_MEDIA_TYPE
*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE
) * MediaTypeCount
);
1329 // not enough memory
1330 OutputDebugStringW(L
"COutputPin::EnumMediaTypes CoTaskMemAlloc\n");
1331 return E_OUTOFMEMORY
;
1335 ZeroMemory(MediaTypes
, sizeof(AM_MEDIA_TYPE
) * MediaTypeCount
);
1337 for(Index
= 0; Index
< MediaTypeCount
; Index
++)
1340 hr
= KsGetMediaType(Index
, &MediaTypes
[Index
], hFilter
, m_PinId
);
1344 CoTaskMemFree(MediaTypes
);
1345 OutputDebugStringW(L
"COutputPin::EnumMediaTypes failed\n");
1350 return CEnumMediaTypes_fnConstructor(MediaTypeCount
, MediaTypes
, IID_IEnumMediaTypes
, (void**)ppEnum
);
1354 COutputPin::QueryInternalConnections(IPin
**apPin
, ULONG
*nPin
)
1356 OutputDebugStringW(L
"COutputPin::QueryInternalConnections called\n");
1361 COutputPin::EndOfStream( void)
1363 OutputDebugStringW(L
"COutputPin::EndOfStream called\n");
1368 COutputPin::BeginFlush( void)
1370 OutputDebugStringW(L
"COutputPin::BeginFlush called\n");
1375 COutputPin::EndFlush( void)
1377 OutputDebugStringW(L
"COutputPin::EndFlush called\n");
1382 COutputPin::NewSegment(REFERENCE_TIME tStart
, REFERENCE_TIME tStop
, double dRate
)
1384 OutputDebugStringW(L
"COutputPin::NewSegment called\n");
1390 COutputPin_Constructor(
1391 IBaseFilter
* ParentFilter
,
1397 COutputPin
* handler
= new COutputPin(ParentFilter
, PinName
, PinId
);
1400 return E_OUTOFMEMORY
;
1402 if (FAILED(handler
->QueryInterface(riid
, ppv
)))
1406 return E_NOINTERFACE
;