|
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 "AMRAudioPlayControllerDecoder.h" |
|
23 #include <mmfcodec.h> |
|
24 #include "DebugMacros.h" |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS =============================== |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // C++ default constructor can NOT contain any code, that |
|
30 // might leave. |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CAMRAudioPlayControllerDecoder::CAMRAudioPlayControllerDecoder() |
|
34 : CAdvancedAudioDecoder(CActive::EPriorityStandard) |
|
35 { |
|
36 DP0(_L("CAMRAudioPlayControllerDecoder::CAMRAudioPlayControllerDecoder()")); |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CAMRAudioPlayControllerDecoder::ConstructL |
|
41 // Symbian 2nd phase constructor can leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void CAMRAudioPlayControllerDecoder::ConstructL() |
|
45 { |
|
46 DP0(_L("CAMRAudioPlayControllerDecoder::ConstructL()")); |
|
47 iSoftCodec = CMMFCodec::NewL(TFourCC(' ','A','M','R'), TFourCC(' ','P','1','6')); |
|
48 |
|
49 iFrameTable = CFrameTable::NewL(); |
|
50 |
|
51 InitCodecConfigs(); |
|
52 |
|
53 CActiveScheduler::Add(this); |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // C++ default constructor can NOT contain any code, that |
|
58 // might leave. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CAMRAudioPlayControllerDecoder* CAMRAudioPlayControllerDecoder::NewL() |
|
62 { |
|
63 DP0(_L("CAMRAudioPlayControllerDecoder::NewL()")); |
|
64 CAMRAudioPlayControllerDecoder* self = new(ELeave) CAMRAudioPlayControllerDecoder(); |
|
65 CleanupStack::PushL(self); |
|
66 self->ConstructL(); |
|
67 CleanupStack::Pop(self); |
|
68 return self; |
|
69 } |
|
70 |
|
71 // Destructor |
|
72 CAMRAudioPlayControllerDecoder::~CAMRAudioPlayControllerDecoder() |
|
73 { |
|
74 DP0(_L("CAMRAudioPlayControllerDecoder::~CAMRAudioPlayControllerDecoder()")); |
|
75 delete iSoftCodec; |
|
76 delete iFrameTable; |
|
77 } |
|
78 |
|
79 |
|
80 void CAMRAudioPlayControllerDecoder::InitCodecConfigs() |
|
81 { |
|
82 iRenderEnableConfig.Reset(); |
|
83 iRenderEnableConfig.Append(0); // [0] |
|
84 iRenderEnableConfig.Append(0); // [1] table pointer |
|
85 iRenderEnableConfig.Append(1); // [2] render enabled |
|
86 iRenderEnableConfig.Append(0); // [3] |
|
87 iRenderEnableConfig.Append(0); // [4] |
|
88 |
|
89 iRenderDisableConfig.Reset(); |
|
90 iRenderDisableConfig.Append(0); // [0] |
|
91 iRenderDisableConfig.Append(0); // [1] |
|
92 iRenderDisableConfig.Append(2); // [2] render disable |
|
93 iRenderDisableConfig.Append(0); // [3] |
|
94 iRenderDisableConfig.Append(0); // [4] |
|
95 |
|
96 iMarkPlayEndConfig.Reset(); |
|
97 iMarkPlayEndConfig.Append(0); // [0] |
|
98 iMarkPlayEndConfig.Append(0); // [1] |
|
99 iMarkPlayEndConfig.Append(0); // [2] |
|
100 iMarkPlayEndConfig.Append(1); // [3] mark play end |
|
101 iMarkPlayEndConfig.Append(0); // [4] |
|
102 |
|
103 iUnMarkPlayEndConfig.Reset(); |
|
104 iUnMarkPlayEndConfig.Append(0); // [0] |
|
105 iUnMarkPlayEndConfig.Append(0); // [1] |
|
106 iUnMarkPlayEndConfig.Append(0); // [2] |
|
107 iUnMarkPlayEndConfig.Append(2); // [3] unmark play end |
|
108 iUnMarkPlayEndConfig.Append(0); // [4] |
|
109 |
|
110 iEnableConfig.Reset(); |
|
111 iEnableConfig.Append(0); // [0] |
|
112 iEnableConfig.Append(0); // [1] |
|
113 iEnableConfig.Append(0); // [2] |
|
114 iEnableConfig.Append(0); // [3] |
|
115 iEnableConfig.Append(1); // [4] enable |
|
116 |
|
117 iDisableConfig.Reset(); |
|
118 iDisableConfig.Append(0); // [0] |
|
119 iDisableConfig.Append(0); // [1] |
|
120 iDisableConfig.Append(0); // [2] |
|
121 iDisableConfig.Append(0); // [3] |
|
122 iDisableConfig.Append(2); // [4] disable |
|
123 |
|
124 RenderEnable(); |
|
125 UnMarkPlayEnd(); |
|
126 Enable(); |
|
127 } |
|
128 |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CAMRAudioPlayControllerDecoder::CodecConfig |
|
132 // Sets configuration data and configures the codec. |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 TInt CAMRAudioPlayControllerDecoder::CodecConfig(RArray<TInt>& aCodecConfigData) |
|
136 { |
|
137 TInt stat; |
|
138 aCodecConfigData[1] = reinterpret_cast<TInt>(iFrameTable); |
|
139 TRAP(stat, iSoftCodec->ConfigureL(KUidConfig, reinterpret_cast<TDesC8&>(aCodecConfigData))); |
|
140 return stat; |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CAMRAudioPlayControllerDecoder::IsHwAccelerated |
|
145 // Always return true since soft codec is used. |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 TBool CAMRAudioPlayControllerDecoder::IsHwAccelerated() |
|
149 { |
|
150 return CAdvancedAudioDecoder::IsHwAccelerated(); |
|
151 } |
|
152 |
|
153 void CAMRAudioPlayControllerDecoder::ResetL() |
|
154 { |
|
155 CAdvancedAudioDecoder::ResetL(); |
|
156 } |
|
157 |
|
158 TCodecProcessResult CAMRAudioPlayControllerDecoder::ProcessL(CMMFBuffer& aSrc, CMMFBuffer& aDst) |
|
159 { |
|
160 return CAdvancedAudioDecoder::ProcessL(aSrc, aDst); |
|
161 } |
|
162 |
|
163 TInt CAMRAudioPlayControllerDecoder::CodecCmd(TCodecCmd aCmd) |
|
164 { |
|
165 return CAdvancedAudioDecoder::CodecCmd(aCmd); |
|
166 } |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // CAMRAudioPlayControllerDecoder::SeekSync |
|
170 // Implemented for hw codec |
|
171 // ----------------------------------------------------------------------------- |
|
172 TInt CAMRAudioPlayControllerDecoder::SeekSync(TUint8* /*aBuf*/, TInt /*aBufLen*/) |
|
173 { |
|
174 return KErrNotSupported; |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CAMRAudioPlayControllerDecoder::FrameLength |
|
179 // Implemented for hw codec |
|
180 // ----------------------------------------------------------------------------- |
|
181 TInt CAMRAudioPlayControllerDecoder::FrameLength(const TUint8* /*aBuf*/, TInt /*aBufLen*/, TInt& /*aFrameLength*/) |
|
182 { |
|
183 return KErrNotSupported; |
|
184 } |
|
185 |
|
186 // End of file |