⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chxclientplayer.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 3 页
字号:
			{				spBuffer.AsPtr( ppIDisplayName );				isURL = true;				return true;			}		}		SPIHXValues spProps2;		for ( UINT16 i = 0 ; i < spGroup->GetTrackCount() ; ++i )		{			spGroup->GetTrack( i, *spProps2.AsInOutParam() );			if ( spProps2.IsValid() )			{				spProps2->GetPropertyCString( "title", *spBuffer.AsInOutParam() );				if ( BufferContainsText( spBuffer ) )				{					spBuffer.AsPtr( ppIDisplayName );					return true;				}				spProps2->GetPropertyCString( "src", *spBuffer.AsInOutParam() );				if ( BufferContainsText( spBuffer ) )				{					spBuffer.AsPtr( ppIDisplayName );					isURL = true;					return true;				}			}		}    }	// we failed to get a group or track name or URL, so use one for the overall file	SPIHXValues spValues = m_pIHXCorePlayer;	if ( spValues.IsValid() )	{		spValues->GetPropertyCString( "url", *spBuffer.AsInOutParam() );		if ( BufferContainsText( spBuffer ) )		{			spBuffer.AsPtr( ppIDisplayName );			isURL = true;			return true;		}	}	return false;}boolCHXClientPlayer::GetGroupTitle( UINT16 groupIndex, char* pTitleBuffer, UINT32 bufferLength, UINT32* pUsedBufferLength ) const{	if ( pUsedBufferLength )	{		*pUsedBufferLength = 0;	}	bool isURL = false;	SPIHXBuffer spDisplayName;	if ( GetGroupTitleBuffer( groupIndex, spDisplayName.AsInOutParam(), isURL ) )	{		const unsigned char* pTitleString = spDisplayName->GetBuffer();		const unsigned char* pEndOfTitle = pTitleString + spDisplayName->GetSize() - 1;		while ( pTitleString < pEndOfTitle )		{			if ( !isspace( *pTitleString ) ) break;			pTitleString++;		}		while ( pEndOfTitle > pTitleString )		{			if ( !isspace( pEndOfTitle[ -1 ] ) ) break;			pEndOfTitle--;		}		if ( pTitleString >= pEndOfTitle ) return false;		UINT32 desiredBufferLength = pEndOfTitle - pTitleString + 1;		// XXXSEH: Need to implement this post processing on non Mac platforms.#ifdef _MAC_MACHO		if ( isURL )		{			CFURLRef kNoBaseURL = NULL;			CFURLRef urlRef = CFURLCreateWithBytes( kCFAllocatorDefault, pTitleString, desiredBufferLength, kCFStringEncodingUTF8, kNoBaseURL );			CFStringRef filenameString = ::CFURLCopyLastPathComponent( urlRef );			CFRelease( urlRef );			if ( !filenameString ) return false;							CFStringRef displayName = ::CFURLCreateStringByReplacingPercentEscapes( kCFAllocatorDefault, filenameString, nil );			if ( !displayName )			{				displayName = ( CFStringRef ) CFRetain( filenameString );			}			CFRelease( filenameString );						// If no buffer was provided, just return the string's size.			if ( !pTitleBuffer || ( bufferLength == 0 ) )			{				CFStringGetBytes( displayName, CFRangeMake( 0, CFStringGetLength( displayName ) ), kCFStringEncodingUTF8, '?', false, NULL, 0, ( CFIndex* ) pUsedBufferLength );				if ( pUsedBufferLength )				{					*pUsedBufferLength = *pUsedBufferLength + 1;				}				CFRelease( displayName );				return false;			}			else			{				// XXXSEH: What will this produce if the buffer isn't large enough? Will it properly terminate the truncated string?				if ( CFStringGetCString( displayName, pTitleBuffer, bufferLength, kCFStringEncodingUTF8 ) && pUsedBufferLength )				{					*pUsedBufferLength = strlen( pTitleBuffer ) + 1;				}				CFRelease( displayName );				return true;			}		}		else#endif		{						// If no buffer was provided, just return the string's size.			if ( !pTitleBuffer || ( bufferLength == 0 ) )			{				if ( pUsedBufferLength )				{					*pUsedBufferLength = desiredBufferLength;				}				return false;			}			else			{				UINT32 usedBufferLength = ( desiredBufferLength <= bufferLength ) ? desiredBufferLength : bufferLength;				memcpy( pTitleBuffer, pTitleString, usedBufferLength );				if ( usedBufferLength < desiredBufferLength )				{					pTitleBuffer[ usedBufferLength - 1 ] = '\0';				}				if ( pUsedBufferLength )				{					*pUsedBufferLength = usedBufferLength;				}				return true;			}		}	}	return false;}#pragma mark -voidCHXClientPlayer::SetVolume( UINT16 volume ){	if ( m_pIClientVolume )	{		m_pIClientVolume->SetVolume( volume );	}}UINT16CHXClientPlayer::GetVolume( void ) const{	return m_pIClientVolume ? m_pIClientVolume->GetVolume() : 0;}voidCHXClientPlayer::Mute( bool shouldMute ){	if ( m_pIClientVolume )	{		m_pIClientVolume->SetMute( shouldMute ? 1 : 0 );	}}boolCHXClientPlayer::IsMuted( void ) const{	return m_pIClientVolume ? ( ( 0 != m_pIClientVolume->GetMute() ) ? true : false ) : false;}#pragma mark -voidCHXClientPlayer::EnableEQ( bool enable ){	if ( m_pEQProcessor )	{		m_pEQProcessor->Enable( enable );	}}boolCHXClientPlayer::IsEQEnabled( void ) const{	return m_pEQProcessor ? m_pEQProcessor->IsEnabled() : false;}voidCHXClientPlayer::SetEQGain( int band, INT32 gain ){	if ( m_pEQProcessor )	{		m_pEQProcessor->SetGain( band, gain );	}}INT32CHXClientPlayer::GetEQGain( int band ) const{	return m_pEQProcessor ? m_pEQProcessor->GetGain( band ) : 0;}voidCHXClientPlayer::SetEQPreGain( INT32 preGain ){	if ( m_pEQProcessor )	{		m_pEQProcessor->SetPreGain( preGain );	}}INT32CHXClientPlayer::GetEQPreGain( void ) const{	return m_pEQProcessor ? m_pEQProcessor->GetPreGain() : 0;}voidCHXClientPlayer::EnableEQAutoPreGain( bool enable ){	if ( m_pEQProcessor )	{		m_pEQProcessor->EnableAutoPreGain( enable );	}}boolCHXClientPlayer::IsEQAutoPreGainEnabled( THIS ) const{	return m_pEQProcessor ? m_pEQProcessor->IsAutoPreGainEnabled() : false;}voidCHXClientPlayer::SetEQReverb( INT32 roomSize, INT32 reverb ){	if ( m_pEQProcessor )	{		m_pEQProcessor->SetReverb( roomSize, reverb );	}}voidCHXClientPlayer::GetEQReverb( INT32* pRoomSize, INT32* pReverb ) const{	CHXASSERT( pRoomSize );	CHXASSERT( pReverb );	if ( m_pEQProcessor )	{		int roomSize, reverb;		m_pEQProcessor->GetReverb( &roomSize, &reverb );		*pRoomSize = roomSize;		*pReverb = reverb;	}	else	{		*pRoomSize = 0;		*pReverb = 0;	}}#pragma mark -boolCHXClientPlayer::HasVisualContent( void ) const{#ifdef HELIX_FEATURE_VIDEO	if ( m_SiteSupplier )	{		return m_SiteSupplier->HasVisualContent();	}	else#endif	{		return false;	}}voidCHXClientPlayer::GetIdealSize( INT32* pSiteIdealWidth, INT32* pSiteIdealHeight ) const{#ifdef HELIX_FEATURE_VIDEO	if ( m_SiteSupplier )	{		HXxSize siteIdealSize = { 0, 0 };		m_SiteSupplier->GetIdealSize( siteIdealSize );		*pSiteIdealWidth = siteIdealSize.cx;		*pSiteIdealHeight = siteIdealSize.cy;	}	else#endif	{		*pSiteIdealWidth = 0;		*pSiteIdealHeight = 0;	}}voidCHXClientPlayer::SetSize( INT32 siteWidth, INT32 siteHeight ){#ifdef HELIX_FEATURE_VIDEO	if ( m_SiteSupplier )	{		HXxSize siteSize;		siteSize.cx = siteWidth;		siteSize.cy = siteHeight;		m_SiteSupplier->SetSize( siteSize );	}#endif}voidCHXClientPlayer::DrawSite( const HXxRect* pSiteRect ){#ifdef HELIX_FEATURE_VIDEO	if ( m_SiteSupplier )	{		m_SiteSupplier->DrawSite( *pSiteRect );	}#endif}boolCHXClientPlayer::GetVideoAttribute( int attributeKey, float* pAttributeValue ) const{	CHXASSERT( pAttributeValue );		bool outOK = false;#ifdef HELIX_FEATURE_VIDEO	if ( m_SiteSupplier )	{		SPIHXVideoControl spVideoControl = m_SiteSupplier->GetVideoControl();		if ( spVideoControl.IsValid() )		{			outOK = true;			switch ( attributeKey )			{				case kVideoAttrBrightness:					*pAttributeValue = spVideoControl->GetBrightness();					break;				case kVideoAttrContrast:					*pAttributeValue = spVideoControl->GetContrast();					break;				case kVideoAttrSaturation:					*pAttributeValue = spVideoControl->GetSaturation();					break;				case kVideoAttrHue:					*pAttributeValue = spVideoControl->GetHue();					break;				case kVideoAttrSharpness:					*pAttributeValue = spVideoControl->GetSharpness();					break;				default:					outOK = false;					break;			}		}	}#endif	return outOK;}boolCHXClientPlayer::SetVideoAttribute( int attributeKey, float attributeValue ){	bool outOK = false;#ifdef HELIX_FEATURE_VIDEO	if ( m_SiteSupplier )	{		SPIHXVideoControl spVideoControl = m_SiteSupplier->GetVideoControl();		if ( spVideoControl.IsValid() )		{			outOK = true;			switch ( attributeKey )			{				case kVideoAttrBrightness:					spVideoControl->SetBrightness( attributeValue );					break;				case kVideoAttrContrast:					spVideoControl->SetContrast( attributeValue );					break;				case kVideoAttrSaturation:					spVideoControl->SetSaturation( attributeValue );					break;				case kVideoAttrHue:					spVideoControl->SetHue( attributeValue );					break;				case kVideoAttrSharpness:					spVideoControl->SetSharpness( attributeValue );					break;				default:					outOK = false;					break;			}		}	}#endif	return outOK;}boolCHXClientPlayer::GetStatistic( const char* pStatisticKey, unsigned char* pValueBuffer, UINT32 bufferLength, int* pValueType, UINT32* pUsedBufferLength ){#if defined(HELIX_FEATURE_REGISTRY) && defined(HELIX_FEATURE_STATS)	if ( m_pStatisticTracker )	{		return m_pStatisticTracker->GetStatisticsFor( pStatisticKey, pValueBuffer, bufferLength, pValueType, pUsedBufferLength );	}	else#endif	{		return false;	}}boolCHXClientPlayer::AddStatisticObserver( const char* pStatisticKey, const HXStatisticsCallbacks* pStatisticsCallbacks, void* observerInfo ){#if defined(HELIX_FEATURE_REGISTRY) && defined(HELIX_FEATURE_STATS)	if ( m_pStatisticTracker )	{		return m_pStatisticTracker->AddObserver( pStatisticKey, pStatisticsCallbacks, observerInfo );	}	else#endif	{		return false;	}}voidCHXClientPlayer::RemoveStatisticObserver( const char* pStatisticKey, const HXStatisticsCallbacks* pStatisticsCallbacks, void* observerInfo ){#if defined(HELIX_FEATURE_REGISTRY) && defined(HELIX_FEATURE_STATS)	if ( m_pStatisticTracker )	{		m_pStatisticTracker->RemoveObserver( pStatisticKey, pStatisticsCallbacks, observerInfo );	}#endif}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -