1159b3361Sopenharmony_ci/** 2159b3361Sopenharmony_ci * 3159b3361Sopenharmony_ci * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows 4159b3361Sopenharmony_ci * 5159b3361Sopenharmony_ci * Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr> 6159b3361Sopenharmony_ci * 7159b3361Sopenharmony_ci * This library is free software; you can redistribute it and/or 8159b3361Sopenharmony_ci * modify it under the terms of the GNU Lesser General Public 9159b3361Sopenharmony_ci * License as published by the Free Software Foundation; either 10159b3361Sopenharmony_ci * version 2.1 of the License, or (at your option) any later version. 11159b3361Sopenharmony_ci * 12159b3361Sopenharmony_ci * This library is distributed in the hope that it will be useful, 13159b3361Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 14159b3361Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15159b3361Sopenharmony_ci * Lesser General Public License for more details. 16159b3361Sopenharmony_ci * 17159b3361Sopenharmony_ci * You should have received a copy of the GNU Lesser General Public 18159b3361Sopenharmony_ci * License along with this library; if not, write to the Free Software 19159b3361Sopenharmony_ci * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20159b3361Sopenharmony_ci * 21159b3361Sopenharmony_ci */ 22159b3361Sopenharmony_ci 23159b3361Sopenharmony_ci/*! 24159b3361Sopenharmony_ci \author Steve Lhomme 25159b3361Sopenharmony_ci \version \$Id$ 26159b3361Sopenharmony_ci*/ 27159b3361Sopenharmony_ci 28159b3361Sopenharmony_ci#if !defined(_ACMSTREAM_H__INCLUDED_) 29159b3361Sopenharmony_ci#define _ACMSTREAM_H__INCLUDED_ 30159b3361Sopenharmony_ci 31159b3361Sopenharmony_ci#if _MSC_VER >= 1000 32159b3361Sopenharmony_ci#pragma once 33159b3361Sopenharmony_ci#endif // _MSC_VER >= 1000 34159b3361Sopenharmony_ci 35159b3361Sopenharmony_ci#include <mmreg.h> 36159b3361Sopenharmony_ci#include <msacm.h> 37159b3361Sopenharmony_ci#include <msacmdrv.h> 38159b3361Sopenharmony_ci 39159b3361Sopenharmony_ci#include "ADbg/ADbg.h" 40159b3361Sopenharmony_ci 41159b3361Sopenharmony_ci#include "AEncodeProperties.h" 42159b3361Sopenharmony_ci 43159b3361Sopenharmony_ci 44159b3361Sopenharmony_citypedef enum vbr_mode_e vbr_mode; 45159b3361Sopenharmony_citypedef struct lame_global_struct lame_global_flags; 46159b3361Sopenharmony_ci 47159b3361Sopenharmony_ci 48159b3361Sopenharmony_ciclass ACMStream 49159b3361Sopenharmony_ci{ 50159b3361Sopenharmony_cipublic: 51159b3361Sopenharmony_ci ACMStream( ); 52159b3361Sopenharmony_ci virtual ~ACMStream( ); 53159b3361Sopenharmony_ci 54159b3361Sopenharmony_ci static ACMStream * Create(); 55159b3361Sopenharmony_ci static const bool Erase(const ACMStream * a_ACMStream); 56159b3361Sopenharmony_ci 57159b3361Sopenharmony_ci bool init(const int nSamplesPerSec, const int nOutputSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const vbr_mode mode); 58159b3361Sopenharmony_ci bool open(const AEncodeProperties & the_Properties); 59159b3361Sopenharmony_ci bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize); 60159b3361Sopenharmony_ci 61159b3361Sopenharmony_ci DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const; 62159b3361Sopenharmony_ci bool ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader); 63159b3361Sopenharmony_ci 64159b3361Sopenharmony_ci static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels); 65159b3361Sopenharmony_ci 66159b3361Sopenharmony_ciprotected: 67159b3361Sopenharmony_ci lame_global_flags * gfp; 68159b3361Sopenharmony_ci 69159b3361Sopenharmony_ci ADbg * my_debug; 70159b3361Sopenharmony_ci int my_SamplesPerSec; 71159b3361Sopenharmony_ci int my_Channels; 72159b3361Sopenharmony_ci int my_AvgBytesPerSec; 73159b3361Sopenharmony_ci int my_OutBytesPerSec; 74159b3361Sopenharmony_ci vbr_mode my_VBRMode; 75159b3361Sopenharmony_ci DWORD my_SamplesPerBlock; 76159b3361Sopenharmony_ci 77159b3361Sopenharmony_ciunsigned int m_WorkingBufferUseSize; 78159b3361Sopenharmony_ci char m_WorkingBuffer[2304*2]; // should be at least twice my_SamplesPerBlock 79159b3361Sopenharmony_ci 80159b3361Sopenharmony_ciinline int GetBytesPerBlock(DWORD bytes_per_sec, DWORD samples_per_sec, int BlockAlign) const; 81159b3361Sopenharmony_ci 82159b3361Sopenharmony_ci}; 83159b3361Sopenharmony_ci 84159b3361Sopenharmony_ci#endif // !defined(_ACMSTREAM_H__INCLUDED_) 85159b3361Sopenharmony_ci 86