Team Fortress 2 Source Code as on 22/4/2020
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.

72 lines
1.8 KiB

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