diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /engine/audio/private/VBRHeader.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'engine/audio/private/VBRHeader.h')
| -rw-r--r-- | engine/audio/private/VBRHeader.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/engine/audio/private/VBRHeader.h b/engine/audio/private/VBRHeader.h new file mode 100644 index 0000000..42395cf --- /dev/null +++ b/engine/audio/private/VBRHeader.h @@ -0,0 +1,72 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef VBRHEADER_H +#define VBRHEADER_H +#ifdef _WIN32 +#pragma once +#endif + +// for XING VBR Header flags +#define FRAMES_FLAG 0x0001 +#define BYTES_FLAG 0x0002 +#define TOC_FLAG 0x0004 +#define VBR_SCALE_FLAG 0x0008 + +class CMPAFile; + +class CVBRHeader +{ +public: + enum VBRHeaderType + { + NoHeader, + XINGHeader, + VBRIHeader + }; + + CVBRHeader( CMPAFile* pMPAFile, VBRHeaderType HeaderType, uint32 dwOffset ); + ~CVBRHeader(void); + + static bool IsVBRHeaderAvailable( CMPAFile* pMPAFile, VBRHeaderType& HeaderType, uint32& dwOffset ); + bool SeekPoint(float fPercent, uint32& dwSeekPoint); + + uint32 m_dwBytesPerSec; + uint32 m_dwBytes; // total number of bytes + uint32 m_dwFrames; // total number of frames + +private: + static uint32 m_dwXINGOffsets[2][2]; + + static bool CheckID( CMPAFile* pMPAFile, char ch0, char ch1, char ch2, char ch3, uint32& dwOffset ); + static bool CheckXING( CMPAFile* pMPAFile, uint32& dwOffset ); + static bool CheckVBRI( CMPAFile* pMPAFile, uint32& dwOffset ); + + bool ExtractLAMETag( uint32 dwOffset ); + bool ExtractXINGHeader( uint32 dwOffset ); + bool ExtractVBRIHeader( uint32 dwOffset ); + + uint32 SeekPointXING(float fPercent)const ; + uint32 SeekPointVBRI(float fPercent) const; + uint32 SeekPointByTimeVBRI(float fEntryTimeMS) const; + + CMPAFile* m_pMPAFile; +public: + VBRHeaderType m_HeaderType; + uint32 m_dwOffset; + uint32 m_dwQuality; // quality (0..100) + int* m_pnToc; // TOC points for seeking (must be freed) + uint32 m_dwTableSize; // size of table (number of entries) + + // only VBRI + float m_fDelay; + uint32 m_dwTableScale; // for seeking + uint32 m_dwBytesPerEntry; + uint32 m_dwFramesPerEntry; + uint32 m_dwVersion; +}; + +#endif // VBRHEADER_H |