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

📄 audrend.h

📁 著名的 helix realplayer 基于手机 symbian 系统的 播放器全套源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* ***** BEGIN LICENSE BLOCK ***** 
 * Version: RCSL 1.0/RPSL 1.0 
 *  
 * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
 *      
 * The contents of this file, and the files included with this file, are 
 * subject to the current version of the RealNetworks Public Source License 
 * Version 1.0 (the "RPSL") available at 
 * http://www.helixcommunity.org/content/rpsl unless you have licensed 
 * the file under the RealNetworks Community Source License Version 1.0 
 * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
 * in which case the RCSL will apply. You may also obtain the license terms 
 * directly from RealNetworks.  You may not use this file except in 
 * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
 * applicable to this file, the RCSL.  Please see the applicable RPSL or 
 * RCSL for the rights, obligations and limitations governing use of the 
 * contents of the file.  
 *  
 * This file is part of the Helix DNA Technology. RealNetworks is the 
 * developer of the Original Code and owns the copyrights in the portions 
 * it created. 
 *  
 * This file, and the files included with this file, is distributed and made 
 * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
 * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
 * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
 * 
 * Technology Compatibility Kit Test Suite(s) Location: 
 *    http://www.helixcommunity.org/content/tck 
 * 
 * Contributor(s): 
 *  
 * ***** END LICENSE BLOCK ***** */ 

#ifndef _AUDREND_H_
#define _AUDREND_H_

/****************************************************************************
 *  Includes
 */
#include "audrendf.h"
#include "hxplugn.h"
#include "hxrendr.h"
#include "hxasm.h"
#include "hxmon.h"
#include "hxcore.h"
#include "hxtick.h"
#include "hxerror.h"

#include "audstats.h"

#define AUDREND_INITIAL_NUMSTREAMPTRS  4


/****************************************************************************
 *  CAudioRenderer
 */
