khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 23 Jun 2010 18:47:10 +0300
changeset 31 8dfd592727cb
parent 16 43d09473c595
child 42 1fa3fb47b1e3
permissions -rw-r--r--
Revision: 201023 Kit: 2010125

/*
 * 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: Metadata Adaptation MMF
 *
 */

#include <assert.h>
#include <stdlib.h>
#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;
                }
            }

        }
    else
        {
        DEBUG_ERR("Failed to create XAMetadataAdaptationMMFCtx !!!");
        return 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");
    }