Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.9 KiB

  1. //====== Copyright 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef VBRHEADER_H
  7. #define VBRHEADER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier0/platform.h"
  12. // for XING VBR Header flags
  13. #define FRAMES_FLAG 0x0001
  14. #define BYTES_FLAG 0x0002
  15. #define TOC_FLAG 0x0004
  16. #define VBR_SCALE_FLAG 0x0008
  17. class CMPAFile;
  18. class CVBRHeader
  19. {
  20. public:
  21. enum VBRHeaderType
  22. {
  23. NoHeader,
  24. XINGHeader,
  25. VBRIHeader
  26. };
  27. CVBRHeader( CMPAFile* pMPAFile, VBRHeaderType HeaderType, uint32 dwOffset );
  28. ~CVBRHeader(void);
  29. static bool IsVBRHeaderAvailable( CMPAFile* pMPAFile, VBRHeaderType& HeaderType, uint32& dwOffset );
  30. bool SeekPoint(float fPercent, uint32& dwSeekPoint);
  31. uint32 m_dwBytesPerSec;
  32. uint32 m_dwBytes; // total number of bytes
  33. uint32 m_dwFrames; // total number of frames
  34. private:
  35. static uint32 m_dwXINGOffsets[2][2];
  36. static bool CheckID( CMPAFile* pMPAFile, char ch0, char ch1, char ch2, char ch3, uint32& dwOffset );
  37. static bool CheckXING( CMPAFile* pMPAFile, uint32& dwOffset );
  38. static bool CheckVBRI( CMPAFile* pMPAFile, uint32& dwOffset );
  39. bool ExtractLAMETag( uint32 dwOffset );
  40. bool ExtractXINGHeader( uint32 dwOffset );
  41. bool ExtractVBRIHeader( uint32 dwOffset );
  42. uint32 SeekPointXING(float fPercent)const ;
  43. uint32 SeekPointVBRI(float fPercent) const;
  44. uint32 SeekPointByTimeVBRI(float fEntryTimeMS) const;
  45. CMPAFile* m_pMPAFile;
  46. public:
  47. VBRHeaderType m_HeaderType;
  48. uint32 m_dwOffset;
  49. uint32 m_dwQuality; // quality (0..100)
  50. int* m_pnToc; // TOC points for seeking (must be freed)
  51. uint32 m_dwTableSize; // size of table (number of entries)
  52. // only VBRI
  53. float m_fDelay;
  54. uint32 m_dwTableScale; // for seeking
  55. uint32 m_dwBytesPerEntry;
  56. uint32 m_dwFramesPerEntry;
  57. uint32 m_dwVersion;
  58. };
  59. #endif // VBRHEADER_H