MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / ReceiveConnection

Method ReceiveConnection

Source/VideoRendererInputPin.cpp:96–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96STDMETHODIMP CVideoRendererInputPin::ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt)
97{
98 DLog(L"CVideoRendererInputPin::ReceiveConnection()");
99
100 CAutoLock cObjectLock(m_pLock);
101
102 if (m_Connected) {
103 CMediaType mt(*pmt);
104
105 if (FAILED(CheckMediaType(&mt))) {
106 return VFW_E_TYPE_NOT_ACCEPTED;
107 }
108
109 ALLOCATOR_PROPERTIES props, actual;
110
111 CComPtr<IMemAllocator> pMemAllocator;
112 if (FAILED(GetAllocator(&pMemAllocator))
113 || FAILED(pMemAllocator->Decommit())
114 || FAILED(pMemAllocator->GetProperties(&props))) {
115 return FrameInVideoMem()
116 ? S_OK // hack for Microsoft DTV-DVD Video Decoder
117 : E_FAIL;
118 }
119
120 CMediaType mtNew(*pmt);
121 props.cbBuffer = m_pBaseRenderer->CalcImageSize(mtNew, !FrameInVideoMem());
122
123 if (FAILED(pMemAllocator->SetProperties(&props, &actual))
124 || FAILED(pMemAllocator->Commit())
125 || props.cbBuffer != actual.cbBuffer) {
126 return E_FAIL;
127 }
128
129 return SetMediaType(&mt) == S_OK // here set mt, not mtNew
130 ? S_OK
131 : VFW_E_TYPE_NOT_ACCEPTED;
132 } else {
133 m_bDXVA = m_bD3D11 = false;
134 }
135
136 return __super::ReceiveConnection(pConnector, pmt);
137}
138
139STDMETHODIMP CVideoRendererInputPin::NewSegment(REFERENCE_TIME startTime, REFERENCE_TIME stopTime, double rate)
140{

Callers

nothing calls this directly

Calls 3

DLogFunction · 0.85
CalcImageSizeMethod · 0.80
SetPropertiesMethod · 0.80

Tested by

no test coverage detected