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 /*! 24 \author Steve Lhomme 25 \version \$Id$ 26 */ 27 28 #if !defined(_ACMSTREAM_H__INCLUDED_) 29 #define _ACMSTREAM_H__INCLUDED_ 30 31 #if _MSC_VER >= 1000 32 #pragma once 33 #endif // _MSC_VER >= 1000 34 35 #include <mmreg.h> 36 #include <msacm.h> 37 #include <msacmdrv.h> 38 39 #include "ADbg/ADbg.h" 40 41 #include "AEncodeProperties.h" 42 43 44 typedef enum vbr_mode_e vbr_mode; 45 typedef struct lame_global_struct lame_global_flags; 46 47 48 class ACMStream 49 { 50 public: 51 ACMStream( ); 52 virtual ~ACMStream( ); 53 54 static ACMStream * Create(); 55 static const bool Erase(const ACMStream * a_ACMStream); 56 57 bool init(const int nSamplesPerSec, const int nOutputSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const vbr_mode mode); 58 bool open(const AEncodeProperties & the_Properties); 59 bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize); 60 61 DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const; 62 bool ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader); 63 64 static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels); 65 66 protected: 67 lame_global_flags * gfp; 68 69 ADbg * my_debug; 70 int my_SamplesPerSec; 71 int my_Channels; 72 int my_AvgBytesPerSec; 73 int my_OutBytesPerSec; 74 vbr_mode my_VBRMode; 75 DWORD my_SamplesPerBlock; 76 77 unsigned int m_WorkingBufferUseSize; 78 char m_WorkingBuffer[2304*2]; // should be at least twice my_SamplesPerBlock 79 80 inline int GetBytesPerBlock(DWORD bytes_per_sec, DWORD samples_per_sec, int BlockAlign) const; 81 82 }; 83 84 #endif // !defined(_ACMSTREAM_H__INCLUDED_) 85 86