mp3streaminfo.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /***************************************************************************\
  2. *
  3. * MPEG Layer3-Audio Decoder
  4. * © 1997-2006 by Fraunhofer IIS
  5. * All Rights Reserved
  6. *
  7. * filename: mp3streaminfo.h
  8. * project : MPEG Layer-3 Decoder
  9. * author : Martin Sieler
  10. * date : 1998-05-27
  11. * contents/description: current bitstream parameters
  12. *
  13. \***************************************************************************/
  14. /*
  15. * $Date: 2010/11/17 20:46:04 $
  16. * $Id: mp3streaminfo.h,v 1.1 2010/11/17 20:46:04 audiodsp Exp $
  17. */
  18. #ifndef __MP3STREAMINFO_H__
  19. #define __MP3STREAMINFO_H__
  20. /* ------------------------ structure alignment ---------------------------*/
  21. #ifdef WIN32
  22. #pragma pack(push, 8)
  23. #endif
  24. /*-------------------------------------------------------------------------*/
  25. typedef struct
  26. {
  27. int m_Layer; /* ISO/MPEG Layer */
  28. int m_MpegVersion; /* ISO/MPEG Version */
  29. int m_Bitrate; /* Bitrate (Bit/s) */
  30. int m_BitrateIndex; /* ISO/MPEG Bitrate index of frame */
  31. int m_Channels; /* Number of Channels (as indicated) */
  32. int m_SFreq; /* Sampling Frequency (as indicated) */
  33. int m_EffectiveChannels; /* Number of effective output channels */
  34. int m_EffectiveSFreq; /* Effective Sampling Frequency */
  35. int m_BitsPerFrame; /* Number of bits in frame */
  36. float m_Duration; /* Duration of frame in milli seconds */
  37. int m_CrcError; /* Indication of CRC Errors */
  38. int m_NoMainData; /* Indication of missing main data */
  39. int m_SamplesPerFrame;
  40. } MP3STREAMINFO;
  41. /*-------------------------------------------------------------------------*/
  42. #ifdef __cplusplus
  43. //
  44. // Mp3 Streaminfo object.
  45. //
  46. // Object holding information on the last successfully decode frame.
  47. //
  48. class CMp3StreamInfo : protected MP3STREAMINFO
  49. {
  50. public:
  51. CMp3StreamInfo() { Reset(); }
  52. int GetLayer() const { return m_Layer; }
  53. int GetMpegVersion() const { return m_MpegVersion; }
  54. int GetBitrate() const { return m_Bitrate; }
  55. int GetBitrateIndex() const { return m_BitrateIndex; }
  56. int GetChannels() const { return m_Channels; }
  57. int GetSFreq() const { return m_SFreq; }
  58. int GetBitsPerFrame() const { return m_BitsPerFrame; }
  59. float GetDuration() const { return m_Duration; }
  60. int GetCrcError() const { return m_CrcError; }
  61. int GetNoMainData() const { return m_NoMainData; }
  62. int GetSamplesPerFrame() const { return m_SamplesPerFrame; }
  63. protected:
  64. friend class CMpgaDecoder;
  65. void SetLayer(int nValue) { m_Layer = nValue; }
  66. void SetMpegVersion(int nValue) { m_MpegVersion = nValue; }
  67. void SetBitrate(int nValue) { m_Bitrate = nValue; }
  68. void SetBitrateIndex(int nValue) { m_BitrateIndex = nValue; }
  69. void SetChannels(int nValue) { m_Channels = nValue; }
  70. void SetSFreq(int nValue) { m_SFreq = nValue; }
  71. void SetBitsPerFrame(int nValue) { m_BitsPerFrame = nValue; }
  72. void SetDuration(float fValue) { m_Duration = fValue; }
  73. void SetCrcError(int nValue) { m_CrcError = nValue; }
  74. void SetNoMainData(int nValue) { m_NoMainData = nValue; }
  75. void SetSamplesPerFrame(int nValue) { m_SamplesPerFrame = nValue; }
  76. void Reset()
  77. {
  78. m_Layer = 0;
  79. m_MpegVersion = 0;
  80. m_Bitrate = 0;
  81. m_BitrateIndex = 0;
  82. m_Channels = 0;
  83. m_SFreq = 0;
  84. m_BitsPerFrame = 0;
  85. m_Duration = 0.0f;
  86. m_CrcError = 0;
  87. m_NoMainData = 0;
  88. m_SamplesPerFrame=0;
  89. }
  90. };
  91. #endif /* __cplusplus */
  92. /*-------------------------------------------------------------------------*/
  93. #ifdef WIN32
  94. #pragma pack(pop)
  95. #endif
  96. /*-------------------------------------------------------------------------*/
  97. #endif