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(_DECODESTREAM_H__INCLUDED_)
29159b3361Sopenharmony_ci#define _DECODESTREAM_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
42159b3361Sopenharmony_cistruct lame_global_flags;
43159b3361Sopenharmony_ci
44159b3361Sopenharmony_ci
45159b3361Sopenharmony_ciclass DecodeStream
46159b3361Sopenharmony_ci{
47159b3361Sopenharmony_cipublic:
48159b3361Sopenharmony_ci	DecodeStream( );
49159b3361Sopenharmony_ci	virtual ~DecodeStream( );
50159b3361Sopenharmony_ci
51159b3361Sopenharmony_ci	static DecodeStream * Create();
52159b3361Sopenharmony_ci	static const bool Erase(const DecodeStream * a_ACMStream);
53159b3361Sopenharmony_ci
54159b3361Sopenharmony_ci	bool init(const int nSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const int nSourceBitrate);
55159b3361Sopenharmony_ci	bool open();
56159b3361Sopenharmony_ci	bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize);
57159b3361Sopenharmony_ci
58159b3361Sopenharmony_ci	DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const;
59159b3361Sopenharmony_ci	bool  ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader);
60159b3361Sopenharmony_ci
61159b3361Sopenharmony_ci	static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels);
62159b3361Sopenharmony_ci
63159b3361Sopenharmony_ciprotected:
64159b3361Sopenharmony_ci	lame_global_flags * gfp;
65159b3361Sopenharmony_ci
66159b3361Sopenharmony_ci	ADbg * my_debug;
67159b3361Sopenharmony_ci	int my_SamplesPerSec;
68159b3361Sopenharmony_ci	int my_Channels;
69159b3361Sopenharmony_ci	int my_AvgBytesPerSec;
70159b3361Sopenharmony_ci	DWORD  my_SamplesPerBlock;
71159b3361Sopenharmony_ci	int my_SourceBitrate;
72159b3361Sopenharmony_ci
73159b3361Sopenharmony_ci	MPSTR my_DecodeData;
74159b3361Sopenharmony_ci
75159b3361Sopenharmony_ci	unsigned int m_WorkingBufferUseSize;
76159b3361Sopenharmony_ci	char m_WorkingBuffer[2304*2]; // should be at least twice my_SamplesPerBlock
77159b3361Sopenharmony_ci
78159b3361Sopenharmony_ci	inline int GetBytesPerBlock(DWORD bytes_per_sec, DWORD samples_per_sec, int BlockAlign) const;
79159b3361Sopenharmony_ci
80159b3361Sopenharmony_ci};
81159b3361Sopenharmony_ci
82159b3361Sopenharmony_ci#endif // !defined(_DECODESTREAM_H__INCLUDED_)
83159b3361Sopenharmony_ci
84