khronosfws/openmax_al/src/engine/xaengineitf.c
changeset 55 e267340986c9
parent 47 c2e43643db4c
equal deleted inserted replaced
52:4ce423f34688 55:e267340986c9
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 #include <stdio.h>
    18 #include <stdio.h>
    19 #include <stdlib.h>
    19 #include <stdlib.h>
    20 #include <assert.h>
       
    21 #include "xaengineitf.h"
    20 #include "xaengineitf.h"
    22 #include "xaobjects.h"
    21 #include "xaobjects.h"
    23 #include "xacapabilitiesmgr.h"
    22 #include "xacapabilitiesmgr.h"
    24 /*static XAchar implementationText[] = "Implementation does not conform to AL Spec";*/
    23 /*static XAchar implementationText[] = "Implementation does not conform to AL Spec";*/
    25 
    24 
    45 XAresult XAEngineItfImpl_CreateCameraDevice(XAEngineItf self,
    44 XAresult XAEngineItfImpl_CreateCameraDevice(XAEngineItf self,
    46         XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces,
    45         XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces,
    47         const XAInterfaceID *pInterfaceIds,
    46         const XAInterfaceID *pInterfaceIds,
    48         const XAboolean *pInterfaceRequired)
    47         const XAboolean *pInterfaceRequired)
    49     {
    48     {
    50 #ifdef OMAX_CAMERABIN
       
    51     XAEngineItfImpl* impl = GetImpl(self);
       
    52     return XACameraDeviceImpl_CreateCameraDevice( impl->mapper,impl->capabilities,
       
    53             pDevice, deviceID,numInterfaces,
       
    54             pInterfaceIds, pInterfaceRequired );
       
    55 #else
       
    56     return XA_RESULT_FEATURE_UNSUPPORTED;
    49     return XA_RESULT_FEATURE_UNSUPPORTED;
    57 #endif
       
    58     }
    50     }
    59 
    51 
    60 XAresult XAEngineItfImpl_CreateRadioDevice(XAEngineItf self,
    52 XAresult XAEngineItfImpl_CreateRadioDevice(XAEngineItf self,
    61         XAObjectItf *pDevice, XAuint32 numInterfaces,
    53         XAObjectItf *pDevice, XAuint32 numInterfaces,
    62         const XAInterfaceID *pInterfaceIds,
    54         const XAInterfaceID *pInterfaceIds,
    63         const XAboolean *pInterfaceRequired)
    55         const XAboolean *pInterfaceRequired)
    64     {
    56     {
    65     return XARadioDeviceImpl_CreateRadioDevice( /*((XAEngineItfImpl*)self)->mapper,*/
    57     return XARadioDeviceImpl_CreateRadioDevice(
    66     pDevice, numInterfaces, pInterfaceIds, pInterfaceRequired);
    58     pDevice, numInterfaces, pInterfaceIds, pInterfaceRequired);
    67     }
    59     }
    68 
    60 
    69 XAresult XAEngineItfImpl_CreateLEDDevice(XAEngineItf self,
    61 XAresult XAEngineItfImpl_CreateLEDDevice(XAEngineItf self,
    70         XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces,
    62         XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces,
    88         XADataSink *pVibra, XADataSink *pLEDArray, XAuint32 numInterfaces,
    80         XADataSink *pVibra, XADataSink *pLEDArray, XAuint32 numInterfaces,
    89         const XAInterfaceID *pInterfaceIds,
    81         const XAInterfaceID *pInterfaceIds,
    90         const XAboolean *pInterfaceRequired)
    82         const XAboolean *pInterfaceRequired)
    91     {
    83     {
    92     XAEngineItfImpl* impl = GetImpl(self);
    84     XAEngineItfImpl* impl = GetImpl(self);
       
    85     if (!impl )
       
    86         {
       
    87         /* invalid parameter */
       
    88         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
    89         DEBUG_API("<-XAEngineItfImpl_CreateMediaPlayer");
       
    90         return XA_RESULT_PARAMETER_INVALID;
       
    91         }    
    93     return XAMediaPlayerImpl_CreateMediaPlayer(impl->mapper,
    92     return XAMediaPlayerImpl_CreateMediaPlayer(impl->mapper,
    94             impl->capabilities, pPlayer, pDataSrc, pBankSrc, pAudioSnk,
    93             impl->capabilities, pPlayer, pDataSrc, pBankSrc, pAudioSnk,
    95             pImageVideoSnk, pVibra, pLEDArray, numInterfaces, pInterfaceIds,
    94             pImageVideoSnk, pVibra, pLEDArray, numInterfaces, pInterfaceIds,
    96             pInterfaceRequired);
    95             pInterfaceRequired);
    97     }
    96     }
   101         XADataSource * pImageVideoSrc, XADataSink * pDataSnk,
   100         XADataSource * pImageVideoSrc, XADataSink * pDataSnk,
   102         XAuint32 numInterfaces, const XAInterfaceID * pInterfaceIds,
   101         XAuint32 numInterfaces, const XAInterfaceID * pInterfaceIds,
   103         const XAboolean * pInterfaceRequired)
   102         const XAboolean * pInterfaceRequired)
   104     {
   103     {
   105     XAEngineItfImpl* impl = GetImpl(self);
   104     XAEngineItfImpl* impl = GetImpl(self);
       
   105     if (!impl )
       
   106         {
       
   107         /* invalid parameter */
       
   108         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   109         DEBUG_API("<-XAEngineItfImpl_CreateMediaRecorder");
       
   110         return XA_RESULT_PARAMETER_INVALID;
       
   111         }    
       
   112 
   106     return XAMediaRecorderImpl_CreateMediaRecorder(impl->mapper,
   113     return XAMediaRecorderImpl_CreateMediaRecorder(impl->mapper,
   107             impl->capabilities, pRecorder, pAudioSrc, pImageVideoSrc,
   114             impl->capabilities, pRecorder, pAudioSrc, pImageVideoSrc,
   108             pDataSnk, numInterfaces, pInterfaceIds, pInterfaceRequired);
   115             pDataSnk, numInterfaces, pInterfaceIds, pInterfaceRequired);
   109     }
   116     }
   110 
   117 
   119         XAObjectItf *pMetadataExtractor, XADataSource *pDataSource,
   126         XAObjectItf *pMetadataExtractor, XADataSource *pDataSource,
   120         XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds,
   127         XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds,
   121         const XAboolean *pInterfaceRequired)
   128         const XAboolean *pInterfaceRequired)
   122     {
   129     {
   123     XAEngineItfImpl* impl = GetImpl(self);
   130     XAEngineItfImpl* impl = GetImpl(self);
       
   131     if (!impl )
       
   132         {
       
   133         /* invalid parameter */
       
   134         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   135         DEBUG_API("<-XAEngineItfImpl_CreateMetadataExtractor");
       
   136         return XA_RESULT_PARAMETER_INVALID;
       
   137         }
   124     return XAMetadataExtractorImpl_Create(impl->mapper, impl->capabilities,
   138     return XAMetadataExtractorImpl_Create(impl->mapper, impl->capabilities,
   125             pMetadataExtractor, pDataSource, numInterfaces, pInterfaceIds,
   139             pMetadataExtractor, pDataSource, numInterfaces, pInterfaceIds,
   126             pInterfaceRequired);
   140             pInterfaceRequired);
   127     }
   141     }
   128 
   142 
   184 
   198 
   185 XAresult XAEngineItfImpl_QueryNumSupportedInterfaces(XAEngineItf self,
   199 XAresult XAEngineItfImpl_QueryNumSupportedInterfaces(XAEngineItf self,
   186         XAuint32 objectID, XAuint32 *pNumSupportedInterfaces)
   200         XAuint32 objectID, XAuint32 *pNumSupportedInterfaces)
   187     {
   201     {
   188     XAresult res = XA_RESULT_SUCCESS;
   202     XAresult res = XA_RESULT_SUCCESS;
       
   203     XAEngineItfImpl* impl = GetImpl(self);
   189     DEBUG_API("->XAEngineItfImpl_QueryNumSupportedInterfaces");
   204     DEBUG_API("->XAEngineItfImpl_QueryNumSupportedInterfaces");
   190 
   205 
   191     if (!pNumSupportedInterfaces)
   206     if (!impl || !pNumSupportedInterfaces)
   192         {
   207         {
   193         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   208         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   194         DEBUG_API("<-XAEngineItfImpl_QueryNumSupportedInterfaces");
   209         DEBUG_API("<-XAEngineItfImpl_QueryNumSupportedInterfaces");
   195         return XA_RESULT_PARAMETER_INVALID;
   210         return XA_RESULT_PARAMETER_INVALID;
   196         }
   211         }
       
   212     
   197     *pNumSupportedInterfaces = 0;
   213     *pNumSupportedInterfaces = 0;
   198     switch (objectID)
   214     switch (objectID)
   199         {
   215         {
   200         case XA_OBJECTID_ENGINE:
   216         case XA_OBJECTID_ENGINE:
   201             res = XAEngineImpl_QueryNumSupportedInterfaces(
   217             res = XAEngineImpl_QueryNumSupportedInterfaces(
   228 
   244 
   229 XAresult XAEngineItfImpl_QuerySupportedInterfaces(XAEngineItf self,
   245 XAresult XAEngineItfImpl_QuerySupportedInterfaces(XAEngineItf self,
   230         XAuint32 objectID, XAuint32 index, XAInterfaceID *pInterfaceId)
   246         XAuint32 objectID, XAuint32 index, XAInterfaceID *pInterfaceId)
   231     {
   247     {
   232     XAresult res = XA_RESULT_SUCCESS;
   248     XAresult res = XA_RESULT_SUCCESS;
       
   249     XAEngineItfImpl* impl = GetImpl(self);
   233     DEBUG_API("->XAEngineItfImpl_QuerySupportedInterfaces");
   250     DEBUG_API("->XAEngineItfImpl_QuerySupportedInterfaces");
   234 
   251 
   235     if (!pInterfaceId)
   252     if (!impl || !pInterfaceId)
   236         {
   253         {
   237         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   254         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   238         DEBUG_API("<-XAEngineItfImpl_QuerySupportedInterfaces");
   255         DEBUG_API("<-XAEngineItfImpl_QuerySupportedInterfaces");
   239         return XA_RESULT_PARAMETER_INVALID;
   256         return XA_RESULT_PARAMETER_INVALID;
   240         }
   257         }
       
   258     
   241     *pInterfaceId = XA_IID_NULL;
   259     *pInterfaceId = XA_IID_NULL;
   242     switch (objectID)
   260     switch (objectID)
   243         {
   261         {
   244         case XA_OBJECTID_ENGINE:
   262         case XA_OBJECTID_ENGINE:
   245             res = XAEngineImpl_QuerySupportedInterfaces(index, pInterfaceId);
   263             res = XAEngineImpl_QuerySupportedInterfaces(index, pInterfaceId);
   260             res = XAMetadataExtractorImpl_QuerySupportedInterfaces(index,
   278             res = XAMetadataExtractorImpl_QuerySupportedInterfaces(index,
   261                     pInterfaceId);
   279                     pInterfaceId);
   262             break;
   280             break;
   263         default:
   281         default:
   264             res = XA_RESULT_FEATURE_UNSUPPORTED;
   282             res = XA_RESULT_FEATURE_UNSUPPORTED;
       
   283             break;
   265         }
   284         }
   266 
   285 
   267     DEBUG_API_A1("<-XAEngineItfImpl_QuerySupportedInterfaces %lu", res);
   286     DEBUG_API_A1("<-XAEngineItfImpl_QuerySupportedInterfaces %lu", res);
   268     return res;
   287     return res;
   269     }
   288     }
   411         self->itf.QuerySupportedExtension
   430         self->itf.QuerySupportedExtension
   412                 = XAEngineItfImpl_QuerySupportedExtension;
   431                 = XAEngineItfImpl_QuerySupportedExtension;
   413         self->itf.IsExtensionSupported = XAEngineItfImpl_IsExtensionSupported;
   432         self->itf.IsExtensionSupported = XAEngineItfImpl_IsExtensionSupported;
   414         self->mapper = fwkmapper;
   433         self->mapper = fwkmapper;
   415         self->capabilities = capabilities;
   434         self->capabilities = capabilities;
   416         self->xyz = 50;
       
   417         self->self = self;
   435         self->self = self;
   418         }
   436         }
   419     DEBUG_API("<-XAEngineItfImpl_Create");
   437     DEBUG_API("<-XAEngineItfImpl_Create");
   420     return self;
   438     return self;
   421     }
   439     }
   423 void XAEngineItfImpl_Free(XAEngineItfImpl* self)
   441 void XAEngineItfImpl_Free(XAEngineItfImpl* self)
   424     {
   442     {
   425     DEBUG_API("->XAEngineItfImpl_Free");
   443     DEBUG_API("->XAEngineItfImpl_Free");
   426     if(self)
   444     if(self)
   427         {
   445         {
   428         assert(self==self->self);
       
   429         free(self);
   446         free(self);
   430         }
   447         }
   431     DEBUG_API("<-XAEngineItfImpl_Free");
   448     DEBUG_API("<-XAEngineItfImpl_Free");
   432     }
   449     }