本文整理汇总了C++中IPin::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IPin::Release方法的具体用法?C++ IPin::Release怎么用?C++ IPin::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPin
的用法示例。
在下文中一共展示了IPin::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例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: 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);
}
示例4: 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;
}
示例5: ConnectFilters
static HRESULT ConnectFilters(IGraphBuilder *graph,
IBaseFilter *lhs,
IBaseFilter *rhs)
{
HRESULT hr = S_OK;
IPin *out = 0;
IPin *in = 0;
hr = GetPin(lhs, PINDIR_OUTPUT, &out);
if (FAILED(hr))
return hr;
hr = GetPin(rhs, PINDIR_INPUT, &in);
if (FAILED(hr))
{
out->Release();
return hr;
}
hr = graph->Connect(out, in);
in->Release();
out->Release();
return hr;
}
示例6: GetNextFilter
HRESULT CDShowUtility::GetNextFilter(IBaseFilter *pFilter, PIN_DIRECTION Dir, IBaseFilter **ppNext)
{
if (!pFilter || !ppNext)
{
return E_POINTER;
}
IEnumPins *pEnum = NULL;
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 = NULL;
if (SUCCEEDED(hr))
{
// get the filter that owns that pin
PIN_INFO PinInfo;
hr = pPinNext->QueryPinInfo(&PinInfo);
pPinNext->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;
return S_OK;
}
}
pPin->Release();
}
pEnum->Release();
return hr;
}
示例7: movieConnectFilters
HRESULT movieConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst, IBaseFilter *pSecond)
{
IPin *pOut = NULL;
IPin *pIn = NULL;
// Find the first output pin on the first filter
HRESULT RetVal = movieGetPin(pFirst, PINDIR_OUTPUT, &pOut);
if (RetVal != S_OK)
{
return RetVal;
}
if (NULL == pOut)
{
return E_FAIL;
}
// Find the first input pin on the second filter
RetVal = movieGetPin(pSecond, PINDIR_INPUT, &pIn);
if (RetVal != S_OK)
{
return RetVal;
}
if (NULL == pIn)
{
return E_FAIL;
}
if (RetVal != S_OK)
{
pOut->Release();
return E_FAIL;
}
// Attempt to connect the two pins.
RetVal = pGraph->Connect(pOut, pIn);
// A filter having audio and video will return a VFW_S_PARTIAL_RENDER when attempting
// to connect to a filter only having video (ie. the SampleGrabber filter)
if (VFW_S_PARTIAL_RENDER == RetVal)
{
return S_OK;
}
// Release the pins
pIn->Release();
pOut->Release();
return RetVal;
}
示例8: 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;
}
示例9: EnumPinsOnFilter
HRESULT CKTVDlg::EnumPinsOnFilter( IBaseFilter *pFilter, PIN_DIRECTION PinDir , int index)
{
HRESULT r;
IEnumPins *pEnum = NULL;
IPin *pPin = NULL;
// Verify filter interface
if (!pFilter)
return E_NOINTERFACE;
// Get pin enumerator
r = pFilter->EnumPins(&pEnum);
if (FAILED(r))
return r;
pEnum->Reset();
// Enumerate all pins on this filter
while((r = pEnum->Next(1, &pPin, 0)) == S_OK)
{
PIN_DIRECTION PinDirThis;
r = pPin->QueryDirection(&PinDirThis);
if (FAILED(r))
{
pPin->Release();
continue;
}
// Does the pin's direction match the requested direction?
if (PinDir == PinDirThis)
{
PIN_INFO pininfo={0};
// Direction matches, so add pin name to listbox
r = pPin->QueryPinInfo(&pininfo);
if (SUCCEEDED(r))
{
wstring str = pininfo.achName;
m_captureFilterVec[index].PinVec.push_back(str);
}
// The pininfo structure contains a reference to an IBaseFilter,
// so you must release its reference to prevent resource a leak.
pininfo.pFilter->Release();
}
pPin->Release();
}
pEnum->Release();
return r;
}
示例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: 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;
}
示例13: 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;
}
}
示例14: 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;
}
示例15: FindConnectedFilter
HRESULT FindConnectedFilter(
IBaseFilter *pSrc, // Pointer to the starting filter
PIN_DIRECTION PinDir, // Directtion to look (input = upstream, output = downstream)
IBaseFilter **ppConnected) // Returns a pointer to the filter that is connected to pSrc
{
if (!pSrc || !ppConnected) return E_FAIL;
*ppConnected = NULL;
IEnumPins *pEnum = 0;
IPin *pPin = 0;
HRESULT hr = pSrc->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)
{
// Return the filter that owns this pin.
PIN_INFO PinInfo;
pTmp->QueryPinInfo(&PinInfo);
pTmp->Release();
pEnum->Release();
if (PinInfo.pFilter == NULL)
{
// Inconsistent pin state. Something is wrong...
return E_UNEXPECTED;
}
else
{
*ppConnected = PinInfo.pFilter;
return S_OK;
}
}
}
pPin->Release();
}
pEnum->Release();
return E_FAIL;
}