khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.c
changeset 25 6f7ceef7b1d1
parent 19 4a629bc82c5e
child 53 eabc8c503852
equal deleted inserted replaced
21:2ed61feeead6 25:6f7ceef7b1d1
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description: 
    14  * Description: MMF Adaptation Context 
    15 *
    15  *
    16 */
    16  */
    17 
    17 
    18 #include <assert.h>
    18 #include <assert.h>
    19 #include <string.h>
    19 #include <string.h>
    20 #include "xaadaptationmmf.h"
    20 #include "xaadaptationmmf.h"
    21 #include "xaadaptationmmf.h"
    21 #include "xaadaptationmmf.h"
    25 /*
    25 /*
    26  * XAAdaptationBaseCtx* XAAdaptationBase_Create()
    26  * XAAdaptationBaseCtx* XAAdaptationBase_Create()
    27  * 1st phase initialization function for Adaptation Base context structure.
    27  * 1st phase initialization function for Adaptation Base context structure.
    28  * Reserves memory for base context and initializes GStreamer FW.
    28  * Reserves memory for base context and initializes GStreamer FW.
    29  */
    29  */
    30 XAresult XAAdaptationBaseMMF_Init( XAAdaptationMMFCtx* pSelf, XAuint32 ctxId )
    30 XAresult XAAdaptationBaseMMF_Init(XAAdaptationMMFCtx* pSelf, XAuint32 ctxId)
    31 {
    31     {
    32     DEBUG_API("->XAAdaptationBase_Init");
    32     DEBUG_API("->XAAdaptationBase_Init");
    33 
    33 
    34     if ( pSelf )
    34     if (pSelf)
    35     {
       
    36     if(XAAdaptationBase_Init(&(pSelf->baseObj), ctxId) != XA_RESULT_SUCCESS)
       
    37         {
    35         {
    38         DEBUG_ERR("Failed to init base context!!!");
    36         if (XAAdaptationBase_Init(&(pSelf->baseObj), ctxId)
    39         free(pSelf);
    37                 != XA_RESULT_SUCCESS)
    40         pSelf = NULL;
    38             {
       
    39             DEBUG_ERR("Failed to init base context!!!");
       
    40             free(pSelf);
       
    41             pSelf = NULL;
       
    42             DEBUG_API("<-XAAdaptationBase_Init");
       
    43             return XA_RESULT_MEMORY_FAILURE;
       
    44             }
    41         }
    45         }
    42     }
       
    43     else
    46     else
    44     {
    47         {
    45         DEBUG_ERR("Invalid Adaptation Base Context.")
    48         DEBUG_ERR("Invalid Adaptation Base Context.")
    46         return XA_RESULT_PARAMETER_INVALID;
    49         return XA_RESULT_PARAMETER_INVALID;
    47     }
    50         }
    48 
    51 
    49     DEBUG_API("<-XAAdaptationBase_Init");
    52     DEBUG_API("<-XAAdaptationBase_Init");
    50     return XA_RESULT_SUCCESS;
    53     return XA_RESULT_SUCCESS;
    51 }
    54     }
    52 
    55 
    53 /*
    56 /*
    54  * XAresult XAAdaptationBase_PostInit()
    57  * XAresult XAAdaptationBase_PostInit()
    55  * 2nd phase initialization for Adaptation Base.
    58  * 2nd phase initialization for Adaptation Base.
    56  */
    59  */
    57 XAresult XAAdaptationBaseMMF_PostInit( XAAdaptationMMFCtx* ctx )
    60 XAresult XAAdaptationBaseMMF_PostInit(XAAdaptationMMFCtx* ctx)
    58 {
    61     {
    59     XAresult ret = XA_RESULT_SUCCESS;
    62     XAresult ret = XA_RESULT_SUCCESS;
    60     DEBUG_API("->XAAdaptationBase_PostInit");
    63     DEBUG_API("->XAAdaptationBase_PostInit");
    61 
    64     if(ctx)
    62    XAAdaptationBase_PostInit(&ctx->baseObj);
    65         {
    63 
    66         ret = XAAdaptationBase_PostInit(&ctx->baseObj);
       
    67         }
       
    68     else
       
    69         {
       
    70         ret = XA_RESULT_PARAMETER_INVALID;
       
    71         }
    64     DEBUG_API("<-XAAdaptationBase_PostInit");
    72     DEBUG_API("<-XAAdaptationBase_PostInit");
    65     return ret;
    73     return ret;
    66 }
    74     }
    67 
    75 
    68 /*
    76 /*
    69  * void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx )
    77  * void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx )
    70  * Frees all Base context variables .
    78  * Frees all Base context variables .
    71  */
    79  */
    72 void XAAdaptationBaseMMF_Free( XAAdaptationMMFCtx* ctx )
    80 void XAAdaptationBaseMMF_Free(XAAdaptationMMFCtx* ctx)
    73 {
    81     {
    74     DEBUG_API("->XAAdaptationBaseMMF_Free");
    82     DEBUG_API("->XAAdaptationBaseMMF_Free");
    75     XAAdaptationBase_Free(&ctx->baseObj);
    83     if(ctx)
       
    84         {
       
    85         XAAdaptationBase_Free(&ctx->baseObj);
       
    86         }
    76     DEBUG_API("<-XAAdaptationBaseMMF_Free");
    87     DEBUG_API("<-XAAdaptationBaseMMF_Free");
    77 }
    88     }
    78 
    89 
    79