aboutsummaryrefslogtreecommitdiff
path: root/lib/liblame/ACM/DecodeStream.h
blob: 135ce216c38fdfd00df8c51a5ed6c485971539be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
 *
 * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
 *
 *  Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
 
/*!
	\author Steve Lhomme
	\version \$Id: DecodeStream.h,v 1.2 2006/12/25 21:37:34 robert Exp $
*/

#if !defined(_DECODESTREAM_H__INCLUDED_)
#define _DECODESTREAM_H__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include <mmreg.h>
#include <msacm.h>
#include <msacmdrv.h>

#include "ADbg/ADbg.h"


struct lame_global_flags;


class DecodeStream
{
public:
	DecodeStream( );
	virtual ~DecodeStream( );

	static DecodeStream * Create();
	static const bool Erase(const DecodeStream * a_ACMStream);

	bool init(const int nSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const int nSourceBitrate);
	bool open();
	bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize);

	DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const;
	bool  ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader);

	static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels);

protected:
	lame_global_flags * gfp;

	ADbg * my_debug;
	int my_SamplesPerSec;
	int my_Channels;
	int my_AvgBytesPerSec;
	DWORD  my_SamplesPerBlock;
	int my_SourceBitrate;

	MPSTR my_DecodeData;

	unsigned int m_WorkingBufferUseSize;
	char m_WorkingBuffer[2304*2]; // should be at least twice my_SamplesPerBlock

	inline int GetBytesPerBlock(DWORD bytes_per_sec, DWORD samples_per_sec, int BlockAlign) const;

};

#endif // !defined(_DECODESTREAM_H__INCLUDED_)