Newer
Older
monitord / lame-3.97 / ACM / .svn / text-base / DecodeStream.h.svn-base
  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: DecodeStream.h,v 1.1 2002/01/23 20:39:46 robux4 Exp $
  25. */
  26.  
  27. #if !defined(_DECODESTREAM_H__INCLUDED_)
  28. #define _DECODESTREAM_H__INCLUDED_
  29.  
  30. #if _MSC_VER >= 1000
  31. #pragma once
  32. #endif // _MSC_VER >= 1000
  33.  
  34. #include <mmreg.h>
  35. #include <msacm.h>
  36. #include <msacmdrv.h>
  37.  
  38. #include "ADbg/ADbg.h"
  39.  
  40. #include <config.h>
  41. #include "util.h"
  42. #include "interface.h"
  43.  
  44. class DecodeStream
  45. {
  46. public:
  47. DecodeStream( );
  48. virtual ~DecodeStream( );
  49.  
  50. static DecodeStream * Create();
  51. static const bool Erase(const DecodeStream * a_ACMStream);
  52.  
  53. bool init(const int nSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const int nSourceBitrate);
  54. bool open();
  55. bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize);
  56.  
  57. DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const;
  58. bool ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader);
  59.  
  60. static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels);
  61.  
  62. protected:
  63. lame_global_flags * gfp;
  64.  
  65. ADbg * my_debug;
  66. int my_SamplesPerSec;
  67. int my_Channels;
  68. int my_AvgBytesPerSec;
  69. DWORD my_SamplesPerBlock;
  70. int my_SourceBitrate;
  71.  
  72. MPSTR my_DecodeData;
  73.  
  74. unsigned int m_WorkingBufferUseSize;
  75. char m_WorkingBuffer[2304*2]; // should be at least twice my_SamplesPerBlock
  76.  
  77. inline int GetBytesPerBlock(DWORD bytes_per_sec, DWORD samples_per_sec, int BlockAlign) const;
  78.  
  79. };
  80.  
  81. #endif // !defined(_DECODESTREAM_H__INCLUDED_)
  82.