khronosfws/openmax_al/src/common/xastreaminformationitf.c
changeset 25 6f7ceef7b1d1
parent 19 4a629bc82c5e
child 33 5e8b14bae8c3
equal deleted inserted replaced
21:2ed61feeead6 25:6f7ceef7b1d1
     1 /**
     1 /*
     2  * src\common\XAStreamInformationItf.c
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3  * Part of OpenMAX AL Implementation
     3  * All rights reserved.
     4  * Copyright (c) 2009 Nokia Inc.
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     5  *
     8  *
     6  * This file contains implementation of XAStreamInformationItf
     9  * Initial Contributors:
     7  **/
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Stream Information Interface Implementation
       
    15  *
       
    16  */
     8 
    17 
     9 #include <assert.h>
    18 #include <assert.h>
    10 
    19 
    11 #include "xastreaminformationitf.h"
    20 #include "xastreaminformationitf.h"
    12 #include "xastreaminformationitfadaptation.h"
    21 #include "xastreaminformationitfadaptation.h"
    14 
    23 
    15 /* XAStreamInformationItfImpl* GetImpl
    24 /* XAStreamInformationItfImpl* GetImpl
    16  * Description: Validate interface pointer and cast it to implementation pointer.
    25  * Description: Validate interface pointer and cast it to implementation pointer.
    17  */
    26  */
    18 static XAStreamInformationItfImpl* GetImpl(XAStreamInformationItf self)
    27 static XAStreamInformationItfImpl* GetImpl(XAStreamInformationItf self)
    19 {
    28     {
    20     if(self)
    29     if (self)
    21     {
    30         {
    22         XAStreamInformationItfImpl* impl = (XAStreamInformationItfImpl*)(*self);
    31         XAStreamInformationItfImpl* impl =
    23         if(impl && impl == impl->self)
    32                 (XAStreamInformationItfImpl*) (*self);
    24         {
    33         if (impl && impl == impl->self)
       
    34             {
    25             return impl;
    35             return impl;
    26         }
    36             }
    27     }
    37         }
    28     return NULL;
    38     return NULL;
    29 }
    39     }
    30 
    40 
    31 /**
    41 /**
    32  * Base interface XAPlayItf implementation
    42  * Base interface XAPlayItf implementation
    33  */
    43  */
    34 
    44 
    35 
       
    36 XAresult XAStreamInformationItfImpl_QueryMediaContainerInformation(
    45 XAresult XAStreamInformationItfImpl_QueryMediaContainerInformation(
    37                 XAStreamInformationItf self,
    46         XAStreamInformationItf self, XAMediaContainerInformation * info)
    38                 XAMediaContainerInformation * info)
    47     {
    39 {
       
    40     XAresult ret = XA_RESULT_SUCCESS;
    48     XAresult ret = XA_RESULT_SUCCESS;
    41     XAStreamInformationItfImpl* impl = GetImpl(self);
    49     XAStreamInformationItfImpl* impl = GetImpl(self);
    42     DEBUG_API("->XAStreamInformationItfImpl_QueryMediaContainerInformation");
    50     DEBUG_API("->XAStreamInformationItfImpl_QueryMediaContainerInformation");
    43     if(!impl || !info)
    51     if (!impl || !info || !impl->adapCtx)
    44     {
    52         {
    45         /* invalid parameter */
    53         /* invalid parameter */
    46         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    54         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    47         DEBUG_API("-<XAStreamInformationItfImpl_QueryMediaContainerInformation");
    55         DEBUG_API("-<XAStreamInformationItfImpl_QueryMediaContainerInformation");
    48         return XA_RESULT_PARAMETER_INVALID;
    56         return XA_RESULT_PARAMETER_INVALID;
    49     }
    57         }
    50 
    58 
    51 
    59     if (impl->adapCtx->fwtype == FWMgrFWGST)
    52     if(impl->adapCtx->fwtype == FWMgrFWGST)
    60         {
    53         {
    61         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
    54         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
    62         if (ret == XA_RESULT_PARAMETER_INVALID)
    55         if( ret == XA_RESULT_PARAMETER_INVALID )
    63             {
    56         {
       
    57             DEBUG_API("<-XAStreamInformationItfImpl_QueryMediaContainerInformation");
    64             DEBUG_API("<-XAStreamInformationItfImpl_QueryMediaContainerInformation");
    58             return ret;
    65             return ret;
    59         }
    66             }
    60         ret = XAStreamInformationItfAdapt_QueryMediaContainerInformation(
    67         ret = XAStreamInformationItfAdapt_QueryMediaContainerInformation(
    61                     impl->adapCtx,
    68                 impl->adapCtx, &(info->containerType),
    62                     &(info->containerType),
    69                 &(info->mediaDuration), &(info->numStreams));
    63                     &(info->mediaDuration),
    70         XAAdaptationBase_ThreadExit(impl->adapCtx);
    64                     &(info->numStreams));
    71         }
    65         XAAdaptationBase_ThreadExit(impl->adapCtx);
    72     else
    66         }
    73         {
    67     else
    74         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
    68         {
    75         if (ret == XA_RESULT_PARAMETER_INVALID)
    69         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
    76             {
    70         if( ret == XA_RESULT_PARAMETER_INVALID )
       
    71         {
       
    72             DEBUG_API("<-XAStreamInformationItfImpl_QueryMediaContainerInformation");
    77             DEBUG_API("<-XAStreamInformationItfImpl_QueryMediaContainerInformation");
    73             return ret;
    78             return ret;
    74         }
    79             }
    75         ret = XAStreamInformationItfAdaptMMF_QueryMediaContainerInformation(
    80         ret = XAStreamInformationItfAdaptMMF_QueryMediaContainerInformation(
    76                     impl->adapCtx,
    81                 impl->adapCtx, &(info->containerType),
    77                     &(info->containerType),
    82                 &(info->mediaDuration), &(info->numStreams));
    78                     &(info->mediaDuration),
    83         XAAdaptationBase_ThreadExit(impl->adapCtx);
    79                     &(info->numStreams));
    84         ;
    80         XAAdaptationBase_ThreadExit(impl->adapCtx);;
       
    81         }
    85         }
    82 
    86 
    83     DEBUG_API("-<XAStreamInformationItfImpl_QueryMediaContainerInformation");
    87     DEBUG_API("-<XAStreamInformationItfImpl_QueryMediaContainerInformation");
    84     return ret;
    88     return ret;
    85 }
    89     }
    86 
    90 
    87 XAresult XAStreamInformationItfImpl_QueryStreamType(
    91 XAresult XAStreamInformationItfImpl_QueryStreamType(
    88                 XAStreamInformationItf self,
    92         XAStreamInformationItf self, XAuint32 streamIndex, XAuint32 *domain)
    89                 XAuint32 streamIndex, 
    93     {
    90                 XAuint32 *domain)
       
    91 {
       
    92     XAresult ret = XA_RESULT_SUCCESS;
    94     XAresult ret = XA_RESULT_SUCCESS;
    93     XAStreamInformationItfImpl* impl = GetImpl(self);
    95     XAStreamInformationItfImpl* impl = GetImpl(self);
    94     DEBUG_API("->XAStreamInformationItfImpl_QueryStreamType");
    96     DEBUG_API("->XAStreamInformationItfImpl_QueryStreamType");
    95     if(!impl || !domain || (streamIndex == 0))
    97     if (!impl || !domain || (streamIndex == 0) || !impl->adapCtx)
    96     {
    98         {
    97         /* invalid parameter */
    99         /* invalid parameter */
    98         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   100         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    99         DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamType");
   101         DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamType");
   100         return XA_RESULT_PARAMETER_INVALID;
   102         return XA_RESULT_PARAMETER_INVALID;
   101     }
   103         }
   102     if(impl->adapCtx->fwtype == FWMgrFWGST)
   104     if (impl->adapCtx->fwtype == FWMgrFWGST)
   103         {
   105         {
   104         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   106         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   105         if( ret == XA_RESULT_PARAMETER_INVALID )
   107         if (ret == XA_RESULT_PARAMETER_INVALID)
   106         {
   108             {
   107             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamType");
   109             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamType");
   108             return ret;
   110             return ret;
   109         }
   111             }
   110     
   112 
   111         ret = XAStreamInformationItfAdapt_QueryStreamType(
   113         ret = XAStreamInformationItfAdapt_QueryStreamType(impl->adapCtx,
   112                     impl->adapCtx,
   114                 streamIndex, domain);
   113                     streamIndex,
   115 
   114                     domain);
   116         XAAdaptationBase_ThreadExit(impl->adapCtx);
   115     
   117         }
   116         XAAdaptationBase_ThreadExit(impl->adapCtx);
   118     else
   117         }
   119         {
   118     else
   120         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   119         {
   121         if (ret == XA_RESULT_PARAMETER_INVALID)
   120         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   122             {
   121         if( ret == XA_RESULT_PARAMETER_INVALID )
       
   122         {
       
   123             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamType");
   123             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamType");
   124             return ret;
   124             return ret;
   125         }
   125             }
   126     
   126 
   127         ret = XAStreamInformationItfAdaptMMF_QueryStreamType(
   127         ret = XAStreamInformationItfAdaptMMF_QueryStreamType(impl->adapCtx,
   128                     impl->adapCtx,
   128                 streamIndex, domain);
   129                     streamIndex,
   129 
   130                     domain);
   130         XAAdaptationBase_ThreadExit(impl->adapCtx);
   131     
   131         ;
   132         XAAdaptationBase_ThreadExit(impl->adapCtx);;
   132         }DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamType");
   133         }
   133     return ret;
   134     DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamType");
   134     }
   135     return ret;
       
   136 }
       
   137 
   135 
   138 XAresult XAStreamInformationItfImpl_QueryStreamInformation(
   136 XAresult XAStreamInformationItfImpl_QueryStreamInformation(
   139                 XAStreamInformationItf self, 
   137         XAStreamInformationItf self, XAuint32 streamIndex, void * info)
   140                 XAuint32 streamIndex,
   138     {
   141                 void * info)
       
   142 {
       
   143     XAresult ret = XA_RESULT_SUCCESS;
   139     XAresult ret = XA_RESULT_SUCCESS;
   144     XAStreamInformationItfImpl* impl = GetImpl(self);
   140     XAStreamInformationItfImpl* impl = GetImpl(self);
   145     DEBUG_API("->XAStreamInformationItfImpl_QueryStreamInformation");
   141     DEBUG_API("->XAStreamInformationItfImpl_QueryStreamInformation");
   146     if(!impl || !info || (streamIndex == 0))
   142     if (!impl || !info || (streamIndex == 0) || !impl->adapCtx)
   147     {
   143         {
   148         /* invalid parameter */
   144         /* invalid parameter */
   149         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   145         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   150         DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamInformation");
   146         DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamInformation");
   151         return XA_RESULT_PARAMETER_INVALID;
   147         return XA_RESULT_PARAMETER_INVALID;
   152     }
   148         }
   153 
   149 
   154     if(impl->adapCtx->fwtype == FWMgrFWGST)
   150     if (impl->adapCtx->fwtype == FWMgrFWGST)
   155         {
   151         {
   156         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   152         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   157         if( ret == XA_RESULT_PARAMETER_INVALID )
   153         if (ret == XA_RESULT_PARAMETER_INVALID)
   158         {
   154             {
   159             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamInformation");
   155             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamInformation");
   160             return ret;
   156             return ret;
   161         }
   157             }
   162     
   158 
   163         ret = XAStreamInformationItfAdapt_QueryStreamInformation(
   159         ret = XAStreamInformationItfAdapt_QueryStreamInformation(
   164                     impl->adapCtx,
   160                 impl->adapCtx, streamIndex, info);
   165                     streamIndex,
   161 
   166                     info);
   162         XAAdaptationBase_ThreadExit(impl->adapCtx);
   167     
   163         }
   168         XAAdaptationBase_ThreadExit(impl->adapCtx);
   164     else
   169         }
   165         {
   170     else
   166         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   171         {
   167         if (ret == XA_RESULT_PARAMETER_INVALID)
   172         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   168             {
   173         if( ret == XA_RESULT_PARAMETER_INVALID )
       
   174         {
       
   175             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamInformation");
   169             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamInformation");
   176             return ret;
   170             return ret;
   177         }
   171             }
   178     
   172 
   179         ret = XAStreamInformationItfAdaptMMF_QueryStreamInformation(
   173         ret = XAStreamInformationItfAdaptMMF_QueryStreamInformation(
   180                     impl->adapCtx,
   174                 impl->adapCtx, streamIndex, info);
   181                     streamIndex,
   175 
   182                     info);
   176         XAAdaptationBase_ThreadExit(impl->adapCtx);
   183     
   177         ;
   184         XAAdaptationBase_ThreadExit(impl->adapCtx);;
       
   185         }
   178         }
   186 
   179 
   187     DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamInformation");
   180     DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamInformation");
   188     return ret;
   181     return ret;
   189 }
   182     }
   190 
   183 
   191 XAresult XAStreamInformationItfImpl_QueryStreamName(
   184 XAresult XAStreamInformationItfImpl_QueryStreamName(
   192                 XAStreamInformationItf self, 
   185         XAStreamInformationItf self, XAuint32 streamIndex,
   193                 XAuint32 streamIndex, 
   186         XAuint16 * pNameSize, XAchar * pName)
   194                 XAuint16 * pNameSize,
   187     {
   195                 XAchar * pName)
       
   196 {
       
   197     XAresult ret = XA_RESULT_SUCCESS;
   188     XAresult ret = XA_RESULT_SUCCESS;
   198     XAStreamInformationItfImpl* impl = GetImpl(self);
   189     XAStreamInformationItfImpl* impl = GetImpl(self);
   199     DEBUG_API("->XAStreamInformationItfImpl_QueryStreamName");
   190     DEBUG_API("->XAStreamInformationItfImpl_QueryStreamName");
   200     if(!impl || (streamIndex == 0) || !pNameSize)
   191     if (!impl || (streamIndex == 0) || !pNameSize || !impl->adapCtx)
   201     {
   192         {
   202         /* invalid parameter */
   193         /* invalid parameter */
   203         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   194         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   204         DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamName");
   195         DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamName");
   205         return XA_RESULT_PARAMETER_INVALID;
   196         return XA_RESULT_PARAMETER_INVALID;
   206     }
   197         }
   207 
   198 
   208     if(impl->adapCtx->fwtype == FWMgrFWGST)
   199     if (impl->adapCtx->fwtype == FWMgrFWGST)
   209         {
   200         {
   210         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   201         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   211         if( ret == XA_RESULT_PARAMETER_INVALID )
   202         if (ret == XA_RESULT_PARAMETER_INVALID)
   212         {
   203             {
   213             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamName");
   204             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamName");
   214             return ret;
   205             return ret;
   215         }
   206             }
   216     
   207 
   217         ret = XAStreamInformationItfAdapt_QueryStreamName(
   208         ret = XAStreamInformationItfAdapt_QueryStreamName(impl->adapCtx,
   218                     impl->adapCtx,
   209                 streamIndex, pNameSize, pName);
   219                     streamIndex,
   210 
   220                     pNameSize,
   211         XAAdaptationBase_ThreadExit(impl->adapCtx);
   221                     pName);
   212         }
   222     
   213     else
   223         XAAdaptationBase_ThreadExit(impl->adapCtx);
   214         {
   224         }
   215         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   225     else
   216         if (ret == XA_RESULT_PARAMETER_INVALID)
   226         {
   217             {
   227         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
       
   228         if( ret == XA_RESULT_PARAMETER_INVALID )
       
   229         {
       
   230             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamName");
   218             DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamName");
   231             return ret;
   219             return ret;
   232         }
   220             }
   233     
   221 
   234         ret = XAStreamInformationItfAdaptMMF_QueryStreamName(
   222         ret = XAStreamInformationItfAdaptMMF_QueryStreamName(impl->adapCtx,
   235                     impl->adapCtx,
   223                 streamIndex, pNameSize, pName);
   236                     streamIndex,
   224 
   237                     pNameSize,
   225         XAAdaptationBase_ThreadExit(impl->adapCtx);
   238                     pName);
   226         ;
   239     
   227         }DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamName");
   240         XAAdaptationBase_ThreadExit(impl->adapCtx);;
   228     return ret;
   241         }
   229     }
   242     DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamName");
       
   243     return ret;
       
   244 }
       
   245 
   230 
   246 XAresult XAStreamInformationItfImpl_RegisterStreamChangeCallback(
   231 XAresult XAStreamInformationItfImpl_RegisterStreamChangeCallback(
   247                 XAStreamInformationItf self,
   232         XAStreamInformationItf self, xaStreamEventChangeCallback callback,
   248                 xaStreamEventChangeCallback callback,
   233         void * pContext)
   249                 void * pContext)
   234     {
   250 {
       
   251     XAresult ret = XA_RESULT_SUCCESS;
   235     XAresult ret = XA_RESULT_SUCCESS;
   252     XAStreamInformationItfImpl* impl = GetImpl(self);
   236     XAStreamInformationItfImpl* impl = GetImpl(self);
   253     DEBUG_API("->XAStreamInformationItfImpl_RegisterStreamChangeCallback");
   237     DEBUG_API("->XAStreamInformationItfImpl_RegisterStreamChangeCallback");
   254     if(!impl)
   238     if (!impl)
   255     {
   239         {
   256         /* invalid parameter */
   240         /* invalid parameter */
   257         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   241         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   258         DEBUG_API("-<XAStreamInformationItfImpl_RegisterStreamChangeCallback");
   242         DEBUG_API("-<XAStreamInformationItfImpl_RegisterStreamChangeCallback");
   259         return XA_RESULT_PARAMETER_INVALID;
   243         return XA_RESULT_PARAMETER_INVALID;
   260     }
   244         }
   261 
   245 
   262     /* callback may be NULL (to remove callback) */
   246     /* callback may be NULL (to remove callback) */
   263     impl->callback = callback;
   247     impl->callback = callback;
   264     impl->cbcontext = pContext;
   248     impl->cbcontext = pContext;
   265     impl->cbPtrToSelf = self;
   249     impl->cbPtrToSelf = self;
   266 
   250 
   267     DEBUG_API("-<XAStreamInformationItfImpl_RegisterStreamChangeCallback");
   251     DEBUG_API("-<XAStreamInformationItfImpl_RegisterStreamChangeCallback");
   268     return ret;
   252     return ret;
   269 }
   253     }
   270 
   254 
   271 XAresult XAStreamInformationItfImpl_QueryActiveStreams(
   255 XAresult XAStreamInformationItfImpl_QueryActiveStreams(
   272                 XAStreamInformationItf self,
   256         XAStreamInformationItf self, XAuint32 *numStreams,
   273                 XAuint32 *numStreams,
   257         XAboolean *activeStreams)
   274                 XAboolean *activeStreams)
   258     {
   275 {
       
   276     XAresult ret = XA_RESULT_SUCCESS;
   259     XAresult ret = XA_RESULT_SUCCESS;
   277     XAStreamInformationItfImpl* impl = GetImpl(self);
   260     XAStreamInformationItfImpl* impl = GetImpl(self);
   278     DEBUG_API("->XAStreamInformationItfImpl_QueryActiveStreams");
   261     DEBUG_API("->XAStreamInformationItfImpl_QueryActiveStreams");
   279     if(!impl || !numStreams)
   262     if (!impl || !numStreams || !impl->adapCtx)
   280     {
   263         {
   281         /* invalid parameter */
   264         /* invalid parameter */
   282         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   265         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   283         DEBUG_API("-<XAStreamInformationItfImpl_QueryActiveStreams");
   266         DEBUG_API("-<XAStreamInformationItfImpl_QueryActiveStreams");
   284         return XA_RESULT_PARAMETER_INVALID;
   267         return XA_RESULT_PARAMETER_INVALID;
   285     }
   268         }
   286 
   269 
   287     if(impl->adapCtx->fwtype == FWMgrFWGST)
   270     if (impl->adapCtx->fwtype == FWMgrFWGST)
   288         {    
   271         {
   289         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   272         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   290         if( ret == XA_RESULT_PARAMETER_INVALID )
   273         if (ret == XA_RESULT_PARAMETER_INVALID)
   291         {
   274             {
   292             DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams");
   275             DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams");
   293             return ret;
   276             return ret;
   294         }
   277             }
   295     
   278 
   296         ret = XAStreamInformationItfAdapt_QueryActiveStreams(
   279         ret = XAStreamInformationItfAdapt_QueryActiveStreams(impl->adapCtx,
   297                     impl->adapCtx,
   280                 numStreams, activeStreams);
   298                     numStreams,
   281 
   299                     activeStreams);
   282         XAAdaptationBase_ThreadExit(impl->adapCtx);
   300     
   283         }
   301         XAAdaptationBase_ThreadExit(impl->adapCtx);
   284     else
   302         }
   285         {
   303     else
   286         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   304         {
   287         if (ret == XA_RESULT_PARAMETER_INVALID)
   305         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   288             {
   306         if( ret == XA_RESULT_PARAMETER_INVALID )
       
   307         {
       
   308             DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams");
   289             DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams");
   309             return ret;
   290             return ret;
   310         }
   291             }
   311     
   292 
   312         ret = XAStreamInformationItfAdaptMMF_QueryActiveStreams(
   293         ret = XAStreamInformationItfAdaptMMF_QueryActiveStreams(
   313                     impl->adapCtx,
   294                 impl->adapCtx, numStreams, activeStreams);
   314                     numStreams,
   295 
   315                     activeStreams);
   296         XAAdaptationBase_ThreadExit(impl->adapCtx);
   316     
   297         ;
   317         XAAdaptationBase_ThreadExit(impl->adapCtx);;
       
   318         }
   298         }
   319 
   299 
   320     DEBUG_API("-<XAStreamInformationItfImpl_QueryActiveStreams");
   300     DEBUG_API("-<XAStreamInformationItfImpl_QueryActiveStreams");
   321     return ret;
   301     return ret;
   322 }
   302     }
   323 
   303 
   324 XAresult XAStreamInformationItfImpl_SetActiveStream(
   304 XAresult XAStreamInformationItfImpl_SetActiveStream(
   325                 XAStreamInformationItf self, 
   305         XAStreamInformationItf self, XAuint32 streamNum, XAboolean active,
   326                 XAuint32 streamNum,
   306         XAboolean commitNow)
   327                 XAboolean active, 
   307     {
   328                 XAboolean commitNow)
       
   329 {
       
   330     XAresult ret = XA_RESULT_SUCCESS;
   308     XAresult ret = XA_RESULT_SUCCESS;
   331     XAStreamInformationItfImpl* impl = GetImpl(self);
   309     XAStreamInformationItfImpl* impl = GetImpl(self);
   332     DEBUG_API("->XAStreamInformationItfImpl_SetActiveStream");
   310     DEBUG_API("->XAStreamInformationItfImpl_SetActiveStream");
   333     if(!impl)
   311     if (!impl || !impl->adapCtx)
   334     {
   312         {
   335         /* invalid parameter */
   313         /* invalid parameter */
   336         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   314         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   337         DEBUG_API("-<XAStreamInformationItfImpl_SetActiveStream");
   315         DEBUG_API("-<XAStreamInformationItfImpl_SetActiveStream");
   338         return XA_RESULT_PARAMETER_INVALID;
   316         return XA_RESULT_PARAMETER_INVALID;
   339     }
   317         }
   340 
   318 
   341     if(impl->adapCtx->fwtype == FWMgrFWGST)
   319     if (impl->adapCtx->fwtype == FWMgrFWGST)
   342         {      
   320         {
   343         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   321         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   344         if( ret == XA_RESULT_PARAMETER_INVALID )
   322         if (ret == XA_RESULT_PARAMETER_INVALID)
   345         {
   323             {
   346             DEBUG_API("<-XAStreamInformationItfImpl_SetActiveStream");
   324             DEBUG_API("<-XAStreamInformationItfImpl_SetActiveStream");
   347             return ret;
   325             return ret;
   348         }
   326             }
   349     
   327 
   350         ret = XAStreamInformationItfAdapt_SetActiveStream(
   328         ret = XAStreamInformationItfAdapt_SetActiveStream(impl->adapCtx,
   351                     impl->adapCtx,
   329                 streamNum, active, commitNow);
   352                     streamNum,
   330 
   353                     active, 
   331         XAAdaptationBase_ThreadExit(impl->adapCtx);
   354                     commitNow);
   332         }
   355     
   333     else
   356         XAAdaptationBase_ThreadExit(impl->adapCtx);
   334         {
   357         }
   335         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   358     else
   336         if (ret == XA_RESULT_PARAMETER_INVALID)
   359         {
   337             {
   360         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
       
   361         if( ret == XA_RESULT_PARAMETER_INVALID )
       
   362         {
       
   363             DEBUG_API("<-XAStreamInformationItfImpl_SetActiveStream");
   338             DEBUG_API("<-XAStreamInformationItfImpl_SetActiveStream");
   364             return ret;
   339             return ret;
   365         }
   340             }
   366     
   341 
   367         ret = XAStreamInformationItfAdaptMMF_SetActiveStream(
   342         ret = XAStreamInformationItfAdaptMMF_SetActiveStream(impl->adapCtx,
   368                     impl->adapCtx,
   343                 streamNum, active, commitNow);
   369                     streamNum,
   344 
   370                     active, 
   345         XAAdaptationBase_ThreadExit(impl->adapCtx);
   371                     commitNow);
   346         ;
   372     
       
   373         XAAdaptationBase_ThreadExit(impl->adapCtx);;
       
   374         }
   347         }
   375 
   348 
   376     DEBUG_API("-<XAStreamInformationItfImpl_SetActiveStream");
   349     DEBUG_API("-<XAStreamInformationItfImpl_SetActiveStream");
   377     return ret;
   350     return ret;
   378 }
   351     }
   379 
   352 
   380 /**
   353 /**
   381  * XAStreamInformationItfImpl -specific methods
   354  * XAStreamInformationItfImpl -specific methods
   382  **/
   355  **/
   383 
   356 
   384 /**
   357 /**
   385  * XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create()
   358  * XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create()
   386  * Description: Allocate and initialize PlayItfImpl
   359  * Description: Allocate and initialize PlayItfImpl
   387  **/
   360  **/
   388 XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create( XAAdaptationBaseCtx *adapCtx )
   361 XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create(
   389 {
   362         XAAdaptationBaseCtx *adapCtx)
       
   363     {
   390     XAStreamInformationItfImpl *self;
   364     XAStreamInformationItfImpl *self;
   391 
   365 
   392     DEBUG_API("->XAStreamInformationItfImpl_Create");
   366     DEBUG_API("->XAStreamInformationItfImpl_Create");
   393     self = (XAStreamInformationItfImpl*)calloc(1,sizeof(XAStreamInformationItfImpl));
   367     self = (XAStreamInformationItfImpl*) calloc(1,
   394     if(self)
   368             sizeof(XAStreamInformationItfImpl));
   395     {
   369     if (self)
       
   370         {
   396         /* init itf default implementation */
   371         /* init itf default implementation */
   397         self->itf.QueryMediaContainerInformation = XAStreamInformationItfImpl_QueryMediaContainerInformation;
   372         self->itf.QueryMediaContainerInformation
   398         self->itf.QueryStreamType = XAStreamInformationItfImpl_QueryStreamType;
   373                 = XAStreamInformationItfImpl_QueryMediaContainerInformation;
   399         self->itf.QueryStreamInformation = XAStreamInformationItfImpl_QueryStreamInformation;
   374         self->itf.QueryStreamType
   400         self->itf.QueryStreamName = XAStreamInformationItfImpl_QueryStreamName;
   375                 = XAStreamInformationItfImpl_QueryStreamType;
   401         self->itf.RegisterStreamChangeCallback = XAStreamInformationItfImpl_RegisterStreamChangeCallback;
   376         self->itf.QueryStreamInformation
   402         self->itf.QueryActiveStreams = XAStreamInformationItfImpl_QueryActiveStreams;
   377                 = XAStreamInformationItfImpl_QueryStreamInformation;
   403         self->itf.SetActiveStream = XAStreamInformationItfImpl_SetActiveStream;
   378         self->itf.QueryStreamName
       
   379                 = XAStreamInformationItfImpl_QueryStreamName;
       
   380         self->itf.RegisterStreamChangeCallback
       
   381                 = XAStreamInformationItfImpl_RegisterStreamChangeCallback;
       
   382         self->itf.QueryActiveStreams
       
   383                 = XAStreamInformationItfImpl_QueryActiveStreams;
       
   384         self->itf.SetActiveStream
       
   385                 = XAStreamInformationItfImpl_SetActiveStream;
   404 
   386 
   405         /* init variables */
   387         /* init variables */
   406         self->cbPtrToSelf = NULL;
   388         self->cbPtrToSelf = NULL;
   407         self->callback = NULL;
   389         self->callback = NULL;
   408         self->cbcontext = NULL;
   390         self->cbcontext = NULL;
   409         self->adapCtx = adapCtx;
   391         self->adapCtx = adapCtx;
   410 
   392 
   411         self->self = self;
   393         self->self = self;
   412     }
   394         }
   413 
   395 
   414     DEBUG_API("<-XAStreamInformationItfImpl_Create");
   396     DEBUG_API("<-XAStreamInformationItfImpl_Create");
   415     return self;
   397     return self;
   416 }
   398     }
   417 
   399 
   418 /* void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self)
   400 /* void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self)
   419  * Description: Free all resources reserved at XAStreamInformationItfImpl_Create
   401  * Description: Free all resources reserved at XAStreamInformationItfImpl_Create
   420  */
   402  */
   421 void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self)
   403 void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self)
   422 {
   404     {
   423     DEBUG_API("->XAStreamInformationItfImpl_Free");
   405     DEBUG_API("->XAStreamInformationItfImpl_Free");
   424     assert(self==self->self);
   406     assert(self==self->self);
   425     free(self);
   407     if(self)
       
   408         {
       
   409         free(self);
       
   410         }
   426     DEBUG_API("<-XAStreamInformationItfImpl_Free");
   411     DEBUG_API("<-XAStreamInformationItfImpl_Free");
   427 }
   412     }
   428 
   413 
   429