hxapihelp_player.cpp
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:3k
源码类别:

Symbian

开发平台:

Visual C++

  1. /************************************************************************
  2.  * hxsym_hxapihelp_player.cpp
  3.  * -------------
  4.  *
  5.  * Synopsis:
  6.  *  helpers for working with IHXPlayer related helix api interfaces
  7.  *
  8.  *
  9.  * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
  10.  *
  11.  ************************************************************************/
  12. #include "hxtypes.h"
  13. #include "hxcom.h"
  14. #include "hxresult.h"
  15. #include "ihxpckts.h" //IHXValues
  16. #include "hxcore.h" //IHXPlayer
  17. #include "hxsmbw.h" //IHXASMProps
  18. #include "comptr.h"
  19. #include "comptr_traits.h"
  20. #include "hxsym_debug.h"
  21. #include "hxapihelp_player.h"
  22. comptr<IHXStreamSource> player::GetSource(IHXPlayer* pPlayer, UINT32 idxSource)
  23. {
  24.     comptr<IHXStreamSource> streamSource;
  25.     if(idxSource < pPlayer->GetSourceCount())
  26.     {
  27.         comptr<IUnknown> sourceUnknown;
  28.         pPlayer->GetSource( UINT16(idxSource), sourceUnknown.AsRef());
  29.         streamSource.From(sourceUnknown); 
  30.     }
  31.     return streamSource;
  32. }
  33. UINT32 player::GetStreamASMBandwidth(IHXStream* pStream)
  34. {
  35.     UINT32 bw = 0; //IHXStreamBandwidthNegotiator::GetThresholdInfo, IHXASMProps::GetPreData
  36.     comptr<IHXASMProps> props;
  37.     props.From(pStream);
  38.     if(props)
  39.     {
  40.         props->GetBandwidth(bw);
  41.     }
  42.     return bw;
  43. }
  44. comptr<IHXValues> player::GetFileHeader(IHXPlayer* pPlayer, UINT32 idxSource)
  45. {
  46.     comptr<IHXValues> fileHeader;
  47.     comptr<IHXStreamSource> streamSource = GetSource(pPlayer, idxSource);
  48.     fileHeader.From(streamSource);
  49.     return fileHeader;
  50. }
  51. UINT32 player::GetStreamCount(IHXPlayer* pPlayer, UINT32 idxSource)
  52. {
  53.     UINT32 streamCount = 0;
  54.     comptr<IHXStreamSource> streamSource = GetSource(pPlayer, idxSource);
  55.     if( streamSource )
  56.     {
  57.         streamCount = streamSource->GetStreamCount();
  58.     }
  59.        
  60.     return streamCount;
  61. }
  62. comptr<IHXStream> player::GetStream(IHXStreamSource* pStreamSource, UINT32 idxStream)
  63. {
  64.     comptr<IHXStream> stream;
  65.     if( pStreamSource )
  66.     {
  67.         comptr<IUnknown> streamUnknown;
  68.         pStreamSource->GetStream(idxStream, streamUnknown.AsRef());
  69.         stream.From(streamUnknown);
  70.     }
  71.     return stream;
  72. }
  73. comptr<IHXStream> player::GetStream(IHXPlayer* pPlayer, UINT32 idxSource, UINT32 idxStream)
  74. {
  75.     comptr<IHXStream> stream;
  76.     comptr<IHXStreamSource> streamSource = GetSource(pPlayer, idxSource);
  77.     if( streamSource )
  78.     {
  79.         comptr<IUnknown> streamUnknown;
  80.         streamSource->GetStream(idxStream, streamUnknown.AsRef());
  81.         stream.From(streamUnknown);
  82.     }
  83.     return stream;
  84. }
  85. comptr<IHXValues> player::GetStreamHeader(IHXStreamSource* pStreamSource, UINT32 idxStream)
  86. {
  87.     comptr<IHXValues> streamHeader;
  88.     comptr<IHXStream> stream = GetStream(pStreamSource, idxStream);
  89.     streamHeader.Take(stream->GetHeader());
  90.     return streamHeader;
  91. }
  92. comptr<IHXValues> player::GetStreamHeader(IHXPlayer* pPlayer, UINT32 idxSource, UINT32 idxStream)
  93. {
  94.     comptr<IHXValues> streamHeader;
  95.     comptr<IHXStream> stream = GetStream(pPlayer, idxSource, idxStream);
  96.     streamHeader.Take(stream->GetHeader());
  97.     return streamHeader;
  98. }