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