khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.c
changeset 25 6f7ceef7b1d1
parent 19 4a629bc82c5e
child 53 eabc8c503852
--- a/khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.c	Fri May 28 19:26:28 2010 -0500
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.c	Fri Jun 11 19:59:23 2010 -0500
@@ -1,19 +1,19 @@
 /*
-* 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: 
-*
-*/
+ * 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: MMF Adaptation Context 
+ *
+ */
 
 #include <assert.h>
 #include <string.h>
@@ -27,53 +27,63 @@
  * 1st phase initialization function for Adaptation Base context structure.
  * Reserves memory for base context and initializes GStreamer FW.
  */
-XAresult XAAdaptationBaseMMF_Init( XAAdaptationMMFCtx* pSelf, XAuint32 ctxId )
-{
+XAresult XAAdaptationBaseMMF_Init(XAAdaptationMMFCtx* pSelf, XAuint32 ctxId)
+    {
     DEBUG_API("->XAAdaptationBase_Init");
 
-    if ( pSelf )
-    {
-    if(XAAdaptationBase_Init(&(pSelf->baseObj), ctxId) != XA_RESULT_SUCCESS)
+    if (pSelf)
         {
-        DEBUG_ERR("Failed to init base context!!!");
-        free(pSelf);
-        pSelf = NULL;
+        if (XAAdaptationBase_Init(&(pSelf->baseObj), ctxId)
+                != XA_RESULT_SUCCESS)
+            {
+            DEBUG_ERR("Failed to init base context!!!");
+            free(pSelf);
+            pSelf = NULL;
+            DEBUG_API("<-XAAdaptationBase_Init");
+            return XA_RESULT_MEMORY_FAILURE;
+            }
         }
-    }
     else
-    {
+        {
         DEBUG_ERR("Invalid Adaptation Base Context.")
         return XA_RESULT_PARAMETER_INVALID;
-    }
+        }
 
     DEBUG_API("<-XAAdaptationBase_Init");
     return XA_RESULT_SUCCESS;
-}
+    }
 
 /*
  * XAresult XAAdaptationBase_PostInit()
  * 2nd phase initialization for Adaptation Base.
  */
-XAresult XAAdaptationBaseMMF_PostInit( XAAdaptationMMFCtx* ctx )
-{
+XAresult XAAdaptationBaseMMF_PostInit(XAAdaptationMMFCtx* ctx)
+    {
     XAresult ret = XA_RESULT_SUCCESS;
     DEBUG_API("->XAAdaptationBase_PostInit");
-
-   XAAdaptationBase_PostInit(&ctx->baseObj);
-
+    if(ctx)
+        {
+        ret = XAAdaptationBase_PostInit(&ctx->baseObj);
+        }
+    else
+        {
+        ret = XA_RESULT_PARAMETER_INVALID;
+        }
     DEBUG_API("<-XAAdaptationBase_PostInit");
     return ret;
-}
+    }
 
 /*
  * void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx )
  * Frees all Base context variables .
  */
-void XAAdaptationBaseMMF_Free( XAAdaptationMMFCtx* ctx )
-{
+void XAAdaptationBaseMMF_Free(XAAdaptationMMFCtx* ctx)
+    {
     DEBUG_API("->XAAdaptationBaseMMF_Free");
-    XAAdaptationBase_Free(&ctx->baseObj);
+    if(ctx)
+        {
+        XAAdaptationBase_Free(&ctx->baseObj);
+        }
     DEBUG_API("<-XAAdaptationBaseMMF_Free");
-}
+    }
 
-