Newer
Older
monitord / lame-3.97 / ACM / .svn / text-base / ACMStream.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: ACMStream.h,v 1.4 2002/04/06 14:01:33 robux4 Exp $
  25. */
  26.  
  27. #if !defined(_ACMSTREAM_H__INCLUDED_)
  28. #define _ACMSTREAM_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.  
  43. #include "AEncodeProperties.h"
  44.  
  45. class ACMStream
  46. {
  47. public:
  48. ACMStream( );
  49. virtual ~ACMStream( );
  50.  
  51. static ACMStream * Create();
  52. static const bool Erase(const ACMStream * a_ACMStream);
  53.  
  54. bool init(const int nSamplesPerSec, const int nOutputSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const vbr_mode mode);
  55. bool open(const AEncodeProperties & the_Properties);
  56. bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize);
  57.  
  58. DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const;
  59. bool ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader);
  60.  
  61. static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels);
  62.  
  63. protected:
  64. lame_global_flags * gfp;
  65.  
  66. ADbg * my_debug;
  67. int my_SamplesPerSec;
  68. int my_Channels;
  69. int my_AvgBytesPerSec;
  70. int my_OutBytesPerSec;
  71. vbr_mode my_VBRMode;
  72. DWORD my_SamplesPerBlock;
  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(_ACMSTREAM_H__INCLUDED_)
  82.