123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870 |
- #ifndef _IAK_STREAM_MGR_H_
- #define _IAK_STREAM_MGR_H_
- #include <AK/SoundEngine/Common/AkMemoryMgr.h>
- #define AK_MONITOR_STREAMNAME_MAXLENGTH (64)
- #define AK_MONITOR_DEVICENAME_MAXLENGTH (16)
-
- enum AkStmStatus
- {
- AK_StmStatusIdle = 0,
- AK_StmStatusCompleted = 1,
- AK_StmStatusPending = 2,
- AK_StmStatusCancelled = 3,
- AK_StmStatusError = 4
- };
- enum AkMoveMethod
- {
- AK_MoveBegin = 0,
- AK_MoveCurrent = 1,
- AK_MoveEnd = 2
- };
- enum AkOpenMode
- {
- AK_OpenModeRead = 0,
- AK_OpenModeWrite = 1,
- AK_OpenModeWriteOvrwr = 2,
- AK_OpenModeReadWrite = 3
- };
- struct AkFileSystemFlags
- {
- AkFileSystemFlags()
- : uCacheID( AK_INVALID_FILE_ID ), uDirectoryHash( AK_INVALID_UNIQUE_ID ) {}
- AkFileSystemFlags( AkUInt32 in_uCompanyID, AkUInt32 in_uCodecID, AkUInt32 in_uCustomParamSize, void * in_pCustomParam, bool in_bIsLanguageSpecific, AkFileID in_uCacheID )
- : uCompanyID( in_uCompanyID )
- , uCodecID( in_uCodecID )
- , uCustomParamSize( in_uCustomParamSize )
- , pCustomParam( in_pCustomParam )
- , bIsLanguageSpecific( in_bIsLanguageSpecific )
- , uCacheID( in_uCacheID )
- , uNumBytesPrefetch( 0 )
- , uDirectoryHash( AK_INVALID_UNIQUE_ID ) {}
- AkUInt32 uCompanyID;
- AkUInt32 uCodecID;
- AkUInt32 uCustomParamSize;
- void * pCustomParam;
- bool bIsLanguageSpecific;
- bool bIsAutomaticStream;
-
- AkFileID uCacheID;
-
- AkUInt32 uNumBytesPrefetch;
-
-
- AkUInt32 uDirectoryHash;
- };
- struct AkStreamInfo
- {
- AkDeviceID deviceID;
- const AkOSChar * pszName;
- AkUInt64 uSize;
- bool bIsOpen;
- };
- struct AkAutoStmHeuristics
- {
- AkReal32 fThroughput;
- AkUInt32 uLoopStart;
- AkUInt32 uLoopEnd;
- AkUInt8 uMinNumBuffers;
-
-
-
- AkPriority priority;
- };
- struct AkAutoStmBufSettings
- {
- AkUInt32 uBufferSize;
-
-
- AkUInt32 uMinBufferSize;
-
- AkUInt32 uBlockSize;
- };
- #pragma pack(push, 4)
- struct AkDeviceDesc
- {
- AkDeviceID deviceID;
- bool bCanWrite;
- bool bCanRead;
- AkUtf16 szDeviceName[AK_MONITOR_DEVICENAME_MAXLENGTH];
- AkUInt32 uStringSize;
- };
- struct AkDeviceData
- {
- AkDeviceID deviceID;
- AkUInt32 uMemSize;
- AkUInt32 uMemUsed;
- AkUInt32 uAllocs;
- AkUInt32 uFrees;
- AkUInt32 uPeakRefdMemUsed;
- AkUInt32 uUnreferencedCachedBytes;
- AkUInt32 uGranularity;
- AkUInt32 uNumActiveStreams;
- AkUInt32 uTotalBytesTransferred;
- AkUInt32 uLowLevelBytesTransferred;
- AkReal32 fAvgCacheEfficiency;
- AkUInt32 uNumLowLevelRequestsCompleted;
- AkUInt32 uNumLowLevelRequestsCancelled;
- AkUInt32 uNumLowLevelRequestsPending;
- AkUInt32 uCustomParam;
- AkUInt32 uCachePinnedBytes;
- };
- struct AkStreamRecord
- {
- AkUInt32 uStreamID;
- AkDeviceID deviceID;
- AkUtf16 szStreamName[AK_MONITOR_STREAMNAME_MAXLENGTH];
- AkUInt32 uStringSize;
- AkUInt64 uFileSize;
- AkUInt32 uCustomParamSize;
- AkUInt32 uCustomParam;
- bool bIsAutoStream;
- bool bIsCachingStream;
- };
- struct AkStreamData
- {
- AkUInt32 uStreamID;
-
- AkUInt32 uPriority;
- AkUInt64 uFilePosition;
- AkUInt32 uTargetBufferingSize;
- AkUInt32 uVirtualBufferingSize;
- AkUInt32 uBufferedSize;
- AkUInt32 uNumBytesTransfered;
- AkUInt32 uNumBytesTransferedLowLevel;
- AkUInt32 uMemoryReferenced;
- AkReal32 fEstimatedThroughput;
- bool bActive;
- };
- #pragma pack(pop)
- namespace AK
- {
-
-
-
-
-
-
-
- class IAkStreamProfile
- {
- protected:
-
- virtual ~IAkStreamProfile(){}
- public:
-
-
-
- virtual void GetStreamRecord(
- AkStreamRecord & out_streamRecord
- ) = 0;
-
-
-
- virtual void GetStreamData(
- AkStreamData & out_streamData
- ) = 0;
-
-
-
-
- virtual bool IsNew() = 0;
-
-
-
- virtual void ClearNew() = 0;
- };
-
-
-
-
- class IAkDeviceProfile
- {
- protected:
-
- virtual ~IAkDeviceProfile(){}
- public:
-
- virtual void OnProfileStart() = 0;
-
- virtual void OnProfileEnd() = 0;
-
-
-
- virtual void GetDesc(
- AkDeviceDesc & out_deviceDesc
- ) = 0;
-
-
-
- virtual void GetData(
- AkDeviceData & out_deviceData
- ) = 0;
-
-
-
-
- virtual bool IsNew() = 0;
-
-
-
- virtual void ClearNew() = 0;
-
-
-
-
- virtual AkUInt32 GetNumStreams() = 0;
-
-
-
-
- virtual IAkStreamProfile * GetStreamProfile(
- AkUInt32 in_uStreamIndex
- ) = 0;
- };
-
-
-
-
- class IAkStreamMgrProfile
- {
- protected:
-
- virtual ~IAkStreamMgrProfile(){}
-
- public:
-
-
-
-
- virtual AKRESULT StartMonitoring() = 0;
-
-
-
- virtual void StopMonitoring() = 0;
-
-
-
-
-
- virtual AkUInt32 GetNumDevices() = 0;
-
-
-
-
-
- virtual IAkDeviceProfile * GetDeviceProfile(
- AkUInt32 in_uDeviceIndex
- ) = 0;
- };
-
-
-
-
-
-
-
-
- class IAkStdStream
- {
- protected:
-
- virtual ~IAkStdStream(){}
- public:
-
-
-
-
-
- virtual void Destroy() = 0;
-
-
-
- virtual void GetInfo(
- AkStreamInfo & out_info
- ) = 0;
-
-
- virtual void * GetFileDescriptor() = 0;
-
-
-
- virtual AKRESULT SetStreamName(
- const AkOSChar * in_pszStreamName
- ) = 0;
-
-
-
-
-
-
- virtual AkUInt32 GetBlockSize() = 0;
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT Read(
- void * in_pBuffer,
- AkUInt32 in_uReqSize,
- bool in_bWait,
- AkPriority in_priority,
- AkReal32 in_fDeadline,
- AkUInt32 & out_uSize
- ) = 0;
-
-
-
-
-
-
- virtual AKRESULT Write(
- void * in_pBuffer,
- AkUInt32 in_uReqSize,
- bool in_bWait,
- AkPriority in_priority,
- AkReal32 in_fDeadline,
- AkUInt32 & out_uSize
- ) = 0;
-
-
-
-
-
- virtual AkUInt64 GetPosition(
- bool * out_pbEndOfStream
- ) = 0;
-
-
-
-
-
-
- virtual AKRESULT SetPosition(
- AkInt64 in_iMoveOffset,
- AkMoveMethod in_eMoveMethod,
- AkInt64 * out_piRealOffset
-
- ) = 0;
-
-
-
-
-
- virtual void Cancel() = 0;
-
-
-
-
-
-
-
- virtual void * GetData(
- AkUInt32 & out_uSize
- ) = 0;
-
-
-
-
- virtual AkStmStatus GetStatus() = 0;
-
-
-
-
-
- virtual AkStmStatus WaitForPendingOperation() = 0;
-
- };
-
-
-
-
-
-
-
-
- class IAkAutoStream
- {
- protected:
-
- virtual ~IAkAutoStream(){}
- public:
-
-
-
-
-
- virtual void Destroy() = 0;
-
-
-
- virtual void GetInfo(
- AkStreamInfo & out_info
- ) = 0;
-
-
- virtual void * GetFileDescriptor() = 0;
-
-
-
- virtual void GetHeuristics(
- AkAutoStmHeuristics & out_heuristics
- ) = 0;
-
-
-
- virtual AKRESULT SetHeuristics(
- const AkAutoStmHeuristics & in_heuristics
- ) = 0;
-
-
-
-
-
-
- virtual AKRESULT SetMinimalBufferSize(
- AkUInt32 in_uMinBufferSize
- ) = 0;
-
-
-
-
-
-
-
-
- virtual AKRESULT SetMinTargetBufferSize(
- AkUInt32 in_uMinTargetBufferSize
- ) = 0;
-
-
-
- virtual AKRESULT SetStreamName(
- const AkOSChar * in_pszStreamName
- ) = 0;
-
-
-
-
-
-
- virtual AkUInt32 GetBlockSize() = 0;
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT QueryBufferingStatus(
- AkUInt32 & out_uNumBytesAvailable
- ) = 0;
-
-
-
- virtual AkUInt32 GetNominalBuffering() = 0;
-
-
-
-
-
-
-
-
- virtual AKRESULT Start() = 0;
-
-
-
-
- virtual AKRESULT Stop() = 0;
-
-
-
-
-
-
-
-
-
- virtual AkUInt64 GetPosition(
- bool * out_pbEndOfStream
- ) = 0;
-
-
-
-
-
-
-
- virtual AKRESULT SetPosition(
- AkInt64 in_iMoveOffset,
- AkMoveMethod in_eMoveMethod,
- AkInt64 * out_piRealOffset
-
- ) = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT GetBuffer(
- void *& out_pBuffer,
- AkUInt32 & out_uSize,
- bool in_bWait
- ) = 0;
-
-
-
-
-
-
- virtual AKRESULT ReleaseBuffer() = 0;
-
- };
-
-
-
-
-
- class IAkStreamMgr
- {
- protected:
-
- virtual ~IAkStreamMgr(){}
-
- public:
-
-
-
-
- inline static IAkStreamMgr * Get()
- {
- return m_pStreamMgr;
- }
-
-
-
- virtual void Destroy() = 0;
-
-
-
-
- virtual IAkStreamMgrProfile * GetStreamMgrProfile() = 0;
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT CreateStd(
- const AkOSChar* in_pszFileName,
- AkFileSystemFlags * in_pFSFlags,
- AkOpenMode in_eOpenMode,
- IAkStdStream *& out_pStream,
- bool in_bSyncOpen
- ) = 0;
-
-
-
-
-
- virtual AKRESULT CreateStd(
- AkFileID in_fileID,
- AkFileSystemFlags * in_pFSFlags,
- AkOpenMode in_eOpenMode,
- IAkStdStream *& out_pStream,
- bool in_bSyncOpen
- ) = 0;
-
-
-
-
-
-
-
-
- virtual AKRESULT CreateAuto(
- const AkOSChar* in_pszFileName,
- AkFileSystemFlags * in_pFSFlags,
- const AkAutoStmHeuristics & in_heuristics,
- AkAutoStmBufSettings * in_pBufferSettings,
- IAkAutoStream *& out_pStream,
- bool in_bSyncOpen
- ) = 0;
-
-
-
-
-
-
- virtual AKRESULT CreateAuto(
- AkFileID in_fileID,
- AkFileSystemFlags * in_pFSFlags,
- const AkAutoStmHeuristics & in_heuristics,
- AkAutoStmBufSettings * in_pBufferSettings,
- IAkAutoStream *& out_pStream,
- bool in_bSyncOpen
- ) = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT CreateAuto(
- void * in_pBuffer,
- AkUInt64 in_uSize,
- const AkAutoStmHeuristics & in_heuristics,
- IAkAutoStream *& out_pStream
- ) = 0;
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT PinFileInCache(
- AkFileID in_fileID,
- AkFileSystemFlags * in_pFSFlags,
- AkPriority in_uPriority
- ) = 0;
-
-
-
-
-
-
-
-
-
- virtual AKRESULT UnpinFileInCache(
- AkFileID in_fileID,
- AkPriority in_uPriority
- ) = 0;
-
-
-
-
-
-
-
-
-
- virtual AKRESULT UpdateCachingPriority(
- AkFileID in_fileID,
- AkPriority in_uPriority,
- AkPriority in_uOldPriority
- ) = 0;
-
-
-
-
- virtual AKRESULT GetBufferStatusForPinnedFile(
- AkFileID in_fileID,
- AkReal32& out_fPercentBuffered,
- bool& out_bCacheFull
- ) = 0;
-
- virtual AKRESULT RelocateMemoryStream(
- IAkAutoStream * in_pStream,
- AkUInt8 * in_pNewStart
- ) = 0;
-
- protected:
-
-
-
- static AKSOUNDENGINE_API IAkStreamMgr * m_pStreamMgr;
- };
- }
- #endif
|