omxil/omxilcomponentcommon/src/common/omxilstate.h
changeset 0 40261b775718
child 16 eedf2dcd43c6
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 /**
       
    18    @file
       
    19    @internalComponent
       
    20 */
       
    21 
       
    22 #ifndef OMXILSTATE_H
       
    23 #define OMXILSTATE_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <openmax/il/khronos/v1_x/OMX_Core.h>
       
    27 
       
    28 #include "omxilfsm.h"
       
    29 #include "omxilportmanager.h"
       
    30 
       
    31 // Forward declarations
       
    32 class TOmxILCommand;
       
    33 
       
    34 /**
       
    35    Base class for concrete OpenMAX IL state objects (State Pattern)
       
    36 */
       
    37 class COmxILFsm::COmxILState : public CBase
       
    38 	{
       
    39 
       
    40 public:
       
    41 
       
    42 	//
       
    43 	// Events, a.k.a. OpenMAX IL API calls
       
    44 	//
       
    45 
       
    46 	virtual OMX_ERRORTYPE GetParameter(
       
    47 		const COmxILFsm& aFsm,
       
    48 		OMX_INDEXTYPE aParamIndex,
       
    49 		TAny* apComponentParameterStructure) const;
       
    50 
       
    51 	/**
       
    52 	   State-specific version of the OpenMAX IL SetParameter API.
       
    53 
       
    54 	   @param [in] aFsm The main FSM context class that delegates the events to the
       
    55 	   state classes.
       
    56 
       
    57 	   @param [in] aParamIndex The index of the structure that is to be filled.
       
    58 
       
    59 	   @param [in] apComponentParameterStructure A pointer to the IL structure.
       
    60 
       
    61 	   @return OMX_ERRORTYPE
       
    62 	*/
       
    63 	virtual OMX_ERRORTYPE SetParameter(
       
    64 		COmxILFsm& aFsm,
       
    65 		OMX_INDEXTYPE aParamIndex,
       
    66 		const TAny* apComponentParameterStructure) = 0;
       
    67 
       
    68 	virtual OMX_ERRORTYPE GetConfig(
       
    69 		const COmxILFsm& aFsm,
       
    70 		OMX_INDEXTYPE aConfigIndex,
       
    71 		TAny* apComponentConfigStructure) const;
       
    72 
       
    73 	virtual OMX_ERRORTYPE SetConfig(
       
    74 		COmxILFsm& aFsm,
       
    75 		OMX_INDEXTYPE aConfigIndex,
       
    76 		const TAny* apComponentConfigStructure);
       
    77 
       
    78 	virtual OMX_ERRORTYPE GetExtensionIndex(
       
    79 		const COmxILFsm& aFsm,
       
    80 		OMX_STRING aParameterName,
       
    81 		OMX_INDEXTYPE* apIndexType) const;
       
    82 
       
    83 	/**
       
    84 	   State-specific version of the OpenMAX IL GetState API.
       
    85 
       
    86 	   @return OMX_STATETYPE
       
    87 	*/
       
    88 	virtual OMX_STATETYPE GetState() const = 0;
       
    89 
       
    90 	/**
       
    91 	   State-specific version of the OpenMAX IL ComponentTunnelRequest API.
       
    92 
       
    93 	   @param [in] aFsm The main FSM context class that delegates the events to
       
    94 	   the state classes.
       
    95 
       
    96 	   @param [in] aPort Used to select the port on the component to be used
       
    97 	   for tunneling.
       
    98 
       
    99 	   @param [in] aTunneledComp Handle of the component to tunnel with.
       
   100 
       
   101 	   @param [in] aTunneledPort Indicates the port the component should tunnel
       
   102 	   with.
       
   103 
       
   104 	   @param [in] aTunnelSetup Pointer to the tunnel setup structure.
       
   105 
       
   106 	   @return OMX_ERRORTYPE
       
   107 	*/
       
   108 	inline virtual OMX_ERRORTYPE ComponentTunnelRequest(
       
   109 		COmxILFsm& aFsm,
       
   110 		OMX_U32 aPort,
       
   111 		OMX_HANDLETYPE aTunneledComp,
       
   112 		OMX_U32 aTunneledPort,
       
   113 		OMX_TUNNELSETUPTYPE* apTunnelSetup) = 0;
       
   114 
       
   115 	/**
       
   116 	   State-specific version of the PopulateBuffer method used by the FSM
       
   117 	   object to implement the OpenMAX IL AllocateBuffer/UseBuffer APIs.
       
   118 
       
   119 	   @param [in] aFsm The main FSM context class that delegates the events
       
   120 	   to the state classes.
       
   121 
       
   122 	   @param [out] appBufferHdr A pointer to a pointer of an
       
   123 	   OMX_BUFFERHEADERTYPE structure that receives the pointer to the buffer
       
   124 	   header.
       
   125 
       
   126 	   @param [in] aPortIndex The index of the port that will use the
       
   127 	   specified buffer. This index is relative to the component that owns the
       
   128 	   port.
       
   129 
       
   130 	   @param [in] apAppPrivate A pointer that refers to an
       
   131 	   implementation-specific memory area that is under responsibility of the
       
   132 	   supplier of the buffer.
       
   133 
       
   134 	   @param [in] aSizeBytes The buffer size in bytes.
       
   135 
       
   136 	   @param [in] apBuffer A pointer to the memory buffer area to be used.
       
   137 
       
   138 	   @param [out] portPopulationCompleted Used to signal the FSM object the
       
   139 	   the port population has completed.
       
   140 
       
   141 	   @return OMX_ERRORTYPE
       
   142 	*/
       
   143 	inline virtual OMX_ERRORTYPE PopulateBuffer(
       
   144 		COmxILFsm& aFsm,
       
   145 		OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   146 		OMX_U32 aPortIndex,
       
   147 		OMX_PTR apAppPrivate,
       
   148 		OMX_U32 aSizeBytes,
       
   149 		OMX_U8* apBuffer,
       
   150 		TBool& portPopulationCompleted) = 0;
       
   151 
       
   152 	/**
       
   153 	   State-specific version of the OpenMAX IL FreeBuffer API.
       
   154 
       
   155 	   @param [in] aFsm The main FSM context class that delegates the events
       
   156 	   to the state classes.
       
   157 
       
   158 	   @param [in] aPortIndex The index of the port that is using the
       
   159 	   specified buffer.
       
   160 
       
   161 	   @param [in] apBuffer A pointer to an OMX_BUFFERHEADERTYPE structure
       
   162 	   used to provide or receive the pointer to the buffer header.
       
   163 
       
   164 	   @param [out] aPortDepopulationCompleted Used to signal the FSM object
       
   165 	   the the port population has completed.
       
   166 
       
   167 	   @return OMX_ERRORTYPE
       
   168 	*/
       
   169 	inline virtual OMX_ERRORTYPE FreeBuffer(
       
   170 		COmxILFsm& aFsm,
       
   171 		OMX_U32 aPortIndex,
       
   172 		OMX_BUFFERHEADERTYPE* apBuffer,
       
   173 		TBool& aPortDepopulationCompleted) = 0;
       
   174 
       
   175 	/**
       
   176 	   State-specific version of the OpenMAX IL EmptyThisBuffer API.
       
   177 
       
   178 	   @param  [in] aFsm The main FSM context class that delegates the events
       
   179 	   to the state classes.
       
   180 
       
   181 	   @param [in] apBuffer A pointer to an OMX_BUFFERHEADERTYPE structure that is
       
   182 	   used to receive the pointer to the buffer header. The buffer header
       
   183 	   shall specify the index of the input port that receives the buffer.
       
   184 
       
   185 	   @return OMX_ERRORTYPE
       
   186 	*/
       
   187 	inline virtual OMX_ERRORTYPE EmptyThisBuffer(
       
   188 		COmxILFsm& aFsm,
       
   189 		OMX_BUFFERHEADERTYPE* apBuffer) = 0;
       
   190 
       
   191 	/**
       
   192 	   State-specific version of the OpenMAX IL FillThisBuffer API.
       
   193 
       
   194 	   @param [in] aFsm The main FSM context class that delegates the events
       
   195 	   to the state classes.
       
   196 
       
   197 	   @param [in] apBuffer A pointer to an OMX_BUFFERHEADERTYPE structure
       
   198 	   that is used to receive the pointer to the buffer header. The buffer
       
   199 	   header shall specify the index of the input port that receives the
       
   200 	   buffer.
       
   201 
       
   202 	   @return OMX_ERRORTYPE
       
   203 	*/
       
   204 	inline virtual OMX_ERRORTYPE FillThisBuffer(
       
   205 		COmxILFsm& aFsm,
       
   206 		OMX_BUFFERHEADERTYPE* apBuffer) = 0;
       
   207 
       
   208 	/**
       
   209 	   State-specific version of the method used by the FSM object to
       
   210 	   implement the OpenMAX IL OMX_CommandStateSet command.
       
   211 
       
   212 	   @param [in] aFsm The main FSM context class that delegates the events
       
   213 	   to the state classes.
       
   214 
       
   215 	   @param [in] aCommand A TOmxILCommand object used to carry the command
       
   216 	   parameters.
       
   217 
       
   218 	   @return OMX_ERRORTYPE
       
   219 	*/
       
   220 	virtual OMX_ERRORTYPE CommandStateSet(
       
   221 		COmxILFsm& aFsm,
       
   222 		const TOmxILCommand& aCommand) = 0;
       
   223 
       
   224 	virtual OMX_ERRORTYPE CommandFlush(
       
   225 		COmxILFsm& aFsm,
       
   226 		const TOmxILCommand& aCommand);
       
   227 
       
   228 	/**
       
   229 	   State-specific version of the method used by the FSM object to
       
   230 	   implement the OpenMAX IL OMX_CommandPortEnable command.
       
   231 
       
   232 	   @param [in] aFsm The main FSM context class that delegates the events
       
   233 	   to the state classes.
       
   234 
       
   235 	   @param [in] aCommand A TOmxILCommand object used to carry the command
       
   236 	   parameters.
       
   237 
       
   238 	   @return OMX_ERRORTYPE
       
   239 	*/
       
   240 	virtual OMX_ERRORTYPE CommandPortEnable(
       
   241 		COmxILFsm& aFsm,
       
   242 		const TOmxILCommand& aCommand) = 0;
       
   243 
       
   244 	virtual OMX_ERRORTYPE CommandPortDisable(
       
   245 		COmxILFsm& aFsm,
       
   246 		const TOmxILCommand& aCommand);
       
   247 
       
   248 	virtual OMX_ERRORTYPE CommandMarkBuffer(
       
   249 		COmxILFsm& aFsm,
       
   250 		const TOmxILCommand& aCommand);
       
   251 
       
   252 protected:
       
   253 
       
   254 	virtual OMX_ERRORTYPE SetParameterV2(
       
   255 		COmxILFsm& aFsm,
       
   256 		OMX_INDEXTYPE aParamIndex,
       
   257 		const TAny* apComponentParameterStructure);
       
   258 
       
   259 	inline virtual OMX_ERRORTYPE PopulateBufferV2(
       
   260 		COmxILFsm& aFsm,
       
   261 		OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   262 		OMX_U32 aPortIndex,
       
   263 		OMX_PTR apAppPrivate,
       
   264 		OMX_U32 aSizeBytes,
       
   265 		OMX_U8* apBuffer,
       
   266 		TBool& portPopulationCompleted);
       
   267 
       
   268 	inline virtual OMX_ERRORTYPE FreeBufferV2(
       
   269 		COmxILFsm& aFsm,
       
   270 		OMX_U32 aPortIndex,
       
   271 		OMX_BUFFERHEADERTYPE* apBuffer,
       
   272 		TBool& aPortDepopulationCompleted);
       
   273 
       
   274 	inline virtual OMX_ERRORTYPE ComponentTunnelRequestV2(
       
   275 		COmxILFsm& aFsm,
       
   276 		OMX_U32 aPort,
       
   277 		OMX_HANDLETYPE aTunneledComp,
       
   278 		OMX_U32 aTunneledPort,
       
   279 		OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   280 
       
   281 	inline virtual OMX_ERRORTYPE EmptyThisBufferV2(
       
   282 		COmxILFsm& aFsm,
       
   283 		OMX_BUFFERHEADERTYPE* apBuffer);
       
   284 
       
   285 	inline virtual OMX_ERRORTYPE FillThisBufferV2(
       
   286 		COmxILFsm& aFsm,
       
   287 		OMX_BUFFERHEADERTYPE* apBuffer);
       
   288 
       
   289 	};
       
   290 
       
   291 
       
   292 /**
       
   293    Concrete class that implements the OpenMAX IL OMX_StateInvalid state
       
   294 */
       
   295 class COmxILFsm::COmxILStateInvalid : public COmxILFsm::COmxILState
       
   296 	{
       
   297 
       
   298 public:
       
   299 
       
   300 	OMX_ERRORTYPE GetParameter(const COmxILFsm& aFsm,
       
   301 							   OMX_INDEXTYPE aParamIndex,
       
   302 							   TAny* apComponentParameterStructure) const;
       
   303 
       
   304 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   305 							   OMX_INDEXTYPE aParamIndex,
       
   306 							   const TAny* apComponentParameterStructure);
       
   307 
       
   308 	OMX_ERRORTYPE GetConfig(const COmxILFsm& aFsm,
       
   309 							OMX_INDEXTYPE aConfigIndex,
       
   310 							TAny* apComponentConfigStructure) const;
       
   311 
       
   312 	OMX_ERRORTYPE SetConfig(COmxILFsm& aFsm,
       
   313 							OMX_INDEXTYPE aConfigIndex,
       
   314 							const TAny* apComponentConfigStructure);
       
   315 
       
   316 	OMX_ERRORTYPE GetExtensionIndex(const COmxILFsm& aFsm,
       
   317 									OMX_STRING aParameterName,
       
   318 									OMX_INDEXTYPE* apIndexType) const;
       
   319 
       
   320 	OMX_STATETYPE GetState() const;
       
   321 
       
   322 	OMX_ERRORTYPE ComponentTunnelRequest(COmxILFsm& aFsm,
       
   323 										 OMX_U32 aPort,
       
   324 										 OMX_HANDLETYPE aTunneledComp,
       
   325 										 OMX_U32 aTunneledPort,
       
   326 										 OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   327 
       
   328 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   329 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   330 								 OMX_U32 aPortIndex,
       
   331 								 OMX_PTR apAppPrivate,
       
   332 								 OMX_U32 aSizeBytes,
       
   333 								 OMX_U8* apBuffer,
       
   334 								 TBool& portPopulationCompleted);
       
   335 
       
   336 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   337 							 OMX_U32 aPortIndex,
       
   338 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   339 							 TBool& aPortDepopulationCompleted);
       
   340 
       
   341 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   342 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   343 
       
   344 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   345 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   346 
       
   347 
       
   348 	OMX_ERRORTYPE CommandStateSet(
       
   349 		COmxILFsm& aFsm,
       
   350 		const TOmxILCommand& aCommand);
       
   351 
       
   352 	OMX_ERRORTYPE CommandFlush(
       
   353 		COmxILFsm& aFsm,
       
   354 		const TOmxILCommand& aCommand);
       
   355 
       
   356 	OMX_ERRORTYPE CommandPortEnable(
       
   357 		COmxILFsm& aFsm,
       
   358 		const TOmxILCommand& aCommand);
       
   359 
       
   360 	OMX_ERRORTYPE CommandPortDisable(
       
   361 		COmxILFsm& aFsm,
       
   362 		const TOmxILCommand& aCommand);
       
   363 
       
   364 	OMX_ERRORTYPE CommandMarkBuffer(
       
   365 		COmxILFsm& aFsm,
       
   366 		const TOmxILCommand& aCommand);
       
   367 
       
   368 	};
       
   369 
       
   370 /**
       
   371    Concrete class that implements the OpenMAX IL OMX_StateLoaded state
       
   372 */
       
   373 class COmxILFsm::COmxILStateLoaded : public COmxILFsm::COmxILState
       
   374 	{
       
   375 
       
   376 public:
       
   377 
       
   378 	OMX_STATETYPE GetState() const;
       
   379 
       
   380 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   381 							   OMX_INDEXTYPE aParamIndex,
       
   382 							   const TAny* apComponentParameterStructure);
       
   383 
       
   384 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   385 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   386 								 OMX_U32 aPortIndex,
       
   387 								 OMX_PTR apAppPrivate,
       
   388 								 OMX_U32 aSizeBytes,
       
   389 								 OMX_U8* apBuffer,
       
   390 								 TBool& portPopulationCompleted);
       
   391 
       
   392 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   393 							 OMX_U32 aPortIndex,
       
   394 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   395 							 TBool& aPortDepopulationCompleted);
       
   396 
       
   397 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   398 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   399 
       
   400 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   401 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   402 
       
   403 	OMX_ERRORTYPE ComponentTunnelRequest(COmxILFsm& aFsm,
       
   404 										 OMX_U32 aPort,
       
   405 										 OMX_HANDLETYPE aTunneledComp,
       
   406 										 OMX_U32 aTunneledPort,
       
   407 										 OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   408 
       
   409 	OMX_ERRORTYPE CommandStateSet(
       
   410 		COmxILFsm& aFsm,
       
   411 		const TOmxILCommand& aCommand);
       
   412 
       
   413 	OMX_ERRORTYPE CommandPortEnable(
       
   414 		COmxILFsm& aFsm,
       
   415 		const TOmxILCommand& aCommand);
       
   416 
       
   417 	};
       
   418 
       
   419 
       
   420 /**
       
   421    Concrete class that implements the intermediate state OMX_StateLoaded ->
       
   422    OMX_StateIdle.
       
   423 */
       
   424 class COmxILFsm::COmxILStateLoadedToIdle : public COmxILFsm::COmxILStateLoaded
       
   425 	{
       
   426 
       
   427 public:
       
   428 
       
   429 
       
   430 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   431 							   OMX_INDEXTYPE aParamIndex,
       
   432 							   const TAny* apComponentParameterStructure);
       
   433 
       
   434 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   435 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   436 								 OMX_U32 aPortIndex,
       
   437 								 OMX_PTR apAppPrivate,
       
   438 								 OMX_U32 aSizeBytes,
       
   439 								 OMX_U8* apBuffer,
       
   440 								 TBool& portPopulationCompleted);
       
   441 
       
   442 	OMX_ERRORTYPE CommandStateSet(
       
   443 		COmxILFsm& aFsm,
       
   444 		const TOmxILCommand& aCommand);
       
   445 
       
   446 	OMX_ERRORTYPE CommandPortEnable(
       
   447 		COmxILFsm& aFsm,
       
   448 		const TOmxILCommand& aCommand);
       
   449 
       
   450 private:
       
   451 
       
   452 	TBool iUseBufferReceived;
       
   453 
       
   454 	};
       
   455 
       
   456 /**
       
   457    Concrete class that implements the OpenMAX IL OMX_StateWaitForResources
       
   458    state
       
   459 
       
   460    NOTE: This state is here only to provide the basic functionality of
       
   461    transitioning form OMX_StateLoaded to OMX_StateWaitForResources and
       
   462    viceversa. Transition from OMX_StateWaitForResources to OMX_StateIdle is not
       
   463    implemented at this stage since a Resource Manager is not present
       
   464    yet. Whenever a Resource Manager becomes available, a
       
   465    COmxILStateWaitForResourcesToIdle substate should be implemented to handle
       
   466    the allocation of buffers mandated by the standard in this transition.
       
   467 
       
   468 */
       
   469 class COmxILFsm::COmxILStateWaitForResources : public COmxILFsm::COmxILState
       
   470 	{
       
   471 
       
   472 public:
       
   473 
       
   474 	OMX_STATETYPE GetState() const;
       
   475 
       
   476 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   477 							   OMX_INDEXTYPE aParamIndex,
       
   478 							   const TAny* apComponentParameterStructure);
       
   479 
       
   480 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   481 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   482 								 OMX_U32 aPortIndex,
       
   483 								 OMX_PTR apAppPrivate,
       
   484 								 OMX_U32 aSizeBytes,
       
   485 								 OMX_U8* apBuffer,
       
   486 								 TBool& portPopulationCompleted);
       
   487 
       
   488 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   489 							 OMX_U32 aPortIndex,
       
   490 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   491 							 TBool& aPortDepopulationCompleted);
       
   492 
       
   493 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   494 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   495 
       
   496 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   497 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   498 
       
   499 	OMX_ERRORTYPE ComponentTunnelRequest(COmxILFsm& aFsm,
       
   500 										 OMX_U32 aPort,
       
   501 										 OMX_HANDLETYPE aTunneledComp,
       
   502 										 OMX_U32 aTunneledPort,
       
   503 										 OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   504 
       
   505 	OMX_ERRORTYPE CommandStateSet(
       
   506 		COmxILFsm& aFsm,
       
   507 		const TOmxILCommand& aCommand);
       
   508 
       
   509 	OMX_ERRORTYPE CommandPortEnable(
       
   510 		COmxILFsm& aFsm,
       
   511 		const TOmxILCommand& aCommand);
       
   512 
       
   513 	};
       
   514 
       
   515 /**
       
   516    Concrete class that implements the OpenMAX IL COmxILStateIdle state
       
   517 */
       
   518 class COmxILFsm::COmxILStateIdle : public COmxILFsm::COmxILState
       
   519 	{
       
   520 
       
   521 public:
       
   522 
       
   523 	OMX_STATETYPE GetState() const;
       
   524 
       
   525 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   526 							   OMX_INDEXTYPE aParamIndex,
       
   527 							   const TAny* apComponentParameterStructure);
       
   528 
       
   529 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   530 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   531 								 OMX_U32 aPortIndex,
       
   532 								 OMX_PTR apAppPrivate,
       
   533 								 OMX_U32 aSizeBytes,
       
   534 								 OMX_U8* apBuffer,
       
   535 								 TBool& portPopulationCompleted);
       
   536 
       
   537 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   538 							 OMX_U32 aPortIndex,
       
   539 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   540 							 TBool& aPortDepopulationCompleted);
       
   541 
       
   542 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   543 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   544 
       
   545 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   546 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   547 
       
   548 	OMX_ERRORTYPE ComponentTunnelRequest(COmxILFsm& aFsm,
       
   549 										 OMX_U32 aPort,
       
   550 										 OMX_HANDLETYPE aTunneledComp,
       
   551 										 OMX_U32 aTunneledPort,
       
   552 										 OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   553 
       
   554 	OMX_ERRORTYPE CommandStateSet(
       
   555 		COmxILFsm& aFsm,
       
   556 		const TOmxILCommand& aCommand);
       
   557 
       
   558 	OMX_ERRORTYPE CommandFlush(
       
   559 		COmxILFsm& aFsm,
       
   560 		const TOmxILCommand& aCommand);
       
   561 
       
   562 	OMX_ERRORTYPE CommandPortEnable(
       
   563 		COmxILFsm& aFsm,
       
   564 		const TOmxILCommand& aCommand);
       
   565 
       
   566 	};
       
   567 
       
   568 /**
       
   569    Concrete class that implements the intermediate state OMX_StateIdle ->
       
   570    OMX_StateLoaded.
       
   571 */
       
   572 class COmxILFsm::COmxILStateIdleToLoaded : public COmxILFsm::COmxILStateIdle
       
   573 	{
       
   574 
       
   575 public:
       
   576 
       
   577 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   578 							 OMX_U32 aPortIndex,
       
   579 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   580 							 TBool& aPortDepopulationCompleted);
       
   581 
       
   582 	OMX_ERRORTYPE CommandStateSet(
       
   583 		COmxILFsm& aFsm,
       
   584 		const TOmxILCommand& aCommand);
       
   585 
       
   586 	};
       
   587 
       
   588 /**
       
   589    Concrete class that implements the OpenMAX IL COmxILStateExecuting state
       
   590 */
       
   591 class COmxILFsm::COmxILStateExecuting : public COmxILFsm::COmxILState
       
   592 	{
       
   593 
       
   594 public:
       
   595 
       
   596 	OMX_STATETYPE GetState() const;
       
   597 
       
   598 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   599 							   OMX_INDEXTYPE aParamIndex,
       
   600 							   const TAny* apComponentParameterStructure);
       
   601 
       
   602 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   603 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   604 								 OMX_U32 aPortIndex,
       
   605 								 OMX_PTR apAppPrivate,
       
   606 								 OMX_U32 aSizeBytes,
       
   607 								 OMX_U8* apBuffer,
       
   608 								 TBool& portPopulationCompleted);
       
   609 
       
   610 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   611 							 OMX_U32 aPortIndex,
       
   612 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   613 							 TBool& aPortDepopulationCompleted);
       
   614 
       
   615 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   616 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   617 
       
   618 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   619 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   620 
       
   621 	OMX_ERRORTYPE ComponentTunnelRequest(COmxILFsm& aFsm,
       
   622 										 OMX_U32 aPort,
       
   623 										 OMX_HANDLETYPE aTunneledComp,
       
   624 										 OMX_U32 aTunneledPort,
       
   625 										 OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   626 
       
   627 	OMX_ERRORTYPE CommandStateSet(
       
   628 		COmxILFsm& aFsm,
       
   629 		const TOmxILCommand& aCommand);
       
   630 
       
   631 	OMX_ERRORTYPE CommandPortEnable(
       
   632 		COmxILFsm& aFsm,
       
   633 		const TOmxILCommand& aCommand);
       
   634 
       
   635 	};
       
   636 
       
   637 /**
       
   638    Class used to abstract the commonalities of the transitions from
       
   639    OMX_StatePause or OMX_StateExecuting to OMX_StateIdle.
       
   640 */
       
   641 class COmxILFsm::MOmxILPauseOrExecutingToIdle
       
   642 	{
       
   643 
       
   644 protected:
       
   645 
       
   646 	OMX_ERRORTYPE ReturnThisBuffer(COmxILFsm& aFsm,
       
   647 								   OMX_BUFFERHEADERTYPE* apBuffer,
       
   648 								   OMX_DIRTYPE aDirection);
       
   649 
       
   650 	OMX_ERRORTYPE CommandPortEnable(
       
   651 		COmxILFsm& aFsm,
       
   652 		const TOmxILCommand& aCommand);
       
   653 
       
   654 	};
       
   655 
       
   656 /**
       
   657    Concrete class that implements the intermediate state OMX_StateExecuting ->
       
   658    OMX_StateIdle.
       
   659 */
       
   660 class COmxILFsm::COmxILStateExecutingToIdle :
       
   661 	public COmxILFsm::COmxILStateExecuting,
       
   662 	private COmxILFsm::MOmxILPauseOrExecutingToIdle
       
   663 
       
   664 	{
       
   665 
       
   666 public:
       
   667 
       
   668 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   669 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   670 
       
   671 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   672 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   673 
       
   674 	OMX_ERRORTYPE CommandStateSet(
       
   675 		COmxILFsm& aFsm,
       
   676 		const TOmxILCommand& aCommand);
       
   677 
       
   678 	};
       
   679 
       
   680 /**
       
   681    Concrete class that implements the OpenMAX IL COmxILStatePause state
       
   682 */
       
   683 class COmxILFsm::COmxILStatePause : public COmxILFsm::COmxILState
       
   684 	{
       
   685 
       
   686 public:
       
   687 
       
   688 	OMX_STATETYPE GetState() const;
       
   689 
       
   690 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   691 							   OMX_INDEXTYPE aParamIndex,
       
   692 							   const TAny* apComponentParameterStructure);
       
   693 
       
   694 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   695 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   696 								 OMX_U32 aPortIndex,
       
   697 								 OMX_PTR apAppPrivate,
       
   698 								 OMX_U32 aSizeBytes,
       
   699 								 OMX_U8* apBuffer,
       
   700 								 TBool& portPopulationCompleted);
       
   701 
       
   702 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   703 							 OMX_U32 aPortIndex,
       
   704 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   705 							 TBool& aPortDepopulationCompleted);
       
   706 
       
   707 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   708 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   709 
       
   710 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   711 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   712 
       
   713 	OMX_ERRORTYPE ComponentTunnelRequest(COmxILFsm& aFsm,
       
   714 										 OMX_U32 aPort,
       
   715 										 OMX_HANDLETYPE aTunneledComp,
       
   716 										 OMX_U32 aTunneledPort,
       
   717 										 OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   718 
       
   719 	OMX_ERRORTYPE CommandStateSet(
       
   720 		COmxILFsm& aFsm,
       
   721 		const TOmxILCommand& aCommand);
       
   722 
       
   723 	OMX_ERRORTYPE CommandPortEnable(
       
   724 		COmxILFsm& aFsm,
       
   725 		const TOmxILCommand& aCommand);
       
   726 
       
   727 	};
       
   728 
       
   729 /**
       
   730    Concrete class that implements the intermediate state OMX_StatePause ->
       
   731    OMX_StateIdle.
       
   732 */
       
   733 class COmxILFsm::COmxILStatePauseToIdle
       
   734 	: public COmxILFsm::COmxILStatePause,
       
   735 	  private COmxILFsm::MOmxILPauseOrExecutingToIdle
       
   736 	{
       
   737 
       
   738 public:
       
   739 
       
   740 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   741 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   742 
       
   743 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   744 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   745 
       
   746 	OMX_ERRORTYPE CommandStateSet(
       
   747 		COmxILFsm& aFsm,
       
   748 		const TOmxILCommand& aCommand);
       
   749 
       
   750 	};
       
   751 
       
   752 #include "omxilstate.inl"
       
   753 
       
   754 #endif // OMXILSTATE_H
       
   755 
       
   756