khronosfws/openmax_al/src/engine/xaengineitf.c
changeset 33 5e8b14bae8c3
parent 25 6f7ceef7b1d1
child 43 9894ed580e4a
equal deleted inserted replaced
28:ebf79c79991a 33:5e8b14bae8c3
    17 
    17 
    18 #include <stdio.h>
    18 #include <stdio.h>
    19 #include <stdlib.h>
    19 #include <stdlib.h>
    20 #include <assert.h>
    20 #include <assert.h>
    21 #include "xaengineitf.h"
    21 #include "xaengineitf.h"
    22 #include "xavibraitf.h"
       
    23 #include "xaledarrayitf.h"
       
    24 #include "xaobjects.h"
    22 #include "xaobjects.h"
    25 #include "xacapabilitiesmgr.h"
    23 #include "xacapabilitiesmgr.h"
    26 /*static XAchar implementationText[] = "Implementation does not conform to AL Spec";*/
    24 /*static XAchar implementationText[] = "Implementation does not conform to AL Spec";*/
    27 
    25 
    28 /**
    26 /**
    71 XAresult XAEngineItfImpl_CreateLEDDevice(XAEngineItf self,
    69 XAresult XAEngineItfImpl_CreateLEDDevice(XAEngineItf self,
    72         XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces,
    70         XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces,
    73         const XAInterfaceID *pInterfaceIds,
    71         const XAInterfaceID *pInterfaceIds,
    74         const XAboolean *pInterfaceRequired)
    72         const XAboolean *pInterfaceRequired)
    75     {
    73     {
    76     return XALEDArrayDeviceImpl_CreateLEDArrayDevice(
    74     return XA_RESULT_FEATURE_UNSUPPORTED;
    77             ((XAEngineItfImpl*) self)->mapper, pDevice, deviceID,
       
    78             numInterfaces, pInterfaceIds, pInterfaceRequired);
       
    79     }
    75     }
    80 
    76 
    81 XAresult XAEngineItfImpl_CreateVibraDevice(XAEngineItf self,
    77 XAresult XAEngineItfImpl_CreateVibraDevice(XAEngineItf self,
    82         XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces,
    78         XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces,
    83         const XAInterfaceID *pInterfaceIds,
    79         const XAInterfaceID *pInterfaceIds,
    84         const XAboolean *pInterfaceRequired)
    80         const XAboolean *pInterfaceRequired)
    85     {
    81     {
    86     return XAVibraDeviceImpl_CreateVibraDevice(
    82     return XA_RESULT_FEATURE_UNSUPPORTED;
    87             ((XAEngineItfImpl*) self)->mapper, pDevice, deviceID,
       
    88             numInterfaces, pInterfaceIds, pInterfaceRequired);
       
    89     }
    83     }
    90 
    84 
    91 XAresult XAEngineItfImpl_CreateMediaPlayer(XAEngineItf self,
    85 XAresult XAEngineItfImpl_CreateMediaPlayer(XAEngineItf self,
    92         XAObjectItf *pPlayer, XADataSource *pDataSrc, XADataSource *pBankSrc,
    86         XAObjectItf *pPlayer, XADataSource *pDataSrc, XADataSource *pBankSrc,
    93         XADataSink *pAudioSnk, XADataSink *pImageVideoSnk,
    87         XADataSink *pAudioSnk, XADataSink *pImageVideoSnk,
   116 
   110 
   117 XAresult XAEngineItfImpl_CreateOutputMix(XAEngineItf self, XAObjectItf *pMix,
   111 XAresult XAEngineItfImpl_CreateOutputMix(XAEngineItf self, XAObjectItf *pMix,
   118         XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds,
   112         XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds,
   119         const XAboolean *pInterfaceRequired)
   113         const XAboolean *pInterfaceRequired)
   120     {
   114     {
   121     XAEngineItfImpl* impl = GetImpl(self);
   115     return XA_RESULT_FEATURE_UNSUPPORTED;
   122     return XAOMixImpl_CreateOutputMix(impl->mapper, impl->capabilities, pMix,
       
   123             numInterfaces, pInterfaceIds, pInterfaceRequired);
       
   124     }
   116     }
   125 
   117 
   126 XAresult XAEngineItfImpl_CreateMetadataExtractor(XAEngineItf self,
   118 XAresult XAEngineItfImpl_CreateMetadataExtractor(XAEngineItf self,
   127         XAObjectItf *pMetadataExtractor, XADataSource *pDataSource,
   119         XAObjectItf *pMetadataExtractor, XADataSource *pDataSource,
   128         XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds,
   120         XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds,
   151     {
   143     {
   152     DEBUG_API("->XAEngineItfImpl_GetImplementationInfo");
   144     DEBUG_API("->XAEngineItfImpl_GetImplementationInfo");
   153 
   145 
   154     if (!pMajor || !pMinor || !pStep)
   146     if (!pMajor || !pMinor || !pStep)
   155         {
   147         {
   156         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineItfImpl_GetImplementationInfo");
   148         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   149         DEBUG_API("<-XAEngineItfImpl_GetImplementationInfo");
   157         return XA_RESULT_PARAMETER_INVALID;
   150         return XA_RESULT_PARAMETER_INVALID;
   158         }
   151         }
   159     /* OpenMAX AL API ver 1.0.1 */
   152     /* OpenMAX AL API ver 1.0.1 */
   160     *pMajor = 1;
   153     *pMajor = 1;
   161     *pMinor = 0;
   154     *pMinor = 0;
   195     XAresult res = XA_RESULT_SUCCESS;
   188     XAresult res = XA_RESULT_SUCCESS;
   196     DEBUG_API("->XAEngineItfImpl_QueryNumSupportedInterfaces");
   189     DEBUG_API("->XAEngineItfImpl_QueryNumSupportedInterfaces");
   197 
   190 
   198     if (!pNumSupportedInterfaces)
   191     if (!pNumSupportedInterfaces)
   199         {
   192         {
   200         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineItfImpl_QueryNumSupportedInterfaces");
   193         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   194         DEBUG_API("<-XAEngineItfImpl_QueryNumSupportedInterfaces");
   201         return XA_RESULT_PARAMETER_INVALID;
   195         return XA_RESULT_PARAMETER_INVALID;
   202         }
   196         }
   203     *pNumSupportedInterfaces = 0;
   197     *pNumSupportedInterfaces = 0;
   204     switch (objectID)
   198     switch (objectID)
   205         {
   199         {
   213             break;
   207             break;
   214         case XA_OBJECTID_MEDIARECORDER:
   208         case XA_OBJECTID_MEDIARECORDER:
   215             res = XAMediaRecorderImpl_QueryNumSupportedInterfaces(
   209             res = XAMediaRecorderImpl_QueryNumSupportedInterfaces(
   216                     pNumSupportedInterfaces);
   210                     pNumSupportedInterfaces);
   217             break;
   211             break;
   218         case XA_OBJECTID_OUTPUTMIX:
       
   219             res = XAOMixImpl_QueryNumSupportedInterfaces(
       
   220                     pNumSupportedInterfaces);
       
   221             break;
       
   222 #ifdef OMAX_CAMERABIN
       
   223             case XA_OBJECTID_CAMERADEVICE:
       
   224             res = XACameraDeviceImpl_QueryNumSupportedInterfaces(
       
   225                     pNumSupportedInterfaces);
       
   226             break;
       
   227 #endif
       
   228         case XA_OBJECTID_RADIODEVICE:
   212         case XA_OBJECTID_RADIODEVICE:
   229             res = XARadioDeviceImpl_QueryNumSupportedInterfaces(
   213             res = XARadioDeviceImpl_QueryNumSupportedInterfaces(
   230                     pNumSupportedInterfaces);
   214                     pNumSupportedInterfaces);
   231             break;
   215             break;
   232         case XA_OBJECTID_LEDDEVICE:
       
   233             res = XALEDArrayDeviceImpl_QueryNumSupportedInterfaces(
       
   234                     pNumSupportedInterfaces);
       
   235             break;
       
   236         case XA_OBJECTID_VIBRADEVICE:
       
   237             res = XAVibraDeviceImpl_QueryNumSupportedInterfaces(
       
   238                     pNumSupportedInterfaces);
       
   239             break;
       
   240         case XA_OBJECTID_METADATAEXTRACTOR:
   216         case XA_OBJECTID_METADATAEXTRACTOR:
   241             res = XAMetadataExtractorImpl_QueryNumSupportedInterfaces(
   217             res = XAMetadataExtractorImpl_QueryNumSupportedInterfaces(
   242                     pNumSupportedInterfaces);
   218                     pNumSupportedInterfaces);
   243             break;
   219             break;
   244         default:
   220         default:
   274             break;
   250             break;
   275         case XA_OBJECTID_MEDIARECORDER:
   251         case XA_OBJECTID_MEDIARECORDER:
   276             res = XAMediaRecorderImpl_QuerySupportedInterfaces(index,
   252             res = XAMediaRecorderImpl_QuerySupportedInterfaces(index,
   277                     pInterfaceId);
   253                     pInterfaceId);
   278             break;
   254             break;
   279         case XA_OBJECTID_OUTPUTMIX:
       
   280             res = XAOMixImpl_QuerySupportedInterfaces(index, pInterfaceId);
       
   281             break;
       
   282 #ifdef OMAX_CAMERABIN
       
   283             case XA_OBJECTID_CAMERADEVICE:
       
   284             res = XACameraDeviceImpl_QuerySupportedInterfaces(
       
   285                     index, pInterfaceId );
       
   286             break;
       
   287 #endif
       
   288         case XA_OBJECTID_RADIODEVICE:
   255         case XA_OBJECTID_RADIODEVICE:
   289             res = XARadioDeviceImpl_QuerySupportedInterfaces(index,
   256             res = XARadioDeviceImpl_QuerySupportedInterfaces(index,
   290                     pInterfaceId);
   257                     pInterfaceId);
   291             break;
   258             break;
   292         case XA_OBJECTID_LEDDEVICE:
       
   293             res = XALEDArrayDeviceImpl_QuerySupportedInterfaces(index,
       
   294                     pInterfaceId);
       
   295             break;
       
   296         case XA_OBJECTID_VIBRADEVICE:
       
   297             res = XAVibraDeviceImpl_QuerySupportedInterfaces(index,
       
   298                     pInterfaceId);
       
   299             break;
       
   300         case XA_OBJECTID_METADATAEXTRACTOR:
   259         case XA_OBJECTID_METADATAEXTRACTOR:
   301             res = XAMetadataExtractorImpl_QuerySupportedInterfaces(index,
   260             res = XAMetadataExtractorImpl_QuerySupportedInterfaces(index,
   302                     pInterfaceId);
   261                     pInterfaceId);
   303             break;
   262             break;
   304         default:
   263         default:
   311 
   270 
   312 XAresult XAEngineItfImpl_QueryLEDCapabilities(XAEngineItf self,
   271 XAresult XAEngineItfImpl_QueryLEDCapabilities(XAEngineItf self,
   313         XAuint32 *pIndex, XAuint32 *pLEDDeviceID,
   272         XAuint32 *pIndex, XAuint32 *pLEDDeviceID,
   314         XALEDDescriptor *pDescriptor)
   273         XALEDDescriptor *pDescriptor)
   315     {
   274     {
   316 
   275     XAresult res = XA_RESULT_SUCCESS;
   317     XALEDDescriptor descriptor;
       
   318 
       
   319     DEBUG_API("->XAEngineItfImpl_QueryLEDCapabilities");
   276     DEBUG_API("->XAEngineItfImpl_QueryLEDCapabilities");
   320 
   277 
   321     if (!pDescriptor)
   278     if (!pDescriptor)
   322         { /*query number of devices*/
   279         { /*query number of devices*/
   323         if (!pIndex)
   280         if (!pIndex)
   324             {
   281             {
   325             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   282             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   326             DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities");
   283             DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities");
   327             return XA_RESULT_PARAMETER_INVALID;
   284             return XA_RESULT_PARAMETER_INVALID;
   328             }
   285             }
   329         /* Number of devices */
   286         else
   330         *pIndex = 1;
   287             {
       
   288             /* Number of devices */
       
   289             *pIndex = 0;
       
   290             }
   331         }
   291         }
   332     else
   292     else
   333         {
   293         {
   334 
   294         // return NotSupported below
   335         /* query device capabilities */
   295         res = XA_RESULT_FEATURE_UNSUPPORTED;
   336         if (pIndex)
   296         }
   337             {
   297     DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities");
   338             if (*pIndex == 0)
   298     return res;
   339                 {
       
   340                 if (!pLEDDeviceID)
       
   341                     {
       
   342                     DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   343                     DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities");
       
   344                     return XA_RESULT_PARAMETER_INVALID;
       
   345                     }
       
   346                 *pLEDDeviceID = XA_ADAPTID_LEDARRAY;
       
   347                 }
       
   348             else
       
   349                 {
       
   350                 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   351                 DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities");
       
   352                 return XA_RESULT_PARAMETER_INVALID;
       
   353                 }
       
   354             }
       
   355 
       
   356         if (*pLEDDeviceID == XA_ADAPTID_LEDARRAY)
       
   357             {
       
   358             descriptor.colorMask = COLOR_MASK;
       
   359             descriptor.ledCount = LED_COUNT;
       
   360             descriptor.primaryLED = PRIMARY_LED;
       
   361             *pDescriptor = descriptor;
       
   362             }
       
   363 
       
   364         }DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities");
       
   365     return XA_RESULT_SUCCESS;
       
   366     }
   299     }
   367 
   300 
   368 XAresult XAEngineItfImpl_QueryVibraCapabilities(XAEngineItf self,
   301 XAresult XAEngineItfImpl_QueryVibraCapabilities(XAEngineItf self,
   369         XAuint32 *pIndex, XAuint32 *pVibraDeviceID,
   302         XAuint32 *pIndex, XAuint32 *pVibraDeviceID,
   370         XAVibraDescriptor *pDescriptor)
   303         XAVibraDescriptor *pDescriptor)
   371     {
   304     {
   372 
   305     XAresult res = XA_RESULT_SUCCESS;
   373     XAVibraDescriptor descriptor;
       
   374 
       
   375     DEBUG_API("->XAEngineItfImpl_QueryVibraCapabilities");
   306     DEBUG_API("->XAEngineItfImpl_QueryVibraCapabilities");
   376 
   307 
   377     if (!pDescriptor)
   308     if (!pDescriptor)
   378         { /*query number of devices*/
   309         { /*query number of devices*/
   379         if (!pIndex)
   310         if (!pIndex)
   380             {
   311             {
   381             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   312             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   382             DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities");
   313             DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities");
   383             return XA_RESULT_PARAMETER_INVALID;
   314             res = XA_RESULT_PARAMETER_INVALID;
   384             }
   315             }
   385         /* Number of devices */
   316         else
   386         *pIndex = 1;
   317             {
       
   318             /* Number of devices */
       
   319             *pIndex = 0;
       
   320             }
   387         }
   321         }
   388     else
   322     else
   389         {
   323         {
   390 
   324         // return NotSupported below
   391         /* query device capabilities */
   325         res = XA_RESULT_FEATURE_UNSUPPORTED;
   392         if (pIndex)
       
   393             {
       
   394             if (*pIndex == 0)
       
   395                 {
       
   396                 if (!pVibraDeviceID)
       
   397                     {
       
   398                     DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   399                     DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities");
       
   400                     return XA_RESULT_PARAMETER_INVALID;
       
   401                     }
       
   402 
       
   403                 *pVibraDeviceID = XA_ADAPTID_VIBRA;
       
   404                 }
       
   405             else
       
   406                 {
       
   407                 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   408                 DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities");
       
   409                 return XA_RESULT_PARAMETER_INVALID;
       
   410                 }
       
   411             }
       
   412 
       
   413         if (*pVibraDeviceID == XA_ADAPTID_VIBRA)
       
   414             {
       
   415             descriptor.minFrequency = MIN_FREQUENCY;
       
   416             descriptor.maxFrequency = MAX_FREQUENCY;
       
   417             descriptor.supportsFrequency = XA_BOOLEAN_TRUE;
       
   418             descriptor.supportsIntensity = XA_BOOLEAN_TRUE;
       
   419             *pDescriptor = descriptor;
       
   420             }
       
   421 
       
   422         }
   326         }
   423 
   327 
   424     DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities");
   328     DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities");
   425     return XA_RESULT_SUCCESS;
   329     return res;
   426     }
   330     }
   427 
   331 
   428 XAresult XAEngineItfImpl_QueryNumSupportedExtensions(XAEngineItf self,
   332 XAresult XAEngineItfImpl_QueryNumSupportedExtensions(XAEngineItf self,
   429         XAuint32 *pNumExtensions)
   333         XAuint32 *pNumExtensions)
   430     {
   334     {