hxapihelp_player.cpp

来自「symbian 下的helix player源代码」· C++ 代码 · 共 121 行

CPP
121
字号
/************************************************************************
 * 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;
}

⌨️ 快捷键说明

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