class CAudioRenderer : public IHXPlugin,
		       public IHXRenderer,
		       public IHXStatistics,
		       public IHXInterruptSafe,
		       public IHXDryNotification
{
protected:
    typedef enum 
    {
	stopped, 
	buffering, 
	playing, 
	paused, 
	seeking
    } PlayState;
    
    static const char*	const zm_pDescription;
    static const char*	const zm_pCopyright;
    static const char*	const zm_pMoreInfoURL;
    static const char*	const zm_pStreamMimeTypes[];

    HX_RESULT InitAudioStream (IHXValues* pHeader,
			       IHXAudioStream** ppAudioStream);

    HX_RESULT DoAudio	      (UINT32 &ulAudioTime, 
			       AUDIO_STATE audioState  = AUDIO_NORMAL);

    HX_RESULT WriteToAudioServices (HXAudioData* pAudioData);

    HX_RESULT AttemptToSatisfyDryRequest (UINT32 ulAudioTimeWanted);

    void CalculateMaxTimeStamp(HXAudioData* pAudioData);

    HX_RESULT CheckForAudioStreamChange(REF(BOOL) rbAudioStreamChanged);
    BOOL      HasAudioFormatChanged();
    HX_RESULT IncrementAudioStream();

    BOOL IsRebuffering() const;
    void StartRebuffer(UINT32 ulAudioWantedTime);
    void EndRebuffer();

    IHXAudioPlayer*	    m_pAudioPlayer;
    IHXAudioStream**        m_ppAudioStream;
    UINT32                  m_ulNumAudioStreams;
    UINT32                  m_ulCurAudioStream;
    
    UINT32		    m_ulPreroll;
    UINT32		    m_ulDelay;
    UINT32		    m_ulDuration;
    UINT32		    m_ulAudioWantedTime;
    UINT32		    m_ulLastWriteTime;
    UINT32		    m_ulBaseWriteTime;
    INT32             m_lTimeOffset;

    PlayState		    m_PlayState;
  
    HX_BITFIELD		    m_bDoneWritingPackets:1;
    HX_BITFIELD		    m_bEndOfPackets:1;
    HX_BITFIELD		    m_bProcessingPacket:1;
    HX_BITFIELD		    m_bInSeekMode:1;
    HX_BITFIELD		    m_bFirstPacket:1;
    HX_BITFIELD		    m_bDelayOffsetSet:1;
    HX_BITFIELD             m_bCanChangeAudioStream : 1;

    HXMutex*		    m_pMutex;

    HX_RESULT CheckStreamVersions (IHXValues* pHeader);
    virtual HX_RESULT CheckAudioServices() {return HXR_OK;}

public:
    /*
     *	Costructor
     */
    CAudioRenderer();

    /*
     *	IUnknown methods
     */
    STDMETHOD(QueryInterface)	(THIS_
				REFIID riid,
				void** ppvObj);

    STDMETHOD_(UINT32,AddRef)	(THIS);

    STDMETHOD_(UINT32,Release)	(THIS);

    /*
     *	IHXPlugin methods
     */
    /************************************************************************
     *	Method:
     *	    IHXPlugin::GetPluginInfo
     *	Purpose:
     *	    Returns the basic information about this plugin. Including:
     *
     *	    bLoadMultiple	whether or not this plugin DLL can be loaded
     *				multiple times. All File Formats must set
     *				this value to TRUE.
     *	    pDescription	which is used in about UIs (can be NULL)
     *	    pCopyright		which is used in about UIs (can be NULL)
     *	    pMoreInfoURL	which is used in about UIs (can be NULL)
     */
    STDMETHOD(GetPluginInfo)	(THIS_
				REF(BOOL)	 /*OUT*/ bLoadMultiple,
				REF(const char*) /*OUT*/ pDescription,
				REF(const char*) /*OUT*/ pCopyright,
				REF(const char*) /*OUT*/ pMoreInfoURL,
				REF(ULONG32)	 /*OUT*/ ulVersionNumber
				);

    /************************************************************************
     *	Method:
     *	    IHXPlugin::InitPlugin
     *	Purpose:
     *	    Initializes the plugin for use. This interface must always be
     *	    called before any other method is called. This is primarily needed 
     *	    so that the plugin can have access to the context for creation of
     *	    IHXBuffers and IMalloc.
     */
    STDMETHOD(InitPlugin)   (THIS_
			    IUnknown*   /*IN*/  pContext);

    
    /*
     *	IHXRenderer methods
     */
    /************************************************************************
     *	Method:
     *	    IHXRenderer::GetRendererInfo
     *	Purpose:
     *	    Returns information vital to the instantiation of rendering 
     *	    plugins.
     */
    STDMETHOD(GetRendererInfo)	(THIS_
				REF(const char**) /*OUT*/ pStreamMimeTypes,
				REF(UINT32)      /*OUT*/ unInitialGranularity
				);

    /////////////////////////////////////////////////////////////////////////
    //	Method:
    //	    IHXRenderer::StartStream
    //	Purpose:
    //	    Called by client engine to inform the renderer of the stream it
    //	    will be rendering. The stream interface can provide access to
    //	    its source or player. This method also provides access to the 
    //	    primary client controller interface.
    //
    STDMETHOD (StartStream)	(THIS_			
				IHXStream*	    pStream,
				IHXPlayer*	    pPlayer);

    /////////////////////////////////////////////////////////////////////////
    //	Method:
    //	    IHXRenderer::EndStream
    //	Purpose:
    //	    Called by client engine to inform the renderer that the stream
    //	    is was rendering is closed.
    //
    STDMETHOD (EndStream)	(THIS);

    /////////////////////////////////////////////////////////////////////////
    //	Method:
    //		IHXRenderer::OnHeader
    //	Purpose:
    //		Called by client engine when a header for this renderer is 
    //		available. The header will arrive before any packets.
    //
    STDMETHOD (OnHeader)	(THIS_
				IHXValues*	    pHeader);

    /////////////////////////////////////////////////////////////////////////
    //	Method:
    //	    IHXRenderer::OnPacket
    //	Purpose:
    //	    Called by client engine when a packet for this renderer is 
    //	    due.

⌨️ 快捷键说明

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