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: GST Capabilities Mgr. Here you can query the capabilities
|
|
15 |
* of various GST components and store it in a list.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
19
|
19 |
#include <stdio.h>
|
|
20 |
#include <string.h>
|
28
|
21 |
#include <strings.h>
|
|
22 |
|
25
|
23 |
#include "xagstcapabilitiesmgr.h"
|
|
24 |
#include "xaframeworkmgr.h"
|
19
|
25 |
|
25
|
26 |
static XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(
|
|
27 |
XACapabilities **ppNode);
|
|
28 |
static XAresult XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(
|
|
29 |
XACapabilities **ppNode);
|
|
30 |
static XAresult XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(
|
|
31 |
XACapabilities **ppNode);
|
19
|
32 |
|
53
|
33 |
/* XAresult XAGSTCapabilitiesMgr_UpdateCapabilitieList(
|
|
34 |
* FrameworkMap *frameworkMap, XACapabilities **ppListHead)
|
|
35 |
* Description: Append capabilities supported by Gstreamer framework.
|
19
|
36 |
*/
|
|
37 |
XAresult XAGSTCapabilitiesMgr_UpdateCapabilitieList(
|
25
|
38 |
FrameworkMap *frameworkMap, XACapabilities **ppListHead)
|
19
|
39 |
|
25
|
40 |
{
|
19
|
41 |
XAresult res = XA_RESULT_SUCCESS;
|
|
42 |
XACapabilities *newNode = NULL;
|
|
43 |
FWMgrFwType fwtype = FWMgrFWUknown;
|
|
44 |
char *uri = NULL;
|
53
|
45 |
XACapabilities *lastNode = NULL;
|
|
46 |
XACapabilities *firstNode = NULL;
|
19
|
47 |
|
|
48 |
DEBUG_API("->XAGSTCapabilitiesMgr_UpdateCapabilitieList");
|
|
49 |
|
25
|
50 |
if (!frameworkMap || !ppListHead)
|
|
51 |
{
|
53
|
52 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
53 |
DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList");
|
|
54 |
return XA_RESULT_PARAMETER_INVALID;
|
25
|
55 |
}
|
19
|
56 |
|
|
57 |
uri = "file:///c:/test.mp4";
|
25
|
58 |
fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder);
|
|
59 |
if (fwtype == FWMgrFWGST)
|
|
60 |
{
|
|
61 |
res = XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(&newNode);
|
|
62 |
if (res != XA_RESULT_SUCCESS)
|
|
63 |
{
|
53
|
64 |
XACapabilitiesMgr_DeleteCapabilitieList(&firstNode);
|
|
65 |
DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList");
|
25
|
66 |
return res;
|
|
67 |
}
|
53
|
68 |
if (!firstNode)
|
25
|
69 |
{
|
53
|
70 |
firstNode = newNode;
|
25
|
71 |
lastNode = newNode;
|
|
72 |
}
|
|
73 |
}
|
19
|
74 |
|
|
75 |
uri = "file:///c:/test.amr";
|
25
|
76 |
fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder);
|
|
77 |
if (fwtype == FWMgrFWGST)
|
|
78 |
{
|
|
79 |
res = XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(&newNode);
|
|
80 |
if (res != XA_RESULT_SUCCESS)
|
|
81 |
{
|
53
|
82 |
XACapabilitiesMgr_DeleteCapabilitieList(&firstNode);
|
|
83 |
DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList");
|
25
|
84 |
return res;
|
|
85 |
}
|
53
|
86 |
if (!firstNode)
|
|
87 |
{
|
|
88 |
firstNode = newNode;
|
|
89 |
lastNode = newNode;
|
|
90 |
}
|
|
91 |
else
|
25
|
92 |
{
|
|
93 |
lastNode->next = newNode;
|
|
94 |
lastNode = newNode;
|
|
95 |
}
|
|
96 |
}
|
19
|
97 |
|
|
98 |
uri = "file:///c:/test.wav";
|
25
|
99 |
fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder);
|
|
100 |
if (fwtype == FWMgrFWGST)
|
|
101 |
{
|
|
102 |
res = XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(&newNode);
|
|
103 |
if (res != XA_RESULT_SUCCESS)
|
|
104 |
{
|
53
|
105 |
XACapabilitiesMgr_DeleteCapabilitieList(&firstNode);
|
|
106 |
DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList");
|
25
|
107 |
return res;
|
|
108 |
}
|
53
|
109 |
if (!firstNode)
|
|
110 |
{
|
|
111 |
firstNode = newNode;
|
|
112 |
lastNode = newNode;
|
|
113 |
}
|
|
114 |
else
|
25
|
115 |
{
|
|
116 |
lastNode->next = newNode;
|
|
117 |
lastNode = newNode;
|
|
118 |
}
|
|
119 |
}
|
53
|
120 |
|
|
121 |
/* if we have some capabilities supported by Gstreamer framework */
|
|
122 |
if (firstNode)
|
19
|
123 |
{
|
53
|
124 |
/* if empty list, then append first node as the head */
|
|
125 |
if (!(*ppListHead))
|
|
126 |
{
|
|
127 |
*ppListHead = firstNode;
|
|
128 |
}
|
|
129 |
else /* traverse to the last item in the list and link firstNode to it */
|
|
130 |
{
|
|
131 |
lastNode = *ppListHead;
|
|
132 |
while(lastNode->next)
|
|
133 |
{
|
|
134 |
lastNode = lastNode->next;
|
|
135 |
}
|
|
136 |
lastNode->next = firstNode;
|
|
137 |
}
|
33
|
138 |
}
|
|
139 |
DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList");
|
19
|
140 |
return res;
|
25
|
141 |
}
|
19
|
142 |
|
53
|
143 |
/* XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(
|
|
144 |
XACapabilities **ppNode)
|
|
145 |
* Description: If return value is XA_RESULT_SUCCESS, Creats a new XACapabilities
|
|
146 |
* node and update ppNode to contain pointer to it.
|
|
147 |
* Otherwise return error code for failure.
|
|
148 |
*/
|
25
|
149 |
XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(
|
|
150 |
XACapabilities **ppNode)
|
|
151 |
{
|
19
|
152 |
XAresult res = XA_RESULT_SUCCESS;
|
|
153 |
XACapabilities *newNode = NULL;
|
|
154 |
XAchar aacencelement[] = "nokiaaacenc";
|
|
155 |
int strLen = 0;
|
53
|
156 |
XAAudioCodecDescriptor *codecDesc = NULL;
|
25
|
157 |
|
53
|
158 |
DEBUG_API("->XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities");
|
25
|
159 |
newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
|
19
|
160 |
if (!newNode)
|
25
|
161 |
{
|
53
|
162 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
163 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities");
|
|
164 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
165 |
}
|
19
|
166 |
|
|
167 |
newNode->capsType = AUD_E;
|
|
168 |
newNode->xaid = XA_AUDIOCODEC_AAC;
|
25
|
169 |
|
|
170 |
strLen = strlen((char*) aacencelement);
|
|
171 |
newNode->adaptId = (XAchar *) calloc(strLen + 1, sizeof(XAchar));
|
19
|
172 |
if (!newNode->adaptId)
|
25
|
173 |
{
|
19
|
174 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
53
|
175 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
176 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities");
|
|
177 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
178 |
}
|
19
|
179 |
|
25
|
180 |
strncpy((char*) newNode->adaptId, (char*) aacencelement, strLen);
|
19
|
181 |
newNode->adaptId[strLen] = '\0'; /*Null terminate it*/
|
25
|
182 |
|
53
|
183 |
/* create XAAudioCodecDescriptor for AAC and initialize values */
|
|
184 |
codecDesc = (XAAudioCodecDescriptor*) calloc(2, sizeof(XAAudioCodecDescriptor));
|
|
185 |
if (!codecDesc)
|
25
|
186 |
{
|
53
|
187 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
188 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
189 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities");
|
|
190 |
return XA_RESULT_MEMORY_FAILURE;
|
|
191 |
}
|
|
192 |
newNode->noOfEntries = 2;
|
|
193 |
newNode->pEntry = (void *)codecDesc;
|
|
194 |
|
|
195 |
codecDesc->maxChannels = 2;
|
|
196 |
(codecDesc+1)->maxChannels = 2;
|
|
197 |
codecDesc->minBitsPerSample = 16;
|
|
198 |
(codecDesc+1)->minBitsPerSample = 16;
|
|
199 |
codecDesc->maxBitsPerSample = 16;
|
|
200 |
(codecDesc+1)->maxBitsPerSample = 16;
|
|
201 |
codecDesc->minSampleRate = 8000000;
|
|
202 |
(codecDesc+1)->minSampleRate = 8000000;
|
|
203 |
codecDesc->maxSampleRate = 48000000;
|
|
204 |
(codecDesc+1)->maxSampleRate = 48000000;
|
|
205 |
codecDesc->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
|
|
206 |
(codecDesc+1)->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
|
|
207 |
codecDesc->pSampleRatesSupported = (XAmilliHertz*)calloc(5, sizeof(XAmilliHertz));
|
|
208 |
if (!(codecDesc->pSampleRatesSupported))
|
|
209 |
{
|
|
210 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
211 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
212 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities");
|
|
213 |
return XA_RESULT_MEMORY_FAILURE;
|
|
214 |
}
|
|
215 |
(codecDesc+1)->pSampleRatesSupported = (XAmilliHertz*)calloc(5, sizeof(XAmilliHertz));
|
|
216 |
if (!((codecDesc+1)->pSampleRatesSupported))
|
|
217 |
{
|
19
|
218 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
53
|
219 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
220 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities");
|
|
221 |
return XA_RESULT_MEMORY_FAILURE;
|
|
222 |
}
|
|
223 |
codecDesc->pSampleRatesSupported[0] = 8000000;
|
|
224 |
(codecDesc+1)->pSampleRatesSupported[0] = 8000000;
|
|
225 |
codecDesc->pSampleRatesSupported[1] = 16000000;
|
|
226 |
(codecDesc+1)->pSampleRatesSupported[1] = 16000000;
|
|
227 |
codecDesc->pSampleRatesSupported[2] = 24000000;
|
|
228 |
(codecDesc+1)->pSampleRatesSupported[2] = 24000000;
|
|
229 |
codecDesc->pSampleRatesSupported[3] = 32000000;
|
|
230 |
(codecDesc+1)->pSampleRatesSupported[3] = 32000000;
|
|
231 |
codecDesc->pSampleRatesSupported[4] = 48000000;
|
|
232 |
(codecDesc+1)->pSampleRatesSupported[4] = 48000000;
|
|
233 |
codecDesc->numSampleRatesSupported = 5;
|
|
234 |
(codecDesc+1)->numSampleRatesSupported = 5;
|
|
235 |
codecDesc->minBitRate = 32000;
|
|
236 |
(codecDesc+1)->minBitRate = 32000;
|
|
237 |
codecDesc->maxBitRate = 256000;
|
|
238 |
(codecDesc+1)->maxBitRate = 256000;
|
|
239 |
codecDesc->isBitrateRangeContinuous = XA_BOOLEAN_FALSE;
|
|
240 |
(codecDesc+1)->isBitrateRangeContinuous = XA_BOOLEAN_FALSE;
|
|
241 |
codecDesc->pBitratesSupported = (XAuint32 *)calloc(8, sizeof(XAuint32));;
|
|
242 |
if (!(codecDesc->pBitratesSupported))
|
|
243 |
{
|
|
244 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
245 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
246 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities");
|
|
247 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
248 |
}
|
53
|
249 |
(codecDesc+1)->pBitratesSupported = (XAuint32 *)calloc(8, sizeof(XAuint32));;
|
|
250 |
if (!((codecDesc+1)->pBitratesSupported))
|
|
251 |
{
|
|
252 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
253 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
254 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities");
|
|
255 |
return XA_RESULT_MEMORY_FAILURE;
|
|
256 |
}
|
|
257 |
codecDesc->pBitratesSupported[0] = 32000;
|
|
258 |
(codecDesc+1)->pBitratesSupported[0] = 32000;
|
|
259 |
codecDesc->pBitratesSupported[1] = 64000;
|
|
260 |
(codecDesc+1)->pBitratesSupported[1] = 64000;
|
|
261 |
codecDesc->pBitratesSupported[2] = 96000;
|
|
262 |
(codecDesc+1)->pBitratesSupported[2] = 96000;
|
|
263 |
codecDesc->pBitratesSupported[3] = 128000;
|
|
264 |
(codecDesc+1)->pBitratesSupported[3] = 128000;
|
|
265 |
codecDesc->pBitratesSupported[4] = 160000;
|
|
266 |
(codecDesc+1)->pBitratesSupported[4] = 160000;
|
|
267 |
codecDesc->pBitratesSupported[5] = 192000;
|
|
268 |
(codecDesc+1)->pBitratesSupported[5] = 192000;
|
|
269 |
codecDesc->pBitratesSupported[6] = 224000;
|
|
270 |
(codecDesc+1)->pBitratesSupported[6] = 224000;
|
|
271 |
codecDesc->pBitratesSupported[7] = 256000;
|
|
272 |
(codecDesc+1)->pBitratesSupported[7] = 256000;
|
|
273 |
codecDesc->numBitratesSupported = 8;
|
|
274 |
(codecDesc+1)->numBitratesSupported = 8;
|
|
275 |
codecDesc->profileSetting = XA_AUDIOPROFILE_AAC_AAC;
|
|
276 |
(codecDesc+1)->profileSetting = XA_AUDIOPROFILE_AAC_AAC;
|
|
277 |
codecDesc->modeSetting = XA_AUDIOMODE_AAC_HE;
|
|
278 |
(codecDesc+1)->modeSetting = XA_AUDIOMODE_AAC_LC;
|
19
|
279 |
|
|
280 |
*ppNode = newNode;
|
53
|
281 |
|
|
282 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities");
|
19
|
283 |
return res;
|
25
|
284 |
}
|
19
|
285 |
|
25
|
286 |
XAresult XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(
|
|
287 |
XACapabilities **ppNode)
|
|
288 |
{
|
19
|
289 |
XAresult res = XA_RESULT_SUCCESS;
|
|
290 |
XACapabilities *newNode = NULL;
|
53
|
291 |
XAchar amrencelement[] = "devsoundsrc";
|
|
292 |
int strLen = 0;
|
|
293 |
XAAudioCodecDescriptor *codecDesc = NULL;
|
25
|
294 |
|
53
|
295 |
DEBUG_API("->XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities");
|
25
|
296 |
newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
|
19
|
297 |
if (!newNode)
|
25
|
298 |
{
|
53
|
299 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
300 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities");
|
|
301 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
302 |
}
|
19
|
303 |
|
|
304 |
newNode->capsType = AUD_E;
|
|
305 |
newNode->xaid = XA_AUDIOCODEC_AMR;
|
53
|
306 |
|
|
307 |
strLen = strlen((char*) amrencelement);
|
|
308 |
newNode->adaptId = (XAchar *) calloc(strLen + 1, sizeof(XAchar));
|
|
309 |
if (!newNode->adaptId)
|
25
|
310 |
{
|
19
|
311 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
53
|
312 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
313 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities");
|
|
314 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
315 |
}
|
19
|
316 |
|
53
|
317 |
strncpy((char*) newNode->adaptId, (char*) amrencelement, strLen);
|
|
318 |
newNode->adaptId[strLen] = '\0'; /*Null terminate it*/
|
|
319 |
|
|
320 |
/* create XAAudioCodecDescriptor for AMR and initialize values */
|
|
321 |
codecDesc = (XAAudioCodecDescriptor*) calloc(1, sizeof(XAAudioCodecDescriptor));
|
|
322 |
if (!codecDesc)
|
|
323 |
{
|
|
324 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
325 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
326 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities");
|
|
327 |
return XA_RESULT_MEMORY_FAILURE;
|
|
328 |
}
|
|
329 |
newNode->noOfEntries = 1;
|
|
330 |
newNode->pEntry = (void *)codecDesc;
|
25
|
331 |
|
53
|
332 |
codecDesc->maxChannels = 1;
|
|
333 |
codecDesc->minBitsPerSample = 8;
|
|
334 |
codecDesc->maxBitsPerSample = 8;
|
|
335 |
codecDesc->minSampleRate = 8000000;
|
|
336 |
codecDesc->maxSampleRate = 8000000;
|
|
337 |
codecDesc->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
|
|
338 |
codecDesc->pSampleRatesSupported = (XAmilliHertz*)calloc(1, sizeof(XAmilliHertz));
|
|
339 |
if (!(codecDesc->pSampleRatesSupported))
|
|
340 |
{
|
|
341 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
342 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
343 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities");
|
|
344 |
return XA_RESULT_MEMORY_FAILURE;
|
|
345 |
}
|
|
346 |
codecDesc->pSampleRatesSupported[0] = 8000000;
|
|
347 |
codecDesc->numSampleRatesSupported = 1;
|
|
348 |
codecDesc->minBitRate = 4750;
|
|
349 |
codecDesc->maxBitRate = 12200;
|
|
350 |
codecDesc->isBitrateRangeContinuous = XA_BOOLEAN_FALSE;
|
|
351 |
codecDesc->pBitratesSupported = (XAuint32 *)calloc(8, sizeof(XAuint32));;
|
|
352 |
if (!(codecDesc->pBitratesSupported))
|
|
353 |
{
|
|
354 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
355 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
356 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities");
|
|
357 |
return XA_RESULT_MEMORY_FAILURE;
|
|
358 |
}
|
|
359 |
codecDesc->pBitratesSupported[0] = 4750;
|
|
360 |
codecDesc->pBitratesSupported[1] = 5150;
|
|
361 |
codecDesc->pBitratesSupported[2] = 5900;
|
|
362 |
codecDesc->pBitratesSupported[3] = 6700;
|
|
363 |
codecDesc->pBitratesSupported[4] = 7400;
|
|
364 |
codecDesc->pBitratesSupported[5] = 7950;
|
|
365 |
codecDesc->pBitratesSupported[6] = 10200;
|
|
366 |
codecDesc->pBitratesSupported[7] = 12200;
|
|
367 |
codecDesc->numBitratesSupported = 8;
|
|
368 |
codecDesc->profileSetting = XA_AUDIOPROFILE_AMR;
|
|
369 |
codecDesc->modeSetting = 0;
|
|
370 |
|
|
371 |
*ppNode = newNode;
|
19
|
372 |
|
53
|
373 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities");
|
19
|
374 |
return res;
|
25
|
375 |
}
|
19
|
376 |
|
25
|
377 |
XAresult XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(
|
|
378 |
XACapabilities **ppNode)
|
|
379 |
{
|
19
|
380 |
XAresult res = XA_RESULT_SUCCESS;
|
|
381 |
XACapabilities *newNode = NULL;
|
53
|
382 |
XAchar wavencelement[] = "wavenc";
|
|
383 |
int strLen = 0;
|
|
384 |
XAAudioCodecDescriptor *codecDesc = NULL;
|
19
|
385 |
|
53
|
386 |
DEBUG_API("->XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities");
|
25
|
387 |
newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
|
19
|
388 |
if (!newNode)
|
25
|
389 |
{
|
53
|
390 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
391 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities");
|
|
392 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
393 |
}
|
19
|
394 |
|
|
395 |
newNode->capsType = AUD_E;
|
|
396 |
newNode->xaid = XA_AUDIOCODEC_PCM;
|
53
|
397 |
|
|
398 |
strLen = strlen((char*) wavencelement);
|
|
399 |
newNode->adaptId = (XAchar *) calloc(strLen + 1, sizeof(XAchar));
|
|
400 |
if (!newNode->adaptId)
|
25
|
401 |
{
|
19
|
402 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
53
|
403 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
404 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities");
|
|
405 |
return XA_RESULT_MEMORY_FAILURE;
|
25
|
406 |
}
|
19
|
407 |
|
53
|
408 |
strncpy((char*) newNode->adaptId, (char*) wavencelement, strLen);
|
|
409 |
newNode->adaptId[strLen] = '\0'; /*Null terminate it*/
|
|
410 |
|
|
411 |
/* create XAAudioCodecDescriptor for PCM and initialize values */
|
|
412 |
codecDesc = (XAAudioCodecDescriptor*) calloc(1, sizeof(XAAudioCodecDescriptor));
|
|
413 |
if (!codecDesc)
|
|
414 |
{
|
|
415 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
416 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
417 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities");
|
|
418 |
return XA_RESULT_MEMORY_FAILURE;
|
|
419 |
}
|
|
420 |
newNode->noOfEntries = 1;
|
|
421 |
newNode->pEntry = (void *)codecDesc;
|
19
|
422 |
|
53
|
423 |
codecDesc->maxChannels = 2;
|
|
424 |
codecDesc->minBitsPerSample = 16;
|
|
425 |
codecDesc->maxBitsPerSample = 16;
|
|
426 |
codecDesc->minSampleRate = 8000000;
|
|
427 |
codecDesc->maxSampleRate = 48000000;
|
|
428 |
codecDesc->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
|
|
429 |
codecDesc->pSampleRatesSupported = (XAmilliHertz*)calloc(12, sizeof(XAmilliHertz));
|
|
430 |
if (!(codecDesc->pSampleRatesSupported))
|
|
431 |
{
|
|
432 |
XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
|
|
433 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
|
|
434 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities");
|
|
435 |
return XA_RESULT_MEMORY_FAILURE;
|
|
436 |
}
|
|
437 |
codecDesc->pSampleRatesSupported[0] = 8000000;
|
|
438 |
codecDesc->pSampleRatesSupported[1] = 16000000;
|
|
439 |
codecDesc->pSampleRatesSupported[2] = 24000000;
|
|
440 |
codecDesc->pSampleRatesSupported[3] = 32000000;
|
|
441 |
codecDesc->pSampleRatesSupported[4] = 48000000;
|
|
442 |
codecDesc->numSampleRatesSupported = 5;
|
|
443 |
codecDesc->minBitRate = 0;
|
|
444 |
codecDesc->maxBitRate = 0;
|
|
445 |
codecDesc->isBitrateRangeContinuous = XA_BOOLEAN_FALSE;
|
|
446 |
codecDesc->pBitratesSupported = NULL;
|
|
447 |
codecDesc->numBitratesSupported = 0;
|
|
448 |
codecDesc->profileSetting = XA_AUDIOPROFILE_PCM;
|
|
449 |
codecDesc->modeSetting = 0;
|
|
450 |
|
|
451 |
*ppNode = newNode;
|
19
|
452 |
|
53
|
453 |
DEBUG_API("<-XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities");
|
19
|
454 |
return res;
|
25
|
455 |
}
|