当前位置: 首页>>代码示例>>C++>>正文


C++ IPin类代码示例

本文整理汇总了C++中IPin的典型用法代码示例。如果您正苦于以下问题:C++ IPin类的具体用法?C++ IPin怎么用?C++ IPin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IPin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetPin

HRESULT GetPin( IBaseFilter * pFilter, PIN_DIRECTION dirrequired, int iNum, IPin **ppPin)
{
    CComPtr< IEnumPins > pEnum;
    *ppPin = 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)
            {
                *ppPin = pPin;
                // Found requested pin, so clear error
                hr = S_OK;
                break;
            }
            iNum--;
        }

        pPin->Release();
    }

    return hr;
}
开发者ID:shilinxu,项目名称:iprojects,代码行数:33,代码来源:dshowutil.cpp

示例2: gst_dshow_get_pin_from_filter

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;
}
开发者ID:lubing521,项目名称:gst-embedded-builder,代码行数:29,代码来源:gstdshow.cpp

示例3: CountTotalFilterPins

HRESULT CountTotalFilterPins(IBaseFilter *pFilter, ULONG *pulPins)
{
    HRESULT hr;
    IEnumPins *pEnum=0;
    ULONG ulFound;
    IPin *pPin;

    // Verify input
    if (!pFilter || !pulPins)
        return E_POINTER;

    // Clear number of pins found
    *pulPins = 0;

    // Get pin enumerator
    hr = pFilter->EnumPins(&pEnum);
    if(FAILED(hr))
        return hr;

    // Count every pin on the filter, ignoring direction
    while(S_OK == pEnum->Next(1, &pPin, &ulFound))
    {
        (*pulPins)++;
        pPin->Release();
    }

    pEnum->Release();
    return hr;
}
开发者ID:shilinxu,项目名称:iprojects,代码行数:29,代码来源:dshowutil.cpp

示例4: ConnectFilters

// ConnectFilters   
//    Connects a pin of an upstream filter to the pDest downstream filter   
HRESULT ConnectFilters(   
					   IGraphBuilder *pGraph, // Filter Graph Manager.   
					   IPin *pOut,            // Output pin on the upstream filter.   
					   IBaseFilter *pDest)    // Downstream filter.   
{   
	if ((pGraph == NULL) || (pOut == NULL) || (pDest == NULL))   
	{   
		return E_POINTER;   
	}   
#ifdef debug   
	PIN_DIRECTION PinDir;   
	pOut->QueryDirection(&PinDir);   
	_ASSERTE(PinDir == PINDIR_OUTPUT);   
#endif   

	// Find an input pin on the downstream filter.   
	IPin *pIn = 0;   
	HRESULT hr = GetUnconnectedPin(pDest, PINDIR_INPUT, &pIn);   
	if (FAILED(hr))   
	{   
		return hr;   
	}   
	// Try to connect them.   
	hr = pGraph->Connect(pOut, pIn);   
	pIn->Release();   
	return hr;   
}   
开发者ID:juanjmostazo,项目名称:once-upon-a-night,代码行数:29,代码来源:CVDShowUtil.cpp

示例5: while

//-----------------------------------------------------------------------------
// 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;
}
开发者ID:MattHung,项目名称:sage-graphics,代码行数:63,代码来源:Utils.cpp

示例6: __CONTEXT

HRESULT 
recChannel_t::set_rate(float FR)
{
     __CONTEXT("recChannel_t::set_rate");
	if (FR<1)
    {
        return S_OK;
    }
	float factorRate = FR/30;
	int hr = 0;

	if (factorRate<0.1) factorRate = 0.1;
	frameRate = factorRate;

	IAMStreamConfig *pConfig = NULL;		
				
	if ((camInfo->getKind() == SHARED ||
         camInfo->getKind() == CAM)   && 
		actualFormat.pbFormat != NULL)
	{
			VIDEOINFOHEADER *pVih = (VIDEOINFOHEADER*) actualFormat.pbFormat;
            double newFR = 10000000.0/FR;
			pVih->AvgTimePerFrame = newFR;
            camInfo->setRate(pVih->AvgTimePerFrame);
            if (camInfo->getKind() == CAM)
            {
                IPin * pInput = NULL;
                get_camInfo()->output->ConnectedTo(&pInput);
                if (mapping)
                {
                    pControl->Stop();
                }
                if (pInput)
                {
                    get_camInfo()->output->Disconnect();
                    pInput->Disconnect();
                }
             	hr = get_camInfo()->output->QueryInterface(IID_IAMStreamConfig, (void**)&pConfig);
                if (pConfig)
                {
                    int hr = pConfig->SetFormat(&actualFormat);
                    errorCheck(hr);
                    pConfig->Release();
                }
                if (pInput)
                {
                    hr = pGraph->Connect(get_camInfo()->output,pInput);
                    errorCheck(hr);
                }
                errorCheck(hr);
                if (mapping)
                {
                    pControl->Run();
                }
			}
    }
    return hr;
	
}
开发者ID:cchatterj,项目名称:isabel,代码行数:59,代码来源:recchanel.cpp

示例7: GetPin

