diff -r 80975da52420 -r 43d09473c595 khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c Fri May 14 16:22:35 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include "xametadataadaptctxmmf.h" +#include "xaobjectitf.h" +#include "cmetadatautilityitf.h" + +XAAdaptationBaseCtx* XAMetadataAdaptCtxMMF_Create(XADataSource * pDataSrc) +{ + + XAMetadataAdaptationMMFCtx *pSelf = NULL; + DEBUG_API("->XAMetadataAdaptCtxMMF_Create"); + + pSelf = calloc(1, sizeof(XAMetadataAdaptationMMFCtx)); + if ( pSelf) + { + + if( XAAdaptationBaseMMF_Init(&(pSelf->baseObj),XAMDAdaptation) + != XA_RESULT_SUCCESS ) + { + DEBUG_ERR("Failed to init base context!!!"); + free(pSelf); + pSelf = NULL; + } + else + + { + pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; + pSelf->xaSource = pDataSrc; + } + + if(pDataSrc) + { + pSelf->mmfContext = mmf_metadata_utility_init((char *)(( (XADataLocator_URI*)(pDataSrc->pLocator))->URI)); + if(!pSelf->mmfContext) + { + DEBUG_ERR("Failed to init mmf context!!!"); + free(pSelf); + pSelf = NULL; + } + } + + } + + DEBUG_API("<- XAMetadataAdaptCtxMMF_Create"); + return (XAAdaptationBaseCtx*)(&pSelf->baseObj.baseObj); +} + + +/* + * XAresult XAMediaPlayerAdaptMMF_PostInit() + * 2nd phase initialization of Media Player Adaptation Context + * @param XAMediaPlayerAdaptationMMFCtx* ctx - pointer to Media Player adaptation context + * @return XAresult - Success value + */ +XAresult XAMetadataAdaptCtxMMF_PostInit( XAAdaptationMMFCtx* bCtx ) +{ + XAresult ret = XA_RESULT_SUCCESS; + + DEBUG_API("<-XAMetadataAdaptCtxMMF_PostInit"); + return ret; +} + +/* + * void XAMediaPlayerAdaptMMF_Destroy( XAMediaPlayerAdaptationMMFCtx* ctx ) + * Destroys Media Player Adaptation Context + * @param ctx - Media Player Adaptation context to be destroyed + */ +void XAMetadataAdaptCtxMMF_Destroy( XAAdaptationMMFCtx* bCtx ) +{ + DEBUG_API("->XAMetadataAdaptCtxMMF_Destroy"); + if(bCtx == NULL) + { + DEBUG_ERR("Invalid parameter!!"); + DEBUG_API("<-XAMetadataAdaptCtxMMF_Destroy"); + return; + } + + if(((XAMetadataAdaptationMMFCtx*)bCtx)->mmfContext) + { + mmf_metadata_utility_destroy(((XAMetadataAdaptationMMFCtx*)bCtx)->mmfContext); + } + + XAAdaptationBase_Free( &bCtx->baseObj ); + free(bCtx); + bCtx = NULL; + + DEBUG_API("<-XAMetadataExtractorAdaptMMF_Destroy"); +} + +