hxapihelp_player.cpp
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:3k
- /************************************************************************
- * hxsym_hxapihelp_player.cpp
- * -------------
- *
- * Synopsis:
- * helpers for working with IHXPlayer related helix api interfaces
- *
- *
- * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- ************************************************************************/
- #include "hxtypes.h"
- #include "hxcom.h"
- #include "hxresult.h"
- #include "ihxpckts.h" //IHXValues
- #include "hxcore.h" //IHXPlayer
- #include "hxsmbw.h" //IHXASMProps
- #include "comptr.h"
- #include "comptr_traits.h"
- #include "hxsym_debug.h"
- #include "hxapihelp_player.h"
- comptr<IHXStreamSource> player::GetSource(IHXPlayer* pPlayer, UINT32 idxSource)
- {
- comptr<IHXStreamSource> streamSource;
- if(idxSource < pPlayer->GetSourceCount())
- {
- comptr<IUnknown> sourceUnknown;
- pPlayer->GetSource( UINT16(idxSource), sourceUnknown.AsRef());
- streamSource.From(sourceUnknown);
- }
- return streamSource;
- }
- UINT32 player::GetStreamASMBandwidth(IHXStream* pStream)
- {
- UINT32 bw = 0; //IHXStreamBandwidthNegotiator::GetThresholdInfo, IHXASMProps::GetPreData
- comptr<IHXASMProps> props;
- props.From(pStream);
- if(props)
- {
- props->GetBandwidth(bw);
- }
- return bw;
- }
- comptr<IHXValues> player::GetFileHeader(IHXPlayer* pPlayer, UINT32 idxSource)
- {
- comptr<IHXValues> fileHeader;
- comptr<IHXStreamSource> streamSource = GetSource(pPlayer, idxSource);
- fileHeader.From(streamSource);
- return fileHeader;
- }
- UINT32 player::GetStreamCount(IHXPlayer* pPlayer, UINT32 idxSource)
- {
- UINT32 streamCount = 0;
- comptr<IHXStreamSource> streamSource = GetSource(pPlayer, idxSource);
- if( streamSource )
- {
- streamCount = streamSource->GetStreamCount();
- }
-
- return streamCount;
- }
- comptr<IHXStream> player::GetStream(IHXStreamSource* pStreamSource, UINT32 idxStream)
- {
- comptr<IHXStream> stream;
- if( pStreamSource )
- {
- comptr<IUnknown> streamUnknown;
- pStreamSource->GetStream(idxStream, streamUnknown.AsRef());
- stream.From(streamUnknown);
- }
- return stream;
- }
- comptr<IHXStream> player::GetStream(IHXPlayer* pPlayer, UINT32 idxSource, UINT32 idxStream)
- {
- comptr<IHXStream> stream;
- comptr<IHXStreamSource> streamSource = GetSource(pPlayer, idxSource);
- if( streamSource )
- {
- comptr<IUnknown> streamUnknown;
- streamSource->GetStream(idxStream, streamUnknown.AsRef());
- stream.From(streamUnknown);
- }
- return stream;
- }
- comptr<IHXValues> player::GetStreamHeader(IHXStreamSource* pStreamSource, UINT32 idxStream)
- {
- comptr<IHXValues> streamHeader;
- comptr<IHXStream> stream = GetStream(pStreamSource, idxStream);
- streamHeader.Take(stream->GetHeader());
- return streamHeader;
- }
- comptr<IHXValues> player::GetStreamHeader(IHXPlayer* pPlayer, UINT32 idxSource, UINT32 idxStream)
- {
- comptr<IHXValues> streamHeader;
- comptr<IHXStream> stream = GetStream(pPlayer, idxSource, idxStream);
- streamHeader.Take(stream->GetHeader());
- return streamHeader;
- }