Adafruit mp3
mpadecobjfixpt.h
1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: RCSL 1.0/RPSL 1.0
3  *
4  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
5  *
6  * The contents of this file, and the files included with this file, are
7  * subject to the current version of the RealNetworks Public Source License
8  * Version 1.0 (the "RPSL") available at
9  * http://www.helixcommunity.org/content/rpsl unless you have licensed
10  * the file under the RealNetworks Community Source License Version 1.0
11  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
12  * in which case the RCSL will apply. You may also obtain the license terms
13  * directly from RealNetworks. You may not use this file except in
14  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
15  * applicable to this file, the RCSL. Please see the applicable RPSL or
16  * RCSL for the rights, obligations and limitations governing use of the
17  * contents of the file.
18  *
19  * This file is part of the Helix DNA Technology. RealNetworks is the
20  * developer of the Original Code and owns the copyrights in the portions
21  * it created.
22  *
23  * This file, and the files included with this file, is distributed and made
24  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
25  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
26  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
27  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
28  *
29  * Technology Compatibility Kit Test Suite(s) Location:
30  * http://www.helixcommunity.org/content/tck
31  *
32  * Contributor(s):
33  *
34  * ***** END LICENSE BLOCK ***** */
35 
36 #ifndef _MPADECOBJFIXPT_H_
37 #define _MPADECOBJFIXPT_H_
38 
39 #include "mp3dec.h" /* public C API for new MP3 decoder */
40 
42 {
43 public:
44  CMpaDecObj();
45  ~CMpaDecObj();
46 
48  // Function: Init_n
49  // Purpose: Initialize the mp3 decoder.
50  // Parameters: pSync a pointer to a syncword
51  // ulSize the size of the buffer pSync points to
52  // bUseSize this tells the decoder to use the input frame
53  // size on the decode instead of calculating
54  // the frame size. This is necessary when
55  // our formatted mp3 data (main_data_begin always
56  // equal to 0).
57  //
58  // Returns: returns 1 on success, 0 on failure
60  int Init_n(unsigned char *pSync,
61  unsigned long ulSize,
62  unsigned char bUseSize=0);
63 
65  // Function: DecodeFrame_v
66  // Purpose: Decodes one mp3 frame
67  // Parameters: pSource pointer to an mp3 frame (at a syncword)
68  // pulSize size of the buffer pSource points to. It will
69  // contain the number of mp3 bytes decoded upon
70  // return.
71  // pPCM pointer to a buffer to decode into
72  // pulPCMSize size of the PCM buffer. It will contain the
73  // number of PCM bytes prodced upon return.
75  void DecodeFrame_v(unsigned char *pSource,
76  unsigned long *pulSize,
77  unsigned char *pPCM,
78  unsigned long *pulPCMSize);
79 
80  // overloaded new version that returns error code in errCode
81  void DecodeFrame_v(unsigned char *pSource,
82  unsigned long *pulSize,
83  unsigned char *pPCM,
84  unsigned long *pulPCMSize,
85  int *errCode);
86 
87  void GetPCMInfo_v(unsigned long &ulSampRate,
88  int &nChannels,
89  int &nBitsPerSample);
90 
91  // return number of samples per frame, PER CHANNEL (renderer multiplies this result by nChannels)
92  int GetSamplesPerFrame_n();
93 
94  void SetTrustPackets(unsigned char bTrust) { m_bTrustPackets = bTrust; }
95 
96 private:
97  void * m_pDec; // generic void ptr
98 
99  void * m_pDecL1; // not implemented (could use old Xing mpadecl1.cpp)
100  void * m_pDecL2; // not implemented (could use old Xing mpadecl2.cpp)
101  HMP3Decoder m_pDecL3;
102 
103  MP3FrameInfo m_lastMP3FrameInfo;
104  unsigned char m_bUseFrameSize;
105  unsigned char m_bTrustPackets;
106 };
107 
108 #endif /* _MPADECOBJFIXPT_H_ */
Definition: mp3dec.h:115
Definition: mpadecobjfixpt.h:41