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


C++ SmartPtr::Next方法代码示例

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


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

示例1:

BOOL CSampleCGB::IsMPEG2Pin( IPin *pPin )
{
	if(!pPin)return FALSE;
	SmartPtr<IEnumMediaTypes> pMediaTypes;
	HRESULT hr = pPin->EnumMediaTypes(&pMediaTypes);
	if(FAILED(hr))return FALSE;
	hr = pMediaTypes->Reset();
	if(FAILED(hr))return FALSE;


	ULONG fetched;
	AM_MEDIA_TYPE* pTempMediaType;

	while(S_OK == pMediaTypes->Next(1,&pTempMediaType,&fetched))
	{
		if(
			(
			::IsEqualGUID(pTempMediaType->majortype,MEDIATYPE_Video) ||
			::IsEqualGUID(pTempMediaType->majortype,MEDIATYPE_Stream)
			)
			&&
			(
			::IsEqualGUID(pTempMediaType->subtype,MEDIASUBTYPE_MPEG2_VIDEO) ||
			::IsEqualGUID(pTempMediaType->subtype,MEDIASUBTYPE_MPEG2_PROGRAM)
			)
			)
		{
			DeleteMediaType(pTempMediaType);
			return TRUE;
		}
		DeleteMediaType(pTempMediaType);
	}
	return FALSE;
}
开发者ID:Forlearngit,项目名称:VisitorManager,代码行数:34,代码来源:SampleCGB.cpp

示例2: HasMediaType

BOOL CSampleCGB::HasMediaType(IPin *pPin, REFGUID majorType )
{
	if(!pPin)
	{
		return FALSE;
	}

	SmartPtr<IEnumMediaTypes> pMediaTypes;
	HRESULT hr = pPin->EnumMediaTypes(&pMediaTypes);
	if(FAILED(hr))return FALSE;

	hr = pMediaTypes->Reset();
	if(FAILED(hr))return FALSE;

	ULONG cFetched;
	AM_MEDIA_TYPE* pTempMediaType;
	while(S_OK == pMediaTypes->Next(1,&pTempMediaType,&cFetched))
	{
		if(::IsEqualGUID(pTempMediaType->majortype,majorType))
		{
			DeleteMediaType(pTempMediaType);
			return TRUE;
		}
		DeleteMediaType(pTempMediaType);
	}
	return FALSE;
}
开发者ID:Forlearngit,项目名称:VisitorManager,代码行数:27,代码来源:SampleCGB.cpp

示例3: while

HRESULT 
ISampleCaptureGraphBuilder::FindAudioPin( 
                                IBaseFilter *pFilter, 
                                IPin **ppPin  )
{
    if( !pFilter )
    {
        return E_POINTER;
    }

    SmartPtr<IEnumPins> pEnumPins;
    HRESULT hr = pFilter->EnumPins( &pEnumPins );
    if( FAILED( hr ) )
    {
        return hr;
    }

    SmartPtr<IPin>   pTempPin;
    ULONG           fetched;
    hr = pEnumPins->Reset( );

    while( pTempPin.Release(), S_OK == pEnumPins->Next( 1, &pTempPin, &fetched ) )
    {
        if( IsAudioPin( pTempPin ) )
        {
            (*ppPin) = pTempPin.Detach();
            return S_OK;
        }
    }
    return E_FAIL;
}
开发者ID:bai-lu-sz,项目名称:KineCT,代码行数:31,代码来源:SampleCGB.cpp

示例4: FindPin

