khronosfws/openmax_al/src/common/xadynamicsourceitf.c
changeset 25 6f7ceef7b1d1
parent 19 4a629bc82c5e
child 33 5e8b14bae8c3
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: Dynamic Source Interface Implementation
    15 *
    15  *
    16 */
    16  */
    17 
    17 
    18 #include <stdio.h>
    18 #include <stdio.h>
    19 #include <stdlib.h>
    19 #include <stdlib.h>
    20 #include <assert.h>
    20 #include <assert.h>
    21 #include "xadynamicsourceitf.h"
    21 #include "xadynamicsourceitf.h"
    22  
    22 
    23 #include "xadynamicsourceitfadaptation.h"
    23 #include "xadynamicsourceitfadaptation.h"
    24 #include "xadynamicsourceitfadaptationmmf.h"
    24 #include "xadynamicsourceitfadaptationmmf.h"
    25 
       
    26 
    25 
    27 /*****************************************************************************
    26 /*****************************************************************************
    28  * Base interface XADynamicSourceItf implementation
    27  * Base interface XADynamicSourceItf implementation
    29  *****************************************************************************/
    28  *****************************************************************************/
    30 
    29 
    31 /* XAResult XADynamicSourceItfImpl_SetSource
    30 /* XAResult XADynamicSourceItfImpl_SetSource
    32  * Description: Sets the data source for the object.
    31  * Description: Sets the data source for the object.
    33  */
    32  */
    34 XAresult XADynamicSourceItfImpl_SetSource(XADynamicSourceItf self,
    33 XAresult XADynamicSourceItfImpl_SetSource(XADynamicSourceItf self,
    35                                           XADataSource *pDataSource)
    34         XADataSource *pDataSource)
    36 {
    35     {
    37     XAresult res = XA_RESULT_SUCCESS;
    36     XAresult res = XA_RESULT_SUCCESS;
    38     XADynamicSourceItfImpl* impl = (XADynamicSourceItfImpl*)(*self);
    37     XADynamicSourceItfImpl* impl = (XADynamicSourceItfImpl*) (*self);
    39     DEBUG_API("->XADynamicSourceItfImpl_SetSource");
    38     DEBUG_API("->XADynamicSourceItfImpl_SetSource");
    40     /* check casting */
    39     /* check casting */
    41     if( !impl ||  impl != impl->self || !pDataSource )
    40     if (!impl || impl != impl->self || !pDataSource)
    42     {
    41         {
    43         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    42         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADynamicSourceItfImpl_SetSource");
    44         DEBUG_API("<-XADynamicSourceItfImpl_SetSource");
       
    45         return XA_RESULT_PARAMETER_INVALID;
    43         return XA_RESULT_PARAMETER_INVALID;
    46     }
    44         }
    47  
    45 
    48     if( !impl->adaptCtx )
    46     if (!impl->adaptCtx)
    49     {
    47         {
    50         DEBUG_ERR("Adaptation not ready!!");
    48         DEBUG_ERR("Adaptation not ready!!");DEBUG_ERR("XA_RESULT_INTERNAL_ERROR");DEBUG_API("<-XADynamicSourceItfImpl_SetSource");
    51         DEBUG_ERR("XA_RESULT_INTERNAL_ERROR");
       
    52         DEBUG_API("<-XADynamicSourceItfImpl_SetSource");
       
    53         res = XA_RESULT_INTERNAL_ERROR;
    49         res = XA_RESULT_INTERNAL_ERROR;
    54     }
    50         }
    55     else
    51     else
    56     {
       
    57         res = XACommon_CheckDataSource(pDataSource,NULL);
       
    58         if(res==XA_RESULT_SUCCESS)
       
    59         {
    52         {
    60             if(impl->adaptCtx->fwtype == FWMgrFWGST)
    53         res = XACommon_CheckDataSource(pDataSource, NULL);
       
    54         if (res == XA_RESULT_SUCCESS)
       
    55             {
       
    56             if (impl->adaptCtx->fwtype == FWMgrFWGST)
    61                 {
    57                 {
    62                 res = XADynamicSourceItfAdapt_SetSource((XAAdaptationGstCtx*)impl->adaptCtx, pDataSource );
    58                 res = XADynamicSourceItfAdapt_SetSource(
       
    59                         (XAAdaptationGstCtx*) impl->adaptCtx, pDataSource);
    63                 }
    60                 }
    64             else
    61             else
    65                 {
    62                 {
    66                 res = XADynamicSourceItfAdaptMMF_SetSource((XAAdaptationMMFCtx*)impl->adaptCtx, pDataSource );
    63                 res = XADynamicSourceItfAdaptMMF_SetSource(
       
    64                         (XAAdaptationMMFCtx*) impl->adaptCtx, pDataSource);
    67                 }
    65                 }
       
    66             }
    68         }
    67         }
    69     }
       
    70 
    68 
    71     DEBUG_API("<-XADynamicSourceItfImpl_SetSource");
    69     DEBUG_API("<-XADynamicSourceItfImpl_SetSource");
    72     return res;
    70     return res;
    73 }
    71     }
    74 
    72 
    75 /*****************************************************************************
    73 /*****************************************************************************
    76  * XADynamicSourceItfImpl -specific methods
    74  * XADynamicSourceItfImpl -specific methods
    77  *****************************************************************************/
    75  *****************************************************************************/
    78 
    76 
    79 /* XADynamicSourceItfImpl* XADynamicSourceItfImpl_Create()
    77 /* XADynamicSourceItfImpl* XADynamicSourceItfImpl_Create()
    80  * Description: Allocate and initialize DynamicSourceItfImpl
    78  * Description: Allocate and initialize DynamicSourceItfImpl
    81  */
    79  */
    82 XADynamicSourceItfImpl* XADynamicSourceItfImpl_Create( XAAdaptationBaseCtx *adaptCtx )
    80 XADynamicSourceItfImpl* XADynamicSourceItfImpl_Create(
    83 {
    81         XAAdaptationBaseCtx *adaptCtx)
    84     XADynamicSourceItfImpl* self = (XADynamicSourceItfImpl*)
    82     {
    85         calloc(1,sizeof(XADynamicSourceItfImpl));
    83     XADynamicSourceItfImpl* self = (XADynamicSourceItfImpl*) calloc(1,
    86     
    84             sizeof(XADynamicSourceItfImpl));
       
    85 
    87     DEBUG_API("->XADynamicSourceItfImpl_Create");
    86     DEBUG_API("->XADynamicSourceItfImpl_Create");
    88     if( self )
    87     if (self)
    89     {
    88         {
    90         /* init itf default implementation */
    89         /* init itf default implementation */
    91         self->itf.SetSource = XADynamicSourceItfImpl_SetSource;
    90         self->itf.SetSource = XADynamicSourceItfImpl_SetSource;
    92         /* init variables */
    91         /* init variables */
    93         self->adaptCtx = adaptCtx;
    92         self->adaptCtx = adaptCtx;
    94         self->self = self;
    93         self->self = self;
       
    94         }DEBUG_API("<-XADynamicSourceItfImpl_Create");
       
    95     return self;
    95     }
    96     }
    96     DEBUG_API("<-XADynamicSourceItfImpl_Create");
       
    97     return self;
       
    98 }
       
    99 
    97 
   100 /* void XADynamicSourceItfImpl_Free(XADynamicSourceItfImpl* self)
    98 /* void XADynamicSourceItfImpl_Free(XADynamicSourceItfImpl* self)
   101  * Description: Free all resources reserved at XADynamicSourceItfImpl_Create
    99  * Description: Free all resources reserved at XADynamicSourceItfImpl_Create
   102  */
   100  */
   103 void XADynamicSourceItfImpl_Free(XADynamicSourceItfImpl* self)
   101 void XADynamicSourceItfImpl_Free(XADynamicSourceItfImpl* self)
   104 {
   102     {
   105     DEBUG_API("->XADynamicSourceItfImpl_Free");
   103     DEBUG_API("->XADynamicSourceItfImpl_Free");
   106     assert( self==self->self );
   104     assert( self==self->self );
   107     free( self );
   105     free(self);
   108     DEBUG_API("<-XADynamicSourceItfImpl_Free");
   106     DEBUG_API("<-XADynamicSourceItfImpl_Free");
   109 }
   107     }
   110 
   108 
   111