void CCaptureDevice::SetCaptureBufferSize(void)
{
	IPin * pCapturePin = GetPin();
	if (pCapturePin)
	{
		DWORD  dwBytesPerSec = 0;
		AM_MEDIA_TYPE * pmt = {0};
		IAMStreamConfig * pCfg = NULL;
		HRESULT hr = pCapturePin->QueryInterface(IID_IAMStreamConfig, (void **)&pCfg);
		if ( hr==S_OK )
		{
            hr = pCfg->GetFormat(&pmt);
			if ( hr==S_OK )
			{
				WAVEFORMATEX *pWF = (WAVEFORMATEX *) pmt->pbFormat;
				dwBytesPerSec = pWF->nAvgBytesPerSec;
				pWF->nChannels = 1;
				pWF->wBitsPerSample = 8;
				pWF->nSamplesPerSec = 11025;
				pWF->nAvgBytesPerSec = pWF->nSamplesPerSec * pWF->nChannels * pWF->wBitsPerSample / 8;
				pWF->nBlockAlign = 1;
/*
	info.cbSize = sizeof(WAVEFORMATEX);
	info.wFormatTag = 1;
	info.nChannels = 2;
	info.nSamplesPerSec = 44100;
	//info.nSamplesPerSec = 22050;
	11025
	info.wBitsPerSample = 16;
	info.nAvgBytesPerSec = info.nSamplesPerSec * info.nChannels * info.wBitsPerSample / 8;
	info.nBlockAlign = 4;
	*/
				pCfg->SetFormat( pmt );
				DeleteMediaType(pmt);
			}
			pCfg->Release();
		}
/*		if (dwBytesPerSec)
		{
			IAMBufferNegotiation * pNeg = NULL;
			hr = pCapturePin->QueryInterface(IID_IAMBufferNegotiation, 
				(void **)&pNeg);
			if (SUCCEEDED(hr))
			{
				ALLOCATOR_PROPERTIES AllocProp;
				AllocProp.cbAlign  = -1;  // -1 means no preference.
				AllocProp.cbBuffer = dwBytesPerSec *  dwLatencyInMilliseconds / 1000;
				AllocProp.cbPrefix = -1;
				AllocProp.cBuffers = -1;
				hr = pNeg->SuggestAllocatorProperties(&AllocProp);
				pNeg->Release();
			}
		}*/
	}
}
开发者ID:duzhi5368,项目名称:FKChessCards,代码行数:55,代码来源:CaptureDevice.cpp

示例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;
}
开发者ID:BOTCrusher,项目名称:sagetv,代码行数:55,代码来源:DVDPlaybackExtensions.cpp

示例9: 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;
}
开发者ID:dalinhuang,项目名称:networkprogram,代码行数:55,代码来源:FilterCommon.cpp

示例10: 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;
}
开发者ID:Jackovic,项目名称:Gem,代码行数:54,代码来源:pix_movieDS.cpp

示例11: PrintFunc

STDMETHODIMP CapturePin::ConnectedTo(IPin **pPin)
{
	PrintFunc(L"CapturePin::ConnectedTo");

	if (!connectedPin)
		return VFW_E_NOT_CONNECTED;

	IPin *pin = connectedPin;
	pin->AddRef();
	*pPin = pin;
	return S_OK;
}
开发者ID:devgopher,项目名称:Isotoxin,代码行数:12,代码来源:capture-filter.cpp

示例12: 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;
}
开发者ID:GreenHackers,项目名称:KTV-4,代码行数:52,代码来源:KTVDlg.cpp

示例13: 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;
}
开发者ID:TheRyuu,项目名称:ffdshow,代码行数:49,代码来源:TffdshowDecAudioInputPin.cpp

示例14: RenderOutputPins

//------------------------------------------------------------------------------
// Name: RenderOutputPins()
// Desc: Renders every output pin on a specified filter. 
//
// pGB:     Pointer to the Filter Graph Manager.
// pFilter: Pointer to the filter.
//------------------------------------------------------------------------------
HRESULT RenderOutputPins(IGraphBuilder *pGB, IBaseFilter *pFilter)
{
    HRESULT         hr = S_OK;
    IEnumPins *     pEnumPin = NULL;
    IPin *          pConnectedPin = NULL, * pPin;
    PIN_DIRECTION   PinDirection;
    ULONG           ulFetched;

    // Enumerate all the pins on the filter.
    hr = pFilter->EnumPins( &pEnumPin );

    if(SUCCEEDED(hr))
    {
        // Step through every pin, looking for the output pins.
        while (S_OK == (hr = pEnumPin->Next( 1L, &pPin, &ulFetched)))
        {
            // Check whether this pin is already connected. If so, ignore it.
            hr = pPin->ConnectedTo(&pConnectedPin);
            if (pConnectedPin)
            {
                // Release the IPin interface on the connected pin.
                pConnectedPin->Release();
                pConnectedPin = NULL;
            }

            if (VFW_E_NOT_CONNECTED == hr)
            {
                // This pin is not connected to another filter yet. Check 
                // whether it is an output pin. If so, use the Filter Graph
                // Manager's Render() method to render the pin.

                hr = pPin->QueryDirection( &PinDirection );
                if ( ( S_OK == hr ) && ( PinDirection == PINDIR_OUTPUT ) )
                {
                    hr = pGB->Render(pPin);
                }
            }
            pPin->Release();

            // If there was an error, stop enumerating.
            if (FAILED(hr))                      
                break;
        }
    }

    // Release the pin enumerator object.
    pEnumPin->Release();
    return hr;
}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:56,代码来源:DSSeekFm.cpp

示例15: 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;
}
开发者ID:leok7v,项目名称:uvc_mjpg_win10,代码行数:15,代码来源:test.cpp


注:本文中的IPin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。