//
//  search the encoder that has this special medium
//  video == TRUE -- look for a video pin
//  video == FALSE -- look for a audio pin  
//
HRESULT ISampleCaptureGraphBuilder::FindPin( 
            IBaseFilter *pFilter, 
            const REGPINMEDIUM& regPinMedium, 
            PIN_DIRECTION direction, 
            BOOL video,             
            IPin **ppPin)
{
    if( !pFilter )
    {
        return E_POINTER;
    }

    SmartPtr<IEnumPins> pEnumPins;
    HRESULT hr = pFilter->EnumPins( &pEnumPins );
    if( FAILED( hr ) )
    {
        return hr;
    }
    
    SmartPtr<IPin>   pTempPin;
    ULONG           fetched;
    REGPINMEDIUM    regPinMediumTemp;
    PIN_DIRECTION   dir;

    hr = pEnumPins->Reset( );
    while( pTempPin.Release(), S_OK == pEnumPins->Next( 1, &pTempPin, &fetched ) )
    {
        ASSERT( pTempPin );

        hr = pTempPin->QueryDirection( &dir );
        if( FAILED( hr ) || dir != direction )
        {
            continue;
        }

        hr = GetMedium( pTempPin, regPinMediumTemp );
        if( FAILED( hr ) )
        {
            continue;
        }

        if( !IsVideoPin( pTempPin ) )
        {
            continue;
        }

        if( ::IsEqualGUID( regPinMediumTemp.clsMedium, regPinMedium.clsMedium  ) &&
            regPinMediumTemp.dw1 == regPinMedium.dw1 )
        {
            (*ppPin) = pTempPin.Detach();
            return S_OK;
        }
    }

    return E_FAIL;
}
开发者ID:bai-lu-sz,项目名称:KineCT,代码行数:61,代码来源:SampleCGB.cpp

示例5: ConnectPin

HRESULT CSampleCGB::ConnectPin( IPin *pPin, IBaseFilter *pFilter )
{
	if(!pPin || !pFilter)return E_INVALIDARG;

	PIN_DIRECTION pinDirection;
	HRESULT hr = pPin->QueryDirection(&pinDirection);
	if(FAILED(hr) || PINDIR_INPUT == pinDirection)return E_FAIL;

	//Add the filter to the graph
	BOOL bConnected = FALSE;
	ULONG cFetched = 0;
	SmartPtr<IPin> pDownFilterPin;

	//
	//  Loop through every input pin from downstream filter
	//  and try to connect the pin
	//  

	SmartPtr<IEnumPins> pEnumDownFiltersPins;
	hr = pFilter->EnumPins(&pEnumDownFiltersPins);
	if(FAILED(hr))return hr;

	while(pDownFilterPin.Release(),pEnumDownFiltersPins->Next(1,&pDownFilterPin,&cFetched))
	{
		hr = pDownFilterPin->QueryDirection(&pinDirection);
		if(FAILED(hr))
		{
			continue;
		}

		if(pinDirection == PINDIR_OUTPUT)
		{
			continue;
		}

		hr = graph_->ConnectDirect(pPin,pDownFilterPin,NULL);
		if(SUCCEEDED(hr))
		{
			bConnected = TRUE;
			break;
		}
	}

	if(!bConnected)
	{
		graph_->RemoveFilter(pFilter);
		return E_FAIL;
	}
	return S_OK;
}
开发者ID:Forlearngit,项目名称:VisitorManager,代码行数:50,代码来源:SampleCGB.cpp

示例6: FindAudioPin

HRESULT CSampleCGB::FindAudioPin( IBaseFilter *pFilter, IPin **ppPin )
{
	if(!pFilter)return E_POINTER;

	SmartPtr<IEnumPins> pEnumPins;
	HRESULT hr = pFilter->EnumPins(&pEnumPins);
	if(FAILED(hr))return hr;

	SmartPtr<IPin> pTempPin;
	ULONG cFetched;
	hr = pEnumPins->Reset();
	if(FAILED(hr))return hr;

	while(pTempPin.Release(),pEnumPins->Next(1,&pTempPin,&cFetched))
	{
		if(IsAudioPin(pTempPin))
		{
			*ppPin = pTempPin.Detach();
			return S_OK;
		}
	}
	return E_FAIL;
}
开发者ID:Forlearngit,项目名称:VisitorManager,代码行数:23,代码来源:SampleCGB.cpp

示例7: HasMediaType

