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 __CPROCProcDecoder_H__ |
|
22 #define __CPROCProcDecoder_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 #include <MMFCodec.h> |
|
27 |
|
28 #include "AudCommon.h" |
|
29 #include "ProcConstants.h" |
|
30 #include "RateConverter.h" |
|
31 |
|
32 class CProcDecoder : public CBase |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 /* |
|
38 * Symbian constructors |
|
39 * |
|
40 */ |
|
41 |
|
42 static CProcDecoder* NewL(); |
|
43 |
|
44 static CProcDecoder* NewLC(); |
|
45 |
|
46 /* |
|
47 * Destructor |
|
48 */ |
|
49 ~CProcDecoder(); |
|
50 |
|
51 /* |
|
52 * Initialize the decoder |
|
53 * |
|
54 * @param aProperties properties of the input clip (in compressed domain) |
|
55 * @param aTargetSamplingRate sampling rate to decode to |
|
56 * @param aChannelMode channel mode to decode to |
|
57 * |
|
58 * @return ETrue if successful |
|
59 * |
|
60 */ |
|
61 |
|
62 TBool InitL(TAudFileProperties aProperties, TInt aTargetSamplingRate, TChannelMode aChannelMode); |
|
63 |
|
64 /* |
|
65 * Feed the encoder |
|
66 * |
|
67 * @param aEncFrame encoded input frame |
|
68 * @param aDecbuffer buffer for decoded output data |
|
69 * |
|
70 * @return ETrue if output was generated, EFalse if more data is needed |
|
71 */ |
|
72 |
|
73 TBool FillDecBufferL(const HBufC8* aEncFrame, HBufC8*& aDecBuffer); |
|
74 |
|
75 |
|
76 |
|
77 protected: |
|
78 |
|
79 // constructL |
|
80 void ConstructL(); |
|
81 |
|
82 // C++ constructor |
|
83 CProcDecoder(); |
|
84 |
|
85 // configure AAC decoder |
|
86 // configure AAC Plus decoder |
|
87 void ConfigureAACPlusDecoderL(); |
|
88 |
|
89 // configure MP3 decoder |
|
90 void ConfigureMP3DecoderL(); |
|
91 |
|
92 // if input buffer is too small |
|
93 void ReAllocBufferL( CMMFDataBuffer* aBuffer, TInt aNewMaxSize ); |
|
94 |
|
95 // feed the codec |
|
96 void FeedCodecL( CMMFCodec* aCodec, CMMFDataBuffer* aSourceBuffer, CMMFDataBuffer* aDestBuffer ); |
|
97 |
|
98 // decode |
|
99 TCodecProcessResult DecodeL( CMMFCodec* aCodec, CMMFDataBuffer* aInBuffer, CMMFDataBuffer* aOutBuffer); |
|
100 |
|
101 // is supported dest codec? |
|
102 TBool GetIsSupportedSourceCodec(); |
|
103 |
|
104 // set source codec |
|
105 void SetSourceCodecL(); |
|
106 |
|
107 // is codec available? |
|
108 TBool CheckIfCodecAvailableL(const TDesC8& aCodecFourCCString, const TUid& aCodecUId ); |
|
109 |
|
110 // update output buffer |
|
111 TBool UpdateOutputBufferL(CMMFDataBuffer* aInBuffer); |
|
112 |
|
113 protected: |
|
114 |
|
115 // properties of the input data |
|
116 TAudFileProperties iProperties; |
|
117 |
|
118 // a flag to indicate if decoding can take place |
|
119 TBool iReady; |
|
120 |
|
121 // Input buffer for decoder. |
|
122 CMMFDataBuffer* iSourceInputBuffer; |
|
123 |
|
124 // Input buffer for encoder (alternative output buffer for decoder). |
|
125 CMMFDataBuffer* iDestInputBuffer; |
|
126 |
|
127 CMMFDataBuffer* iSampleRateChannelBuffer; |
|
128 |
|
129 // Codec used in decoding input audio to PCM16 |
|
130 CMMFCodec* iSourceCodec; |
|
131 |
|
132 // Channel and sample rate converter |
|
133 CRateConverter* iRateConverter; |
|
134 |
|
135 // Whether audio converter needs to do channel and/or samplerate conversion. |
|
136 TBool iDoSampleRateChannelConversion; |
|
137 |
|
138 // Whether decoding is required (not required if input is WAV) |
|
139 TBool iDoDecoding; |
|
140 |
|
141 // Samplerate to convert from. |
|
142 TInt iFromSampleRate; |
|
143 // Samplerate to convert to. |
|
144 TInt iToSampleRate; |
|
145 // Number of channels in input. |
|
146 TInt iFromChannels; |
|
147 // Number of channels in output. |
|
148 TInt iToChannels; |
|
149 |
|
150 // a pointer to store output buffer |
|
151 HBufC8* iDecBuffer; |
|
152 |
|
153 // decimation factor for decoder |
|
154 TInt iDecimFactor; |
|
155 |
|
156 |
|
157 }; |
|
158 |
|
159 #endif |
|