📄 raibufs.h
字号:
/* ***** 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 _RAIBUFS_H_
#define _RAIBUFS_H_
/****************************************************************************
* Includes
*/
#include "ctrange.h"
/****************************************************************************
* CInterleaveBufs
*/
class CInterleaveBufs
{
public:
CInterleaveBufs(CStreamParam ¶m, UINT16 uStreamNumber = 0);
~CInterleaveBufs();
HX_RESULT InitDeinterleaver(void);
HX_RESULT AllocIBufs(void);
void DeallocIBufs(void);
HX_RESULT OnPacket(Byte* pData,
UINT32 ulSize,
UINT32 ulSequence,
UINT32 ulTimestamp,
BOOL bLost,
UINT16 usFlags);
HX_RESULT OnSeek(void);
HX_RESULT DeInterleaveData(void);
HX_RESULT GetBlock (Byte** hData, UINT32* pDataSize, UINT32* pDataFlags, UINT32* pTimestamp,UINT32* ulActualTimestamp);
HX_RESULT NextBlock(void);
void OnEndofPackets(void);
void SwitchOff(void);
void NumDecodedBytes(UINT32 ulNumDecodedBytes);
void NumDecodedBytes(UINT32 ulEndingTS, UINT32 ulNumDecodedBytes);
BOOL DataAvailable(AUDIO_STATE audioState);
BOOL IsISuperBlockFilled(void);
BOOL IsDSuperBlockEmpty(void);
BOOL IsStreamDone(void);
inline BOOL IsISuperBlockEmpty(void)
{
return m_bISuperBlockEmpty;
}
inline BOOL IsISuperBlockDone(void)
{
return m_bISuperBlockDone;
}
inline void FlushIBlock()
{
m_bISuperBlockEmpty = TRUE;
m_bISuperBlockDone = FALSE;
m_uNumIBlocks = 0;
m_bFirstPacketReceived = FALSE;
}
inline void FlushDBlock()
{
m_bDSuperBlockEmpty = TRUE;
if (m_bISuperBlockEmpty)
{
m_bFirstPacketReceived = FALSE;
}
}
inline void SetTimeStampsInTenths(BOOL bTimeStampsInTenths)
{
m_bTimeStampsInTenths = bTimeStampsInTenths;
}
inline void SetSamplesIn(UINT32 ulSamplesIn)
{
m_ulSamplesIn = ulSamplesIn;
}
inline void SetReliableSamplesIn(BOOL bFlag)
{
m_bReliableSamplesIn = TRUE;
}
inline INT32 RateInBytesPerSec(void)
{
if (m_fmsPerBlock) return (INT32) (1000/m_fmsPerBlock);
return 0;
};
inline double GetMSPerBlock()
{
return m_fmsPerBlock;
}
inline UINT32 GetSuperBlockTime()
{
return (UINT32)(m_fmsPerBlock * m_Param.uInterleaveFactor);
}
double CalcMs(UINT32 ulNumBytes);
UINT32 CalcBytes(double fMs);
CTimeRange m_IBlockTimeRange;
CTimeRange m_DBlockTimeRange;
private:
CStreamParam& m_Param;
CInterleave* m_Interleaver;
UINT16 m_uStreamNumber; // Debug use
UINT32 m_ulSuperBlockSize;
double m_fmsPerBlock;
UINT32 m_ulSamplesIn;
UINT32 m_ulLastDecodedTime;
Byte* m_pIDataBuf; // Interleaved Data
Byte* m_pDDataBuf; // De-interleaved Data
UINT32* m_pIPresent; // Interleaved Flags (data not lost)
UINT32* m_pDPresent;
double* m_pIActualTimestamps; // Interleaved Timestamps
double* m_pDActualTimestamps;
UINT16 m_uBlockToDecode;
UINT16 m_uNumIBlocks;
UINT32 m_ulFirstSequenceNum;
UINT32 m_ulVBRSMaxBufSize;
UINT32 m_ulVBRSDBufBytes;
double m_fCurrentTimestamp;
double m_fActualTimestamp;
double m_fCurrentDeinterleaveTimestamp;
double m_fMsPerByte;
double m_fLastDecodedTime;
BOOL m_bLastDecodedTimeSet;
BOOL m_bDeinterleaveInPlace;
BOOL m_bReliableSamplesIn;
BOOL m_bIsVBRS;
HX_BITFIELD m_bISuperBlockDone:1; // ready to de-interleave
// Flags & Params for Interleaved Data
HX_BITFIELD m_bISuperBlockEmpty:1;
HX_BITFIELD m_bFirstPacketReceived:1;
// Flags & Params for De-interleaved Data
HX_BITFIELD m_bDSuperBlockEmpty:1;
HX_BITFIELD m_bEndOfPackets:1;
HX_BITFIELD m_bTimeStampsInTenths:1;
};
#define INITIAL_VBR_MAXBUFSIZE 8192 // Max AAC frame size is 8191
#endif // ndef _RAIBUFS_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -