khronosfws/openmax_al/src/engine/xaengine.c
changeset 42 1fa3fb47b1e3
parent 31 8dfd592727cb
child 53 eabc8c503852
equal deleted inserted replaced
32:94fc26b6e006 42:1fa3fb47b1e3
    23 #include "xaobjectitf.h"
    23 #include "xaobjectitf.h"
    24 #include "xaengineitf.h"
    24 #include "xaengineitf.h"
    25 #include "xathreadsyncitf.h"
    25 #include "xathreadsyncitf.h"
    26 #include "xadynintmgmtitf.h"
    26 #include "xadynintmgmtitf.h"
    27 #include "xaaudioiodevicecapabilitiesitf.h"
    27 #include "xaaudioiodevicecapabilitiesitf.h"
    28 #include "xaaudiodecodercapabilitiesitf.h"
       
    29 #include "xaaudioencodercapabilitiesitf.h"
    28 #include "xaaudioencodercapabilitiesitf.h"
    30 #include "xaimagedecodercapabilitiesitf.h"
       
    31 #include "xaimageencodercapabilitiesitf.h"
       
    32 #include "xavideodecodercapabilitiesitf.h"
       
    33 #include "xavideoencodercapabilitiesitf.h"
       
    34 #include "xacameracapabilitiesitf.h"
       
    35 #include "xadevicevolumeitf.h"
       
    36 #include "xaconfigextensionsitf.h"
    29 #include "xaconfigextensionsitf.h"
    37 #include "xathreadsafety.h"
    30 #include "xathreadsafety.h"
    38 #include "xaframeworkmgr.h"  
    31 #include "xaframeworkmgr.h"  
    39 #include "xastaticcameracapsadaptation.h"
       
    40 
    32 
    41 /* Static mapping of enumeration XAEngineInterfaces to interface iids */
    33 /* Static mapping of enumeration XAEngineInterfaces to interface iids */
    42 static const XAInterfaceID* xaEngineItfIIDs[ENGINE_ITFCOUNT] =
    34 static const XAInterfaceID* xaEngineItfIIDs[ENGINE_ITFCOUNT] =
    43     {
    35     {
    44     &XA_IID_OBJECT,
    36     &XA_IID_OBJECT,
    78     XAboolean threadSafeEnabled = XA_BOOLEAN_TRUE;
    70     XAboolean threadSafeEnabled = XA_BOOLEAN_TRUE;
    79     DEBUG_API("->XAEngineImpl_Create");
    71     DEBUG_API("->XAEngineImpl_Create");
    80 
    72 
    81     if (!pEngine)
    73     if (!pEngine)
    82         {
    74         {
    83         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineImpl_Create");
    75         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
    76         DEBUG_API("<-XAEngineImpl_Create");
    84         /* invalid parameter */
    77         /* invalid parameter */
    85         return XA_RESULT_PARAMETER_INVALID;
    78         return XA_RESULT_PARAMETER_INVALID;
    86         }
    79         }
    87 
    80 
    88     /* check engine options */
    81     /* check engine options */
   105 
    98 
   106     /* instantiate object implementation */
    99     /* instantiate object implementation */
   107     pImpl = (XAEngineImpl*) calloc(1, sizeof(XAEngineImpl));
   100     pImpl = (XAEngineImpl*) calloc(1, sizeof(XAEngineImpl));
   108     if (!pImpl)
   101     if (!pImpl)
   109         {
   102         {
   110         DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");DEBUG_API("<-XAEngineImpl_Create");
   103         DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
       
   104         DEBUG_API("<-XAEngineImpl_Create");
   111         /* memory allocation failed */
   105         /* memory allocation failed */
   112         return XA_RESULT_MEMORY_FAILURE;
   106         return XA_RESULT_MEMORY_FAILURE;
   113         }
   107         }
   114     pBaseObj = &pImpl->baseObj;
   108     pBaseObj = &pImpl->baseObj;
   115 
   109 
   140                 {
   134                 {
   141                 if (pInterfaceRequired[itfIndex])
   135                 if (pInterfaceRequired[itfIndex])
   142                     {
   136                     {
   143                     /* required interface cannot be accommodated - fail creation */
   137                     /* required interface cannot be accommodated - fail creation */
   144                     XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj));
   138                     XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj));
   145                     DEBUG_ERR("Required interface not found - abort creation!");DEBUG_API("<-XAEngineImpl_Create");
   139                     DEBUG_ERR("Required interface not found - abort creation!");
       
   140                     DEBUG_API("<-XAEngineImpl_Create");
   146                     return XA_RESULT_FEATURE_UNSUPPORTED;
   141                     return XA_RESULT_FEATURE_UNSUPPORTED;
   147                     }
   142                     }
   148                 else
   143                 else
   149                     {
   144                     {
   150                     DEBUG_INFO("Requested (not required) interface not found - continue creation");
   145                     DEBUG_INFO("Requested (not required) interface not found - continue creation");
   189         DEBUG_API("<-XAEngineImpl_QueryNumSupportedInterfaces");
   184         DEBUG_API("<-XAEngineImpl_QueryNumSupportedInterfaces");
   190         return XA_RESULT_SUCCESS;
   185         return XA_RESULT_SUCCESS;
   191         }
   186         }
   192     else
   187     else
   193         {
   188         {
   194         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineImpl_QueryNumSupportedInterfaces");
   189         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   190         DEBUG_API("<-XAEngineImpl_QueryNumSupportedInterfaces");
   195         return XA_RESULT_PARAMETER_INVALID;
   191         return XA_RESULT_PARAMETER_INVALID;
   196         }
   192         }
   197     }
   193     }
   198 
   194 
   199 /* XAResult XAEngineImpl_QuerySupportedInterfaces
   195 /* XAResult XAEngineImpl_QuerySupportedInterfaces
   291                     break;
   287                     break;
   292                 case ENGINE_AUDIOENCODERCAPAITF:
   288                 case ENGINE_AUDIOENCODERCAPAITF:
   293                     pItf = XAAudioEncoderCapabilitiesItfImpl_Create(
   289                     pItf = XAAudioEncoderCapabilitiesItfImpl_Create(
   294                             pObjImpl->capabilities);
   290                             pObjImpl->capabilities);
   295                     break;
   291                     break;
   296                     /*
       
   297                      case ENGINE_AUDIODECODERCAPAITF:
       
   298                      pItf = XAAudioDecoderCapabilitiesItfImpl_Create();
       
   299                      break;
       
   300                      case ENGINE_CONFIGEXTENSIONSITF:
       
   301                      pItf = XAConfigExtensionsItfImpl_Create();
       
   302                      break;
       
   303                      case ENGINE_DEVICEVOLUMEITF:
       
   304                      pItf = XADeviceVolumeItfImpl_Create(pObjImpl->adaptationCtx);
       
   305                      break;
       
   306                      case ENGINE_CAMERACAPAITF:
       
   307 
       
   308                      XAStaticCameraCaps_Init();
       
   309                      pItf = XACameraCapabilitiesItfImpl_Create();
       
   310                      
       
   311                      break;
       
   312                      case ENGINE_IMAGEDECODERCAPAITF:
       
   313                      pItf = XAImageDecoderCapabilitiesItfImpl_Create();
       
   314                      break;
       
   315                      case ENGINE_IMAGEENCODERCAPAITF:
       
   316                      pItf = XAImageEncoderCapabilitiesItfImpl_Create();
       
   317                      break;
       
   318                      case ENGINE_VIDEODECODERCAPAITF:
       
   319                      pItf = XAVideoDecoderCapabilitiesItfImpl_Create();
       
   320                      break;
       
   321                      case ENGINE_VIDEOENCODERCAPAITF:
       
   322                      pItf = XAVideoEncoderCapabilitiesItfImpl_Create();
       
   323                      break;
       
   324                      */
       
   325                 default:
   292                 default:
   326                     break;
   293                     break;
   327                 }
   294                 }
   328             if (!pItf)
   295             if (!pItf)
   329                 {
   296                 {
   330                 DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");DEBUG_API("<-XAEngineImpl_DoRealize");
   297                 DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");
       
   298                 DEBUG_API("<-XAEngineImpl_DoRealize");
   331                 /* memory allocation failed */
   299                 /* memory allocation failed */
   332                 return XA_RESULT_MEMORY_FAILURE;
   300                 return XA_RESULT_MEMORY_FAILURE;
   333                 }
   301                 }
   334             else
   302             else
   335                 {
   303                 {
   346 /* XAresult XAEngineImpl_DoResume
   314 /* XAresult XAEngineImpl_DoResume
   347  * Description: Resume object from suspended state
   315  * Description: Resume object from suspended state
   348  */
   316  */
   349 XAresult XAEngineImpl_DoResume(XAObjectItf self)
   317 XAresult XAEngineImpl_DoResume(XAObjectItf self)
   350     {
   318     {
   351     DEBUG_API("->XAEngineImpl_DoResume");DEBUG_API("<-XAEngineImpl_DoResume");
   319     DEBUG_API("->XAEngineImpl_DoResume");
       
   320     DEBUG_API("<-XAEngineImpl_DoResume");
   352 
   321 
   353     return XA_RESULT_PRECONDITIONS_VIOLATED;
   322     return XA_RESULT_PRECONDITIONS_VIOLATED;
   354     }
   323     }
   355 
   324 
   356 /* void XAEngineImpl_FreeResources
   325 /* void XAEngineImpl_FreeResources
   385                     XAAudIODevCapaItfImpl_Free(pItf);
   354                     XAAudIODevCapaItfImpl_Free(pItf);
   386                     break;
   355                     break;
   387                 case ENGINE_AUDIOENCODERCAPAITF:
   356                 case ENGINE_AUDIOENCODERCAPAITF:
   388                     XAAudioEncoderCapabilitiesItfImpl_Free(pItf);
   357                     XAAudioEncoderCapabilitiesItfImpl_Free(pItf);
   389                     break;
   358                     break;
   390                     /*
       
   391                      case ENGINE_AUDIODECODERCAPAITF:
       
   392                      XAAudioDecoderCapabilitiesItfImpl_Free(pItf);
       
   393                      break;
       
   394                      case ENGINE_CONFIGEXTENSIONSITF:
       
   395                      XAConfigExtensionsItfImpl_Free(pItf);
       
   396                      break;
       
   397                      case ENGINE_DEVICEVOLUMEITF:
       
   398                      XADeviceVolumeItfImpl_Free(pItf);
       
   399                      break;
       
   400                      case ENGINE_CAMERACAPAITF:
       
   401 
       
   402                      XACameraCapabilitiesItfImpl_Free(pItf);
       
   403                      
       
   404                      break;
       
   405                      case ENGINE_IMAGEDECODERCAPAITF:
       
   406                      XAImageDecoderCapabilitiesItfImpl_Free(pItf);
       
   407                      break;
       
   408                      case ENGINE_IMAGEENCODERCAPAITF:
       
   409                      XAImageEncoderCapabilitiesItfImpl_Free(pItf);
       
   410                      break;
       
   411                      case ENGINE_VIDEODECODERCAPAITF:
       
   412                      XAVideoDecoderCapabilitiesItfImpl_Free(pItf);
       
   413                      break;
       
   414                      case ENGINE_VIDEOENCODERCAPAITF:
       
   415                      XAVideoEncoderCapabilitiesItfImpl_Free(pItf);
       
   416                      break;
       
   417                      */
       
   418                 default:
   359                 default:
   419                     break;
   360                     break;
   420                 }
   361                 }
   421             pObj->interfaceMap[itfIdx].pItf = NULL;
   362             pObj->interfaceMap[itfIdx].pItf = NULL;
   422             }
   363             }