19
|
1 |
/*
|
25
|
2 |
* Copyright (c) 2009 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: Capability Manager to query capabilities from different
|
|
15 |
* adaptations and store it in a linked list.
|
|
16 |
*
|
|
17 |
*/
|
19
|
18 |
|
|
19 |
#include "xacapabilitiesmgr.h"
|
|
20 |
#include "xammfcapabilitiesmgr.h"
|
|
21 |
#include "xagstcapabilitiesmgr.h"
|
|
22 |
#include <stdio.h>
|
|
23 |
#include <string.h>
|
|
24 |
|
25
|
25 |
static XAresult XACapabilitiesMgr_GetAudioInputDeviceCapabilities(
|
|
26 |
XACapabilities **ppNode);
|
|
27 |
static XAresult XACapabilitiesMgr_GetAudioOutputDeviceCapabilities(
|
|
28 |
XACapabilities **ppNode);
|
19
|
29 |
|
|
30 |
/* XAresult XAGSTCapabilitiesMgr_UpdateAudioIOCapabilitieList
|
|
31 |
* Description: Update the capabilities list supported by GStreamer framework.
|
|
32 |
*/
|
|
33 |
XAresult XACapabilitiesMgr_UpdateAudioIOCapabilitieList(
|
25
|
34 |
FrameworkMap *frameworkMap, XACapabilities **ppListHead)
|
19
|
35 |
|
25
|
36 |
{
|
19
|
37 |
XAresult res = XA_RESULT_SUCCESS;
|
|
38 |
XACapabilities *lastNode;
|
25
|
39 |
XACapabilities *firstNode;
|
19
|
40 |
XACapabilities *newNode = NULL;
|
25
|
41 |
|
|
42 |
if (!frameworkMap || !ppListHead)
|
|
43 |
{
|
19
|
44 |
res = XA_RESULT_PARAMETER_INVALID;
|
|
45 |
return res;
|
25
|
46 |
}
|
|
47 |
|
|
48 |
lastNode = *ppListHead;
|
|
49 |
firstNode = *ppListHead;
|
19
|
50 |
|
|
51 |
DEBUG_API("->XACapabilitiesMgr_UpdateAudioIOCapabilitieList");
|
|
52 |
|
|
53 |
/* traverse and point to the last node in the list */
|
25
|
54 |
while (lastNode && lastNode->next)
|
|
55 |
{
|
19
|
56 |
lastNode = lastNode->next;
|
25
|
57 |
}
|
19
|
58 |
|
|
59 |
/* If no input devices are supported, the function returns
|
|
60 |
* XA_RESULT_SUCCESS and newNode will be NULL*/
|
|
61 |
newNode = NULL;
|
|
62 |
res = XACapabilitiesMgr_GetAudioInputDeviceCapabilities(&newNode);
|
|
63 |
if (res != XA_RESULT_SUCCESS)
|
|
64 |
{
|
|
65 |
return res;
|
|
66 |
}
|
25
|
67 |
|
19
|
68 |
if (lastNode)
|
25
|
69 |
{
|
19
|
70 |
lastNode->next = newNode;
|
25
|
71 |
}
|
19
|
72 |
if (newNode)
|
25
|
73 |
{ /* if a new node is created move lastNode to the new item */
|
19
|
74 |
if (!firstNode)
|
|
75 |
firstNode = newNode;
|
|
76 |
lastNode = newNode;
|
25
|
77 |
}
|
|
78 |
|
19
|
79 |
/* If no input devices are supported, the function returns
|
|
80 |
* XA_RESULT_SUCCESS and newNode will be NULL*/
|
|
81 |
newNode = NULL;
|
|
82 |
res = XACapabilitiesMgr_GetAudioOutputDeviceCapabilities(&newNode);
|
|
83 |
if (res != XA_RESULT_SUCCESS)
|
|
84 |
{
|
|
85 |
return res;
|
|
86 |
}
|
25
|
87 |
|
19
|
88 |
if (lastNode)
|
25
|
89 |
{
|
19
|
90 |
lastNode->next = newNode;
|
25
|
91 |
}
|
19
|
92 |
if (newNode)
|
25
|
93 |
{ /* if a new node is created move lastNode to the new item */
|
19
|
94 |
if (!firstNode)
|
|
95 |
firstNode = newNode;
|
|
96 |
lastNode = newNode;
|
25
|
97 |
}
|
19
|
98 |
/* if empty list, then append first node as the head */
|
|
99 |
if (!(*ppListHead))
|
|
100 |
{
|
|
101 |
*ppListHead = firstNode;
|
25
|
102 |
}DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList");
|
19
|
103 |
return res;
|
25
|
104 |
}
|
19
|
105 |
|
25
|
106 |
XAresult XACapabilitiesMgr_CreateCapabilitieList(FrameworkMap* frameworkMap,
|
|
107 |
XACapabilities** ppListHead)
|
|
108 |
{
|
19
|
109 |
XACapabilities* list = NULL;
|
|
110 |
XAresult res = XA_RESULT_SUCCESS;
|
25
|
111 |
if (!ppListHead)
|
|
112 |
{
|
19
|
113 |
res = XA_RESULT_PARAMETER_INVALID;
|
|
114 |
return res;
|
25
|
115 |
}
|
19
|
116 |
|
|
117 |
*ppListHead = NULL;
|
|
118 |
|
|
119 |
res = XACapabilitiesMgr_UpdateAudioIOCapabilitieList(frameworkMap, &list);
|
|
120 |
if (res != XA_RESULT_SUCCESS)
|
25
|
121 |
{
|
19
|
122 |
XACapabilitiesMgr_DeleteCapabilitieList(&list);
|
|
123 |
return res;
|
25
|
124 |
}
|
|
125 |
|
19
|
126 |
res = XAGSTCapabilitiesMgr_UpdateCapabilitieList(frameworkMap, &list);
|
|
127 |
if (res != XA_RESULT_SUCCESS)
|
25
|
128 |
{
|
19
|
129 |
XACapabilitiesMgr_DeleteCapabilitieList(&list);
|
|
130 |
return res;
|
25
|
131 |
}
|
19
|
132 |
|
|
133 |
res = XAMMFCapabilitiesMgr_UpdateCapabilitieList(frameworkMap, &list);
|
|
134 |
if (res != XA_RESULT_SUCCESS)
|
25
|
135 |
{
|
19
|
136 |
XACapabilitiesMgr_DeleteCapabilitieList(&list);
|
|
137 |
return res;
|
25
|
138 |
}
|
19
|
139 |
|
|
140 |
*ppListHead = list;
|
|
141 |
return res;
|
25
|
142 |
}
|
19
|
143 |
|
|
144 |
XAresult XACapabilitiesMgr_DeleteCapabilitieList(XACapabilities** ppListHead)
|
25
|
145 |
{
|
19
|
146 |
XACapabilities* currNode = NULL;
|
|
147 |
XACapabilities* nextNode = NULL;
|
|
148 |
XAresult res = XA_RESULT_SUCCESS;
|
25
|
149 |
|
|
150 |
if (!ppListHead)
|
|
151 |
{
|
19
|
152 |
res = XA_RESULT_PARAMETER_INVALID;
|
|
153 |
return res;
|
25
|
154 |
}
|
19
|
155 |
|
|
156 |
currNode = *ppListHead;
|
|
157 |
while (currNode)
|
25
|
158 |
{
|
19
|
159 |
if (currNode->capsType == AUD_I)
|
25
|
160 |
{
|
|
161 |
XAAudioInputDescriptor* entries =
|
|
162 |
(XAAudioInputDescriptor*) currNode->pEntry;
|
19
|
163 |
XAint32 i;
|
25
|
164 |
for (i = 0; i < currNode->noOfEntries; i++)
|
|
165 |
{
|
19
|
166 |
free(entries[i].samplingRatesSupported);
|
|
167 |
free(entries[i].deviceName);
|
25
|
168 |
}
|
19
|
169 |
free(entries);
|
25
|
170 |
}
|
19
|
171 |
else if (currNode->capsType == AUD_O)
|
25
|
172 |
{
|
|
173 |
XAAudioOutputDescriptor* entries =
|
|
174 |
(XAAudioOutputDescriptor*) currNode->pEntry;
|
19
|
175 |
XAint32 i;
|
25
|
176 |
for (i = 0; i < currNode->noOfEntries; i++)
|
|
177 |
{
|
19
|
178 |
free(entries[i].samplingRatesSupported);
|
|
179 |
free(entries[i].pDeviceName);
|
25
|
180 |
}
|
19
|
181 |
free(entries);
|
25
|
182 |
}
|
19
|
183 |
else if (currNode->capsType == AUD_E)
|
25
|
184 |
{
|
|
185 |
XAAudioCodecDescriptor* entries =
|
|
186 |
(XAAudioCodecDescriptor*) currNode->pEntry;
|
19
|
187 |
XAint32 i;
|
25
|
188 |
for (i = 0; i < currNode->noOfEntries; i++)
|
|
189 |
{
|
19
|
190 |
free(entries[i].pSampleRatesSupported);
|
|
191 |
free(entries[i].pBitratesSupported);
|
25
|
192 |
}
|
19
|
193 |
free(entries);
|
|
194 |
|
25
|
195 |
}
|
19
|
196 |
|
25
|
197 |
if (currNode->adaptId)
|
19
|
198 |
{
|
|
199 |
free(currNode->adaptId);
|
|
200 |
}
|
25
|
201 |
|
19
|
202 |
nextNode = currNode->next;
|
|
203 |
free(currNode);
|
|
204 |
currNode = nextNode;
|
25
|
205 |
}
|
19
|
206 |
|
|
207 |
*ppListHead = NULL;
|
|
208 |
return res;
|
25
|
209 |
}
|
19
|
210 |
|
|
211 |
/* XAresult XACapabilitiesMgr_GetCapsCount
|
|
212 |
* Description: Count capabilities of certain type. Filter is specified by
|
|
213 |
* bitmasking XACapsType values.
|
|
214 |
*/
|
25
|
215 |
XAresult XACapabilitiesMgr_GetCapsCount(XACapabilities* pListHead,
|
|
216 |
XACapsType filter, XAuint32* count)
|
|
217 |
{
|
19
|
218 |
XAresult res = XA_RESULT_SUCCESS;
|
|
219 |
XACapabilities* currNode = pListHead;
|
|
220 |
|
|
221 |
DEBUG_API("->XACapabilitiesMgr_GetCapsCount");
|
25
|
222 |
if (!currNode || !count)
|
|
223 |
{
|
19
|
224 |
res = XA_RESULT_PARAMETER_INVALID;
|
|
225 |
return res;
|
25
|
226 |
}
|
19
|
227 |
|
25
|
228 |
(*count) = 0;
|
19
|
229 |
while (currNode)
|
|
230 |
{
|
25
|
231 |
if ((currNode->capsType & filter) == filter)
|
|
232 |
{
|
19
|
233 |
(*count)++;
|
25
|
234 |
}
|
19
|
235 |
currNode = currNode->next;
|
25
|
236 |
}
|
19
|
237 |
|
|
238 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsCount");
|
|
239 |
return res;
|
25
|
240 |
}
|
19
|
241 |
|
|
242 |
/* XAresult XACapabilitiesMgr_GetCapsById
|
|
243 |
* Description: Get capabilities of type XACapsType and matching id
|
|
244 |
*/
|
25
|
245 |
XAresult XACapabilitiesMgr_GetCapsById(XACapabilities* pListHead,
|
|
246 |
XACapsType filter, XAuint32 maxId, XACapabilities* data)
|
|
247 |
{
|
19
|
248 |
XAresult res = XA_RESULT_SUCCESS;
|
|
249 |
XACapabilities* currNode = pListHead;
|
|
250 |
XAboolean found = XA_BOOLEAN_FALSE;
|
|
251 |
|
|
252 |
DEBUG_API("->XACapabilitiesMgr_GetCapsById");
|
|
253 |
|
25
|
254 |
if (!currNode)
|
|
255 |
{
|
19
|
256 |
res = XA_RESULT_PARAMETER_INVALID;
|
|
257 |
return res;
|
25
|
258 |
}
|
19
|
259 |
|
|
260 |
while (currNode)
|
|
261 |
{
|
25
|
262 |
if (((currNode->capsType & filter) == filter) && (maxId
|
|
263 |
== currNode->xaid))
|
|
264 |
{
|
19
|
265 |
memcpy(data, currNode, sizeof(XACapabilities));
|
|
266 |
found = XA_BOOLEAN_TRUE;
|
|
267 |
break;
|
25
|
268 |
}
|
19
|
269 |
currNode = currNode->next;
|
25
|
270 |
}
|
19
|
271 |
|
25
|
272 |
if (!found)
|
|
273 |
{
|
|
274 |
res = XA_RESULT_FEATURE_UNSUPPORTED;
|
|
275 |
return res;
|
|
276 |
}
|
19
|
277 |
|
|
278 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsById");
|
|
279 |
return res;
|
25
|
280 |
}
|
19
|
281 |
|
|
282 |
/* XAresult XACapabilitiesMgr_GetCapsByIdx
|
|
283 |
* Description: Get n'th capabilities of type XACapsType
|
|
284 |
*/
|
25
|
285 |
XAresult XACapabilitiesMgr_GetCapsByIdx(XACapabilities* pListHead,
|
|
286 |
XACapsType filter, XAuint32 idx, XACapabilities* data)
|
|
287 |
{
|
19
|
288 |
XAresult res = XA_RESULT_SUCCESS;
|
|
289 |
XACapabilities* currNode = pListHead;
|
|
290 |
XAboolean found = XA_BOOLEAN_FALSE;
|
|
291 |
XAuint32 j = 0;
|
|
292 |
|
|
293 |
DEBUG_API("->XACapabilitiesMgr_GetCapsByIdx");
|
|
294 |
|
25
|
295 |
if (!currNode)
|
|
296 |
{
|
19
|
297 |
res = XA_RESULT_PARAMETER_INVALID;
|
|
298 |
return res;
|
25
|
299 |
}
|
19
|
300 |
|
|
301 |
while (currNode)
|
|
302 |
{
|
25
|
303 |
if ((currNode->capsType & filter) == filter)
|
19
|
304 |
{
|
25
|
305 |
if (idx == j++)
|
|
306 |
{
|
19
|
307 |
memcpy(data, currNode, sizeof(XACapabilities));
|
|
308 |
found = XA_BOOLEAN_TRUE;
|
|
309 |
break;
|
25
|
310 |
}
|
19
|
311 |
}
|
25
|
312 |
currNode = currNode->next;
|
19
|
313 |
}
|
|
314 |
|
25
|
315 |
if (!found)
|
|
316 |
{
|
|
317 |
res = XA_RESULT_PARAMETER_INVALID;
|
|
318 |
return res;
|
|
319 |
}
|
19
|
320 |
|
|
321 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsByIdx");
|
|
322 |
return res;
|
25
|
323 |
}
|
19
|
324 |
|
|
325 |
/* XAresult XACapabilitiesMgr_QueryColorFormats
|
|
326 |
* Description: Get color formats associated with the XA_IMAGECODEC_RAW codec.
|
|
327 |
*/
|
25
|
328 |
XAresult XACapabilitiesMgr_QueryColorFormats(XACapabilities* pListHead,
|
|
329 |
XAuint32* pIndex, XAuint32* pColorFormats)
|
|
330 |
{
|
19
|
331 |
XAresult res = XA_RESULT_SUCCESS;
|
|
332 |
XACapabilities temp;
|
|
333 |
|
|
334 |
DEBUG_API("->XACapabilitiesMgr_QueryColorFormats");
|
|
335 |
|
25
|
336 |
if (!pIndex)
|
|
337 |
{
|
19
|
338 |
DEBUG_ERR("illegal NULL parameter");
|
|
339 |
res = XA_RESULT_PARAMETER_INVALID;
|
|
340 |
return res;
|
25
|
341 |
}
|
19
|
342 |
|
25
|
343 |
res = XACapabilitiesMgr_GetCapsById(pListHead,
|
|
344 |
(XACapsType) ((XACapsType) (XACAP_ENCODER | XACAP_IMAGE)),
|
|
345 |
XA_IMAGECODEC_RAW, &temp);
|
|
346 |
if (res == XA_RESULT_SUCCESS)
|
|
347 |
{
|
|
348 |
if (!pColorFormats)
|
|
349 |
{ /* query number of color formats */
|
19
|
350 |
*pIndex = 1; /* one used by camera context */
|
25
|
351 |
}
|
19
|
352 |
else
|
25
|
353 |
{ /* query color format */
|
|
354 |
if (*pIndex >= 1) /* one used by camera context */
|
|
355 |
{
|
19
|
356 |
DEBUG_ERR("index parameter invalid");
|
|
357 |
res = XA_RESULT_PARAMETER_INVALID;
|
25
|
358 |
}
|
19
|
359 |
else
|
25
|
360 |
{ /* internal format used by pipeline, look camera context for details */
|
19
|
361 |
*pColorFormats = XA_COLORFORMAT_YUV420PLANAR;
|
25
|
362 |
}
|
19
|
363 |
}
|
|
364 |
}
|
|
365 |
else
|
25
|
366 |
{
|
19
|
367 |
*pIndex = 0;
|
25
|
368 |
}
|
19
|
369 |
|
|
370 |
DEBUG_API("<-XACapabilitiesMgr_QueryColorFormats");
|
|
371 |
return res;
|
25
|
372 |
}
|
19
|
373 |
|
|
374 |
/* Add AudioInputDeviceCaps */
|
25
|
375 |
XAresult XACapabilitiesMgr_GetAudioInputDeviceCapabilities(
|
|
376 |
XACapabilities** ppNode)
|
|
377 |
{
|
19
|
378 |
XAresult res = XA_RESULT_SUCCESS;
|
|
379 |
XACapabilities *newNode = NULL;
|
|
380 |
XAAudioInputDescriptor *entries = NULL;
|
|
381 |
XAchar micDeviceName[] = "Default Mic";
|
|
382 |
int strLen = 0;
|
|
383 |
|
25
|
384 |
newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
|
19
|
385 |
if (!newNode)
|
25
|
386 |
{
|
19
|
387 |
res = XA_RESULT_MEMORY_FAILURE;
|
|
388 |
return res;
|
25
|
389 |
}
|
19
|
390 |
|
|
391 |
newNode->capsType = AUD_I;
|
|
392 |
newNode->xaid = 0xAD7E5001;
|
|
393 |
newNode->noOfEntries = 1;
|
|
394 |
|
|
395 |
/* Allocate array */
|
25
|
396 |
entries = (XAAudioInputDescriptor*) calloc(1,
|
|
397 |
sizeof(XAAudioInputDescriptor));
|
19
|
398 |
if (!entries)
|
25
|
399 |
{
|
19
|
400 |
res = XA_RESULT_MEMORY_FAILURE;
|
|
401 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
402 |
return res;
|
25
|
403 |
}
|
|
404 |
|
|
405 |
newNode->pEntry = (void*) entries;
|
19
|
406 |
|
25
|
407 |
strLen = strlen((char*) micDeviceName);
|
|
408 |
entries->deviceName = (XAchar *) calloc(strLen + 1, sizeof(XAchar));
|
19
|
409 |
if (!entries->deviceName)
|
25
|
410 |
{
|
19
|
411 |
res = XA_RESULT_MEMORY_FAILURE;
|
|
412 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
413 |
return res;
|
25
|
414 |
}
|
19
|
415 |
|
25
|
416 |
strncpy((char*) entries->deviceName, (char*) micDeviceName, strLen);
|
19
|
417 |
entries->deviceName[strLen] = '\0'; /*Null terminate it*/
|
|
418 |
entries->deviceConnection = XA_DEVCONNECTION_INTEGRATED;
|
|
419 |
entries->deviceScope = XA_DEVSCOPE_ENVIRONMENT;
|
|
420 |
entries->deviceLocation = XA_DEVLOCATION_HANDSET;
|
|
421 |
entries->isForTelephony = XA_BOOLEAN_FALSE;
|
25
|
422 |
entries->minSampleRate = 8000000; /* milliHz */
|
19
|
423 |
entries->maxSampleRate = 96000000; /* milliHz */
|
25
|
424 |
entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
|
19
|
425 |
entries->numOfSamplingRatesSupported = 12;
|
25
|
426 |
entries->samplingRatesSupported = (XAmilliHertz*) calloc(
|
|
427 |
entries->numOfSamplingRatesSupported, sizeof(XAmilliHertz));
|
19
|
428 |
if (!entries->samplingRatesSupported)
|
25
|
429 |
{
|
19
|
430 |
res = XA_RESULT_MEMORY_FAILURE;
|
|
431 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
432 |
return res;
|
25
|
433 |
}
|
19
|
434 |
/* entries in milliHz */
|
|
435 |
entries->samplingRatesSupported[0] = 8000000;
|
|
436 |
entries->samplingRatesSupported[1] = 11025000;
|
|
437 |
entries->samplingRatesSupported[2] = 12000000;
|
|
438 |
entries->samplingRatesSupported[3] = 16000000;
|
|
439 |
entries->samplingRatesSupported[4] = 22050000;
|
|
440 |
entries->samplingRatesSupported[5] = 24000000;
|
|
441 |
entries->samplingRatesSupported[6] = 32000000;
|
|
442 |
entries->samplingRatesSupported[7] = 44100000;
|
|
443 |
entries->samplingRatesSupported[8] = 48000000;
|
|
444 |
entries->samplingRatesSupported[9] = 64000000;
|
|
445 |
entries->samplingRatesSupported[10] = 88200000;
|
|
446 |
entries->samplingRatesSupported[11] = 96000000;
|
|
447 |
entries->maxChannels = 2;
|
|
448 |
|
25
|
449 |
newNode->pEntry = (void*) entries;
|
19
|
450 |
|
|
451 |
*ppNode = newNode;
|
|
452 |
return res;
|
25
|
453 |
}
|
19
|
454 |
|
25
|
455 |
XAresult XACapabilitiesMgr_GetAudioOutputDeviceCapabilities(
|
|
456 |
XACapabilities **ppNode)
|
|
457 |
{
|
19
|
458 |
XAresult res = XA_RESULT_SUCCESS;
|
|
459 |
XACapabilities *newNode = NULL;
|
|
460 |
XAAudioOutputDescriptor *entries = NULL;
|
|
461 |
XAchar outputDeviceName[] = "Default Speaker";
|
|
462 |
int strLen = 0;
|
|
463 |
|
25
|
464 |
newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
|
19
|
465 |
if (!newNode)
|
25
|
466 |
{
|
19
|
467 |
res = XA_RESULT_MEMORY_FAILURE;
|
|
468 |
return res;
|
25
|
469 |
}
|
19
|
470 |
|
|
471 |
newNode->capsType = AUD_O;
|
|
472 |
newNode->xaid = 0xAD7E5002;
|
|
473 |
newNode->noOfEntries = 1;
|
|
474 |
|
|
475 |
/* Allocate array */
|
25
|
476 |
entries = (XAAudioOutputDescriptor*) calloc(1,
|
|
477 |
sizeof(XAAudioOutputDescriptor));
|
19
|
478 |
if (!entries)
|
25
|
479 |
{
|
19
|
480 |
res = XA_RESULT_MEMORY_FAILURE;
|
|
481 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
482 |
return res;
|
25
|
483 |
}
|
19
|
484 |
|
25
|
485 |
newNode->pEntry = (void*) entries;
|
19
|
486 |
|
25
|
487 |
strLen = strlen((char*) outputDeviceName);
|
|
488 |
entries->pDeviceName = (XAchar *) calloc(strLen + 1, sizeof(XAchar));
|
19
|
489 |
if (!entries->pDeviceName)
|
25
|
490 |
{
|
19
|
491 |
res = XA_RESULT_MEMORY_FAILURE;
|
|
492 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
493 |
return res;
|
25
|
494 |
}
|
|
495 |
strncpy((char*) entries->pDeviceName, (char*) outputDeviceName, strLen);
|
19
|
496 |
entries->pDeviceName[strLen] = '\0'; /*Null terminate it*/
|
|
497 |
entries->deviceConnection = XA_DEVCONNECTION_INTEGRATED;
|
|
498 |
entries->deviceScope = XA_DEVSCOPE_ENVIRONMENT;
|
|
499 |
entries->deviceLocation = XA_DEVLOCATION_HANDSET;
|
|
500 |
entries->isForTelephony = XA_BOOLEAN_FALSE;
|
|
501 |
entries->minSampleRate = 8000000; /* milliHz */
|
|
502 |
entries->maxSampleRate = 96000000; /* milliHz */
|
|
503 |
entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
|
|
504 |
entries->numOfSamplingRatesSupported = 12;
|
25
|
505 |
entries->samplingRatesSupported = (XAmilliHertz*) calloc(
|
|
506 |
entries->numOfSamplingRatesSupported, sizeof(XAmilliHertz));
|
19
|
507 |
if (!entries->samplingRatesSupported)
|
25
|
508 |
{
|
19
|
509 |
res = XA_RESULT_MEMORY_FAILURE;
|
|
510 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
511 |
return res;
|
25
|
512 |
}
|
19
|
513 |
/* entries in milliHz */
|
|
514 |
entries->samplingRatesSupported[0] = 8000000;
|
|
515 |
entries->samplingRatesSupported[1] = 11025000;
|
|
516 |
entries->samplingRatesSupported[2] = 12000000;
|
|
517 |
entries->samplingRatesSupported[3] = 16000000;
|
|
518 |
entries->samplingRatesSupported[4] = 22050000;
|
|
519 |
entries->samplingRatesSupported[5] = 24000000;
|
|
520 |
entries->samplingRatesSupported[6] = 32000000;
|
|
521 |
entries->samplingRatesSupported[7] = 44100000;
|
|
522 |
entries->samplingRatesSupported[8] = 48000000;
|
|
523 |
entries->samplingRatesSupported[9] = 64000000;
|
|
524 |
entries->samplingRatesSupported[10] = 88200000;
|
|
525 |
entries->samplingRatesSupported[11] = 96000000;
|
|
526 |
entries->maxChannels = 2;
|
|
527 |
|
25
|
528 |
newNode->pEntry = (void*) entries;
|
19
|
529 |
|
|
530 |
*ppNode = newNode;
|
|
531 |
return res;
|
25
|
532 |
}
|
19
|
533 |
|