本文整理汇总了C++中IPin::QueryDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ IPin::QueryDirection方法的具体用法?C++ IPin::QueryDirection怎么用?C++ IPin::QueryDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPin
的用法示例。
在下文中一共展示了IPin::QueryDirection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindPin
void FindPin(IBaseFilter* baseFilter, PIN_DIRECTION direction, int pinNumber, IPin** destPin)
{
IEnumPins *enumPins = 0;
*destPin = NULL;
if (SUCCEEDED(baseFilter->EnumPins(&enumPins))) {
ULONG numFound;
IPin* tmpPin;
while (SUCCEEDED(enumPins->Next(1, &tmpPin, &numFound))) {
PIN_DIRECTION pinDirection;
tmpPin->QueryDirection(&pinDirection);
if (pinDirection == direction) {
if (pinNumber == 0) {
// Return the pin's interface
*destPin = tmpPin;
break;
}
pinNumber--;
}
tmpPin->Release();
}
}
if (enumPins)
{
enumPins->Release();
}
}
示例2: 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);
}
示例3: FindPinByDirection
IPin* FindPinByDirection(IBaseFilter* pFilter, PIN_DIRECTION Criteria)
{
IPin* pPin = 0;
IEnumPins* pEnum = 0;
ULONG ul = 0;
PIN_DIRECTION TempDir;
pFilter->EnumPins(&pEnum);
if(!pEnum) return 0;
while(1)
{
pEnum->Next(1, &pPin, &ul);
if(ul != 1)
{
pPin = 0;
break;
}
// Examine this pin.
pPin->QueryDirection(&TempDir);
if(TempDir == Criteria)
{
break;
}
pPin->Release();
}
SAFE_RELEASE(pEnum);
return pPin;
}
示例4: 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;
}
示例5: GetPin
HRESULT CDirSoundSource::GetPin( IBaseFilter * pFilter, PIN_DIRECTION dirrequired, int iNum, CComPtr<IPin> &pin)
{
CComPtr< IEnumPins > pEnum;
pin = NULL;
HRESULT hr = pFilter->EnumPins(&pEnum);
if(FAILED(hr))
return hr;
ULONG ulFound;
IPin *pPin;
hr = E_FAIL;
while(S_OK == pEnum->Next(1, &pPin, &ulFound))
{
PIN_DIRECTION pindir = (PIN_DIRECTION)3;
pPin->QueryDirection(&pindir);
if(pindir == dirrequired)
{
if(iNum == 0)
{
pin = pPin;
// Found requested pin, so clear error
hr = S_OK;
break;
}
iNum--;
}
pPin->Release();
}
return hr;
}
示例6: 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;
}
示例7: GetPin
IPin* EMTestVideoOut::GetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir)
{
BOOL bFound = FALSE;
IEnumPins *pEnum;
IPin *pPin;
bool FoundIt = false;
pFilter->EnumPins(&pEnum);
while(pEnum->Next(1, &pPin, 0) == S_OK)
{
PIN_DIRECTION PinDirThis;
pPin->QueryDirection(&PinDirThis);
if (bFound = (PinDir == PinDirThis))
{
// MessageBox(NULL, "Found Matching PIN_DIRECTION", "Looking for a PIN", MB_OK);
FoundIt = true;
break;
}
pPin->Release();
// MessageBox(NULL, "Found A Non Matching PIN_DIRECTION", "Looking for a PIN", MB_OK);
}
// if(!FoundIt)
// MessageBox(NULL, "DIDN'T FIND A MATCHING PIN", "WARNING WARNING!!!", MB_OK);
pEnum->Release();
return (bFound ? pPin : 0);
}
示例8: GetOutPin
IPin * GetOutPin( IBaseFilter * pFilter, int PinNum )
{
IEnumPins * pEnum = 0;
HRESULT hr = pFilter->EnumPins( &pEnum );
pEnum->Reset( );
ULONG Fetched;
do
{
Fetched = 0;
IPin * pPin = 0;
pEnum->Next( 1, &pPin, &Fetched );
if( Fetched )
{
PIN_DIRECTION pd;
pPin->QueryDirection( &pd);
pPin->Release( );
if( pd == PINDIR_OUTPUT )
{
if( PinNum == 0 )
{
pEnum->Release( );
return pPin;
}
PinNum--;
}
}
}
while( Fetched );
pEnum->Release( );
return NULL;
}
示例9: 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;
}
示例10: GetPinCountForOneType
HRESULT GetPinCountForOneType(IUnknown* pUnk, PIN_DIRECTION direction, LPDWORD pPinCount)
{
(*pPinCount) = 0;
IBaseFilter* pBaseFilter = NULL;
HRESULT hr = pUnk->QueryInterface(IID_IBaseFilter, (VOID**)&pBaseFilter);
if (SUCCEEDED(hr))
{
IEnumPins* pEnumPins = NULL;
hr = pBaseFilter->EnumPins(&pEnumPins);
if (SUCCEEDED(hr))
{
pEnumPins->Reset();
if (SUCCEEDED(hr))
{
IPin* pPin = NULL;
BOOL bFound = FALSE;
DWORD dwFetched = 0;
while (((pEnumPins->Next(1, &pPin, &dwFetched)) == S_OK) && !bFound)
{
PIN_DIRECTION fetchedDir;
hr = pPin->QueryDirection(&fetchedDir);
if (SUCCEEDED(hr) && (fetchedDir == direction))
{
(*pPinCount)++;
}
pPin->Release();
}
}
pEnumPins->Release();
}
pBaseFilter->Release();
}
return hr;
}
示例11: GetAMConfigForSinglePin
HRESULT GetAMConfigForSinglePin(IUnknown* pUnk, PIN_DIRECTION direction, IAMStreamConfig** ppConfig)
{
IBaseFilter* pBaseFilter = NULL;
HRESULT hr = pUnk->QueryInterface(IID_IBaseFilter, (void**)&pBaseFilter);
if (SUCCEEDED(hr))
{
IEnumPins* pEnumPins = NULL;
hr = pBaseFilter->EnumPins(&pEnumPins);
if (SUCCEEDED(hr))
{
pEnumPins->Reset();
if (SUCCEEDED(hr))
{
IPin* pPin = NULL;
BOOL bFound = FALSE;
while (((pEnumPins->Next(1, &pPin, NULL)) == S_OK) && !bFound)
{
PIN_DIRECTION fetchedDir;
hr = pPin->QueryDirection(&fetchedDir);
if (SUCCEEDED(hr) && (fetchedDir == direction))
{
hr = pPin->QueryInterface(IID_IAMStreamConfig, (void**)ppConfig);
bFound = SUCCEEDED(hr);
}
pPin->Release();
}
}
pEnumPins->Release();
}
pBaseFilter->Release();
}
return hr;
}
示例12: while
gboolean
gst_dshow_get_pin_from_filter (IBaseFilter * filter, PIN_DIRECTION pindir,
IPin ** pin)
{
gboolean ret = FALSE;
IEnumPins *enumpins = NULL;
IPin *pintmp = NULL;
HRESULT hres;
*pin = NULL;
hres = filter->EnumPins (&enumpins);
if (FAILED (hres)) {
return ret;
}
while (enumpins->Next (1, &pintmp, NULL) == S_OK) {
PIN_DIRECTION pindirtmp;
hres = pintmp->QueryDirection (&pindirtmp);
if (hres == S_OK && pindir == pindirtmp) {
*pin = pintmp;
ret = TRUE;
break;
}
pintmp->Release ();
}
enumpins->Release ();
return ret;
}
示例13: get_pin
HRESULT win_webcam_utils::get_pin(IBaseFilter * filter, PIN_DIRECTION dirrequired, int num, IPin **pin)
{
CComPtr<IEnumPins> enum_pin;
*pin = nullptr;
HRESULT res = filter->EnumPins(&enum_pin);
if (S_OK != res)
{
return res;
}
ULONG found;
IPin *pPin;
res = E_FAIL;
while (S_OK == enum_pin->Next(1, &pPin, &found))
{
PIN_DIRECTION pindir = (PIN_DIRECTION)3;
pPin->QueryDirection(&pindir);
if (pindir == dirrequired)
{
if (num == 0)
{
*pin = pPin; // Return the pin's interface
res = S_OK; // Found requested pin, so clear error
break;
}
num--;
}
pPin->Release();
}
return res;
}
示例14: GetPin
//-----------------------------------------------------------------------------
// GetPin
// Find the pin of the specified format type on the given filter
// This method leaves an outstanding reference on the pin if successful
HRESULT CDSUtils::GetPin(IBaseFilter* pFilter, const GUID* pFormat, PIN_DIRECTION PinDir, IPin** ppPin)
{
HRESULT hr = S_OK;
if (pFilter && pFormat && ppPin)
{
CComPtr<IEnumPins> pIEnumPins = NULL;
hr = pFilter->EnumPins(&pIEnumPins);
if (SUCCEEDED(hr))
{
// find the pin with the specified format
IPin* pIPin = NULL;
while (S_OK == pIEnumPins->Next(1, &pIPin, NULL))
{
// match the pin direction
PIN_DIRECTION pinDir;
pIPin->QueryDirection(&pinDir);
if (pinDir == PinDir)
{
// match pin direction check the first media type returned from the upstream pin
CComPtr<IEnumMediaTypes> pIEnumMT = NULL;
hr = pIPin->EnumMediaTypes(&pIEnumMT);
if (SUCCEEDED(hr))
{
AM_MEDIA_TYPE* pmt = NULL;
hr = pIEnumMT->Next(1, &pmt, NULL);
if (S_OK == hr)
{
if (pmt->majortype == *pFormat)
{
// found the pin with the specified format
*ppPin = pIPin;
DeleteMediaType(pmt);
break;
}
else
{
DeleteMediaType(pmt);
}
}
}
}
SAFE_RELEASE(pIPin);
}
if (NULL == *ppPin)
{
// failed to find the named pin
hr = E_FAIL;
}
}
}
else
{
hr = E_INVALIDARG;
}
return hr;
}
示例15: 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;
}