rarender.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:25k
- /* ***** 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 _RARENDER_H_
- #define _RARENDER_H_
- /****************************************************************************
- * Defines
- */
- #define STREAM_MAJOR_VERSION 0
- #define STREAM_MINOR_VERSION 0
- #define CONTENT_MAJOR_VERSION 0
- #define CONTENT_MINOR_VERSION 0
- /****************************************************************************
- * Includes
- */
- #include "hxcom.h"
- #include "baseobj.h"
- #include "hxtypes.h"
- #include "hxslist.h"
- #include "hxresult.h"
- #include "hxmarsh.h"
- #include "netbyte.h"
- #include "hxmime.h"
- #include "hxcom.h"
- #include "chxpckts.h"
- #include "hxheap.h"
- #include "hxcomm.h"
- #include "ihxpckts.h"
- #include "hxfiles.h"
- #include "hxcore.h"
- #include "hxengin.h"
- #include "hxprefs.h"
- #include "hxrendr.h"
- #include "hxplugn.h"
- #include "hxbdwdth.h"
- #include "hxausvc.h"
- #include "hxslist.h"
- #include "hxupgrd.h"
- #include "raparser.h"
- #include "hxasm.h"
- #include "hxrasyn.h"
- #include "rmfftype.h"
- #include "hxthread.h"
- #include "hxerror.h"
- #include "pckunpck.h"
- #include "adjtime.h"
- #include "vbrdepack.h"
- #include "dllpath.h"
- #include "readpath.h"
- #include "hxcodec.h"
- #include "codec.h"
- #include "errdbg.h"
- #include "hxtick.h"
- #include "hxstrutl.h"
- #include "raformat.h"
- /****************************************************************************
- * Defines
- */
- #define NO_STREAM_SET 0xFFFF
- class CRealAudioRenderer;
- class CDryNotificationCallback;
- /////////////////////////////////////////////////////////////////////////////
- //
- // Class:
- //
- // CRealAudioRenderer
- //
- // Purpose:
- //
- // Implementation of a basic RealAudio renderer.
- //
- class RuleToFlagMap;
- class HXMutex;
- class CRealAudioRenderer : public IHXPlugin,
- public IHXRenderer,
- public IHXInterruptSafe,
- public IHXDryNotification,
- public IHXBandwidthLister,
- public IHXStatistics,
- public IHXValues, // for HELIX_FEATURE_SETSRCPROPS
- public IHXUpdateProperties,
- public CHXBaseCountingObject
- {
- protected:
- LONG32 m_lRefCount;
- IUnknown* m_pContext;
- IHXStream* m_pStream;
- #if defined(HELIX_CONFIG_SLUGGISHAUTOUPGRADE)
- IHXASMStream2* m_pASMStream;
- #endif
- IHXSourceBufferingStats* m_pBufferingStats;
- IHXAudioPlayer* m_pAudioPlayer;
- IHXErrorMessages* m_pErrorMessages;
- CRaFormat** m_pRaFormats;
- IHXAudioStream** m_pAudioStreams;
- IHXCommonClassFactory* m_pCommonClassFactory;
- UINT32 m_ulPreroll;
- UINT32 m_ulDelay;
- UINT32 m_ulDuration;
- LONG32 m_lTimeLineOffset;
- UINT16 m_usCurrentDryNotificationStream;
- UINT16 m_usPreviousDryNotificationStream;
- UINT16 m_usThisSourceStream;
- UINT32 m_ulCurrentTimelineTime;
- // statistics
- IHXRegistry* m_pRegistry;
- UINT32 m_ulRegistryID;
- UINT32 m_ulNameRegID;
- UINT32 m_ulSmartStreamRegID;
- UINT32 m_ulCodecRegID;
- UINT32 m_ulCodecTextRegID;
- UINT32 m_ulCodec4CCRegID;
- UINT32 m_ulRateRegID;
- UINT32 m_ulChannelsRegID;
- UINT32 m_ulSurroundRegID;
- HX_BITFIELD m_bDoneWritingPackets:1;
- HX_BITFIELD m_bEndOfPackets:1;
- #ifdef _MACINTOSH
- HX_BITFIELD m_bProcessingPacket:1;
- #endif // _MACINTOSH
- HX_BITFIELD m_bAllStreamsToBeUnregistered:1;
- HX_BITFIELD m_bInSeekMode:1;
- HX_BITFIELD m_bReportOKStatus:1;
- HX_BITFIELD m_bStreamSwitchable:1;
- HX_BITFIELD m_bFirstPacket:1;
- HX_BITFIELD m_bDelayOffsetSet:1;
- HX_BITFIELD m_bPreRedstonePlayer:1;
- UINT32 m_ulCurrentGranularity;
- IHXAudioPushdown2* m_pAudioPushdown2;
- // Stream Switching
- RuleToFlagMap* m_pRuleToFlagMap;
- UINT16 m_uNumOfSubStreams;
- UINT16 m_uNumOfRules;
- UINT16* m_pRuleMap;
- BOOL m_bSecurityBreached;
- typedef enum
- {
- stopped, buffering, playing, paused, seeking
- } PlayState;
- PlayState m_PlayState;
- typedef enum
- {
- none, unknownRAContentVersion
- } AutoUpgradeRequestExtraInfo;
- class CUnregisterInfo
- {
- public:
- CUnregisterInfo(UINT32 ulTime, UINT16 uStream)
- {
- m_uStreamToBeUnregistered = uStream;
- m_ulUnregisterTime = ulTime;
- }
- virtual ~CUnregisterInfo() {};
- UINT16 m_uStreamToBeUnregistered;
- UINT32 m_ulUnregisterTime;
- };
- UINT16 m_uSyncUnregisterStream;
- UINT32 m_ulSyncUnregisterTime;
- HXMutex* m_pMutex;
- UINT32 m_ulLatestStreamTime;
- UINT32 m_ulLatestActualTime;
- double m_fLatestStreamTime;
- UINT32 m_ulSrcPropertySubStream;
- IHXValues* m_pValues;
- CVBRSimpleDepacketizer** m_ppVBRDepack;
- #ifdef _MACINTOSH
- CDryNotificationCallback* m_pDryCallback;
- #endif
- static const char* const zm_pName;
- static const char* const zm_pDescription;
- static const char* const zm_pCopyright;
- static const char* const zm_pMoreInfoURL;
- static const char* const zm_pStreamMimeTypes[];
- static const char* const zm_pAdditionalAutoUpgradeInfo[];
- virtual CRaFormat* CreateRaFormat(UINT16 uStreamNum);
- BOOL HaveDataToWrite();
- virtual HX_RESULT FindLowestStartTime(UINT16 &uLowest,
- UINT32 &ulLowestStartTime,
- UINT32 &ulLowestEndTime,
- UINT16 &nActive);
- virtual HX_RESULT FindLongestOverlap(UINT16 uLowest,
- UINT32 ulLowestEndTime,
- UINT16 nActive,
- UINT16 &uLongestOverlap,
- AUDIO_STATE &audioState);
- virtual void GetLatestTimesForStream(UINT16 uStream,
- UINT32& ulLatestActualTime,
- UINT32& ulLatestStreamTime);
- virtual void OffsetLatestTime(UINT16 uStreamNumber,
- INT32 lTimeOffset);
- virtual BOOL IsCrossfadeInProgress(void);
- virtual HX_RESULT AttemptCrossfade(UINT16 uLowest, // From
- UINT16 uLongetOverlap, // To
- UINT32 ulLatestActualTime,
- UINT32 ulLatestStreamTime,
- UINT32& ulFromStreamTimeStart,
- UINT32& ulFromActualTimeStart,
- AUDIO_STATE audioState);
- virtual HX_RESULT AttemptCrossfadeTermination(UINT16& uStream,
- UINT32 ulActualTimestamp,
- BOOL bStreamDone);
- HX_RESULT AddDryNotification(UINT16 usStreamNumber);
- HX_RESULT CheckStreamVersions(IHXValues* pHeader);
- HX_RESULT InitAudioStream(CRaFormat* pRaFormat,
- IHXValues* pHeader,
- IHXAudioStream** ppAudioStream);
- HX_RESULT DoAudio(UINT32 &ulAudioTime,
- AUDIO_STATE audioState);
- virtual HX_RESULT WriteToAudioServices(UINT16 uStreamNumber,
- HXAudioData* pAuidoData,
- UINT32 ulActualTimestamp);
- HX_RESULT GetQualityPreference(UINT16 &usQuality);
- virtual void CalculateMaxTimeStamp(UINT16 uStreamNumber,
- HXAudioData* pAudioData,
- UINT32 ulActualTimeStamp,
- UINT32* pulDataDuration = NULL,
- double *pfDataDuration = NULL);
- virtual void DoSyncRegister(UINT16 ulStreamNumber);
- virtual void QueueUnregisterSync(UINT16 ulStream, UINT32 ulTime);
- virtual void UnregisterTimeSyncs(UINT32 ulCurrentTime);
- virtual void FlushUnregisterQueue(BOOL bDestroy = FALSE);
- void ScheduleDryCallback(UINT32 ulAudioTimeWanted);
- inline BOOL IsStreamActive(UINT16 usStreamNumber)
- {return m_pRaFormats[usStreamNumber]->IsActive();}
- inline void LogAudioWrite(UINT16 uStreamNumber,
- HXAudioData* pAudioData,
- UINT32 ulActualTimestamp,
- HX_RESULT retVal);
- void CheckForSetSourceProperties(BOOL bForceRefresh = FALSE);
- HX_RESULT GetSourcePropertyULONG32(const char* pszProp, REF(ULONG32) rulVal);
- HX_RESULT GetSourcePropertyCString(const char* pszProp, REF(IHXBuffer*) rpBuffer);
- void WriteCodecsToRegistry(const char* pAllCodecs);
- void AddCodec(IHXValues*, char*, UINT32, UINT32, int);
- void RemoveCurrentDryNotification();
- HX_RESULT _OnPacket(IHXPacket* pPacket, INT32 lTimeOffset);
- inline ULONG32 _AddRef(void);
- inline ULONG32 _Release(void);
- public:
- static void AdvanceLatestTime(UINT32 uBaseStreamTime,
- UINT32 ulBaseActualTime,
- UINT32 ulDurationAdvance,
- double fDurationAdvance,
- UINT32 &ulLatestStreamTime,
- double &fLatestStreamTime,
- UINT32 &ulLatestActualTime);
- STDMETHOD(AttemptToSatisfyDryRequest)(THIS_ UINT32 ulAudioTimeWanted);
- CRealAudioRenderer();
- virtual ~CRealAudioRenderer();
- // *** 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);
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_
- REFIID riid,
- void** ppvObj);
- STDMETHOD_(ULONG32,AddRef) (THIS);
- STDMETHOD_(ULONG32,Release) (THIS);
- // *** 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.
- //
- STDMETHOD (OnPacket) (THIS_
- IHXPacket* pPacket,
- LONG32 lTimeOffset);
- /////////////////////////////////////////////////////////////////////////
- // Method:
- // IHXRenderer::OnTimeSync
- // Purpose:
- // Called by client engine to inform the renderer of the current
- // time relative to the streams synchronized time-line. The
- // renderer should use this time value to update its display or
- // render it's stream data accordingly.
- //
- STDMETHOD (OnTimeSync) (THIS_
- ULONG32 ulTime);
- /////////////////////////////////////////////////////////////////////////
- // Method:
- // IHXRenderer::OnPreSeek
- // Purpose:
- // Called by client engine to inform the renderer that a seek is
- // about to occur. The render is informed the last time for the
- // stream's time line before the seek, as well as the first new
- // time for the stream's time line after the seek will be completed.
- //
- STDMETHOD (OnPreSeek) (THIS_
- ULONG32 ulOldTime,
- ULONG32 ulNewTime);
- /////////////////////////////////////////////////////////////////////////
- // Method:
- // IHXRenderer::OnPostSeek
- // Purpose:
- // Called by client engine to inform the renderer that a seek has
- // just occured. The render is informed the last time for the
- // stream's time line before the seek, as well as the first new
- // time for the stream's time line after the seek.
- //
- STDMETHOD (OnPostSeek) (THIS_
- ULONG32 ulOldTime,
- ULONG32 ulNewTime);
- /////////////////////////////////////////////////////////////////////////
- // Method:
- // IHXRenderer::OnPause
- // Purpose:
- // Called by client engine to inform the renderer that a pause has
- // just occured. The render is informed the last time for the
- // stream's time line before the pause.
- //
- STDMETHOD (OnPause) (THIS_
- ULONG32 ulTime);
- /////////////////////////////////////////////////////////////////////////
- // Method:
- // IHXRenderer::OnBegin
- // Purpose:
- // Called by client engine to inform the renderer that a begin or
- // resume has just occured. The render is informed the first time
- // for the stream's time line after the resume.
- //
- STDMETHOD (OnBegin) (THIS_
- ULONG32 ulTime);
- /////////////////////////////////////////////////////////////////////////
- // Method:
- // IHXRenderer::OnBuffering
- // Purpose:
- // Called by client engine to inform the renderer that buffering
- // of data is occuring. The render is informed of the reason for
- // the buffering (start-up of stream, seek has occured, network
- // congestion, etc.), as well as percentage complete of the
- // buffering process.
- //
- STDMETHOD (OnBuffering) (THIS_
- ULONG32 ulFlags,
- UINT16 unPercentComplete);
- /////////////////////////////////////////////////////////////////////////
- // Method:
- // IHXRenderer::GetDisplayType
- // Purpose:
- // Called by client engine to ask the renderer for it's preferred
- // display type. When layout information is not present, the
- // renderer will be asked for it's prefered display type. Depending
- // on the display type a buffer of additional information may be
- // needed. This buffer could contain information about preferred
- // window size.
- //
- STDMETHOD (GetDisplayType) (THIS_
- REF(HX_DISPLAY_TYPE) ulFlags,
- REF(IHXBuffer*) pBuffer);
- /************************************************************************
- * Method:
- * IHXRenderer::OnEndofPackets
- * Purpose:
- * Called by client engine to inform the renderer that all the
- * packets have been delivered. However, if the user seeks before
- * EndStream() is called, renderer may start getting packets again
- * and the client engine will eventually call this function again.
- */
- STDMETHOD(OnEndofPackets) (THIS);
- /*
- * IHXDryNotification methods
- */
- /************************************************************************
- * Method:
- * IHXDryNotificationOnDryNotification
- * Purpose:
- * This function is called when it is time to write to audio device
- * and there is not enough data in the audio stream. The renderer can
- * then decide to add more data to the audio stream. This should be
- * done synchronously within the call to this function.
- * It is OK to not write any data. Silence will be played instead.
- */
- STDMETHOD(OnDryNotification) (THIS_
- UINT32 /*IN*/ ulCurrentStreamTime,
- UINT32 /*IN*/ ulMinimumDurationRequired);
- /*
- * IHXStatistics methods
- */
- /************************************************************************
- * Method:
- * IHXStatistics::InitializeStatistics
- * Purpose:
- * Pass registry ID to the caller
- */
- STDMETHOD (InitializeStatistics)
- (THIS_
- UINT32 /*IN*/ ulRegistryID);
- /************************************************************************
- * Method:
- * IHXStatistics::UpdateStatistics
- * Purpose:
- * Notify the client to update its statistics stored in the registry
- */
- STDMETHOD (UpdateStatistics)(THIS);
- STDMETHOD (GetBandwidthInfo) (THIS_ IHXValues* pValues);
- /*
- * IHXInterruptSafe methods
- */
- /************************************************************************
- * Method:
- * IHXInterruptSafe::IsInterruptSafe
- * Purpose:
- * This is the function that will be called to determine if
- * interrupt time execution is supported.
- */
- STDMETHOD_(BOOL,IsInterruptSafe) (THIS)
- { return TRUE; };
- /************************************************************************
- * Method:
- * IHXUpdateProperties::UpdatePacketTimeOffset
- * Purpose:
- * Call this method to update the timestamp offset of cached packets
- */
- STDMETHOD(UpdatePacketTimeOffset) (THIS_
- INT32 lTimeOffset);
- /************************************************************************
- * Method:
- * IHXUpdateProperties::UpdatePlayTimes
- * Purpose:
- * Call this method to update the playtime attributes
- */
- STDMETHOD(UpdatePlayTimes) (THIS_
- IHXValues* pProps);
- // IHXValues methods
- STDMETHOD(SetPropertyULONG32) (THIS_ const char* pName, ULONG32 ulVal);
- STDMETHOD(GetPropertyULONG32) (THIS_ const char* pName, REF(ULONG32) rulVal);
- STDMETHOD(GetFirstPropertyULONG32) (THIS_ REF(const char*) rpName, REF(ULONG32) rulVal);
- STDMETHOD(GetNextPropertyULONG32) (THIS_ REF(const char*) rpName, REF(ULONG32) rulVal);
- STDMETHOD(SetPropertyBuffer) (THIS_ const char* pName, IHXBuffer* pVal);
- STDMETHOD(GetPropertyBuffer) (THIS_ const char* pName, REF(IHXBuffer*) rpVal);
- STDMETHOD(GetFirstPropertyBuffer) (THIS_ REF(const char*) rpName, REF(IHXBuffer*) rpVal);
- STDMETHOD(GetNextPropertyBuffer) (THIS_ REF(const char*) rpName, REF(IHXBuffer*) rpVal);
- STDMETHOD(SetPropertyCString) (THIS_ const char* pName, IHXBuffer* pVal);
- STDMETHOD(GetPropertyCString) (THIS_ const char* pName, REF(IHXBuffer*) rpVal);
- STDMETHOD(GetFirstPropertyCString) (THIS_ REF(const char*) rpName, REF(IHXBuffer*) rpVal);
- STDMETHOD(GetNextPropertyCString) (THIS_ REF(const char*) rpName, REF(IHXBuffer*) rpVal);
- static HX_RESULT STDAPICALLTYPE HXCreateInstance(IUnknown** ppIUnknown);
- static HX_RESULT STDAPICALLTYPE CanUnload2(void);
- };
- #ifdef _MACINTOSH
- class CDryNotificationCallback : public IHXCallback
- {
- private:
- LONG32 m_lRefCount;
- CRealAudioRenderer* m_pOutter;
- UINT32 m_ulAudioTimeWanted;
- IHXScheduler* m_pScheduler;
- CallbackHandle m_PendingHandle;
- HX_BITFIELD m_bPendingCallback:1;
- CDryNotificationCallback(UINT32 ulAudioTimeWanted, CRealAudioRenderer* pOutter, IUnknown* pIUnknown)
- : m_lRefCount(0)
- , m_ulAudioTimeWanted(ulAudioTimeWanted)
- , m_pOutter(pOutter)
- , m_pScheduler(NULL)
- , m_PendingHandle(NULL)
- , m_bPendingCallback(FALSE)
- {
- if (m_pOutter != NULL)
- {
- m_pOutter->AddRef();
- }
- if (HXR_OK != pIUnknown->QueryInterface(IID_IHXScheduler,
- (void **) &m_pScheduler))
- {
- m_pScheduler = NULL;
- }
- };
- virtual ~CDryNotificationCallback()
- {
- HX_RELEASE(m_pOutter);
- HX_RELEASE(m_pScheduler);
- }
- PRIVATE_DESTRUCTORS_ARE_NOT_A_CRIME
- public:
- static CDryNotificationCallback*
- CreateInstance(UINT32 ulAudioTimeWanted, CRealAudioRenderer* pOutter, IUnknown* pUnk)
- {
- CDryNotificationCallback* pInst = new CDryNotificationCallback(ulAudioTimeWanted, pOutter, pUnk);
- if (pInst != NULL)
- {
- pInst->AddRef();
- }
- return pInst;
- }
- /*
- * IUnknown methods
- */
- STDMETHODIMP QueryInterface(REFIID riid, void** ppvObj)
- {
- if (IsEqualIID(riid, IID_IUnknown))
- {
- AddRef();
- *ppvObj = (IUnknown*)this;
- return HXR_OK;
- }
- else if (IsEqualIID(riid, IID_IHXCallback))
- {
- AddRef();
- *ppvObj = (IHXCallback*)this;
- return HXR_OK;
- }
- *ppvObj = NULL;
- return HXR_NOINTERFACE;
- }
- STDMETHODIMP_(ULONG32)
- AddRef()
- {
- return InterlockedIncrement(&m_lRefCount);
- }
- STDMETHODIMP_(ULONG32)
- Release()
- {
- if (InterlockedDecrement(&m_lRefCount) > 0)
- {
- return m_lRefCount;
- }
- delete this;
- return 0;
- }
- STDMETHODIMP
- Func()
- {
- m_PendingHandle = 0;
- m_bPendingCallback = FALSE;
- if (m_pOutter != NULL)
- {
- return m_pOutter->AttemptToSatisfyDryRequest(m_ulAudioTimeWanted);
- }
- else
- {
- return HXR_UNEXPECTED;
- }
- }
- STDMETHODIMP
- ScheduleCallback()
- {
- IHXCallback* pCallback = NULL;
- if (HXR_OK == QueryInterface(IID_IHXCallback, (void**)&pCallback))
- {
- // we want to do the right thing here and remove a callback before we schedule a new one
- // but we should never do that.
- HX_ASSERT(!m_bPendingCallback);
- if (m_bPendingCallback)
- {
- if (m_pScheduler)
- {
- m_pScheduler->Remove(m_PendingHandle);
- }
- }
- m_bPendingCallback = TRUE;
- m_PendingHandle = m_pScheduler->RelativeEnter(pCallback, 0);
- }
- HX_RELEASE(pCallback);
- return HXR_OK;
- }
- STDMETHODIMP
- Cancel()
- {
- if (m_bPendingCallback && m_pScheduler)
- {
- m_pScheduler->Remove(m_PendingHandle);
- m_bPendingCallback = FALSE;
- m_PendingHandle = 0;
- }
- return HXR_OK;
- }
- STDMETHODIMP
- UpdateAudioTimeWanted(UINT32 ulAudioTimeWanted)
- {
- HX_ASSERT(m_bPendingCallback);
- m_ulAudioTimeWanted = ulAudioTimeWanted;
- return HXR_OK;
- }
- };
- #endif /*_MACINTOSH*/
- ULONG32 CRealAudioRenderer::_AddRef()
- {
- return InterlockedIncrement(&m_lRefCount);
- }
- ULONG32 CRealAudioRenderer::_Release()
- {
- if (InterlockedDecrement(&m_lRefCount) > 0)
- {
- return m_lRefCount;
- }
- delete this;
- return 0;
- }
- #endif // ndef _RARENDER_H_