mpadecobjfixpt.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Version: RCSL 1.0/RPSL 1.0
  3. *
  4. * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
  5. *
  6. * The contents of this file, and the files included with this file, are
  7. * subject to the current version of the RealNetworks Public Source License
  8. * Version 1.0 (the "RPSL") available at
  9. * http://www.helixcommunity.org/content/rpsl unless you have licensed
  10. * the file under the RealNetworks Community Source License Version 1.0
  11. * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
  12. * in which case the RCSL will apply. You may also obtain the license terms
  13. * directly from RealNetworks. You may not use this file except in
  14. * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
  15. * applicable to this file, the RCSL. Please see the applicable RPSL or
  16. * RCSL for the rights, obligations and limitations governing use of the
  17. * contents of the file.
  18. *
  19. * This file is part of the Helix DNA Technology. RealNetworks is the
  20. * developer of the Original Code and owns the copyrights in the portions
  21. * it created.
  22. *
  23. * This file, and the files included with this file, is distributed and made
  24. * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  25. * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  26. * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
  27. * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  28. *
  29. * Technology Compatibility Kit Test Suite(s) Location:
  30. * http://www.helixcommunity.org/content/tck
  31. *
  32. * Contributor(s):
  33. *
  34. * ***** END LICENSE BLOCK ***** */
  35. #ifndef _MPADECOBJFIXPT_H_
  36. #define _MPADECOBJFIXPT_H_
  37. #include "mp3dec.h" /* public C API for new MP3 decoder */
  38. class CMpaDecObj
  39. {
  40. public:
  41. CMpaDecObj();
  42. ~CMpaDecObj();
  43. ///////////////////////////////////////////////////////////////////////////
  44. // Function: Init_n
  45. // Purpose: Initialize the mp3 decoder.
  46. // Parameters: pSync a pointer to a syncword
  47. // ulSize the size of the buffer pSync points to
  48. // bUseSize this tells the decoder to use the input frame
  49. // size on the decode instead of calculating
  50. // the frame size. This is necessary when
  51. // our formatted mp3 data (main_data_begin always
  52. // equal to 0).
  53. //
  54. // Returns: returns 1 on success, 0 on failure
  55. ///////////////////////////////////////////////////////////////////////////
  56. int Init_n(unsigned char *pSync,
  57. unsigned long ulSize,
  58. unsigned char bUseSize=0);
  59. ///////////////////////////////////////////////////////////////////////////
  60. // Function: DecodeFrame_v
  61. // Purpose: Decodes one mp3 frame
  62. // Parameters: pSource pointer to an mp3 frame (at a syncword)
  63. // pulSize size of the buffer pSource points to. It will
  64. // contain the number of mp3 bytes decoded upon
  65. // return.
  66. // pPCM pointer to a buffer to decode into
  67. // pulPCMSize size of the PCM buffer. It will contain the
  68. // number of PCM bytes prodced upon return.
  69. ///////////////////////////////////////////////////////////////////////////
  70. void DecodeFrame_v(unsigned char *pSource,
  71. unsigned long *pulSize,
  72. unsigned char *pPCM,
  73. unsigned long *pulPCMSize);
  74. // overloaded new version that returns error code in errCode
  75. void DecodeFrame_v(unsigned char *pSource,
  76. unsigned long *pulSize,
  77. unsigned char *pPCM,
  78. unsigned long *pulPCMSize,
  79. int *errCode);
  80. void GetPCMInfo_v(unsigned long &ulSampRate,
  81. int &nChannels,
  82. int &nBitsPerSample);
  83. // return number of samples per frame, PER CHANNEL (renderer multiplies this result by nChannels)
  84. int GetSamplesPerFrame_n();
  85. void SetTrustPackets(unsigned char bTrust) { m_bTrustPackets = bTrust; }
  86. private:
  87. void * m_pDec; // generic void ptr
  88. void * m_pDecL1; // not implemented (could use old Xing mpadecl1.cpp)
  89. void * m_pDecL2; // not implemented (could use old Xing mpadecl2.cpp)
  90. HMP3Decoder m_pDecL3;
  91. MP3FrameInfo m_lastMP3FrameInfo;
  92. unsigned char m_bUseFrameSize;
  93. unsigned char m_bTrustPackets;
  94. };
  95. #endif /* _MPADECOBJFIXPT_H_ */