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"
|
53
|
22 |
#include "xaadptbasectx.h"
|
19
|
23 |
#include <stdio.h>
|
|
24 |
#include <string.h>
|
|
25 |
|
53
|
26 |
static XAresult XACapabilitiesMgr_GetAudioInputDeviceMicCapabilities(
|
|
27 |
XACapabilities **ppNode);
|
|
28 |
static XAresult XACapabilitiesMgr_GetAudioInputDeviceFMRxCapabilities(
|
|
29 |
XACapabilities **ppNode);
|
|
30 |
static XAresult XACapabilitiesMgr_GetAudioInputDeviceCallCapabilities(
|
25
|
31 |
XACapabilities **ppNode);
|
|
32 |
static XAresult XACapabilitiesMgr_GetAudioOutputDeviceCapabilities(
|
|
33 |
XACapabilities **ppNode);
|
19
|
34 |
|
|
35 |
/* XAresult XAGSTCapabilitiesMgr_UpdateAudioIOCapabilitieList
|
53
|
36 |
* Description: Update the capabilities list supported by the engine.
|
19
|
37 |
*/
|
|
38 |
XAresult XACapabilitiesMgr_UpdateAudioIOCapabilitieList(
|
25
|
39 |
FrameworkMap *frameworkMap, XACapabilities **ppListHead)
|
19
|
40 |
|
25
|
41 |
{
|
19
|
42 |
XAresult res = XA_RESULT_SUCCESS;
|
53
|
43 |
XACapabilities *lastNode = NULL;
|
|
44 |
XACapabilities *firstNode = NULL;
|
19
|
45 |
XACapabilities *newNode = NULL;
|
25
|
46 |
|
53
|
47 |
DEBUG_API("->XACapabilitiesMgr_UpdateAudioIOCapabilitieList");
|
|
48 |
|
25
|
49 |
if (!frameworkMap || !ppListHead)
|
|
50 |
{
|
53
|
51 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
52 |
DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList");
|
|
53 |
return XA_RESULT_PARAMETER_INVALID;
|
|
54 |
}
|
|
55 |
|
|
56 |
res = XACapabilitiesMgr_GetAudioInputDeviceMicCapabilities(&newNode);
|
|
57 |
if (res != XA_RESULT_SUCCESS)
|
|
58 |
{
|
|
59 |
XACapabilitiesMgr_DeleteCapabilitieList(&firstNode);
|
|
60 |
DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList");
|
19
|
61 |
return res;
|
25
|
62 |
}
|
|
63 |
|
53
|
64 |
if (!firstNode)
|
25
|
65 |
{
|
53
|
66 |
firstNode = newNode;
|
|
67 |
lastNode = newNode;
|
25
|
68 |
}
|
53
|
69 |
|
|
70 |
res = XACapabilitiesMgr_GetAudioInputDeviceFMRxCapabilities(&newNode);
|
19
|
71 |
if (res != XA_RESULT_SUCCESS)
|
|
72 |
{
|
53
|
73 |
XACapabilitiesMgr_DeleteCapabilitieList(&firstNode);
|
|
74 |
DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList");
|
19
|
75 |
return res;
|
|
76 |
}
|
25
|
77 |
|
53
|
78 |
if (!firstNode)
|
|
79 |
{
|
|
80 |
firstNode = newNode;
|
|
81 |
lastNode = newNode;
|
|
82 |
}
|
|
83 |
else
|
25
|
84 |
{
|
19
|
85 |
lastNode->next = newNode;
|
53
|
86 |
lastNode = newNode;
|
25
|
87 |
}
|
53
|
88 |
|
|
89 |
res = XACapabilitiesMgr_GetAudioInputDeviceCallCapabilities(&newNode);
|
|
90 |
if (res != XA_RESULT_SUCCESS)
|
|
91 |
{
|
|
92 |
XACapabilitiesMgr_DeleteCapabilitieList(&firstNode);
|
|
93 |
DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList");
|
|
94 |
return res;
|
|
95 |
}
|
|
96 |
|
|
97 |
if (!firstNode)
|
|
98 |
{
|
|
99 |
firstNode = newNode;
|
|
100 |
lastNode = newNode;
|
|
101 |
}
|
|
102 |
else
|
|
103 |
{
|
|
104 |
lastNode->next = newNode;
|
19
|
105 |
lastNode = newNode;
|
25
|
106 |
}
|
|
107 |
|
19
|
108 |
res = XACapabilitiesMgr_GetAudioOutputDeviceCapabilities(&newNode);
|
|
109 |
if (res != XA_RESULT_SUCCESS)
|
|
110 |
{
|
53
|
111 |
XACapabilitiesMgr_DeleteCapabilitieList(&firstNode);
|
|
112 |
DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList");
|
19
|
113 |
return res;
|
|
114 |
}
|
25
|
115 |
|
53
|
116 |
if (!firstNode)
|
|
117 |
{
|
|
118 |
firstNode = newNode;
|
|
119 |
lastNode = newNode;
|
|
120 |
}
|
|
121 |
else
|
25
|
122 |
{
|
19
|
123 |
lastNode->next = newNode;
|
|
124 |
lastNode = newNode;
|
25
|
125 |
}
|
53
|
126 |
|
|
127 |
/* if we have some iodevice capabilities in the list */
|
|
128 |
if (firstNode)
|
19
|
129 |
{
|
53
|
130 |
/* if empty list, then append first node as the head */
|
|
131 |
if (!(*ppListHead))
|
|
132 |
{
|
|
133 |
*ppListHead = firstNode;
|
|
134 |
}
|
|
135 |
else /* traverse to the last item in the list and link firstNode to it */
|
|
136 |
{
|
|
137 |
lastNode = *ppListHead;
|
|
138 |
while(lastNode->next)
|
|
139 |
{
|
|
140 |
lastNode = lastNode->next;
|
|
141 |
}
|
|
142 |
lastNode->next = firstNode;
|
|
143 |
}
|
33
|
144 |
}
|
|
145 |
DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList");
|
19
|
146 |
return res;
|
25
|
147 |
}
|
19
|
148 |
|
25
|
149 |
XAresult XACapabilitiesMgr_CreateCapabilitieList(FrameworkMap* frameworkMap,
|
|
150 |
XACapabilities** ppListHead)
|
|
151 |
{
|
19
|
152 |
XACapabilities* list = NULL;
|
|
153 |
XAresult res = XA_RESULT_SUCCESS;
|
53
|
154 |
|
|
155 |
DEBUG_API("->XACapabilitiesMgr_CreateCapabilitieList");
|
|
156 |
if (!frameworkMap || !ppListHead)
|
25
|
157 |
{
|
53
|
158 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
159 |
DEBUG_API("<-XACapabilitiesMgr_CreateCapabilitieList");
|
|
160 |
return XA_RESULT_PARAMETER_INVALID;
|
25
|
161 |
}
|
19
|
162 |
|
|
163 |
*ppListHead = NULL;
|
|
164 |
|
|
165 |
res = XACapabilitiesMgr_UpdateAudioIOCapabilitieList(frameworkMap, &list);
|
|
166 |
if (res != XA_RESULT_SUCCESS)
|
25
|
167 |
{
|
19
|
168 |
XACapabilitiesMgr_DeleteCapabilitieList(&list);
|
53
|
169 |
DEBUG_API("<-XACapabilitiesMgr_CreateCapabilitieList");
|
19
|
170 |
return res;
|
25
|
171 |
}
|
|
172 |
|
19
|
173 |
res = XAGSTCapabilitiesMgr_UpdateCapabilitieList(frameworkMap, &list);
|
|
174 |
if (res != XA_RESULT_SUCCESS)
|
25
|
175 |
{
|
19
|
176 |
XACapabilitiesMgr_DeleteCapabilitieList(&list);
|
53
|
177 |
DEBUG_API("<-XACapabilitiesMgr_CreateCapabilitieList");
|
19
|
178 |
return res;
|
25
|
179 |
}
|
19
|
180 |
|
|
181 |
res = XAMMFCapabilitiesMgr_UpdateCapabilitieList(frameworkMap, &list);
|
|
182 |
if (res != XA_RESULT_SUCCESS)
|
25
|
183 |
{
|
19
|
184 |
XACapabilitiesMgr_DeleteCapabilitieList(&list);
|
53
|
185 |
DEBUG_API("<-XACapabilitiesMgr_CreateCapabilitieList");
|
19
|
186 |
return res;
|
25
|
187 |
}
|
19
|
188 |
|
|
189 |
*ppListHead = list;
|
53
|
190 |
DEBUG_API("<-XACapabilitiesMgr_CreateCapabilitieList");
|
19
|
191 |
return res;
|
25
|
192 |
}
|
19
|
193 |
|
|
194 |
XAresult XACapabilitiesMgr_DeleteCapabilitieList(XACapabilities** ppListHead)
|
25
|
195 |
{
|
19
|
196 |
XACapabilities* currNode = NULL;
|
|
197 |
XACapabilities* nextNode = NULL;
|
|
198 |
XAresult res = XA_RESULT_SUCCESS;
|
25
|
199 |
|
53
|
200 |
DEBUG_API("->XACapabilitiesMgr_DeleteCapabilitieList");
|
25
|
201 |
if (!ppListHead)
|
|
202 |
{
|
53
|
203 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
204 |
DEBUG_API("<-XACapabilitiesMgr_DeleteCapabilitieList");
|
|
205 |
return XA_RESULT_PARAMETER_INVALID;
|
25
|
206 |
}
|
19
|
207 |
|
|
208 |
currNode = *ppListHead;
|
|
209 |
while (currNode)
|
25
|
210 |
{
|
19
|
211 |
if (currNode->capsType == AUD_I)
|
25
|
212 |
{
|
|
213 |
XAAudioInputDescriptor* entries =
|
|
214 |
(XAAudioInputDescriptor*) currNode->pEntry;
|
19
|
215 |
XAint32 i;
|
25
|
216 |
for (i = 0; i < currNode->noOfEntries; i++)
|
|
217 |
{
|
19
|
218 |
free(entries[i].samplingRatesSupported);
|
|
219 |
free(entries[i].deviceName);
|
25
|
220 |
}
|
19
|
221 |
free(entries);
|
25
|
222 |
}
|
19
|
223 |
else if (currNode->capsType == AUD_O)
|
25
|
224 |
{
|
|
225 |
XAAudioOutputDescriptor* entries =
|
|
226 |
(XAAudioOutputDescriptor*) currNode->pEntry;
|
19
|
227 |
XAint32 i;
|
25
|
228 |
for (i = 0; i < currNode->noOfEntries; i++)
|
|
229 |
{
|
19
|
230 |
free(entries[i].samplingRatesSupported);
|
|
231 |
free(entries[i].pDeviceName);
|
25
|
232 |
}
|
19
|
233 |
free(entries);
|
25
|
234 |
}
|
19
|
235 |
else if (currNode->capsType == AUD_E)
|
25
|
236 |
{
|
|
237 |
XAAudioCodecDescriptor* entries =
|
|
238 |
(XAAudioCodecDescriptor*) currNode->pEntry;
|
19
|
239 |
XAint32 i;
|
25
|
240 |
for (i = 0; i < currNode->noOfEntries; i++)
|
|
241 |
{
|
19
|
242 |
free(entries[i].pSampleRatesSupported);
|
|
243 |
free(entries[i].pBitratesSupported);
|
25
|
244 |
}
|
19
|
245 |
free(entries);
|
25
|
246 |
}
|
19
|
247 |
|
25
|
248 |
if (currNode->adaptId)
|
19
|
249 |
{
|
|
250 |
free(currNode->adaptId);
|
|
251 |
}
|
25
|
252 |
|
19
|
253 |
nextNode = currNode->next;
|
|
254 |
free(currNode);
|
|
255 |
currNode = nextNode;
|
25
|
256 |
}
|
19
|
257 |
|
|
258 |
*ppListHead = NULL;
|
53
|
259 |
|
|
260 |
DEBUG_API("<-XACapabilitiesMgr_DeleteCapabilitieList");
|
19
|
261 |
return res;
|
25
|
262 |
}
|
19
|
263 |
|
|
264 |
/* XAresult XACapabilitiesMgr_GetCapsCount
|
|
265 |
* Description: Count capabilities of certain type. Filter is specified by
|
|
266 |
* bitmasking XACapsType values.
|
|
267 |
*/
|
25
|
268 |
XAresult XACapabilitiesMgr_GetCapsCount(XACapabilities* pListHead,
|
|
269 |
XACapsType filter, XAuint32* count)
|
|
270 |
{
|
19
|
271 |
XAresult res = XA_RESULT_SUCCESS;
|
|
272 |
XACapabilities* currNode = pListHead;
|
|
273 |
|
|
274 |
DEBUG_API("->XACapabilitiesMgr_GetCapsCount");
|
25
|
275 |
if (!currNode || !count)
|
|
276 |
{
|
53
|
277 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
278 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsCount");
|
|
279 |
return XA_RESULT_PARAMETER_INVALID;
|
25
|
280 |
}
|
19
|
281 |
|
25
|
282 |
(*count) = 0;
|
19
|
283 |
while (currNode)
|
|
284 |
{
|
25
|
285 |
if ((currNode->capsType & filter) == filter)
|
|
286 |
{
|
19
|
287 |
(*count)++;
|
25
|
288 |
}
|
19
|
289 |
currNode = currNode->next;
|
25
|
290 |
}
|
19
|
291 |
|
|
292 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsCount");
|
|
293 |
return res;
|
25
|
294 |
}
|
19
|
295 |
|
|
296 |
/* XAresult XACapabilitiesMgr_GetCapsById
|
|
297 |
* Description: Get capabilities of type XACapsType and matching id
|
|
298 |
*/
|
25
|
299 |
XAresult XACapabilitiesMgr_GetCapsById(XACapabilities* pListHead,
|
|
300 |
XACapsType filter, XAuint32 maxId, XACapabilities* data)
|
|
301 |
{
|
19
|
302 |
XAresult res = XA_RESULT_SUCCESS;
|
|
303 |
XACapabilities* currNode = pListHead;
|
|
304 |
XAboolean found = XA_BOOLEAN_FALSE;
|
|
305 |
|
|
306 |
DEBUG_API("->XACapabilitiesMgr_GetCapsById");
|
|
307 |
|
25
|
308 |
if (!currNode)
|
|
309 |
{
|
53
|
310 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
311 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsById");
|
|
312 |
return XA_RESULT_PARAMETER_INVALID;
|
25
|
313 |
}
|
19
|
314 |
|
|
315 |
while (currNode)
|
|
316 |
{
|
25
|
317 |
if (((currNode->capsType & filter) == filter) && (maxId
|
|
318 |
== currNode->xaid))
|
|
319 |
{
|
19
|
320 |
memcpy(data, currNode, sizeof(XACapabilities));
|
|
321 |
found = XA_BOOLEAN_TRUE;
|
|
322 |
break;
|
25
|
323 |
}
|
19
|
324 |
currNode = currNode->next;
|
25
|
325 |
}
|
19
|
326 |
|
25
|
327 |
if (!found)
|
|
328 |
{
|
53
|
329 |
DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED");
|
|
330 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsById");
|
|
331 |
return XA_RESULT_FEATURE_UNSUPPORTED;
|
25
|
332 |
}
|
19
|
333 |
|
|
334 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsById");
|
|
335 |
return res;
|
25
|
336 |
}
|
19
|
337 |
|
|
338 |
/* XAresult XACapabilitiesMgr_GetCapsByIdx
|
|
339 |
* Description: Get n'th capabilities of type XACapsType
|
|
340 |
*/
|
25
|
341 |
XAresult XACapabilitiesMgr_GetCapsByIdx(XACapabilities* pListHead,
|
|
342 |
XACapsType filter, XAuint32 idx, XACapabilities* data)
|
|
343 |
{
|
19
|
344 |
XAresult res = XA_RESULT_SUCCESS;
|
|
345 |
XACapabilities* currNode = pListHead;
|
|
346 |
XAboolean found = XA_BOOLEAN_FALSE;
|
|
347 |
XAuint32 j = 0;
|
|
348 |
|
|
349 |
DEBUG_API("->XACapabilitiesMgr_GetCapsByIdx");
|
|
350 |
|
25
|
351 |
if (!currNode)
|
|
352 |
{
|
53
|
353 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
354 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsByIdx");
|
|
355 |
return XA_RESULT_PARAMETER_INVALID;
|
25
|
356 |
}
|
19
|
357 |
|
|
358 |
while (currNode)
|
|
359 |
{
|
25
|
360 |
if ((currNode->capsType & filter) == filter)
|
19
|
361 |
{
|
25
|
362 |
if (idx == j++)
|
|
363 |
{
|
19
|
364 |
memcpy(data, currNode, sizeof(XACapabilities));
|
|
365 |
found = XA_BOOLEAN_TRUE;
|
|
366 |
break;
|
25
|
367 |
}
|
19
|
368 |
}
|
25
|
369 |
currNode = currNode->next;
|
19
|
370 |
}
|
|
371 |
|
25
|
372 |
if (!found)
|
|
373 |
{
|
53
|
374 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
375 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsByIdx");
|
|
376 |
return XA_RESULT_PARAMETER_INVALID;
|
25
|
377 |
}
|
19
|
378 |
|
|
379 |
DEBUG_API("<-XACapabilitiesMgr_GetCapsByIdx");
|
|
380 |
return res;
|
25
|
381 |
}
|
19
|
382 |
|
|
383 |
/* XAresult XACapabilitiesMgr_QueryColorFormats
|
|
384 |
* Description: Get color formats associated with the XA_IMAGECODEC_RAW codec.
|
|
385 |
*/
|
25
|
386 |
XAresult XACapabilitiesMgr_QueryColorFormats(XACapabilities* pListHead,
|
|
387 |
XAuint32* pIndex, XAuint32* pColorFormats)
|
|
388 |
{
|
19
|
389 |
XAresult res = XA_RESULT_SUCCESS;
|
|
390 |
XACapabilities temp;
|
|
391 |
|
|
392 |
DEBUG_API("->XACapabilitiesMgr_QueryColorFormats");
|
|
393 |
|
25
|
394 |
if (!pIndex)
|
|
395 |
{
|
53
|
396 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
397 |
DEBUG_API("<-XACapabilitiesMgr_QueryColorFormats");
|
|
398 |
return XA_RESULT_PARAMETER_INVALID;
|
25
|
399 |
}
|
19
|
400 |
|
25
|
401 |
res = XACapabilitiesMgr_GetCapsById(pListHead,
|
|
402 |
(XACapsType) ((XACapsType) (XACAP_ENCODER | XACAP_IMAGE)),
|
|
403 |
XA_IMAGECODEC_RAW, &temp);
|
|
404 |
if (res == XA_RESULT_SUCCESS)
|
|
405 |
{
|
|
406 |
if (!pColorFormats)
|
|
407 |
{ /* query number of color formats */
|
19
|
408 |
*pIndex = 1; /* one used by camera context */
|
25
|
409 |
}
|
19
|
410 |
else
|
25
|
411 |
{ /* query color format */
|
|
412 |
if (*pIndex >= 1) /* one used by camera context */
|
|
413 |
{
|
53
|
414 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
19
|
415 |
res = XA_RESULT_PARAMETER_INVALID;
|
25
|
416 |
}
|
19
|
417 |
else
|
25
|
418 |
{ /* internal format used by pipeline, look camera context for details */
|
19
|
419 |
*pColorFormats = XA_COLORFORMAT_YUV420PLANAR;
|
25
|
420 |
}
|
19
|
421 |
}
|
|
422 |
}
|
|
423 |
else
|
25
|
424 |
{
|
19
|
425 |
*pIndex = 0;
|
25
|
426 |
}
|
19
|
427 |
|
|
428 |
DEBUG_API("<-XACapabilitiesMgr_QueryColorFormats");
|
|
429 |
return res;
|
25
|
430 |
}
|
19
|
431 |
|
|
432 |
/* Add AudioInputDeviceCaps */
|
53
|
433 |
XAresult XACapabilitiesMgr_GetAudioInputDeviceMicCapabilities(
|
25
|
434 |
XACapabilities** ppNode)
|
|
435 |
{
|
19
|
436 |
XAresult res = XA_RESULT_SUCCESS;
|
|
437 |
XACapabilities *newNode = NULL;
|
|
438 |
XAAudioInputDescriptor *entries = NULL;
|
53
|
439 |
XAchar inpDeviceName[] = "Default Mic";
|
19
|
440 |
int strLen = 0;
|
|
441 |
|
53
|
442 |
DEBUG_API("->XACapabilitiesMgr_GetAudioInputDeviceMicCapabilities");
|
25
|
443 |
newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
|
19
|
444 |
if (!newNode)
|
25
|
445 |
{
|
53
|
446 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
447 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceMicCapabilities");
|
|
448 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
449 |
}
|
19
|
450 |
|
|
451 |
newNode->capsType = AUD_I;
|
53
|
452 |
newNode->xaid = XA_ADAPTID_DEVSOUNDSRC_MIC;
|
|
453 |
newNode->noOfEntries = 1;
|
|
454 |
|
|
455 |
/* Allocate array */
|
|
456 |
entries = (XAAudioInputDescriptor*) calloc(1,
|
|
457 |
sizeof(XAAudioInputDescriptor));
|
|
458 |
if (!entries)
|
|
459 |
{
|
|
460 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
461 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
462 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceMicCapabilities");
|
|
463 |
return XA_RESULT_MEMORY_FAILURE;
|
|
464 |
}
|
|
465 |
|
|
466 |
newNode->pEntry = (void*) entries;
|
|
467 |
|
|
468 |
strLen = strlen((char*) inpDeviceName);
|
|
469 |
entries->deviceName = (XAchar *) calloc(strLen + 1, sizeof(XAchar));
|
|
470 |
if (!entries->deviceName)
|
|
471 |
{
|
|
472 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
473 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
474 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceMicCapabilities");
|
|
475 |
return XA_RESULT_MEMORY_FAILURE;
|
|
476 |
}
|
|
477 |
|
|
478 |
strncpy((char*) entries->deviceName, (char*) inpDeviceName, strLen);
|
|
479 |
entries->deviceName[strLen] = '\0'; /*Null terminate it*/
|
|
480 |
entries->deviceConnection = XA_DEVCONNECTION_INTEGRATED;
|
|
481 |
entries->deviceScope = XA_DEVSCOPE_ENVIRONMENT;
|
|
482 |
entries->deviceLocation = XA_DEVLOCATION_HANDSET;
|
|
483 |
entries->isForTelephony = XA_BOOLEAN_FALSE;
|
|
484 |
entries->minSampleRate = 8000000; /* milliHz */
|
|
485 |
entries->maxSampleRate = 48000000; /* milliHz */
|
|
486 |
entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
|
|
487 |
entries->numOfSamplingRatesSupported = 5;
|
|
488 |
entries->samplingRatesSupported = (XAmilliHertz*) calloc(
|
|
489 |
entries->numOfSamplingRatesSupported, sizeof(XAmilliHertz));
|
|
490 |
if (!entries->samplingRatesSupported)
|
|
491 |
{
|
|
492 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
493 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
494 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceMicCapabilities");
|
|
495 |
return XA_RESULT_MEMORY_FAILURE;
|
|
496 |
}
|
|
497 |
/* entries in milliHz */
|
|
498 |
entries->samplingRatesSupported[0] = 8000000;
|
|
499 |
entries->samplingRatesSupported[1] = 16000000;
|
|
500 |
entries->samplingRatesSupported[2] = 24000000;
|
|
501 |
entries->samplingRatesSupported[3] = 32000000;
|
|
502 |
entries->samplingRatesSupported[4] = 48000000;
|
|
503 |
entries->maxChannels = 2;
|
|
504 |
|
|
505 |
newNode->pEntry = (void*) entries;
|
|
506 |
|
|
507 |
*ppNode = newNode;
|
|
508 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceMicCapabilities");
|
|
509 |
return res;
|
|
510 |
}
|
|
511 |
|
|
512 |
/* Add AudioInputDeviceCaps */
|
|
513 |
XAresult XACapabilitiesMgr_GetAudioInputDeviceFMRxCapabilities(
|
|
514 |
XACapabilities** ppNode)
|
|
515 |
{
|
|
516 |
XAresult res = XA_RESULT_SUCCESS;
|
|
517 |
XACapabilities *newNode = NULL;
|
|
518 |
XAAudioInputDescriptor *entries = NULL;
|
|
519 |
XAchar inpDeviceName[] = "FMRadio Recvr";
|
|
520 |
int strLen = 0;
|
|
521 |
|
|
522 |
DEBUG_API("->XACapabilitiesMgr_GetAudioInputDeviceFMRxCapabilities");
|
|
523 |
newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
|
|
524 |
if (!newNode)
|
|
525 |
{
|
|
526 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
527 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceFMRxCapabilities");
|
|
528 |
return XA_RESULT_MEMORY_FAILURE;
|
|
529 |
}
|
|
530 |
|
|
531 |
newNode->capsType = AUD_I;
|
|
532 |
newNode->xaid = XA_ADAPTID_DEVSOUNDSRC_FMRX;
|
19
|
533 |
newNode->noOfEntries = 1;
|
|
534 |
|
|
535 |
/* Allocate array */
|
25
|
536 |
entries = (XAAudioInputDescriptor*) calloc(1,
|
|
537 |
sizeof(XAAudioInputDescriptor));
|
19
|
538 |
if (!entries)
|
25
|
539 |
{
|
19
|
540 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
53
|
541 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
542 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceFMRxCapabilities");
|
|
543 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
544 |
}
|
|
545 |
|
|
546 |
newNode->pEntry = (void*) entries;
|
19
|
547 |
|
53
|
548 |
strLen = strlen((char*) inpDeviceName);
|
25
|
549 |
entries->deviceName = (XAchar *) calloc(strLen + 1, sizeof(XAchar));
|
19
|
550 |
if (!entries->deviceName)
|
25
|
551 |
{
|
19
|
552 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
53
|
553 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
554 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceFMRxCapabilities");
|
|
555 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
556 |
}
|
19
|
557 |
|
53
|
558 |
strncpy((char*) entries->deviceName, (char*) inpDeviceName, strLen);
|
19
|
559 |
entries->deviceName[strLen] = '\0'; /*Null terminate it*/
|
|
560 |
entries->deviceConnection = XA_DEVCONNECTION_INTEGRATED;
|
|
561 |
entries->deviceScope = XA_DEVSCOPE_ENVIRONMENT;
|
|
562 |
entries->deviceLocation = XA_DEVLOCATION_HANDSET;
|
|
563 |
entries->isForTelephony = XA_BOOLEAN_FALSE;
|
25
|
564 |
entries->minSampleRate = 8000000; /* milliHz */
|
53
|
565 |
entries->maxSampleRate = 48000000; /* milliHz */
|
25
|
566 |
entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
|
53
|
567 |
entries->numOfSamplingRatesSupported = 5;
|
25
|
568 |
entries->samplingRatesSupported = (XAmilliHertz*) calloc(
|
|
569 |
entries->numOfSamplingRatesSupported, sizeof(XAmilliHertz));
|
19
|
570 |
if (!entries->samplingRatesSupported)
|
25
|
571 |
{
|
19
|
572 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
53
|
573 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
574 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceFMRxCapabilities");
|
|
575 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
576 |
}
|
19
|
577 |
/* entries in milliHz */
|
|
578 |
entries->samplingRatesSupported[0] = 8000000;
|
53
|
579 |
entries->samplingRatesSupported[1] = 16000000;
|
|
580 |
entries->samplingRatesSupported[2] = 24000000;
|
|
581 |
entries->samplingRatesSupported[3] = 32000000;
|
|
582 |
entries->samplingRatesSupported[4] = 48000000;
|
19
|
583 |
entries->maxChannels = 2;
|
|
584 |
|
25
|
585 |
newNode->pEntry = (void*) entries;
|
19
|
586 |
|
|
587 |
*ppNode = newNode;
|
53
|
588 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceFMRxCapabilities");
|
|
589 |
return res;
|
|
590 |
}
|
|
591 |
|
|
592 |
/* Add AudioInputDeviceCaps */
|
|
593 |
XAresult XACapabilitiesMgr_GetAudioInputDeviceCallCapabilities(
|
|
594 |
XACapabilities** ppNode)
|
|
595 |
{
|
|
596 |
XAresult res = XA_RESULT_SUCCESS;
|
|
597 |
XACapabilities *newNode = NULL;
|
|
598 |
XAAudioInputDescriptor *entries = NULL;
|
|
599 |
XAchar inpDeviceName[] = "Call";
|
|
600 |
int strLen = 0;
|
|
601 |
|
|
602 |
DEBUG_API("->XACapabilitiesMgr_GetAudioInputDeviceCallCapabilities");
|
|
603 |
newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
|
|
604 |
if (!newNode)
|
|
605 |
{
|
|
606 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
607 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceCallCapabilities");
|
|
608 |
return XA_RESULT_MEMORY_FAILURE;
|
|
609 |
}
|
|
610 |
|
|
611 |
newNode->capsType = AUD_I;
|
|
612 |
newNode->xaid = XA_ADAPTID_DEVSOUNDSRC_CALL;
|
|
613 |
newNode->noOfEntries = 1;
|
|
614 |
|
|
615 |
/* Allocate array */
|
|
616 |
entries = (XAAudioInputDescriptor*) calloc(1,
|
|
617 |
sizeof(XAAudioInputDescriptor));
|
|
618 |
if (!entries)
|
|
619 |
{
|
|
620 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
621 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
622 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceCallCapabilities");
|
|
623 |
return XA_RESULT_MEMORY_FAILURE;
|
|
624 |
}
|
|
625 |
|
|
626 |
newNode->pEntry = (void*) entries;
|
|
627 |
|
|
628 |
strLen = strlen((char*) inpDeviceName);
|
|
629 |
entries->deviceName = (XAchar *) calloc(strLen + 1, sizeof(XAchar));
|
|
630 |
if (!entries->deviceName)
|
|
631 |
{
|
|
632 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
633 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
634 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceCallCapabilities");
|
|
635 |
return XA_RESULT_MEMORY_FAILURE;
|
|
636 |
}
|
|
637 |
|
|
638 |
strncpy((char*) entries->deviceName, (char*) inpDeviceName, strLen);
|
|
639 |
entries->deviceName[strLen] = '\0'; /*Null terminate it*/
|
|
640 |
entries->deviceConnection = XA_DEVCONNECTION_INTEGRATED;
|
|
641 |
entries->deviceScope = XA_DEVSCOPE_ENVIRONMENT;
|
|
642 |
entries->deviceLocation = XA_DEVLOCATION_HANDSET;
|
|
643 |
entries->isForTelephony = XA_BOOLEAN_FALSE;
|
|
644 |
entries->minSampleRate = 8000000; /* milliHz */
|
|
645 |
entries->maxSampleRate = 48000000; /* milliHz */
|
|
646 |
entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
|
|
647 |
entries->numOfSamplingRatesSupported = 5;
|
|
648 |
entries->samplingRatesSupported = (XAmilliHertz*) calloc(
|
|
649 |
entries->numOfSamplingRatesSupported, sizeof(XAmilliHertz));
|
|
650 |
if (!entries->samplingRatesSupported)
|
|
651 |
{
|
|
652 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
653 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
654 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceCallCapabilities");
|
|
655 |
return XA_RESULT_MEMORY_FAILURE;
|
|
656 |
}
|
|
657 |
/* entries in milliHz */
|
|
658 |
entries->samplingRatesSupported[0] = 8000000;
|
|
659 |
entries->samplingRatesSupported[1] = 16000000;
|
|
660 |
entries->samplingRatesSupported[2] = 24000000;
|
|
661 |
entries->samplingRatesSupported[3] = 32000000;
|
|
662 |
entries->samplingRatesSupported[4] = 48000000;
|
|
663 |
entries->maxChannels = 2;
|
|
664 |
|
|
665 |
newNode->pEntry = (void*) entries;
|
|
666 |
|
|
667 |
*ppNode = newNode;
|
|
668 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioInputDeviceCallCapabilities");
|
19
|
669 |
return res;
|
25
|
670 |
}
|
19
|
671 |
|
25
|
672 |
XAresult XACapabilitiesMgr_GetAudioOutputDeviceCapabilities(
|
|
673 |
XACapabilities **ppNode)
|
|
674 |
{
|
19
|
675 |
XAresult res = XA_RESULT_SUCCESS;
|
|
676 |
XACapabilities *newNode = NULL;
|
|
677 |
XAAudioOutputDescriptor *entries = NULL;
|
|
678 |
XAchar outputDeviceName[] = "Default Speaker";
|
|
679 |
int strLen = 0;
|
|
680 |
|
53
|
681 |
DEBUG_API("->XACapabilitiesMgr_GetAudioOutputDeviceCapabilities");
|
25
|
682 |
newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
|
19
|
683 |
if (!newNode)
|
25
|
684 |
{
|
53
|
685 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
686 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioOutputDeviceCapabilities");
|
|
687 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
688 |
}
|
19
|
689 |
|
|
690 |
newNode->capsType = AUD_O;
|
53
|
691 |
newNode->xaid = XA_ADAPTID_DEVSOUNDSINK;
|
19
|
692 |
newNode->noOfEntries = 1;
|
|
693 |
|
|
694 |
/* Allocate array */
|
25
|
695 |
entries = (XAAudioOutputDescriptor*) calloc(1,
|
|
696 |
sizeof(XAAudioOutputDescriptor));
|
19
|
697 |
if (!entries)
|
25
|
698 |
{
|
19
|
699 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
53
|
700 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
701 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioOutputDeviceCapabilities");
|
|
702 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
703 |
}
|
19
|
704 |
|
25
|
705 |
newNode->pEntry = (void*) entries;
|
19
|
706 |
|
25
|
707 |
strLen = strlen((char*) outputDeviceName);
|
|
708 |
entries->pDeviceName = (XAchar *) calloc(strLen + 1, sizeof(XAchar));
|
19
|
709 |
if (!entries->pDeviceName)
|
25
|
710 |
{
|
19
|
711 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
53
|
712 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
713 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioOutputDeviceCapabilities");
|
|
714 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
715 |
}
|
|
716 |
strncpy((char*) entries->pDeviceName, (char*) outputDeviceName, strLen);
|
19
|
717 |
entries->pDeviceName[strLen] = '\0'; /*Null terminate it*/
|
|
718 |
entries->deviceConnection = XA_DEVCONNECTION_INTEGRATED;
|
|
719 |
entries->deviceScope = XA_DEVSCOPE_ENVIRONMENT;
|
|
720 |
entries->deviceLocation = XA_DEVLOCATION_HANDSET;
|
|
721 |
entries->isForTelephony = XA_BOOLEAN_FALSE;
|
|
722 |
entries->minSampleRate = 8000000; /* milliHz */
|
53
|
723 |
entries->maxSampleRate = 48000000; /* milliHz */
|
19
|
724 |
entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
|
53
|
725 |
entries->numOfSamplingRatesSupported = 5;
|
25
|
726 |
entries->samplingRatesSupported = (XAmilliHertz*) calloc(
|
|
727 |
entries->numOfSamplingRatesSupported, sizeof(XAmilliHertz));
|
19
|
728 |
if (!entries->samplingRatesSupported)
|
25
|
729 |
{
|
19
|
730 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
53
|
731 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
732 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioOutputDeviceCapabilities");
|
|
733 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
734 |
}
|
19
|
735 |
/* entries in milliHz */
|
|
736 |
entries->samplingRatesSupported[0] = 8000000;
|
53
|
737 |
entries->samplingRatesSupported[1] = 16000000;
|
|
738 |
entries->samplingRatesSupported[2] = 24000000;
|
|
739 |
entries->samplingRatesSupported[3] = 32000000;
|
|
740 |
entries->samplingRatesSupported[4] = 48000000;
|
19
|
741 |
entries->maxChannels = 2;
|
|
742 |
|
25
|
743 |
newNode->pEntry = (void*) entries;
|
19
|
744 |
|
|
745 |
*ppNode = newNode;
|
53
|
746 |
|
|
747 |
DEBUG_API("<-XACapabilitiesMgr_GetAudioOutputDeviceCapabilities");
|
19
|
748 |
return res;
|
25
|
749 |
}
|