|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CPROCAACFRAMEHANDLER_H__ |
|
22 #define __CPROCAACFRAMEHANDLER_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 #include "AudCommon.h" |
|
26 #include "ProcConstants.h" |
|
27 #include "ProcFrameHandler.h" |
|
28 |
|
29 #include "AACConstants.h" |
|
30 #include "AACAPI.h" |
|
31 |
|
32 class CProcAACFrameHandler : public CProcFrameHandler |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 // aGain -40(dB) - +20(dB) |
|
38 virtual TBool ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain); |
|
39 |
|
40 // From base class |
|
41 virtual TBool GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const; |
|
42 virtual TBool GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const; |
|
43 |
|
44 virtual ~CProcAACFrameHandler(); |
|
45 |
|
46 static CProcAACFrameHandler* NewL(TAACFrameHandlerInfo aAACInfo); |
|
47 static CProcAACFrameHandler* NewLC(TAACFrameHandlerInfo aAACInfo); |
|
48 |
|
49 /* |
|
50 * |
|
51 * If there are several AAC frames in a row, their start positions and |
|
52 * lengths can be parsed with this function |
|
53 * |
|
54 * @param aFrame input frame to be parsed |
|
55 * @param aFrameStarts starting locations of each frame |
|
56 * @param aFrameLengths frame lengths of each frame |
|
57 */ |
|
58 |
|
59 TBool ParseFramesL(HBufC8* aFrame, RArray<TInt>& aFrameStarts, RArray<TInt>& aFrameLengths); |
|
60 |
|
61 /* |
|
62 * GetEnhancedAACPlusParametersL |
|
63 * |
|
64 * Fills in aacPlus related fields in aProperties |
|
65 * |
|
66 * |
|
67 * @param buf audio data |
|
68 * @param bufLen lenght of "buf" |
|
69 * @param aProperties properties to fill in |
|
70 * @param aAACInfo info for AAC framehandler |
|
71 * |
|
72 */ |
|
73 |
|
74 static void GetEnhancedAACPlusParametersL(TUint8* buf, TInt bufLen, |
|
75 TAudFileProperties* aProperties, |
|
76 TAACFrameHandlerInfo *aAACInfo); |
|
77 |
|
78 /* |
|
79 * CalculateNumberOfHeaderBytes returns the number of ADTS header bytes |
|
80 * and the number of data blocks in a given frame |
|
81 * |
|
82 * @param aFrame input frame |
|
83 * @param aNumBlocks (output) number of data blocks in the frame (usually 1) |
|
84 * |
|
85 * @return the number of ADTS header bytes |
|
86 */ |
|
87 |
|
88 TInt CalculateNumberOfHeaderBytes(const HBufC8* aFrame, TInt& aNumBlocksInFrame) const; |
|
89 |
|
90 private: |
|
91 |
|
92 // constructL |
|
93 void ConstructL(TAACFrameHandlerInfo aAACInfo); |
|
94 |
|
95 // c++ constructor |
|
96 CProcAACFrameHandler(); |
|
97 |
|
98 // updates the ADTS header if the lenght has |
|
99 // been changed after modifying AACPlus gain |
|
100 TBool UpdateHeaderL(HBufC8* aFrame); |
|
101 |
|
102 private: |
|
103 |
|
104 // AAC decoder handle |
|
105 CAACAudDec* iDecHandle; |
|
106 |
|
107 // stores the starting points of raw data blocks if there are |
|
108 // more than one data block in AAC frame |
|
109 RArray<TInt> iFrameStarts; |
|
110 |
|
111 // lenghts of the data blocks |
|
112 RArray<TInt> iFrameLengths; |
|
113 |
|
114 // info needed for AAC decoder handle creation |
|
115 TAACFrameHandlerInfo iAACInfo; |
|
116 |
|
117 }; |
|
118 |
|
119 #endif |