131 } |
131 } |
132 } |
132 } |
133 |
133 |
134 /* query capabilities from adaptation using codec id */ |
134 /* query capabilities from adaptation using codec id */ |
135 memset(pDescriptor, 0, sizeof(XAAudioCodecDescriptor)); |
135 memset(pDescriptor, 0, sizeof(XAAudioCodecDescriptor)); |
136 |
136 |
137 switch (encoderId) |
|
138 { |
|
139 case XA_AUDIOCODEC_AMR: |
|
140 { |
|
141 impl->sampleRateArray[0] = 8000000; |
|
142 |
|
143 impl->bitRateArray[0] = 4750; |
|
144 impl->bitRateArray[1] = 5150; |
|
145 impl->bitRateArray[2] = 5900; |
|
146 impl->bitRateArray[3] = 6700; |
|
147 impl->bitRateArray[4] = 7400; |
|
148 impl->bitRateArray[5] = 7950; |
|
149 impl->bitRateArray[6] = 10200; |
|
150 impl->bitRateArray[7] = 12200; |
|
151 |
|
152 pDescriptor->maxChannels = 1; |
|
153 pDescriptor->minBitsPerSample = 8; |
|
154 pDescriptor->maxBitsPerSample = 8; |
|
155 pDescriptor->minSampleRate = 8000000; /*milliHz*/ |
|
156 pDescriptor->maxSampleRate = 8000000; |
|
157 pDescriptor->isFreqRangeContinuous = XA_BOOLEAN_FALSE; |
|
158 pDescriptor->pSampleRatesSupported |
|
159 = (XAmilliHertz*) (&(impl->sampleRateArray)); |
|
160 pDescriptor->numSampleRatesSupported = 1; |
|
161 pDescriptor->minBitRate = 4750; |
|
162 pDescriptor->maxBitRate = 12200; |
|
163 pDescriptor->isBitrateRangeContinuous = XA_BOOLEAN_FALSE; |
|
164 pDescriptor->pBitratesSupported |
|
165 = (XAuint32*) (&(impl->bitRateArray)); |
|
166 pDescriptor->numBitratesSupported = 8; |
|
167 pDescriptor->profileSetting = XA_AUDIOPROFILE_AMR; |
|
168 pDescriptor->modeSetting = 0; |
|
169 } |
|
170 break; |
|
171 case XA_AUDIOCODEC_AAC: |
|
172 { |
|
173 impl->sampleRateArray[0] = 8000000; |
|
174 impl->sampleRateArray[1] = 11025000; |
|
175 impl->sampleRateArray[2] = 16000000; |
|
176 impl->sampleRateArray[3] = 22050000; |
|
177 impl->sampleRateArray[4] = 32000000; |
|
178 impl->sampleRateArray[5] = 44100000; |
|
179 impl->sampleRateArray[6] = 48000000; |
|
180 |
|
181 impl->bitRateArray[0] = 32000; |
|
182 impl->bitRateArray[1] = 64000; |
|
183 impl->bitRateArray[2] = 96000; |
|
184 impl->bitRateArray[3] = 128000; |
|
185 impl->bitRateArray[4] = 160000; |
|
186 impl->bitRateArray[5] = 192000; |
|
187 impl->bitRateArray[6] = 224000; |
|
188 impl->bitRateArray[7] = 256000; |
|
189 |
|
190 pDescriptor->maxChannels = 2; |
|
191 pDescriptor->minBitsPerSample = 16; |
|
192 pDescriptor->maxBitsPerSample = 16; |
|
193 pDescriptor->minSampleRate = 8000 * 1000; /*milliHz*/ |
|
194 pDescriptor->maxSampleRate = 48000 * 1000; |
|
195 pDescriptor->isFreqRangeContinuous = XA_BOOLEAN_FALSE; |
|
196 pDescriptor->pSampleRatesSupported |
|
197 = (XAmilliHertz*) (&(impl->sampleRateArray)); |
|
198 pDescriptor->numSampleRatesSupported = 7; |
|
199 pDescriptor->minBitRate = 32000; |
|
200 pDescriptor->maxBitRate = 256000; |
|
201 pDescriptor->isBitrateRangeContinuous = XA_BOOLEAN_FALSE; |
|
202 pDescriptor->pBitratesSupported |
|
203 = (XAuint32*) (&(impl->bitRateArray)); |
|
204 pDescriptor->numBitratesSupported = 8; |
|
205 pDescriptor->profileSetting = XA_AUDIOPROFILE_AAC_AAC; |
|
206 pDescriptor->modeSetting = XA_AUDIOMODE_AAC_LC; |
|
207 } |
|
208 break; |
|
209 case XA_AUDIOCODEC_PCM: |
|
210 { |
|
211 impl->sampleRateArray[0] = 12000000; |
|
212 impl->sampleRateArray[1] = 16000000; |
|
213 impl->sampleRateArray[2] = 22050000; |
|
214 impl->sampleRateArray[3] = 24000000; |
|
215 impl->sampleRateArray[4] = 32000000; |
|
216 impl->sampleRateArray[5] = 44100000; |
|
217 impl->sampleRateArray[6] = 48000000; |
|
218 impl->sampleRateArray[7] = 64000000; |
|
219 impl->sampleRateArray[8] = 88200000; |
|
220 impl->sampleRateArray[9] = 96000000; |
|
221 |
|
222 pDescriptor->maxChannels = 2; |
|
223 pDescriptor->minBitsPerSample = 16; |
|
224 pDescriptor->maxBitsPerSample = 16; |
|
225 pDescriptor->minSampleRate = 8000000; /*milliHz*/ |
|
226 pDescriptor->maxSampleRate = 96000000; |
|
227 pDescriptor->isFreqRangeContinuous = XA_BOOLEAN_FALSE; |
|
228 pDescriptor->pSampleRatesSupported |
|
229 = (XAmilliHertz*) (&(impl->sampleRateArray)); |
|
230 pDescriptor->numSampleRatesSupported = 10; |
|
231 pDescriptor->minBitRate = 0; |
|
232 pDescriptor->maxBitRate = 0; |
|
233 pDescriptor->isBitrateRangeContinuous = XA_BOOLEAN_FALSE; |
|
234 pDescriptor->pBitratesSupported = NULL; |
|
235 pDescriptor->numBitratesSupported = 0; |
|
236 pDescriptor->profileSetting = XA_AUDIOPROFILE_PCM; |
|
237 pDescriptor->modeSetting = 0; |
|
238 } |
|
239 break; |
|
240 } |
|
241 |
|
242 res = XACapabilitiesMgr_GetCapsById(impl->capslist, |
137 res = XACapabilitiesMgr_GetCapsById(impl->capslist, |
243 (XACapsType) (XACAP_ENCODER | XACAP_AUDIO), encoderId, &temp); |
138 (XACapsType) (XACAP_ENCODER | XACAP_AUDIO), encoderId, &temp); |
244 if (res == XA_RESULT_SUCCESS) |
139 if (res == XA_RESULT_SUCCESS) |
245 { |
140 { |
246 XAAudioCodecDescriptor* desc = |
141 XAAudioCodecDescriptor* desc = |
247 ((XAAudioCodecDescriptor*) (temp.pEntry)); |
142 ((XAAudioCodecDescriptor*) (temp.pEntry)); |
248 /* map applicable values to XAAudioCodecCapabilities */ |
143 /* map applicable values to XAAudioCodecCapabilities */ |
249 pDescriptor->maxChannels = desc->maxChannels; |
144 pDescriptor->maxChannels = desc->maxChannels; |
250 pDescriptor->minSampleRate = desc->minSampleRate * 1000; /* milliHz */ |
145 pDescriptor->minSampleRate = desc->minSampleRate ; /* milliHz */ |
251 if (desc->maxSampleRate < (0xFFFFFFFF / 1000)) |
146 if (desc->maxSampleRate < (0xFFFFFFFF)) |
252 { |
147 { |
253 pDescriptor->maxSampleRate = desc->maxSampleRate * 1000; |
148 pDescriptor->maxSampleRate = desc->maxSampleRate; |
254 } |
149 } |
255 else |
150 else |
256 { |
151 { |
257 pDescriptor->maxSampleRate = 0xFFFFFFFF; |
152 pDescriptor->maxSampleRate = 0xFFFFFFFF; |
258 } |
153 } |
259 pDescriptor->minBitsPerSample = desc->minBitsPerSample; |
154 pDescriptor->minBitsPerSample = desc->minBitsPerSample; |
260 pDescriptor->maxBitsPerSample = desc->maxBitsPerSample; |
155 pDescriptor->maxBitsPerSample = desc->maxBitsPerSample; |
261 pDescriptor->isFreqRangeContinuous = XA_BOOLEAN_TRUE; |
156 pDescriptor->isFreqRangeContinuous=desc->isFreqRangeContinuous; |
262 pDescriptor->minBitRate = desc->minBitRate; |
157 pDescriptor->minBitRate = desc->minBitRate; |
263 pDescriptor->maxBitRate = desc->maxBitRate; |
158 pDescriptor->maxBitRate = desc->maxBitRate; |
264 pDescriptor->numBitratesSupported = desc->numBitratesSupported; |
159 pDescriptor->numBitratesSupported = desc->numBitratesSupported; |
265 pDescriptor->isBitrateRangeContinuous = XA_BOOLEAN_TRUE; |
160 pDescriptor->isBitrateRangeContinuous=desc->isBitrateRangeContinuous; |
266 if (temp.xaid == XA_AUDIOCODEC_PCM) |
161 pDescriptor->profileSetting=desc->profileSetting; |
267 { |
162 pDescriptor->modeSetting=desc->modeSetting; /* no chanmode for pcm defined */ |
268 pDescriptor->profileSetting = XA_AUDIOPROFILE_PCM; |
163 } |
269 pDescriptor->modeSetting = 0; /* no chanmode for pcm defined */ |
164 else |
270 } |
165 { |
271 else if (temp.xaid == XA_ADAPTID_VORBIS) /* for ogg */ |
166 /* do nothing */ |
272 { |
167 } |
273 if (desc->maxChannels == 1) |
168 |
274 { |
169 |
275 pDescriptor->profileSetting = XA_AUDIOPROFILE_MPEG1_L3; |
170 |
276 pDescriptor->modeSetting = XA_AUDIOCHANMODE_MP3_MONO; |
|
277 } |
|
278 else |
|
279 { |
|
280 pDescriptor->profileSetting = XA_AUDIOPROFILE_MPEG2_L3; |
|
281 pDescriptor->modeSetting = XA_AUDIOCHANMODE_MP3_STEREO; |
|
282 } |
|
283 } |
|
284 else |
|
285 { |
|
286 /* do nothing */ |
|
287 } |
|
288 |
|
289 } |
|
290 |
|
291 DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoderCapabilities"); |
171 DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoderCapabilities"); |
292 return res; |
172 return res; |
293 } |
173 } |
294 |
174 |
295 /***************************************************************************** |
175 /***************************************************************************** |