khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c
changeset 43 9894ed580e4a
parent 33 5e8b14bae8c3
child 53 eabc8c503852
equal deleted inserted replaced
39:1f58177f6740 43:9894ed580e4a
    26 
    26 
    27     XAMetadataAdaptationMMFCtx *pSelf = NULL;
    27     XAMetadataAdaptationMMFCtx *pSelf = NULL;
    28     DEBUG_API("->XAMetadataAdaptCtxMMF_Create");
    28     DEBUG_API("->XAMetadataAdaptCtxMMF_Create");
    29 
    29 
    30     pSelf = calloc(1, sizeof(XAMetadataAdaptationMMFCtx));
    30     pSelf = calloc(1, sizeof(XAMetadataAdaptationMMFCtx));
    31     if (pSelf)
    31     if(!pSelf)
    32         {
    32         {
    33 
    33         /* memory allocation failed */
    34         if (XAAdaptationBaseMMF_Init(&(pSelf->baseObj), XAMDAdaptation)
    34         DEBUG_ERR("Failed to allocate memory");
    35                 != XA_RESULT_SUCCESS)
    35         DEBUG_API("<-XAMetadataAdaptCtxMMF_Create");
    36             {
       
    37             DEBUG_ERR("Failed to init base context!!!");
       
    38             free(pSelf);
       
    39             pSelf = NULL;
       
    40             }
       
    41         else
       
    42 
       
    43             {
       
    44             pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF;
       
    45             pSelf->xaSource = pDataSrc;
       
    46             }
       
    47 
       
    48         if (pDataSrc)
       
    49             {
       
    50             pSelf->mmfContext
       
    51                     = mmf_metadata_utility_init(
       
    52                             (char *) (((XADataLocator_URI*) (pDataSrc->pLocator))->URI));
       
    53             if (!pSelf->mmfContext)
       
    54                 {
       
    55                 DEBUG_ERR("Failed to init mmf context!!!");
       
    56                 free(pSelf);
       
    57                 pSelf = NULL;
       
    58                 }
       
    59             }
       
    60 
       
    61         }
       
    62     else
       
    63         {
       
    64         DEBUG_ERR("Failed to create XAMetadataAdaptationMMFCtx !!!");
       
    65         return NULL;
    36         return NULL;
    66         }
    37         }
    67        
    38 
       
    39     if (XAAdaptationBaseMMF_Init(&(pSelf->baseObj), XAMDAdaptation)
       
    40             != XA_RESULT_SUCCESS)
       
    41         {
       
    42         free(pSelf);
       
    43         DEBUG_ERR("Failed to init base context!!!");
       
    44         DEBUG_API("<-XAMetadataAdaptCtxMMF_Create");
       
    45         return NULL;
       
    46         }
       
    47 
       
    48     pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF;
       
    49     pSelf->xaSource = pDataSrc;
       
    50 
       
    51     if (pDataSrc)
       
    52         {
       
    53         pSelf->mmfContext
       
    54                 = mmf_metadata_utility_init(
       
    55                         (char *) (((XADataLocator_URI*) (pDataSrc->pLocator))->URI));
       
    56         if (!pSelf->mmfContext)
       
    57             {
       
    58             free(pSelf);
       
    59             DEBUG_ERR("Failed to init mmf context!!!");
       
    60             DEBUG_API("<-XAMetadataAdaptCtxMMF_Create");
       
    61             return NULL;
       
    62             }
       
    63         }
    68 
    64 
    69     DEBUG_API("<- XAMetadataAdaptCtxMMF_Create");
    65     DEBUG_API("<- XAMetadataAdaptCtxMMF_Create");
    70     return (XAAdaptationBaseCtx*) (&pSelf->baseObj.baseObj);
    66     return (XAAdaptationBaseCtx*) (&pSelf->baseObj.baseObj);
    71     }
    67     }
    72 
    68