1
0

MPEGHeader.h 951 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include "foundation/types.h"
  3. class MPEGHeader
  4. {
  5. public:
  6. void ReadBuffer(const uint8_t *buffer);
  7. int GetNumChannels() const;
  8. bool IsSync() const;
  9. int GetBitrate() const;
  10. int HeaderSize() const;
  11. int GetSampleRate() const;
  12. int FrameSize() const;
  13. int GetLayer() const;
  14. bool IsCRC() const;
  15. bool IsCopyright() const;
  16. bool IsOriginal() const;
  17. int GetSamplesPerFrame() const;
  18. enum
  19. {
  20. NotPadded=0,
  21. Padded=1,
  22. CRC = 0,
  23. NoProtection = 1,
  24. Stereo = 0,
  25. JointStereo = 1,
  26. DualChannel = 2,
  27. Mono = 3,
  28. MPEG1 = 3,
  29. MPEG2 = 2,
  30. MPEG_Error = 1,
  31. MPEG2_5 = 0,
  32. Layer1 = 3,
  33. Layer2 = 2,
  34. Layer3 = 1,
  35. LayerError = 0,
  36. Emphasis_None = 0,
  37. Emphasis_50_15_ms = 1,
  38. Emphasis_reserved = 2,
  39. Emphasis_CCIT_J_17 = 3,
  40. };
  41. uint16_t sync;
  42. uint8_t mpeg_version, layer, protection, bitrate_index;
  43. uint8_t padding_bit, private_bit, channel_mode, mode_extension;
  44. uint8_t sample_rate_index, copyright, original, emphasis;
  45. };