46
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Header file for EAacPlusUtil.cpp
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef EAACPLUSUTIL_H
|
|
20 |
#define EAACPLUSUTIL_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
|
|
25 |
// CLASS DECLARATION
|
|
26 |
class EAacpAudioFrameInfo;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* This class implements utility functions to extract AAC frame
|
|
30 |
* information.
|
|
31 |
*
|
|
32 |
* @lib MmfEAacPlusUtil.lib
|
|
33 |
* @since 3.2
|
|
34 |
*/
|
|
35 |
class CEAacPlusUtil : public CBase
|
|
36 |
{
|
|
37 |
public:
|
|
38 |
// CONSTANTS
|
|
39 |
enum TEAacPlusFormatType
|
|
40 |
{
|
|
41 |
EAacPlusFormatRaw=0,
|
|
42 |
EAacPlusFormatAdif=1,
|
|
43 |
EAacPlusFormatAdts=2
|
|
44 |
};
|
|
45 |
/**
|
|
46 |
* EAAC+ frame info struct.
|
|
47 |
*
|
|
48 |
* @lib MmfEAacPlusUtil.lib
|
|
49 |
* @since 3.2
|
|
50 |
*/
|
|
51 |
class TEAacPlusFrameInfo
|
|
52 |
{
|
|
53 |
public:
|
|
54 |
TInt iOutFrameSize; // Size of PCM Samples generated by decoder
|
|
55 |
TInt iNoOfSamples; // Number of PCM Samples generated by decoder per frame
|
|
56 |
TInt iSamplingFrequency; // Sampling freq of AAC Code decoder
|
|
57 |
TInt iNoOfChannels; // No of output channel 1=Mono; 2=Stereo
|
|
58 |
TInt iObjectType; // MPEG Audio Object Type 2=AAC-LC; 4=AAC-LTP
|
|
59 |
TInt iOutSamplingFrequency; // Sampling Frequence for the output samples
|
|
60 |
TInt iDownSampledMode; // 0=Normal Mode; 1=Down Sampled mode
|
|
61 |
TInt iSbr; // 0=SBR not present; 1=SBR present
|
|
62 |
TInt iPs; // 0=PS not present; 1=PS present
|
|
63 |
};
|
|
64 |
|
|
65 |
class TEAacPlusFrameLenConfig
|
|
66 |
{
|
|
67 |
public:
|
|
68 |
TEAacPlusFormatType iFormatType; // Container type.
|
|
69 |
TInt iSamplingFrequency; // Sampling freq of AAC core decoder
|
|
70 |
TInt iObjectType; // MPEG Audio Object Type 2=AAC-LC; 4=AAC-LTP
|
|
71 |
};
|
|
72 |
|
|
73 |
|
|
74 |
public: // Constructors and destructor
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Two-phased constructor.
|
|
78 |
*/
|
|
79 |
IMPORT_C static CEAacPlusUtil* NewL();
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Destructor.
|
|
83 |
*/
|
|
84 |
IMPORT_C virtual ~CEAacPlusUtil();
|
|
85 |
|
|
86 |
public: // New functions
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Used to get the format type.
|
|
90 |
* @since 3.2
|
|
91 |
* @param aBuf buffer of AAC data from start of aac content
|
|
92 |
* @param aBufLen length of aBuf
|
|
93 |
* @param TEAacPlusFormatType returned format type 0=raw; 1=ADIF; 2=ADTS
|
|
94 |
* @return status
|
|
95 |
*/
|
|
96 |
IMPORT_C TInt GetAacFormatType(const TUint8* aBuf, TInt aBufLen, TEAacPlusFormatType& aFormatType);
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Used to get the audio format information for ADIF and ADTS content.
|
|
100 |
* Data should be provided beginning with start of aac content including header.
|
|
101 |
* Enough data should follow the header to determine SBR and PS if needed.
|
|
102 |
* Can be used with mpeg data where aHdrBuf will contain the AudioSpecificConfig. Implicit SBR and PS
|
|
103 |
* will not be determined.
|
|
104 |
* @since 3.2
|
|
105 |
* @param aHdrBuf buffer with AAC data beginning at start of aac content including ADIF or ADTS header
|
|
106 |
* @param aHdrLen length of aHdrBuf; header length is returned in this parameter
|
|
107 |
* @param aFrameInfo returns the format information
|
|
108 |
* @return status
|
|
109 |
*/
|
|
110 |
IMPORT_C TInt GetAacFrameInfo (const TUint8* aHdrBuf, TInt& aHdrLen, TEAacPlusFrameInfo& aFrameInfo);
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Used to get the audio format information for mpeg aac.
|
|
114 |
* aHdrBuf will contain the AudioSpecificConfig. aDataBuf will contain data at beginning of raw audio frames.
|
|
115 |
* Implicit SBR and PS can be determined.
|
|
116 |
* @since 3.2
|
|
117 |
* @param aHdrBuf buffer with AudioSpecificConfig data.
|
|
118 |
* @param aHdrLen length of aHdrBuf
|
|
119 |
* @param aFrameInfo returns the format information
|
|
120 |
* @param aDataBuf buffer with raw audio frames
|
|
121 |
* @param aDataBufLen length of aDataBuf
|
|
122 |
* @return status
|
|
123 |
*/
|
|
124 |
IMPORT_C TInt GetAacFrameInfo (const TUint8* aHdrBuf, TInt& aHdrLen, TEAacPlusFrameInfo& aFrameInfo,
|
|
125 |
TUint8* aDataBuf, TInt aDataBufLen);
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Used to get the size in bytes of the frame found at the start of aBuf.
|
|
129 |
* @since 3.2
|
|
130 |
* @param aBuf buffer with AAC data frame
|
|
131 |
* @param aBufLen length of aBuf
|
|
132 |
* @param aFrameLen returns the frame size in bytes
|
|
133 |
* @return status
|
|
134 |
*/
|
|
135 |
IMPORT_C TInt GetAacFrameLength(const TUint8* aBuf, TInt aBufLen, TInt& aFrameLen);
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Used to configure the utility with information needed to enable the apis.
|
|
139 |
* This api can be used if GetAacFrameInfo is not used to initialize the utility.
|
|
140 |
* @since 3.2
|
|
141 |
* @param aFormatType format type
|
|
142 |
* @param aSamplingFrequency sampling frequency
|
|
143 |
* @return status
|
|
144 |
*/
|
|
145 |
IMPORT_C TInt Config(TEAacPlusFrameLenConfig& aFrameLenConfig);
|
|
146 |
|
|
147 |
private:
|
|
148 |
|
|
149 |
/**
|
|
150 |
* C++ default constructor.
|
|
151 |
*/
|
|
152 |
CEAacPlusUtil();
|
|
153 |
|
|
154 |
/**
|
|
155 |
* By default Symbian 2nd phase constructor is private.
|
|
156 |
*/
|
|
157 |
void ConstructL();
|
|
158 |
|
|
159 |
private: // Data
|
|
160 |
TEAacPlusFormatType iFormat;
|
|
161 |
EAacpAudioFrameInfo* iGetFrameLenParam;
|
|
162 |
TBool iInitialized;
|
|
163 |
};
|
|
164 |
|
|
165 |
#endif // EAACPLUSUTIL_H
|
|
166 |
|
|
167 |
// End of File
|