aboutsummaryrefslogtreecommitdiff
path: root/Src/replicant/nsmp3dec/mpgadecoder.h
blob: 3466cf766b8dd0805350017c62fc615cf8608e02 (plain) (blame)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*************************************************************************** *
*                    MPEG Layer3-Audio Decoder
*                  © 1997-2006 by Fraunhofer IIS
 *                        All Rights Reserved
 *
 *   filename: mpgadecoder.h
 *   project : MPEG Decoder
 *   author  : Martin Sieler
 *   date    : 1998-05-26
 *   contents/description: MPEG Decoder class - HEADER
 *
 *
\***************************************************************************/

/*
 * $Date: 2011/01/25 18:24:17 $
 * $Id: mpgadecoder.h,v 1.4 2011/01/25 18:24:17 audiodsp Exp $
 */

#ifndef __MPGADECODER_H__
#define __MPGADECODER_H__

/* ------------------------ includes --------------------------------------*/

#include "mp3sscdef.h"
#include "mp3streaminfo.h"
#include "mpegbitstream.h"
#include "mp3decode.h"
#include "mp2decode.h"


/*-------------------------- defines --------------------------------------*/

/*-------------------------------------------------------------------------*/

//
// Mp3 Decoder Top Level Object.
//
// This is the main ISO/MPEG decoder object that interfaces with the
// application code.
//
// It is however recommended to use IMpgaDecoder (see mp3decifc.h) instead.
// Define USE_MP3DECIFC when planning to use IMpgaDecoder.
//

enum
{
	MPEGAUDIO_CRCCHECK_OFF = 0,
	MPEGAUDIO_CRCCHECK_ON = 1,
};

class CMpgaDecoder
{
public:
	CMpgaDecoder(int crcCheck = MPEGAUDIO_CRCCHECK_OFF);
	CMpgaDecoder(DecoderHooks *hooks, int crcCheck = MPEGAUDIO_CRCCHECK_OFF);
	CMpgaDecoder(unsigned char *pBuf, int cbSize, int crcCheck = MPEGAUDIO_CRCCHECK_OFF);
	~CMpgaDecoder();
	void *operator new(size_t stAllocateBlock);
	void operator delete(void *);

	void Reset();

	SSC  DecodeFrame(float *pPcm, size_t cbPcm, size_t *pcbUsed = 0, unsigned char *ancData = 0, size_t *numAncBytes = 0, int oflOn = 0, unsigned int *startDelay = 0, unsigned int *totalLength = 0);

	const CMp3StreamInfo *GetStreamInfo() const;
	
	void Connect(CGioBase *gf);
	int  Fill(const unsigned char *pBuffer, int cbBuffer);
	int  GetInputFree() const;
	int  GetInputLeft() const;
	void SetInputEof();
	bool IsEof() const;

#ifdef KSA_DRM
	int GetScfBuffer(const unsigned char** ppBuffer, unsigned int* pBufSize) const;
#endif

	SSC GetLastAncData(unsigned char* ancData = 0, size_t *numAncBytes = 0);

	  SSC GetOflVersion(int* oflVersion = 0);
//protected:

	void SetStreamInfo(SSC dwReturn);


	CMp3StreamInfo m_Info;
	CMpegBitStream m_Mbs;
	NALIGN(16) CMp3Decode m_Mp3Decode;
	NALIGN(16) CMp2Decode m_Mp2Decode;
	bool           m_IsEof;
	int			 m_Layer;

private:

};

/*-------------------------------------------------------------------------*/
#endif