DecodeStream.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. *
  3. * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
  4. *
  5. * Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. /*!
  23. \author Steve Lhomme
  24. \version \$Id$
  25. */
  26. #if !defined(_DECODESTREAM_H__INCLUDED_)
  27. #define _DECODESTREAM_H__INCLUDED_
  28. #if _MSC_VER >= 1000
  29. #pragma once
  30. #endif // _MSC_VER >= 1000
  31. #include <mmreg.h>
  32. #include <msacm.h>
  33. #include <msacmdrv.h>
  34. #include "ADbg/ADbg.h"
  35. struct lame_global_flags;
  36. class DecodeStream
  37. {
  38. public:
  39. DecodeStream( );
  40. virtual ~DecodeStream( );
  41. static DecodeStream * Create();
  42. static const bool Erase(const DecodeStream * a_ACMStream);
  43. bool init(const int nSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const int nSourceBitrate);
  44. bool open();
  45. bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize);
  46. DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const;
  47. bool ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader);
  48. static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels);
  49. protected:
  50. lame_global_flags * gfp;
  51. ADbg * my_debug;
  52. int my_SamplesPerSec;
  53. int my_Channels;
  54. int my_AvgBytesPerSec;
  55. DWORD my_SamplesPerBlock;
  56. int my_SourceBitrate;
  57. MPSTR my_DecodeData;
  58. unsigned int m_WorkingBufferUseSize;
  59. char m_WorkingBuffer[2304*2]; // should be at least twice my_SamplesPerBlock
  60. inline int GetBytesPerBlock(DWORD bytes_per_sec, DWORD samples_per_sec, int BlockAlign) const;
  61. };
  62. #endif // !defined(_DECODESTREAM_H__INCLUDED_)