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