HRESULT CBaseSplitterFilter::RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDst, const AM_MEDIA_TYPE* pmt) { CAutoLock cAutoLock(&m_csPinMap); CBaseSplitterOutputPin* pPin; if (m_pPinMap.Lookup(TrackNumSrc, pPin)) { if (CComQIPtr<IPin> pPinTo = pPin->GetConnected()) { if (pmt && S_OK != pPinTo->QueryAccept(pmt)) { return VFW_E_TYPE_NOT_ACCEPTED; } } m_pPinMap.RemoveKey(TrackNumSrc); m_pPinMap[TrackNumDst] = pPin; if (pmt) { CAutoLock cAutoLock2(&m_csmtnew); m_mtnew[TrackNumDst] = *pmt; } return S_OK; } return E_FAIL; }
HRESULT CBaseSplitterFilter::RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDst, std::vector<CMediaType> mts, BOOL bNeedReconnect /*= FALSE*/) { CAutoLock cAutoLock(&m_csPinMap); CBaseSplitterOutputPin* pPin; if (m_pPinMap.Lookup(TrackNumSrc, pPin)) { AM_MEDIA_TYPE* pmt = NULL; HRESULT hr = S_OK; if (CComQIPtr<IPin> pPinTo = pPin->GetConnected()) { for (size_t i = 0; i < mts.size(); i++) { if (S_OK == pPinTo->QueryAccept(&mts[i])) { pmt = &mts[i]; break; } } if (!pmt) { pmt = &mts[0]; } if (bNeedReconnect) { hr = ReconnectPin(pPinTo, pmt); } } m_pPinMap.RemoveKey(TrackNumSrc); m_pPinMap[TrackNumDst] = pPin; if (pmt) { CAutoLock cAutoLock(&m_csmtnew); m_mtnew[TrackNumDst] = *pmt; } return hr; } return E_FAIL; }