|
1 /* |
|
2 * Copyright (c) 2006 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: The functions in this module implements the common behavior |
|
15 * for the audio output base class. Audio output provides the |
|
16 * interface between the controller and the sound device. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "MP3AudioPlayControllerDecoder.h" |
|
23 #include "DebugMacros.h" |
|
24 |
|
25 #include <mmfcodec.h> |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // C++ default constructor can NOT contain any code, that |
|
31 // might leave. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CMP3AudioPlayControllerDecoder::CMP3AudioPlayControllerDecoder() |
|
35 : CAdvancedAudioDecoder(CActive::EPriorityStandard) |
|
36 { |
|
37 DP0(_L("CMP3AudioPlayControllerDecoder::CMP3AudioPlayControllerDecoder()")); |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CMP3AudioPlayControllerDecoder::ConstructL |
|
42 // Symbian 2nd phase constructor can leave. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 void CMP3AudioPlayControllerDecoder::ConstructL() |
|
46 { |
|
47 DP0(_L("CMP3AudioPlayControllerDecoder::ConstructL()")); |
|
48 iSoftCodec = CMMFCodec::NewL(TFourCC(' ','M','P','3'), TFourCC(' ','P','1','6')); |
|
49 |
|
50 iFrameTable = CFrameTable::NewL(); |
|
51 |
|
52 InitCodecConfigs(); |
|
53 |
|
54 CActiveScheduler::Add(this); |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // C++ default constructor can NOT contain any code, that |
|
59 // might leave. |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CMP3AudioPlayControllerDecoder* CMP3AudioPlayControllerDecoder::NewL() |
|
63 { |
|
64 DP0(_L("CMP3AudioPlayControllerDecoder::NewL()")); |
|
65 CMP3AudioPlayControllerDecoder* self = new(ELeave) CMP3AudioPlayControllerDecoder(); |
|
66 CleanupStack::PushL(self); |
|
67 self->ConstructL(); |
|
68 CleanupStack::Pop(self); |
|
69 return self; |
|
70 } |
|
71 |
|
72 // Destructor |
|
73 CMP3AudioPlayControllerDecoder::~CMP3AudioPlayControllerDecoder() |
|
74 { |
|
75 DP0(_L("CMP3AudioPlayControllerDecoder::~CMP3AudioPlayControllerDecoder()")); |
|
76 |
|
77 delete iSoftCodec; |
|
78 delete iFrameTable; |
|
79 } |
|
80 |
|
81 void CMP3AudioPlayControllerDecoder::InitCodecConfigs() |
|
82 { |
|
83 iRenderEnableConfig.Reset(); |
|
84 iRenderEnableConfig.Append(0); // [0] |
|
85 iRenderEnableConfig.Append(0); // [1] |
|
86 iRenderEnableConfig.Append(0); // [2] |
|
87 iRenderEnableConfig.Append(0); // [3] |
|
88 iRenderEnableConfig.Append(0); // [4] |
|
89 iRenderEnableConfig.Append(0); // [5] |
|
90 iRenderEnableConfig.Append(0); // [6] |
|
91 iRenderEnableConfig.Append(1); // [7] render enabled |
|
92 iRenderEnableConfig.Append(0); // [8] |
|
93 iRenderEnableConfig.Append(0); // [9] |
|
94 iRenderEnableConfig.Append(0); // [10] |
|
95 |
|
96 iRenderDisableConfig.Reset(); |
|
97 iRenderDisableConfig.Append(0); // [0] |
|
98 iRenderDisableConfig.Append(0); // [1] |
|
99 iRenderDisableConfig.Append(0); // [2] |
|
100 iRenderDisableConfig.Append(0); // [3] |
|
101 iRenderDisableConfig.Append(0); // [4] |
|
102 iRenderDisableConfig.Append(0); // [5] |
|
103 iRenderDisableConfig.Append(0); // [6] |
|
104 iRenderDisableConfig.Append(2); // [7] render disable |
|
105 iRenderDisableConfig.Append(0); // [8] |
|
106 iRenderDisableConfig.Append(0); // [9] |
|
107 iRenderDisableConfig.Append(0); // [10] |
|
108 |
|
109 iMarkPlayEndConfig.Reset(); |
|
110 iMarkPlayEndConfig.Append(0); // [0] |
|
111 iMarkPlayEndConfig.Append(0); // [1] |
|
112 iMarkPlayEndConfig.Append(0); // [2] |
|
113 iMarkPlayEndConfig.Append(0); // [3] |
|
114 iMarkPlayEndConfig.Append(0); // [4] |
|
115 iMarkPlayEndConfig.Append(0); // [5] |
|
116 iMarkPlayEndConfig.Append(0); // [6] |
|
117 iMarkPlayEndConfig.Append(0); // [7] |
|
118 iMarkPlayEndConfig.Append(0); // [8] |
|
119 iMarkPlayEndConfig.Append(1); // [9] mark play end |
|
120 iMarkPlayEndConfig.Append(0); // [10] |
|
121 |
|
122 iUnMarkPlayEndConfig.Reset(); |
|
123 iUnMarkPlayEndConfig.Append(0); // [0] |
|
124 iUnMarkPlayEndConfig.Append(0); // [1] |
|
125 iUnMarkPlayEndConfig.Append(0); // [2] |
|
126 iUnMarkPlayEndConfig.Append(0); // [3] |
|
127 iUnMarkPlayEndConfig.Append(0); // [4] |
|
128 iUnMarkPlayEndConfig.Append(0); // [5] |
|
129 iUnMarkPlayEndConfig.Append(0); // [6] |
|
130 iUnMarkPlayEndConfig.Append(0); // [7] |
|
131 iUnMarkPlayEndConfig.Append(0); // [8] |
|
132 iUnMarkPlayEndConfig.Append(2); // [9] unmark play end |
|
133 iUnMarkPlayEndConfig.Append(0); // [10] |
|
134 |
|
135 iEnableConfig.Reset(); |
|
136 iEnableConfig.Append(0); // [0] |
|
137 iEnableConfig.Append(0); // [1] |
|
138 iEnableConfig.Append(0); // [2] |
|
139 iEnableConfig.Append(0); // [3] |
|
140 iEnableConfig.Append(0); // [4] |
|
141 iEnableConfig.Append(0); // [5] |
|
142 iEnableConfig.Append(0); // [6] |
|
143 iEnableConfig.Append(0); // [7] |
|
144 iEnableConfig.Append(0); // [8] |
|
145 iEnableConfig.Append(0); // [9] |
|
146 iEnableConfig.Append(1); // [10] enable |
|
147 |
|
148 iDisableConfig.Reset(); |
|
149 iDisableConfig.Append(0); // [0] |
|
150 iDisableConfig.Append(0); // [1] |
|
151 iDisableConfig.Append(0); // [2] |
|
152 iDisableConfig.Append(0); // [3] |
|
153 iDisableConfig.Append(0); // [4] |
|
154 iDisableConfig.Append(0); // [5] |
|
155 iDisableConfig.Append(0); // [6] |
|
156 iDisableConfig.Append(0); // [7] |
|
157 iDisableConfig.Append(0); // [8] |
|
158 iDisableConfig.Append(0); // [9] |
|
159 iDisableConfig.Append(2); // [10] disable |
|
160 |
|
161 RenderEnable(); |
|
162 UnMarkPlayEnd(); |
|
163 Enable(); |
|
164 } |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // CMP3AudioPlayControllerDecoder::CodecConfig |
|
168 // Sets configuration data and configures the codec. |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 TInt CMP3AudioPlayControllerDecoder::CodecConfig(RArray<TInt>& aCodecConfigData) |
|
172 { |
|
173 TInt stat; |
|
174 // RArray<TInt>& codecArrayConfigData = reinterpret_cast<RArray<TInt>&>(aCodecConfigData); |
|
175 // codecArrayConfigData[6] = reinterpret_cast<TInt>(iFrameTable); |
|
176 aCodecConfigData[6] = reinterpret_cast<TInt>(iFrameTable); |
|
177 TRAP(stat, iSoftCodec->ConfigureL(KUidConfig, reinterpret_cast<TDesC8&>(aCodecConfigData))); |
|
178 return stat; |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CMP3AudioPlayControllerDecoder::IsHwAccelerated |
|
183 // Always return true since soft codec is used. |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 TBool CMP3AudioPlayControllerDecoder::IsHwAccelerated() |
|
187 { |
|
188 return CAdvancedAudioDecoder::IsHwAccelerated(); |
|
189 } |
|
190 |
|
191 void CMP3AudioPlayControllerDecoder::ResetL() |
|
192 { |
|
193 CAdvancedAudioDecoder::ResetL(); |
|
194 } |
|
195 |
|
196 TCodecProcessResult CMP3AudioPlayControllerDecoder::ProcessL(CMMFBuffer& aSrc, CMMFBuffer& aDst) |
|
197 { |
|
198 return CAdvancedAudioDecoder::ProcessL(aSrc, aDst); |
|
199 } |
|
200 |
|
201 TInt CMP3AudioPlayControllerDecoder::CodecCmd(TCodecCmd aCmd) |
|
202 { |
|
203 return CAdvancedAudioDecoder::CodecCmd(aCmd); |
|
204 } |
|
205 |
|
206 // ----------------------------------------------------------------------------- |
|
207 // CMP3AudioPlayControllerDecoder::SeekSync |
|
208 // Implemented for hw codec |
|
209 // ----------------------------------------------------------------------------- |
|
210 TInt CMP3AudioPlayControllerDecoder::SeekSync(TUint8* /*aBuf*/, TInt /*aBufLen*/) |
|
211 { |
|
212 return KErrNotSupported; |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CMP3AudioPlayControllerDecoder::FrameLength |
|
217 // Implemented for hw codec |
|
218 // ----------------------------------------------------------------------------- |
|
219 TInt CMP3AudioPlayControllerDecoder::FrameLength(const TUint8* /*aBuf*/, TInt /*aBufLen*/, TInt& /*aFrameLength*/) |
|
220 { |
|
221 return KErrNotSupported; |
|
222 } |
|
223 |
|
224 |
|
225 |
|
226 // End of file |