BOOL ISampleCaptureGraphBuilder::HasMediaType(IPin *pPin,  REFGUID majorType )
{
    if( !pPin )
    {
        return FALSE;
    }

    SmartPtr<IEnumMediaTypes> pMediaTypes;
    HRESULT hr = pPin->EnumMediaTypes( &pMediaTypes );
    if( FAILED( hr ) )
    {
        return FALSE;
    }

    hr = pMediaTypes->Reset();
    if( FAILED( hr ) )
    {
        return FALSE;
    }

    ULONG           fetched;
    AM_MEDIA_TYPE   *mediaType;

    while( S_OK == pMediaTypes->Next( 1, &mediaType, &fetched ) )
    {
        if( ::IsEqualGUID( mediaType->majortype, majorType ) )
        {
            DeleteMediaType( mediaType );
            return TRUE;
        }
        DeleteMediaType( mediaType );
    }

    return FALSE;

}
开发者ID:bai-lu-sz,项目名称:KineCT,代码行数:36,代码来源:SampleCGB.cpp

示例8: GetMedium

HRESULT 
ISampleCaptureGraphBuilder::ConnectAudioPinToMultiplexer( 
                                            IPin *pPin, 
                                            IBaseFilter *pMultiplexer)
{
    if( !pPin || !pMultiplexer )
    {
        return E_INVALIDARG;
    }

    REGPINMEDIUM pinMedium;
    HRESULT hr = GetMedium( pPin, pinMedium );
    if( FAILED( hr ) )
    {
        return hr;
    }

    SmartPtr<IBaseFilter> pEncoder;
    SmartPtr<IEnumMoniker> pEncoders;

    if( FALSE == ::IsEqualGUID( pinMedium.clsMedium, GUID_NULL ) )
    {
        //
        //  search through encoders category; identify
        //  the encoder using the medium
        //
        hr = GetEncodersByCategory( &pEncoders );
        if( FAILED( hr ) )
        {
            return hr;
        }

        hr = FindEncoder( pEncoders, pinMedium, &pEncoder );
        if( SUCCEEDED( hr ) )
        {
            hr = graph_->AddFilter( pEncoder, L"Audio Encoder" );
            if( SUCCEEDED( hr ) &&
                SUCCEEDED( ConnectPin( pPin, pEncoder ) ) &&
                SUCCEEDED( ConnectFilters( pEncoder, pMultiplexer ) )
            )
            {
                return S_OK;
            }
        }
        
        
        pEncoders = NULL;
        hr = GetEncodersByEnumerating( pPin, pinMedium, &pEncoders );
        if( FAILED( hr ) )
        {
            return hr;
        }

        hr = FindEncoder( pEncoders, pinMedium, &pEncoder );
        if( SUCCEEDED( hr ) )
        {
            hr = graph_->AddFilter( pEncoder, L"Audio Encoder" );
            if( SUCCEEDED( hr ) &&
                SUCCEEDED( ConnectPin( pPin, pEncoder ) ) &&
                SUCCEEDED( ConnectFilters( pEncoder, pMultiplexer ) )
            )
            {
                return S_OK;
            }
        }
        return E_FAIL;
    }


    //
    //  Search throgh the codec category 
    //  
    hr = GetEncodersByCategory( &pEncoders );
    if( FAILED( hr ) )
    {
        return hr;
    }


    SmartPtr<IBaseFilter>    pFilter;
    SmartPtr<IMoniker>       pMoniker;
    ULONG                   fetched;
    while( pFilter.Release(), pMoniker.Release(), S_OK == pEncoders->Next( 1, &pMoniker, &fetched ) )
    {
        hr = pMoniker->BindToObject(
            0, 0, IID_IBaseFilter, reinterpret_cast<void **>( &pFilter ) );
        if( FAILED( hr ) )
        {
            continue;
        }

        hr = graph_->AddFilter( pFilter, L"Audio Encoder" );
        if( FAILED( hr ) )
        {
            continue;
        }

        hr = ConnectPin( pPin, pFilter );
        if( FAILED( hr ) )
        {
//.........这里部分代码省略.........
开发者ID:bai-lu-sz,项目名称:KineCT,代码行数:101,代码来源:SampleCGB.cpp


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