本文整理汇总了C++中IPin::ConnectedTo方法的典型用法代码示例。如果您正苦于以下问题:C++ IPin::ConnectedTo方法的具体用法?C++ IPin::ConnectedTo怎么用?C++ IPin::ConnectedTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPin
的用法示例。
在下文中一共展示了IPin::ConnectedTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// ConnectFilters is called from BuildGraph
// to enumerate and connect pins
HRESULT
CDShowCtrl::DisconnectFilter(
IGraphBuilder* pGraphBuilder,
IBaseFilter* pFilter
)
{
HRESULT hr = E_FAIL;
// grab upstream filter's enumerator
CComPtr <IEnumPins> pIEnumPins;
hr = pFilter->EnumPins(&pIEnumPins);
if(FAILED(hr))
{
return hr;
}
IPin* pIPin = NULL;
// iterate through upstream filter's pins
while (pIEnumPins->Next (1, &pIPin, 0) == S_OK)
{
IPin* pIPinConnection = NULL;
hr = pIPin->ConnectedTo(&pIPinConnection);
if(FAILED(hr))
{
SAFE_RELEASE(pIPin);
continue;
}
hr = pGraphBuilder->Disconnect(pIPin);
hr = pGraphBuilder->Disconnect(pIPinConnection);
SAFE_RELEASE(pIPinConnection);
SAFE_RELEASE(pIPin);
}
return S_OK;
}
示例2: GetUnconnectedPin
HRESULT GetUnconnectedPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin)
{
*ppPin = 0;
IEnumPins *pEnum = 0;
IPin *pPin = 0;
HRESULT hr = pFilter->EnumPins(&pEnum);
if (FAILED(hr))
{
return hr;
}
while (pEnum->Next(1, &pPin, NULL) == S_OK)
{
PIN_DIRECTION ThisPinDir;
pPin->QueryDirection(&ThisPinDir);
if (ThisPinDir == PinDir)
{
IPin *pTmp = 0;
hr = pPin->ConnectedTo(&pTmp);
if (SUCCEEDED(hr))
{
pTmp->Release();
}
else
{
pEnum->Release();
*ppPin = pPin;
return S_OK;
}
}
pPin->Release();
}
pEnum->Release();
return E_FAIL;
}
示例3: IsOvMConnected
//
// CFilePlayer::IsOvMConnected(): Private method to detect if the video stream
// is passing through the Overlay Mixer (i.e, is it connected?).
//
BOOL CFilePlayer::IsOvMConnected(IBaseFilter *pOvM)
{
DbgLog((LOG_TRACE, 5, TEXT("CFilePlayer::IsOvMConnected() entered"))) ;
IEnumPins *pEnumPins ;
IPin *pPin ;
IPin *pPin2 ;
ULONG ul ;
HRESULT hr ;
BOOL bConnected = FALSE ;
pOvM->EnumPins(&pEnumPins) ;
while (S_OK == pEnumPins->Next(1, &pPin, &ul) && 1 == ul)
{
hr = pPin->ConnectedTo(&pPin2) ;
if (SUCCEEDED(hr) && pPin2)
{
DbgLog((LOG_TRACE, 3, TEXT("Found pin %s connected to pin %s"),
(LPCTSTR)CDisp(pPin), (LPCTSTR)CDisp(pPin2))) ;
bConnected = TRUE ;
pPin2->Release() ;
}
pPin->Release() ;
}
pEnumPins->Release() ;
return bConnected ;
}
示例4: while
// Function name : CVMR9Graph::GetPin
// Description : return the desired pin
// Return type : IPin*
// Argument : IBaseFilter *pFilter
// Argument : PIN_DIRECTION PinDir
IPin* CVMR9Graph::GetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir)
{
BOOL bFound = FALSE;
IEnumPins *pEnum;
IPin *pPin;
pFilter->EnumPins(&pEnum);
while(pEnum->Next(1, &pPin, 0) == S_OK) {
PIN_DIRECTION PinDirThis;
pPin->QueryDirection(&PinDirThis);
if (PinDir == PinDirThis)
{
IPin *pTmp = 0;
if (SUCCEEDED(pPin->ConnectedTo(&pTmp))) // Already connected, not the pin we want.
{
pTmp->Release();
}
else // Unconnected, this is the pin we want.
{
bFound = true;
break;
}
}
pPin->Release();
}
pEnum->Release();
return (bFound ? pPin : 0);
}
示例5: GetUnconnectedPin
// helper functions
HRESULT GetUnconnectedPin(IBaseFilter *pFilter,PIN_DIRECTION PinDir, IPin **ppPin)
{
*ppPin = 0;
IEnumPins *pEnum = 0;
IPin *pPin = 0;
HRESULT hr = pFilter->EnumPins(&pEnum);
if (FAILED(hr))
{
return hr;
}
while (pEnum->Next(1, &pPin, NULL) == S_OK)
{
PIN_DIRECTION ThisPinDir;
pPin->QueryDirection(&ThisPinDir);
if (ThisPinDir == PinDir)
{
IPin *pTmp = 0;
hr = pPin->ConnectedTo(&pTmp);
if (SUCCEEDED(hr)) // Already connected, not the pin we want.
{
pTmp->Release();
}
else // Unconnected, this is the pin we want.
{
pEnum->Release();
*ppPin = pPin;
return S_OK;
}
}
pPin->Release();
}
pEnum->Release();
// Did not find a matching pin.
return E_FAIL;
}
示例6: qWarning
IBaseFilter *DirectShowPlayerService::getConnected(
IBaseFilter *filter, PIN_DIRECTION direction) const
{
IBaseFilter *connected = 0;
IEnumPins *pins = 0;
if (SUCCEEDED(filter->EnumPins(&pins))) {
for (IPin *pin = 0; pins->Next(1, &pin, 0) == S_OK; pin->Release()) {
PIN_DIRECTION dir;
if (SUCCEEDED(pin->QueryDirection(&dir)) && dir == direction) {
IPin *peer = 0;
if (SUCCEEDED(pin->ConnectedTo(&peer))) {
PIN_INFO info;
if (SUCCEEDED(peer->QueryPinInfo(&info))) {
if (connected) {
qWarning("DirectShowPlayerService::getConnected: "
"Multiple connected filters");
connected->Release();
}
connected = info.pFilter;
}
peer->Release();
}
}
}
pins->Release();
}
return connected;
}
示例7: ConnectPins
bool ConnectPins(IGraphBuilder *filterGraph, IBaseFilter* outputFilter, unsigned int outputNum, IBaseFilter* inputFilter, unsigned int inputNum)
{
IPin *inputPin = 0;
IPin *outputPin = 0;
if (!outputFilter || !inputFilter) {
return false;
}
FindPin(outputFilter, PINDIR_OUTPUT, outputNum, &outputPin);
FindPin(inputFilter, PINDIR_INPUT, inputNum, &inputPin);
bool ret = false;
if (inputPin && outputPin)
{
IPin *tmp = 0;
outputPin->ConnectedTo (&tmp);
if (tmp)
{
outputPin->Disconnect ();
tmp->Release();
}
inputPin->ConnectedTo (&tmp);
if (tmp)
{
inputPin->Disconnect ();
tmp->Release();
}
HRESULT hr = filterGraph->Connect (outputPin, inputPin);
ret = SUCCEEDED(hr);
}
if (inputPin)
{
inputPin->Release();
}
if (outputPin)
{
outputPin->Release();
}
return ret;
}
示例8: FindDecoderSubpictureOutputPin
IPin* FindDecoderSubpictureOutputPin(IBaseFilter* pFilter)
{
IEnumPins* pEnum = NULL;
HRESULT hr = pFilter->EnumPins(&pEnum);
if (hr != NOERROR)
return NULL;
ULONG ulFound;
IPin *pPin = NULL;
hr = E_FAIL;
while(S_OK == pEnum->Next(1, &pPin, &ulFound))
{
PIN_INFO PinInfo;
//
// grab this, so we can examine its name field
//
hr = pPin->QueryPinInfo(&PinInfo);
if(SUCCEEDED(hr))
{
PinInfo.pFilter->Release();
//
// check direction
//
if (PinInfo.dir == PINDIR_OUTPUT)
{
// Make sure its not connected yet and its a video type.
IPin* dummyPin = NULL;
hr = pPin->ConnectedTo(&dummyPin);
SAFE_RELEASE(dummyPin);
if (hr == VFW_E_NOT_CONNECTED)
{
IEnumMediaTypes *mtEnum = NULL;
pPin->EnumMediaTypes(&mtEnum);
AM_MEDIA_TYPE *pMT = NULL;
while (S_OK == mtEnum->Next(1, &pMT, NULL))
{
if (pMT->majortype == MEDIATYPE_Video)
{
DeleteMediaType(pMT);
SAFE_RELEASE(mtEnum);
SAFE_RELEASE(pEnum);
return pPin;
}
DeleteMediaType(pMT);
}
SAFE_RELEASE(mtEnum);
}
}
}
pPin->Release();
}
SAFE_RELEASE(pEnum);
return NULL;
}
示例9: GetFirstUnConnectedPin
HRESULT CDShowUtility::GetFirstUnConnectedPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin)
{
*ppPin = NULL;
IEnumPins *pEnum = NULL;
IPin *pPin = NULL;
HRESULT hr = pFilter->EnumPins(&pEnum);
if (FAILED(hr))
{
return hr;
}
pEnum->Reset();
while (pEnum->Next(1, &pPin, NULL) == S_OK)
{
PIN_DIRECTION ThisPinDir;
pPin->QueryDirection(&ThisPinDir);
if (PinDir == ThisPinDir)
{
IPin *pTmp = 0;
hr = pPin->ConnectedTo(&pTmp);
if (NULL != pTmp)
{
pTmp->Release();
}
if (SUCCEEDED(hr))
{
//已经连接了
pPin->Release();
continue;
}
else
{
pEnum->Release();
*ppPin = pPin;
return S_OK;
}
}
pPin->Release();
}
pEnum->Release();
return E_FAIL;
}
示例10: GetNextFilter
// Get the first upstream or downstream filter
HRESULT GetNextFilter(
IBaseFilter *pFilter, // Pointer to the starting filter
PIN_DIRECTION Dir, // Direction to search (upstream or downstream)
IBaseFilter **ppNext) // Receives a pointer to the next filter.
{
if (!pFilter || !ppNext) return E_POINTER;
IEnumPins *pEnum = 0;
IPin *pPin = 0;
HRESULT hr = pFilter->EnumPins(&pEnum);
if (FAILED(hr)) return hr;
while (S_OK == pEnum->Next(1, &pPin, 0))
{
// See if this pin matches the specified direction.
PIN_DIRECTION ThisPinDir;
hr = pPin->QueryDirection(&ThisPinDir);
if (FAILED(hr))
{
// Something strange happened.
hr = E_UNEXPECTED;
pPin->Release();
break;
}
if (ThisPinDir == Dir)
{
// Check if the pin is connected to another pin.
IPin *pPinNext = 0;
hr = pPin->ConnectedTo(&pPinNext);
if (SUCCEEDED(hr))
{
// Get the filter that owns that pin.
PIN_INFO PinInfo;
hr = pPinNext->QueryPinInfo(&PinInfo);
pPinNext->Release();
pPin->Release();
pEnum->Release();
if (FAILED(hr) || (PinInfo.pFilter == NULL))
{
// Something strange happened.
return E_UNEXPECTED;
}
// This is the filter we're looking for.
*ppNext = PinInfo.pFilter; // Client must release.
return S_OK;
}
}
pPin->Release();
}
pEnum->Release();
// Did not find a matching filter.
return E_FAIL;
}
示例11: GetPeerFilters
// Find all the immediate upstream or downstream peers of a filter.
HRESULT GetPeerFilters(
IBaseFilter *pFilter, // Pointer to the starting filter
PIN_DIRECTION Dir, // Direction to search (upstream or downstream)
CFilterList &FilterList) // Collect the results in this list.
{
if (!pFilter) return E_POINTER;
IEnumPins *pEnum = 0;
IPin *pPin = 0;
HRESULT hr = pFilter->EnumPins(&pEnum);
if (FAILED(hr)) return hr;
while (S_OK == pEnum->Next(1, &pPin, 0))
{
// See if this pin matches the specified direction.
PIN_DIRECTION ThisPinDir;
hr = pPin->QueryDirection(&ThisPinDir);
if (FAILED(hr))
{
// Something strange happened.
hr = E_UNEXPECTED;
pPin->Release();
break;
}
if (ThisPinDir == Dir)
{
// Check if the pin is connected to another pin.
IPin *pPinNext = 0;
hr = pPin->ConnectedTo(&pPinNext);
if (SUCCEEDED(hr))
{
// Get the filter that owns that pin.
PIN_INFO PinInfo;
hr = pPinNext->QueryPinInfo(&PinInfo);
pPinNext->Release();
if (FAILED(hr) || (PinInfo.pFilter == NULL))
{
// Something strange happened.
pPin->Release();
pEnum->Release();
return E_UNEXPECTED;
}
// Insert the filter into the list.
AddFilterUnique(FilterList, PinInfo.pFilter);
PinInfo.pFilter->Release();
}
}
pPin->Release();
}
pEnum->Release();
return S_OK;
}
示例12: NukeDownstream
// Tear down everything downstream of a given filter
void __fastcall NukeDownstream(IBaseFilter * pf, IGraphBuilder * pGB)
{
IPin *pP = 0;
IPin *pTo = 0;
ULONG u;
IEnumPins *pins = NULL;
PIN_INFO pininfo;
if (!pf)
return;
// Enumerate all filter pins
HRESULT hr = pf->EnumPins(&pins);
// Go to beginning of enumeration
pins->Reset();
while(hr == NOERROR)
{
hr = pins->Next(1, &pP, &u);
if(hr == S_OK && pP)
{
pP->ConnectedTo(&pTo);
if(pTo)
{
hr = pTo->QueryPinInfo(&pininfo);
if(hr == NOERROR)
{
if(pininfo.dir == PINDIR_INPUT)
{
NukeDownstream(pininfo.pFilter, pGB);
pGB->Disconnect(pTo);
pGB->Disconnect(pP);
pGB->RemoveFilter(pininfo.pFilter);
}
pininfo.pFilter->Release();
pininfo.pFilter = NULL;
}
pTo->Release();
pTo = NULL;
}
pP->Release();
pP = NULL;
}
}
if(pins)
{
pins->Release();
pins = NULL;
}
}
示例13: GetUnconnectedPin
//-------------------------------------------------------------------------------------------------
// GetUnconnectedPin
// Attemptes to locate an unconnected pin on filter
HRESULT CDSUtils::GetUnconnectedPin(IBaseFilter* pFilter, PIN_DIRECTION PinDir, IPin** ppPin)
{
HRESULT hr = S_OK;
if (pFilter && ppPin)
{
CComPtr<IEnumPins> pEnum = NULL;
IPin* pPin = NULL;
hr = pFilter->EnumPins(&pEnum);
if (SUCCEEDED(hr))
{
while (pEnum->Next(1, &pPin, NULL) == S_OK)
{
PIN_DIRECTION ThisPinDir;
pPin->QueryDirection(&ThisPinDir);
if (ThisPinDir == PinDir)
{
IPin* pPinTemp = NULL;
hr = pPin->ConnectedTo(&pPinTemp);
if (SUCCEEDED(hr))
{
SAFE_RELEASE(pPinTemp);
}
else
{
// unconnected, return this pin
*ppPin = pPin;
hr = S_OK;
break;
}
}
SAFE_RELEASE(pPin);
}
}
if (NULL == *ppPin)
{
// failed to find an unconnected pin
hr = E_FAIL;
}
}
else
{
hr = E_INVALIDARG;
}
return hr;
}
示例14: GetUnconnectedPin
//得到Filter上未连接Pin
BOOL GetUnconnectedPin(IBaseFilter* pFilter, PIN_DIRECTION pinDir, IPin** ppPin)
{
if(!pFilter || ppPin)
return FALSE;
ASSERT(pinDir == PINDIR_INPUT || PINDIR_INPUT == PINDIR_OUTPUT);
*ppPin = NULL;
IEnumPins* pEnumPin = NULL;
IPin* pPin = NULL;
HRESULT hr = pFilter->EnumPins(&pEnumPin);
if(FAILED(hr))
return FALSE;
while(pEnumPin->Next(1,&pPin,NULL) == S_OK)
{
PIN_DIRECTION pinDirThis;
hr = pPin->QueryDirection(&pinDirThis);
if(FAILED(hr))
{
pPin->Release();
pEnumPin->Release();
return FALSE;
}
if(pinDir == pinDirThis)
{
IPin* pPinConnected = NULL;
hr = pPin->ConnectedTo(&pPinConnected);
if(SUCCEEDED(hr))
{
pPinConnected->Release();
}
else
{
pEnumPin->Release();
*ppPin = pPin;
return TRUE;
}
}
pPin->Release();
}
pEnumPin->Release();
return FALSE;
}
示例15: GetConnectedFilter
BOOL GetConnectedFilter(IBaseFilter* pFilter, PIN_DIRECTION pinDir, IBaseFilter** ppFilterConnected)
{
if(!pFilter || !ppFilterConnected)
return FALSE;
IEnumPins* pEnumPin = NULL;
if(FAILED(pFilter->EnumPins(&pEnumPin)))
return FALSE;
HRESULT hr = E_FAIL;
IPin* pPin = NULL;
while(S_OK == pEnumPin->Next(1,&pPin,NULL))
{
PIN_DIRECTION pinDirThis;
hr = pPin->QueryDirection(&pinDirThis);
if(FAILED(hr))
{
pPin->Release();
pEnumPin->Release();
return FALSE;
}
if(pinDirThis == pinDir)
{
IPin* pPinConnected;
hr = pPin->ConnectedTo(&pPinConnected);
if(SUCCEEDED(hr))
{
PIN_INFO pinInfo;
hr = pPinConnected->QueryPinInfo(&pinInfo);
pPinConnected->Release();
pPin->Release();
pEnumPin->Release();
if(FAILED(hr) || pinInfo.pFilter == NULL)
{
return FALSE;
}
*ppFilterConnected = pinInfo.pFilter;
return TRUE;
}
}
pPin->Release();
}
pEnumPin->Release();
return FALSE;
}