mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxalstrminfoitftests.cpp
changeset 53 eabc8c503852
parent 25 6f7ceef7b1d1
equal deleted inserted replaced
48:a493a607b5bf 53:eabc8c503852
    17 
    17 
    18 // [INCLUDE FILES] - do not remove
    18 // [INCLUDE FILES] - do not remove
    19 #include <e32svr.h>
    19 #include <e32svr.h>
    20 #include <StifParser.h>
    20 #include <StifParser.h>
    21 #include <StifTestInterface.h>
    21 #include <StifTestInterface.h>
       
    22 #include <StifTestEventInterface.h>
    22 #include "openmaxaltestmodule.h"
    23 #include "openmaxaltestmodule.h"
    23 
    24 
    24 // EXTERNAL DATA STRUCTURES
    25 // EXTERNAL DATA STRUCTURES
    25 //extern  ?external_data;
    26 //extern  ?external_data;
    26 
    27 
   199         status = KErrGeneral;
   200         status = KErrGeneral;
   200         }
   201         }
   201     return status;       
   202     return status;       
   202     }
   203     }
   203 
   204 
   204 TInt COpenMAXALTestModule::al_strminfoitf_RegisterStreamChangeCallback( CStifItemParser& /*aItem*/ )
   205 TInt COpenMAXALTestModule::al_strminfoitf_RegisterStreamChangeCallback( CStifItemParser& aItem )
   205     {
   206     {
   206     TInt status(KErrNone);
   207     TInt status(KErrNone);
   207     XAresult res;
   208     XAresult res;
       
   209 		
       
   210 		TInt expectedIndex = -1;
       
   211     status = aItem.GetNextInt(expectedIndex);
       
   212     if(status==KErrNone)
       
   213     {
       
   214     	iStreamInfoItfIndex = expectedIndex; //reset expected event
       
   215     }
       
   216     else
       
   217     {
       
   218     	iStreamInfoItfIndex = -1;
       
   219     	status = KErrNone;
       
   220     }
       
   221 
   208     if(m_StrInfoItf)
   222     if(m_StrInfoItf)
   209         {
   223         {
   210         res = (*m_StrInfoItf)->RegisterStreamChangeCallback(m_StrInfoItf,StreamEventChangeCallback,(void*)this);
   224         res = (*m_StrInfoItf)->RegisterStreamChangeCallback(m_StrInfoItf,StreamEventChangeCallback,(void*)this);
   211         status = res;
   225         status = res;
   212         }
   226         }
   283         {
   297         {
   284         status = KErrNotFound;
   298         status = KErrNotFound;
   285         }
   299         }
   286     return status;          
   300     return status;          
   287     }
   301     }
       
   302 
       
   303 void COpenMAXALTestModule::HandleStreamInfoItfCallback( XAStreamInformationItf /*caller*/, XAuint32 event, XAuint32 streamIndex )
       
   304 {
       
   305     switch (event)
       
   306     {
       
   307         case XA_STREAMCBEVENT_PROPERTYCHANGE:
       
   308         {
       
   309         		if((iStreamInfoItfIndex == -1) || (iStreamInfoItfIndex == streamIndex))
       
   310         		{
       
   311             	TEventIf event( TEventIf::ESetEvent, _L("Event_XA_STREAMCBEVENT_PROPERTYCHANGE") );
       
   312             	TestModuleIf().Event( event );
       
   313         		}
       
   314         }
       
   315         break;
       
   316        
       
   317         default:
       
   318             break;
       
   319     }
       
   320 }
       
   321 
       
   322 TInt COpenMAXALTestModule::al_strminfoitf_SetStreamInfoIndex(CStifItemParser& aItem)
       
   323 {
       
   324 		TInt status(KErrNone);
       
   325     TInt streamindex(0);
       
   326  
       
   327     status = aItem.GetNextInt(streamindex);
       
   328     RET_ERR_IF_ERR(status);
       
   329 		iStreamInfoItfIndex = streamindex;
       
   330 		return status;
       
   331 }
   288 
   332 
   289 void StreamEventChangeCallback (
   333 void StreamEventChangeCallback (
   290         XAStreamInformationItf caller,
   334         XAStreamInformationItf caller,
   291         XAuint32 eventId,
   335         XAuint32 eventId,
   292         XAuint32 streamIndex,
   336         XAuint32 streamIndex,
   293         void * pEventData,
   337         void * pEventData,
   294         void * pContext
   338         void * pContext
   295 )
   339 )
   296     {
   340 {
   297     
   341     if (pContext)
   298     }
   342     {
       
   343     	((COpenMAXALTestModule*)pContext)->HandleStreamInfoItfCallback(caller, eventId, streamIndex);
       
   344     }
       
   345 }