khronosfws/openmax_al/src/gst_adaptation/xagstcapabilitiesmgr.c
changeset 31 8dfd592727cb
parent 16 43d09473c595
child 28 ebf79c79991a
equal deleted inserted replaced
22:128eb6a32b84 31:8dfd592727cb
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description:
    14  * Description: GST Capabilities Mgr. Here you can query the capabilities
    15 *
    15  *               of various GST components and store it in a list.
    16 */
    16  *
    17 #include "xagstcapabilitiesmgr.h"
    17  */
       
    18 
    18 #include <stdio.h>
    19 #include <stdio.h>
    19 #include <string.h>
    20 #include <string.h>
    20 
    21 #include "xagstcapabilitiesmgr.h"
    21 static XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(XACapabilities **ppNode);
    22 #include "xaframeworkmgr.h"
    22 static XAresult XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(XACapabilities **ppNode);
    23 
    23 static XAresult XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(XACapabilities **ppNode);
    24 static XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(
       
    25         XACapabilities **ppNode);
       
    26 static XAresult XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(
       
    27         XACapabilities **ppNode);
       
    28 static XAresult XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(
       
    29         XACapabilities **ppNode);
    24 
    30 
    25 /* XAresult XAGSTCapabilitiesMgr_UpdateCapabilitieList
    31 /* XAresult XAGSTCapabilitiesMgr_UpdateCapabilitieList
    26  * Description: Update the capabilities list supported by GStreamer framework.
    32  * Description: Update the capabilities list supported by GStreamer framework.
    27  */
    33  */
    28 XAresult XAGSTCapabilitiesMgr_UpdateCapabilitieList(
    34 XAresult XAGSTCapabilitiesMgr_UpdateCapabilitieList(
    29                 FrameworkMap *frameworkMap,
    35         FrameworkMap *frameworkMap, XACapabilities **ppListHead)
    30                 XACapabilities **ppListHead)
    36 
    31 
    37     {
    32 {
       
    33     XAresult res = XA_RESULT_SUCCESS;
    38     XAresult res = XA_RESULT_SUCCESS;
    34     XACapabilities *newNode = NULL;
    39     XACapabilities *newNode = NULL;
    35     FWMgrFwType fwtype = FWMgrFWUknown;
    40     FWMgrFwType fwtype = FWMgrFWUknown;
    36     char *uri = NULL;
    41     char *uri = NULL;
    37     XACapabilities *lastNode;
    42     XACapabilities *lastNode;
    38     XACapabilities *firstNode;
    43     XACapabilities *firstNode;
    39 
    44 
    40     DEBUG_API("->XAGSTCapabilitiesMgr_UpdateCapabilitieList");
    45     DEBUG_API("->XAGSTCapabilitiesMgr_UpdateCapabilitieList");
    41 
    46 
    42     if(!frameworkMap || !ppListHead)
    47     if (!frameworkMap || !ppListHead)
    43     {
    48         {
    44         res = XA_RESULT_PARAMETER_INVALID;
    49         res = XA_RESULT_PARAMETER_INVALID;
    45         return res;
    50         return res;
    46     }
    51         }
    47     
    52 
    48     lastNode = firstNode = *ppListHead;
    53     lastNode = firstNode = *ppListHead;
    49     
    54 
    50     /* traverse and point to the last node in the list */
    55     /* traverse and point to the last node in the list */
    51     while(lastNode && lastNode->next)
    56     while (lastNode && lastNode->next)
    52     {
    57         {
    53         lastNode = lastNode->next;
    58         lastNode = lastNode->next;
    54     }
    59         }
    55 
       
    56 
    60 
    57     uri = "file:///c:/test.mp4";
    61     uri = "file:///c:/test.mp4";
    58     fwtype = XAFrameworkMgr_GetFramework(
    62     fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder);
    59             frameworkMap,
    63 
    60             uri,
    64     if (fwtype == FWMgrFWGST)
    61             FWMgrMORecorder);
    65         {
    62     
    66         /* Add codec capabilities */
    63     if(fwtype == FWMgrFWGST)
    67         newNode = NULL;
    64     {
    68         res = XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(&newNode);
    65 	    /* Add codec capabilities */
    69         if (res != XA_RESULT_SUCCESS)
    66 	    newNode = NULL;
    70             {
    67 	    res = XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(&newNode);
    71             return res;
    68 	    if (res != XA_RESULT_SUCCESS)
    72             }
    69 	        {
    73         if (lastNode)
    70 	        return res;
    74             {
    71 	        }
    75             lastNode->next = newNode;
    72 	    if (lastNode)
    76             }
    73 	    {
    77         if (newNode)
    74 	        lastNode->next = newNode;
    78             { /* if a new node is created move lastNode to the new item */
    75 	    }
    79             if (!firstNode)
    76 	    if (newNode)
    80                 firstNode = newNode;
    77 	    { /* if a new node is created move lastNode to the new item */
    81             lastNode = newNode;
    78 	        if (!firstNode)
    82             }
    79 	            firstNode = newNode;
    83         }
    80 	        lastNode = newNode;
       
    81 	    }
       
    82     }
       
    83     
       
    84 
    84 
    85     uri = "file:///c:/test.amr";
    85     uri = "file:///c:/test.amr";
    86     fwtype = XAFrameworkMgr_GetFramework(
    86     fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder);
    87             frameworkMap,
    87 
    88             uri,
    88     if (fwtype == FWMgrFWGST)
    89             FWMgrMORecorder);
    89         {
    90     
    90         newNode = NULL;
    91     if(fwtype == FWMgrFWGST)
    91         res = XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(&newNode);
    92     {
    92         if (res != XA_RESULT_SUCCESS)
    93 	    newNode = NULL;
    93             {
    94 	    res = XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(&newNode);
    94             return res;
    95 	    if (res != XA_RESULT_SUCCESS)
    95             }
    96 	        {
    96         if (lastNode)
    97 	        return res;
    97             {
    98 	        }
    98             lastNode->next = newNode;
    99 	    if (lastNode)
    99             }
   100 	    {
   100         if (newNode)
   101 	        lastNode->next = newNode;
   101             { /* if a new node is created move lastNode to the new item */
   102 	    }
   102             if (!firstNode)
   103 	    if (newNode)
   103                 firstNode = newNode;
   104 	    { /* if a new node is created move lastNode to the new item */
   104             lastNode = newNode;
   105 	        if (!firstNode)
   105             }
   106 	            firstNode = newNode;
   106         }
   107 	        lastNode = newNode;
       
   108 	    }
       
   109     }
       
   110 
   107 
   111     uri = "file:///c:/test.wav";
   108     uri = "file:///c:/test.wav";
   112     fwtype = XAFrameworkMgr_GetFramework(
   109     fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder);
   113             frameworkMap,
   110 
   114             uri,
   111     if (fwtype == FWMgrFWGST)
   115             FWMgrMORecorder);
   112         {
   116     
   113         newNode = NULL;
   117     if(fwtype == FWMgrFWGST)
   114         res = XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(&newNode);
   118     {
   115         if (res != XA_RESULT_SUCCESS)
   119 	    newNode = NULL;
   116             {
   120 	    res = XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(&newNode);
   117             return res;
   121 	    if (res != XA_RESULT_SUCCESS)
   118             }
   122 	        {
   119         if (lastNode)
   123 	        return res;
   120             {
   124 	        }
   121             lastNode->next = newNode;
   125 	    if (lastNode)
   122             }
   126 	    {
   123         if (newNode)
   127 	        lastNode->next = newNode;
   124             { /* if a new node is created move lastNode to the new item */
   128 	    }
   125             if (!firstNode)
   129 	    if (newNode)
   126                 firstNode = newNode;
   130 	    { /* if a new node is created move lastNode to the new item */
   127             lastNode = newNode;
   131 	        if (!firstNode)
   128             }
   132 	            firstNode = newNode;
   129         }
   133 	        lastNode = newNode;
       
   134 	    }
       
   135     }
       
   136     /* if empty list, then append first node as the head */
   130     /* if empty list, then append first node as the head */
   137     if (!(*ppListHead))
   131     if (!(*ppListHead))
   138         {
   132         {
   139         *ppListHead = firstNode;
   133         *ppListHead = firstNode;
   140         }
   134         }DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList");
   141     DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList");
       
   142     return res;
   135     return res;
   143 }
   136     }
   144 
   137 
   145 XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(XACapabilities **ppNode)
   138 XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(
   146 {
   139         XACapabilities **ppNode)
       
   140     {
   147     XAresult res = XA_RESULT_SUCCESS;
   141     XAresult res = XA_RESULT_SUCCESS;
   148     XACapabilities *newNode = NULL;
   142     XACapabilities *newNode = NULL;
   149     XAAudioCodecDescriptor *entries = NULL;
   143     XAAudioCodecDescriptor *entries = NULL;
   150     XAchar aacencelement[] = "nokiaaacenc";
   144     XAchar aacencelement[] = "nokiaaacenc";
   151     int strLen = 0;
   145     int strLen = 0;
   152     
   146 
   153     newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities));
   147     newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
   154     if (!newNode)
   148     if (!newNode)
   155     {
   149         {
   156         res = XA_RESULT_MEMORY_FAILURE;
   150         res = XA_RESULT_MEMORY_FAILURE;
   157         return res;
   151         return res;
   158     }
   152         }
   159 
   153 
   160     newNode->capsType = AUD_E;
   154     newNode->capsType = AUD_E;
   161     newNode->xaid = XA_AUDIOCODEC_AAC;
   155     newNode->xaid = XA_AUDIOCODEC_AAC;
   162     newNode->noOfEntries = 1;
   156     newNode->noOfEntries = 1;
   163     
   157 
   164     
   158     strLen = strlen((char*) aacencelement);
   165     strLen = strlen((char*)aacencelement);
   159     newNode->adaptId = (XAchar *) calloc(strLen + 1, sizeof(XAchar));
   166     newNode->adaptId = (XAchar *)calloc(strLen + 1, sizeof(XAchar));    
       
   167     if (!newNode->adaptId)
   160     if (!newNode->adaptId)
   168     {
   161         {
   169         res = XA_RESULT_MEMORY_FAILURE;
   162         res = XA_RESULT_MEMORY_FAILURE;
   170         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   163         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   171         return res;
   164         return res;
   172     }
   165         }
   173 
   166 
   174     strncpy((char*)newNode->adaptId, (char*)aacencelement, strLen);
   167     strncpy((char*) newNode->adaptId, (char*) aacencelement, strLen);
   175     newNode->adaptId[strLen] = '\0'; /*Null terminate it*/
   168     newNode->adaptId[strLen] = '\0'; /*Null terminate it*/
   176     
   169 
   177     /* Allocate array */
   170     /* Allocate array */
   178     entries = (XAAudioCodecDescriptor*)calloc(1, sizeof(XAAudioCodecDescriptor));
   171     entries = (XAAudioCodecDescriptor*) calloc(1,
       
   172             sizeof(XAAudioCodecDescriptor));
   179     if (!entries)
   173     if (!entries)
   180     {
   174         {
   181         res = XA_RESULT_MEMORY_FAILURE;
   175         res = XA_RESULT_MEMORY_FAILURE;
   182         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   176         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   183         return res;
   177         return res;
   184     }
   178         }
   185 
   179 
   186     newNode->pEntry = (void*)entries;
   180     newNode->pEntry = (void*) entries;
   187  
   181 
   188     entries->maxChannels = 2;
   182     entries->maxChannels = 2;
   189     entries->minBitsPerSample = 16;
   183     entries->minBitsPerSample = 16;
   190     entries->maxBitsPerSample = 16;
   184     entries->maxBitsPerSample = 16;
   191     entries->minSampleRate = 8000000;  /*milliHz*/
   185     entries->minSampleRate = 8000000; /*milliHz*/
   192     entries->maxSampleRate = 48000000;
   186     entries->maxSampleRate = 48000000;
   193     entries->isFreqRangeContinuous=XA_BOOLEAN_FALSE;
   187     entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
   194     entries->numSampleRatesSupported = 7;
   188     entries->numSampleRatesSupported = 7;
   195     entries->pSampleRatesSupported = (XAmilliHertz*)calloc(entries->numSampleRatesSupported, sizeof(XAmilliHertz));
   189     entries->pSampleRatesSupported = (XAmilliHertz*) calloc(
       
   190             entries->numSampleRatesSupported, sizeof(XAmilliHertz));
   196     if (!entries->pSampleRatesSupported)
   191     if (!entries->pSampleRatesSupported)
   197     {
   192         {
   198         res = XA_RESULT_MEMORY_FAILURE;
   193         res = XA_RESULT_MEMORY_FAILURE;
   199         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   194         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   200         return res;
   195         return res;
   201     }
   196         }
   202     /* entries in milliHz */
   197     /* entries in milliHz */
   203     entries->pSampleRatesSupported[0] = 8000000;
   198     entries->pSampleRatesSupported[0] = 8000000;
   204     entries->pSampleRatesSupported[1] = 11025000;
   199     entries->pSampleRatesSupported[1] = 11025000;
   205     entries->pSampleRatesSupported[2] = 16000000;
   200     entries->pSampleRatesSupported[2] = 16000000;
   206     entries->pSampleRatesSupported[3] = 22050000;
   201     entries->pSampleRatesSupported[3] = 22050000;
   210 
   205 
   211     entries->minBitRate = 32000;
   206     entries->minBitRate = 32000;
   212     entries->maxBitRate = 256000;
   207     entries->maxBitRate = 256000;
   213     entries->isBitrateRangeContinuous = XA_BOOLEAN_FALSE;
   208     entries->isBitrateRangeContinuous = XA_BOOLEAN_FALSE;
   214     entries->numBitratesSupported = 8;
   209     entries->numBitratesSupported = 8;
   215     entries->pBitratesSupported = (XAuint32*)calloc(entries->numBitratesSupported, sizeof(XAuint32));
   210     entries->pBitratesSupported = (XAuint32*) calloc(
       
   211             entries->numBitratesSupported, sizeof(XAuint32));
   216     if (!entries->pBitratesSupported)
   212     if (!entries->pBitratesSupported)
   217     {
   213         {
   218         res = XA_RESULT_MEMORY_FAILURE;
   214         res = XA_RESULT_MEMORY_FAILURE;
   219         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   215         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   220         return res;
   216         return res;
   221     }
   217         }
   222     (entries->pBitratesSupported)[0] = 32000;
   218     (entries->pBitratesSupported)[0] = 32000;
   223     (entries->pBitratesSupported)[1] = 64000;
   219     (entries->pBitratesSupported)[1] = 64000;
   224     (entries->pBitratesSupported)[2] = 96000;
   220     (entries->pBitratesSupported)[2] = 96000;
   225     (entries->pBitratesSupported)[3] = 128000;
   221     (entries->pBitratesSupported)[3] = 128000;
   226     (entries->pBitratesSupported)[4] = 160000;
   222     (entries->pBitratesSupported)[4] = 160000;
   229     (entries->pBitratesSupported)[7] = 256000;
   225     (entries->pBitratesSupported)[7] = 256000;
   230 
   226 
   231     entries->profileSetting = XA_AUDIOPROFILE_AAC_AAC;
   227     entries->profileSetting = XA_AUDIOPROFILE_AAC_AAC;
   232     entries->modeSetting = XA_AUDIOMODE_AAC_LC;
   228     entries->modeSetting = XA_AUDIOMODE_AAC_LC;
   233 
   229 
   234     newNode->pEntry = (void*)entries;
   230     newNode->pEntry = (void*) entries;
   235 
   231 
   236     *ppNode = newNode;
   232     *ppNode = newNode;
   237     return res;
   233     return res;
   238 }
   234     }
   239 
   235 
   240 XAresult XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(XACapabilities **ppNode)
   236 XAresult XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(
   241 {
   237         XACapabilities **ppNode)
       
   238     {
   242     XAresult res = XA_RESULT_SUCCESS;
   239     XAresult res = XA_RESULT_SUCCESS;
   243     XACapabilities *newNode = NULL;
   240     XACapabilities *newNode = NULL;
   244     XAAudioCodecDescriptor *entries = NULL;
   241     XAAudioCodecDescriptor *entries = NULL;
   245  
   242 
   246     newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities));
   243     newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
   247     if (!newNode)
   244     if (!newNode)
   248     {
   245         {
   249         res = XA_RESULT_MEMORY_FAILURE;
   246         res = XA_RESULT_MEMORY_FAILURE;
   250         return res;
   247         return res;
   251     }
   248         }
   252 
   249 
   253     newNode->capsType = AUD_E;
   250     newNode->capsType = AUD_E;
   254     newNode->xaid = XA_AUDIOCODEC_AMR;
   251     newNode->xaid = XA_AUDIOCODEC_AMR;
   255     newNode->noOfEntries = 1;
   252     newNode->noOfEntries = 1;
   256 
   253 
   257     /* Allocate array */
   254     /* Allocate array */
   258     entries = (XAAudioCodecDescriptor*)calloc(1, sizeof(XAAudioCodecDescriptor));
   255     entries = (XAAudioCodecDescriptor*) calloc(1,
       
   256             sizeof(XAAudioCodecDescriptor));
   259     if (!entries)
   257     if (!entries)
   260     {
   258         {
   261         res = XA_RESULT_MEMORY_FAILURE;
   259         res = XA_RESULT_MEMORY_FAILURE;
   262         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   260         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   263         return res;
   261         return res;
   264     }
   262         }
   265 
   263 
   266     newNode->pEntry = (void*)entries;
   264     newNode->pEntry = (void*) entries;
   267  
   265 
   268     entries->maxChannels = 1;
   266     entries->maxChannels = 1;
   269     entries->minBitsPerSample = 8;
   267     entries->minBitsPerSample = 8;
   270     entries->maxBitsPerSample = 8;
   268     entries->maxBitsPerSample = 8;
   271     entries->minSampleRate = 8000000;  /*milliHz*/
   269     entries->minSampleRate = 8000000; /*milliHz*/
   272     entries->maxSampleRate = 8000000;
   270     entries->maxSampleRate = 8000000;
   273     entries->isFreqRangeContinuous=XA_BOOLEAN_TRUE;
   271     entries->isFreqRangeContinuous = XA_BOOLEAN_TRUE;
   274     entries->numSampleRatesSupported = 1;
   272     entries->numSampleRatesSupported = 1;
   275     entries->minBitRate=4750;
   273     entries->minBitRate = 4750;
   276     entries->maxBitRate=12200;
   274     entries->maxBitRate = 12200;
   277     entries->isBitrateRangeContinuous=XA_BOOLEAN_FALSE;
   275     entries->isBitrateRangeContinuous = XA_BOOLEAN_FALSE;
   278     entries->numBitratesSupported = 8;
   276     entries->numBitratesSupported = 8;
   279     entries->pBitratesSupported = (XAuint32*)calloc(entries->numBitratesSupported, sizeof(XAuint32));
   277     entries->pBitratesSupported = (XAuint32*) calloc(
       
   278             entries->numBitratesSupported, sizeof(XAuint32));
   280     if (!entries->pBitratesSupported)
   279     if (!entries->pBitratesSupported)
   281     {
   280         {
   282         res = XA_RESULT_MEMORY_FAILURE;
   281         res = XA_RESULT_MEMORY_FAILURE;
   283         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   282         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   284         return res;
   283         return res;
   285     }
   284         }
   286     (entries->pBitratesSupported)[0] = 4750;
   285     (entries->pBitratesSupported)[0] = 4750;
   287     (entries->pBitratesSupported)[1] = 5150;
   286     (entries->pBitratesSupported)[1] = 5150;
   288     (entries->pBitratesSupported)[2] = 5900;
   287     (entries->pBitratesSupported)[2] = 5900;
   289     (entries->pBitratesSupported)[3] = 6700;
   288     (entries->pBitratesSupported)[3] = 6700;
   290     (entries->pBitratesSupported)[4] = 7400;
   289     (entries->pBitratesSupported)[4] = 7400;
   293     (entries->pBitratesSupported)[7] = 12200;
   292     (entries->pBitratesSupported)[7] = 12200;
   294 
   293 
   295     entries->profileSetting = XA_AUDIOPROFILE_AMR;
   294     entries->profileSetting = XA_AUDIOPROFILE_AMR;
   296     entries->modeSetting = 0;
   295     entries->modeSetting = 0;
   297 
   296 
   298     newNode->pEntry = (void*)entries;
   297     newNode->pEntry = (void*) entries;
   299 
   298 
   300     *ppNode = newNode;
   299     *ppNode = newNode;
   301     return res;
   300     return res;
   302 }
   301     }
   303 
   302 
   304 XAresult XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(XACapabilities **ppNode)
   303 XAresult XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(
   305 {
   304         XACapabilities **ppNode)
       
   305     {
   306     XAresult res = XA_RESULT_SUCCESS;
   306     XAresult res = XA_RESULT_SUCCESS;
   307     XACapabilities *newNode = NULL;
   307     XACapabilities *newNode = NULL;
   308     XAAudioCodecDescriptor *entries = NULL;
   308     XAAudioCodecDescriptor *entries = NULL;
   309 
   309 
   310     newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities));
   310     newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
   311     if (!newNode)
   311     if (!newNode)
   312     {
   312         {
   313         res = XA_RESULT_MEMORY_FAILURE;
   313         res = XA_RESULT_MEMORY_FAILURE;
   314         return res;
   314         return res;
   315     }
   315         }
   316 
   316 
   317     newNode->capsType = AUD_E;
   317     newNode->capsType = AUD_E;
   318     newNode->xaid = XA_AUDIOCODEC_PCM;
   318     newNode->xaid = XA_AUDIOCODEC_PCM;
   319     newNode->noOfEntries = 1;
   319     newNode->noOfEntries = 1;
   320 
   320 
   321     /* Allocate array */
   321     /* Allocate array */
   322     entries = (XAAudioCodecDescriptor*)calloc(1, sizeof(XAAudioCodecDescriptor));
   322     entries = (XAAudioCodecDescriptor*) calloc(1,
       
   323             sizeof(XAAudioCodecDescriptor));
   323     if (!entries)
   324     if (!entries)
   324     {
   325         {
   325         res = XA_RESULT_MEMORY_FAILURE;
   326         res = XA_RESULT_MEMORY_FAILURE;
   326         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   327         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   327         return res;
   328         return res;
   328     }
   329         }
   329 
   330 
   330     newNode->pEntry = (void*)entries;
   331     newNode->pEntry = (void*) entries;
   331 
   332 
   332     entries->maxChannels = 2;
   333     entries->maxChannels = 2;
   333     entries->minBitsPerSample = 16;
   334     entries->minBitsPerSample = 16;
   334     entries->maxBitsPerSample = 16;
   335     entries->maxBitsPerSample = 16;
   335     entries->minSampleRate = 8000000;  /*milliHz*/
   336     entries->minSampleRate = 8000000; /*milliHz*/
   336     entries->maxSampleRate = 96000000;
   337     entries->maxSampleRate = 96000000;
   337     entries->isFreqRangeContinuous=XA_BOOLEAN_FALSE;
   338     entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
   338     entries->numSampleRatesSupported = 10;
   339     entries->numSampleRatesSupported = 10;
   339     entries->pSampleRatesSupported = (XAmilliHertz*)calloc(entries->numSampleRatesSupported, sizeof(XAmilliHertz));
   340     entries->pSampleRatesSupported = (XAmilliHertz*) calloc(
       
   341             entries->numSampleRatesSupported, sizeof(XAmilliHertz));
   340     if (!entries->pSampleRatesSupported)
   342     if (!entries->pSampleRatesSupported)
   341     {
   343         {
   342         res = XA_RESULT_MEMORY_FAILURE;
   344         res = XA_RESULT_MEMORY_FAILURE;
   343         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   345         XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
   344         return res;
   346         return res;
   345     }
   347         }
   346     /* entries in milliHz */
   348     /* entries in milliHz */
   347     entries->pSampleRatesSupported[0] = 12000000;
   349     entries->pSampleRatesSupported[0] = 12000000;
   348     entries->pSampleRatesSupported[1] = 16000000;
   350     entries->pSampleRatesSupported[1] = 16000000;
   349     entries->pSampleRatesSupported[2] = 22050000;
   351     entries->pSampleRatesSupported[2] = 22050000;
   350     entries->pSampleRatesSupported[3] = 24000000;
   352     entries->pSampleRatesSupported[3] = 24000000;
   361     entries->pBitratesSupported = NULL;
   363     entries->pBitratesSupported = NULL;
   362     entries->numBitratesSupported = 0;
   364     entries->numBitratesSupported = 0;
   363     entries->profileSetting = XA_AUDIOPROFILE_PCM;
   365     entries->profileSetting = XA_AUDIOPROFILE_PCM;
   364     entries->modeSetting = 0;
   366     entries->modeSetting = 0;
   365 
   367 
   366     newNode->pEntry = (void*)entries;
   368     newNode->pEntry = (void*) entries;
   367 
   369 
   368     *ppNode = newNode;
   370     *ppNode = newNode;
   369     return res;
   371     return res;
   370 }
   372     }