本文整理汇总了C++中IPin::QueryPinInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ IPin::QueryPinInfo方法的具体用法?C++ IPin::QueryPinInfo怎么用?C++ IPin::QueryPinInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPin
的用法示例。
在下文中一共展示了IPin::QueryPinInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findPin
HRESULT MiniPlayer::findPin(IBaseFilter *pFilter, int dir, IPin **pOutPin)
{
IEnumPins *pEnumPins = NULL;
IPin *pPin = NULL;
PIN_INFO pinInfo;
//FILTER_INFO filterInfo;
//HRESULT hr = pFilter->QueryFilterInfo(&filterInfo);
//if(hr == S_OK)
//{
// ctrace(L"%s Pins:\n", filterInfo.achName);
//}
HRESULT hr = pFilter->EnumPins(&pEnumPins);
if(FAILED(hr)) return hr;
while(pEnumPins->Next(1, &pPin, NULL) == S_OK)
{
hr = pPin->QueryPinInfo(&pinInfo);
if(FAILED(hr)) continue;
if(pinInfo.dir == dir)
{
*pOutPin = pPin;
//ctrace(L"[%s] %s\n", (dir == PINDIR_INPUT)? L"INPUT": L"OUTPUT", pinInfo.achName);
return S_OK;
}
}
pEnumPins->Release();
return -1;
}
示例2: GetFilterPin
// フィルタから指定メディアのピンを検索する
IPin* DirectShowUtil::GetFilterPin(IBaseFilter *pFilter, const PIN_DIRECTION dir, const AM_MEDIA_TYPE *pMediaType)
{
IEnumPins *pEnumPins=NULL;
IPin *pPin;
IPin *pRetPin=NULL;
if(pFilter->EnumPins(&pEnumPins)==S_OK ){
ULONG cFetched;
while(!pRetPin&&pEnumPins->Next(1,&pPin,&cFetched)==S_OK){
PIN_INFO stPin;
if(pPin->QueryPinInfo(&stPin)==S_OK){
if(stPin.dir==dir){
if(!pMediaType){
// 方向さえあっていればOK
pRetPin=pPin;
pRetPin->AddRef();
} else {
// DirectShowにまかせてピンを検索
if(pPin->QueryAccept(pMediaType)==S_OK){
pRetPin=pPin;
pRetPin->AddRef();
}
}
}
if(stPin.pFilter) stPin.pFilter->Release();
}
pPin->Release();
}
pEnumPins->Release();
}
return pRetPin;
}
示例3: 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;
}
示例4: 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;
}
示例5: FindSourceFilter
HRESULT FindSourceFilter(IFilterGraph* filterGraph,IBaseFilter*& result)
{
HRESULT hr;
IEnumFilters *enumFilters;
hr = filterGraph->EnumFilters(&enumFilters);
if (FAILED(hr))
{
ErrorPrint("Get enum filters error",hr);
return hr;
}
ComReleaser enumFilterReleaser(enumFilters);
IBaseFilter* filter;
while (S_OK == enumFilters->Next(1, &filter, NULL))
{
ComReleaser filterReleaser(filter);
IEnumPins *enumPins;
hr = filter->EnumPins(&enumPins);
if (FAILED(hr))
{
ErrorPrint("Get enum pins error",hr);
return hr;
}
ComReleaser enumPinsReleaser(enumPins);
IPin* pin;
bool isSourceFilter = true;
while (S_OK == enumPins->Next(1, &pin, NULL))
{
ComReleaser pinReleaser(pin);
PIN_INFO pinInfo;
hr = pin->QueryPinInfo(&pinInfo);
if (FAILED(hr))
{
ErrorPrint("Get pin info error",hr);
continue;
}
if (pinInfo.dir == PINDIR_INPUT) //认为没有输入pin的就是source filter,这其实是有些问题的,特别是当捕获(如声卡的音频)的filter有时候有很多输入PIN
{
isSourceFilter = false;
break;
}
}
if (isSourceFilter)
{
filter->AddRef(); //存在一个资源管理的释放类,必须增加一个引用,否则会被释放掉
result = filter;
return S_OK;
}
}
return E_FAIL;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
}
示例11: CompleteConnect
HRESULT TffdshowDecAudioInputPin::CompleteConnect(IPin* pReceivePin)
{
HRESULT hr = __super::CompleteConnect(pReceivePin);
if (FAILED(hr)) {
return hr;
}
m_hNotifyEvent = NULL;
// Some source filters are not multithreaded, in that case we must not use the blocking mode
unsigned int numstreams = filter->inpins.getNumConnectedInpins();
bool noBlock = false;
for (unsigned int i = 0; i < numstreams; i++) {
TffdshowDecAudioInputPin *inpin = filter->inpins[i];
if (noBlock) {
inpin->m_useBlock = false;
continue;
}
IPin *pPin = NULL;
inpin->ConnectedTo(&pPin);
if (!pPin) {
continue;
}
PIN_INFO pinInfo;
if (SUCCEEDED(pPin->QueryPinInfo(&pinInfo))) {
CLSID clsid;
if (pinInfo.pFilter && SUCCEEDED(pinInfo.pFilter->GetClassID(&clsid))) {
if (clsid == CLSID_AviSplitter || clsid == CLSID_MPC_OggSplitter || clsid == CLSID_MPC_AC3DTSSourceFilter) {
DPRINTF(_l("TffdshowDecAudioInputPin::CompleteConnect Use blocking mode on pin %u"), this);
m_useBlock = true;
}
/* Damm it, Haali is monothreaded (all pins are managed in the same thread), so we cannot use the blocking mode
even if another source filter needs it (DTS/AC3 source filter).
This is annoying because we can't use Haali with an external AC3/DTS file (albain) */
else if (clsid == CLSID_HaaliMediaSplitter) {
DPRINTF(_l("TffdshowDecAudioInputPin::CompleteConnect Disable all blocking modes, source filter is monothreaded on pin %u"), this);
noBlock = true;
i = 0;
}
}
SAFE_RELEASE(pPin);
SAFE_RELEASE(pinInfo.pFilter);
}
}
return S_OK;
}
示例12: 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;
}
示例13: ds_get_pin
static IPin* ds_get_pin(IBaseFilter* filter, const char* pin_name) {
com_t<IEnumPins> enum_pins;
IPin* pin = null;
if_failed_return(filter->EnumPins(&enum_pins), null);
while (enum_pins->Next(1, &pin, 0) == S_OK) {
PIN_INFO pin_info = {0};
pin->QueryPinInfo(&pin_info);
com_release(pin_info.pFilter);
if (stricmp(pin_name, wcs2str(pin_info.achName)) == 0) {
return pin;
}
com_release(pin);
}
return null;
}
示例14: 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;
}
示例15: GetNextFilter
HRESULT GetNextFilter(IBaseFilter* filter, PIN_DIRECTION dir, IBaseFilter*& nextFilter)
{
IEnumPins *enumPins;
IPin* pin;
HRESULT hr;
hr = filter->EnumPins(&enumPins);
if(FAILED(hr))
{
ErrorPrint("Get enum pins error", hr);
return hr;
}
ComReleaser enumPinsReleaser(enumPins);
while (enumPins->Next(1, &pin, NULL) == S_OK)
{
ComReleaser pinReleaser(pin);
PIN_DIRECTION thisDir;
hr = pin->QueryDirection(&thisDir);
if(FAILED(hr))
{
ErrorPrint("Query direction error", hr);
return hr;
}
if(thisDir == dir)
{
IPin *nextPin;
hr = pin->ConnectedTo(&nextPin);
if(SUCCEEDED(hr))
{
ComReleaser nextPinReleaser(nextPin);
PIN_INFO nextPinInfo;
hr = nextPin->QueryPinInfo(&nextPinInfo);
if(SUCCEEDED(hr))
{
nextFilter = nextPinInfo.pFilter;
return S_OK;
}
else
{
return E_UNEXPECTED;
}
}
}
}
return E_FAIL;
}