khronosfws/openmax_al/src/mmf_adaptation/xamediarecorderadaptctxmmf.c
changeset 33 5e8b14bae8c3
parent 25 6f7ceef7b1d1
child 53 eabc8c503852
equal deleted inserted replaced
28:ebf79c79991a 33:5e8b14bae8c3
    20 #include "xamediarecorderadaptctxmmf.h"
    20 #include "xamediarecorderadaptctxmmf.h"
    21 #include "xaadaptationmmf.h"
    21 #include "xaadaptationmmf.h"
    22 #include "cmmfbackendengine.h"
    22 #include "cmmfbackendengine.h"
    23 #include "xaadptbasectx.h"
    23 #include "xaadptbasectx.h"
    24 
    24 
    25 extern XAboolean cameraRealized;
       
    26 
       
    27 /*
    25 /*
    28  * XAAdaptationBaseCtx* XAMediaRecorderAdaptMMF_Create()
    26  * XAAdaptationBaseCtx* XAMediaRecorderAdaptMMF_Create()
    29  * Allocates memory for Media Recorder Adaptation Context and makes 1st phase initialization
    27  * Allocates memory for Media Recorder Adaptation Context and makes 1st phase initialization
    30  * @param XADataSource *pAudioSrc - pointer to OMX-AL audio source
    28  * @param XADataSource *pAudioSrc - pointer to OMX-AL audio source
    31  * @param XADataSource *pImageVideoSrc - pointer image/video source
    29  * @param XADataSource *pImageVideoSrc - pointer image/video source
    34  */
    32  */
    35 XAAdaptationBaseCtx* XAMediaRecorderAdaptMMF_Create(XADataSource* pAudioSrc,
    33 XAAdaptationBaseCtx* XAMediaRecorderAdaptMMF_Create(XADataSource* pAudioSrc,
    36         XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes)
    34         XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes)
    37     {
    35     {
    38     XAMediaRecorderAdaptationMMFCtx *pSelf = NULL;
    36     XAMediaRecorderAdaptationMMFCtx *pSelf = NULL;
    39     XAuint32 locType = 0;
       
    40     XAresult res;
    37     XAresult res;
    41     XADataLocator_IODevice *ioDevice;
       
    42     DEBUG_API("->XAMediaRecorderAdaptMMF_Create");
    38     DEBUG_API("->XAMediaRecorderAdaptMMF_Create");
    43 
    39 
    44     pSelf = (XAMediaRecorderAdaptationMMFCtx*) calloc(1,
    40     pSelf = (XAMediaRecorderAdaptationMMFCtx*) calloc(1,
    45             sizeof(XAMediaRecorderAdaptationMMFCtx));
    41             sizeof(XAMediaRecorderAdaptationMMFCtx));
    46     if (pSelf)
    42     if (pSelf)
    79             pSelf->audioEncSettings.channelsOut = 2;
    75             pSelf->audioEncSettings.channelsOut = 2;
    80             pSelf->audioEncSettings.bitsPerSample = 8;
    76             pSelf->audioEncSettings.bitsPerSample = 8;
    81             pSelf->audioEncSettings.bitRate = 128;
    77             pSelf->audioEncSettings.bitRate = 128;
    82             pSelf->audioEncSettings.sampleRate = 44100;
    78             pSelf->audioEncSettings.sampleRate = 44100;
    83             }
    79             }
    84 
       
    85         if (pImageVideoSrc)
       
    86             {
       
    87             locType = *((XAuint32*) (pImageVideoSrc->pLocator));
       
    88             if (locType == XA_DATALOCATOR_IODEVICE)
       
    89                 {
       
    90                 ioDevice
       
    91                         = (XADataLocator_IODevice*) (pImageVideoSrc->pLocator);
       
    92                 if (ioDevice->deviceType == XA_IODEVICE_CAMERA
       
    93 
       
    94                 && !cameraRealized
       
    95 
       
    96                 )
       
    97                     {
       
    98                     DEBUG_ERR("Preconditions violated - Camera object not realized");
       
    99                     XAAdaptationBaseMMF_Free(&pSelf->baseObj);
       
   100                     free(pSelf);
       
   101                     pSelf = NULL;
       
   102                     }
       
   103                 }
       
   104             }
       
   105         }
    80         }
   106     else
    81     else
   107         {
    82         {
   108         DEBUG_ERR("Failed to create XAMediaRecorderAdaptationMMFCtx !!!");
    83         DEBUG_ERR("Failed to create XAMediaRecorderAdaptationMMFCtx !!!");
   109         return NULL;
    84         return NULL;
   136     XAresult ret = XA_RESULT_SUCCESS;
   111     XAresult ret = XA_RESULT_SUCCESS;
   137     XADataLocator_URI* tempUri;
   112     XADataLocator_URI* tempUri;
   138     XADataFormat_MIME* tempFormat;
   113     XADataFormat_MIME* tempFormat;
   139     XAMediaRecorderAdaptationMMFCtx *pSelf;
   114     XAMediaRecorderAdaptationMMFCtx *pSelf;
   140     DEBUG_API("->XAMediaRecorderAdapt_PostInit");
   115     DEBUG_API("->XAMediaRecorderAdapt_PostInit");
   141     if(bCtx)
   116     if(!bCtx)
   142         {
   117         {
   143         ret = XA_RESULT_PARAMETER_INVALID;
   118         ret = XA_RESULT_PARAMETER_INVALID;
   144         return ret;
   119         return ret;
   145         }
   120         }
   146     
   121