khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c
changeset 16 43d09473c595
child 31 8dfd592727cb
equal deleted inserted replaced
14:80975da52420 16:43d09473c595
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 #include <assert.h>
       
    18 #include <stdlib.h>
       
    19 #include "xametadataadaptctxmmf.h"
       
    20 #include "xaobjectitf.h"
       
    21 #include "cmetadatautilityitf.h"
       
    22 
       
    23 XAAdaptationBaseCtx* XAMetadataAdaptCtxMMF_Create(XADataSource * pDataSrc)
       
    24 {
       
    25 
       
    26     XAMetadataAdaptationMMFCtx *pSelf = NULL;
       
    27     DEBUG_API("->XAMetadataAdaptCtxMMF_Create");
       
    28     
       
    29     pSelf = calloc(1, sizeof(XAMetadataAdaptationMMFCtx));
       
    30     if ( pSelf)
       
    31     {
       
    32           
       
    33         if( XAAdaptationBaseMMF_Init(&(pSelf->baseObj),XAMDAdaptation)
       
    34             != XA_RESULT_SUCCESS )
       
    35         {
       
    36             DEBUG_ERR("Failed to init base context!!!");
       
    37             free(pSelf);
       
    38             pSelf = NULL;
       
    39         }
       
    40         else
       
    41             
       
    42         {
       
    43             pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF;
       
    44             pSelf->xaSource = pDataSrc;
       
    45         }
       
    46 
       
    47 		if(pDataSrc)
       
    48 		{
       
    49 			pSelf->mmfContext = mmf_metadata_utility_init((char *)(( (XADataLocator_URI*)(pDataSrc->pLocator))->URI));
       
    50 			if(!pSelf->mmfContext)
       
    51             {
       
    52 	            DEBUG_ERR("Failed to init mmf context!!!");
       
    53     	        free(pSelf);
       
    54         	    pSelf = NULL;           
       
    55             }
       
    56 		}
       
    57 
       
    58     }
       
    59 
       
    60     DEBUG_API("<- XAMetadataAdaptCtxMMF_Create");
       
    61     return (XAAdaptationBaseCtx*)(&pSelf->baseObj.baseObj);
       
    62 }
       
    63 
       
    64 
       
    65 /*
       
    66  * XAresult XAMediaPlayerAdaptMMF_PostInit()
       
    67  * 2nd phase initialization of Media Player Adaptation Context
       
    68  * @param XAMediaPlayerAdaptationMMFCtx* ctx - pointer to Media Player adaptation context
       
    69  * @return XAresult - Success value
       
    70  */
       
    71 XAresult XAMetadataAdaptCtxMMF_PostInit( XAAdaptationMMFCtx* bCtx )
       
    72 {
       
    73  	XAresult ret = XA_RESULT_SUCCESS;
       
    74  
       
    75   DEBUG_API("<-XAMetadataAdaptCtxMMF_PostInit");
       
    76   return ret;
       
    77 }
       
    78 
       
    79 /*
       
    80  * void XAMediaPlayerAdaptMMF_Destroy( XAMediaPlayerAdaptationMMFCtx* ctx )
       
    81  * Destroys Media Player Adaptation Context
       
    82  * @param ctx - Media Player Adaptation context to be destroyed
       
    83  */
       
    84 void XAMetadataAdaptCtxMMF_Destroy( XAAdaptationMMFCtx* bCtx )
       
    85 {
       
    86     DEBUG_API("->XAMetadataAdaptCtxMMF_Destroy");
       
    87     if(bCtx == NULL)
       
    88     {
       
    89         DEBUG_ERR("Invalid parameter!!");
       
    90         DEBUG_API("<-XAMetadataAdaptCtxMMF_Destroy");
       
    91         return;
       
    92     }
       
    93 	
       
    94     if(((XAMetadataAdaptationMMFCtx*)bCtx)->mmfContext)
       
    95     {
       
    96         mmf_metadata_utility_destroy(((XAMetadataAdaptationMMFCtx*)bCtx)->mmfContext);
       
    97     }
       
    98 
       
    99     XAAdaptationBase_Free( &bCtx->baseObj );
       
   100     free(bCtx);
       
   101     bCtx = NULL;
       
   102 
       
   103     DEBUG_API("<-XAMetadataExtractorAdaptMMF_Destroy");
       
   104 }
       
   105 
       
   106