omxil_generic/omxilcomplib/src/omxilstate.h
changeset 0 0e4a32b9112d
equal deleted inserted replaced
-1:000000000000 0:0e4a32b9112d
       
     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 #include <openmax/il/common/omxilstatedefs.h>
       
    28 #include "omxilfsm.h"
       
    29 #include "omxilportmanagerif.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 PopulateBuffer(COmxILFsm& aFsm,
       
   431 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   432 								 OMX_U32 aPortIndex,
       
   433 								 OMX_PTR apAppPrivate,
       
   434 								 OMX_U32 aSizeBytes,
       
   435 								 OMX_U8* apBuffer,
       
   436 								 TBool& portPopulationCompleted);
       
   437 
       
   438 	OMX_ERRORTYPE CommandStateSet(
       
   439 		COmxILFsm& aFsm,
       
   440 		const TOmxILCommand& aCommand);
       
   441 
       
   442 	OMX_ERRORTYPE CommandPortEnable(
       
   443 		COmxILFsm& aFsm,
       
   444 		const TOmxILCommand& aCommand);
       
   445 
       
   446 	};
       
   447 
       
   448 /**
       
   449    Concrete class that implements the OpenMAX IL OMX_StateWaitForResources
       
   450    state
       
   451 
       
   452    NOTE: This state is here only to provide the basic functionality of
       
   453    transitioning form OMX_StateLoaded to OMX_StateWaitForResources and
       
   454    viceversa. Transition from OMX_StateWaitForResources to OMX_StateIdle is not
       
   455    implemented at this stage since a Resource Manager is not present
       
   456    yet. Whenever a Resource Manager becomes available, a
       
   457    COmxILStateWaitForResourcesToIdle substate should be implemented to handle
       
   458    the allocation of buffers mandated by the standard in this transition.
       
   459 
       
   460 */
       
   461 class COmxILFsm::COmxILStateWaitForResources : public COmxILFsm::COmxILState
       
   462 	{
       
   463 
       
   464 public:
       
   465 
       
   466 	OMX_STATETYPE GetState() const;
       
   467 
       
   468 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   469 							   OMX_INDEXTYPE aParamIndex,
       
   470 							   const TAny* apComponentParameterStructure);
       
   471 
       
   472 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   473 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   474 								 OMX_U32 aPortIndex,
       
   475 								 OMX_PTR apAppPrivate,
       
   476 								 OMX_U32 aSizeBytes,
       
   477 								 OMX_U8* apBuffer,
       
   478 								 TBool& portPopulationCompleted);
       
   479 
       
   480 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   481 							 OMX_U32 aPortIndex,
       
   482 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   483 							 TBool& aPortDepopulationCompleted);
       
   484 
       
   485 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   486 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   487 
       
   488 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   489 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   490 
       
   491 	OMX_ERRORTYPE ComponentTunnelRequest(COmxILFsm& aFsm,
       
   492 										 OMX_U32 aPort,
       
   493 										 OMX_HANDLETYPE aTunneledComp,
       
   494 										 OMX_U32 aTunneledPort,
       
   495 										 OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   496 
       
   497 	OMX_ERRORTYPE CommandStateSet(
       
   498 		COmxILFsm& aFsm,
       
   499 		const TOmxILCommand& aCommand);
       
   500 
       
   501 	OMX_ERRORTYPE CommandPortEnable(
       
   502 		COmxILFsm& aFsm,
       
   503 		const TOmxILCommand& aCommand);
       
   504 
       
   505 	};
       
   506 
       
   507 /**
       
   508    Concrete class that implements the OpenMAX IL COmxILStateIdle state
       
   509 */
       
   510 class COmxILFsm::COmxILStateIdle : public COmxILFsm::COmxILState
       
   511 	{
       
   512 
       
   513 public:
       
   514 
       
   515 	OMX_STATETYPE GetState() const;
       
   516 
       
   517 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   518 							   OMX_INDEXTYPE aParamIndex,
       
   519 							   const TAny* apComponentParameterStructure);
       
   520 
       
   521 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   522 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   523 								 OMX_U32 aPortIndex,
       
   524 								 OMX_PTR apAppPrivate,
       
   525 								 OMX_U32 aSizeBytes,
       
   526 								 OMX_U8* apBuffer,
       
   527 								 TBool& portPopulationCompleted);
       
   528 
       
   529 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   530 							 OMX_U32 aPortIndex,
       
   531 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   532 							 TBool& aPortDepopulationCompleted);
       
   533 
       
   534 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   535 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   536 
       
   537 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   538 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   539 
       
   540 	OMX_ERRORTYPE ComponentTunnelRequest(COmxILFsm& aFsm,
       
   541 										 OMX_U32 aPort,
       
   542 										 OMX_HANDLETYPE aTunneledComp,
       
   543 										 OMX_U32 aTunneledPort,
       
   544 										 OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   545 
       
   546 	OMX_ERRORTYPE CommandStateSet(
       
   547 		COmxILFsm& aFsm,
       
   548 		const TOmxILCommand& aCommand);
       
   549 
       
   550 	OMX_ERRORTYPE CommandFlush(
       
   551 		COmxILFsm& aFsm,
       
   552 		const TOmxILCommand& aCommand);
       
   553 
       
   554 	OMX_ERRORTYPE CommandPortEnable(
       
   555 		COmxILFsm& aFsm,
       
   556 		const TOmxILCommand& aCommand);
       
   557 
       
   558 	};
       
   559 
       
   560 /**
       
   561    Concrete class that implements the intermediate state OMX_StateIdle ->
       
   562    OMX_StateLoaded.
       
   563 */
       
   564 class COmxILFsm::COmxILStateIdleToLoaded : public COmxILFsm::COmxILStateIdle
       
   565 	{
       
   566 
       
   567 public:
       
   568 
       
   569 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   570 							 OMX_U32 aPortIndex,
       
   571 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   572 							 TBool& aPortDepopulationCompleted);
       
   573 
       
   574 	OMX_ERRORTYPE CommandStateSet(
       
   575 		COmxILFsm& aFsm,
       
   576 		const TOmxILCommand& aCommand);
       
   577 
       
   578 	};
       
   579 
       
   580 /**
       
   581    Concrete class that implements the OpenMAX IL COmxILStateExecuting state
       
   582 */
       
   583 class COmxILFsm::COmxILStateExecuting : public COmxILFsm::COmxILState
       
   584 	{
       
   585 
       
   586 public:
       
   587 
       
   588 	OMX_STATETYPE GetState() const;
       
   589 
       
   590 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   591 							   OMX_INDEXTYPE aParamIndex,
       
   592 							   const TAny* apComponentParameterStructure);
       
   593 
       
   594 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   595 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   596 								 OMX_U32 aPortIndex,
       
   597 								 OMX_PTR apAppPrivate,
       
   598 								 OMX_U32 aSizeBytes,
       
   599 								 OMX_U8* apBuffer,
       
   600 								 TBool& portPopulationCompleted);
       
   601 
       
   602 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   603 							 OMX_U32 aPortIndex,
       
   604 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   605 							 TBool& aPortDepopulationCompleted);
       
   606 
       
   607 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   608 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   609 
       
   610 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   611 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   612 
       
   613 	OMX_ERRORTYPE ComponentTunnelRequest(COmxILFsm& aFsm,
       
   614 										 OMX_U32 aPort,
       
   615 										 OMX_HANDLETYPE aTunneledComp,
       
   616 										 OMX_U32 aTunneledPort,
       
   617 										 OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   618 
       
   619 	OMX_ERRORTYPE CommandStateSet(
       
   620 		COmxILFsm& aFsm,
       
   621 		const TOmxILCommand& aCommand);
       
   622 
       
   623 	OMX_ERRORTYPE CommandPortEnable(
       
   624 		COmxILFsm& aFsm,
       
   625 		const TOmxILCommand& aCommand);
       
   626 
       
   627 	};
       
   628 
       
   629 /**
       
   630    Class used to abstract the commonalities of the transitions from
       
   631    OMX_StatePause or OMX_StateExecuting to OMX_StateIdle.
       
   632 */
       
   633 class COmxILFsm::MOmxILPauseOrExecutingToIdle
       
   634 	{
       
   635 
       
   636 protected:
       
   637 
       
   638 	OMX_ERRORTYPE ReturnThisBuffer(COmxILFsm& aFsm,
       
   639 								   OMX_BUFFERHEADERTYPE* apBuffer,
       
   640 								   OMX_DIRTYPE aDirection);
       
   641 
       
   642 	OMX_ERRORTYPE CommandPortEnable(
       
   643 		COmxILFsm& aFsm,
       
   644 		const TOmxILCommand& aCommand);
       
   645 
       
   646 	};
       
   647 
       
   648 /**
       
   649    Concrete class that implements the intermediate state OMX_StateExecuting ->
       
   650    OMX_StateIdle.
       
   651 */
       
   652 class COmxILFsm::COmxILStateExecutingToIdle :
       
   653 	public COmxILFsm::COmxILStateExecuting,
       
   654 	private COmxILFsm::MOmxILPauseOrExecutingToIdle
       
   655 
       
   656 	{
       
   657 
       
   658 public:
       
   659 
       
   660 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   661 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   662 
       
   663 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   664 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   665 
       
   666 	OMX_ERRORTYPE CommandStateSet(
       
   667 		COmxILFsm& aFsm,
       
   668 		const TOmxILCommand& aCommand);
       
   669 
       
   670 	};
       
   671 
       
   672 /**
       
   673    Concrete class that implements the OpenMAX IL COmxILStatePause state
       
   674 */
       
   675 class COmxILFsm::COmxILStatePause : public COmxILFsm::COmxILState
       
   676 	{
       
   677 
       
   678 public:
       
   679 
       
   680 	OMX_STATETYPE GetState() const;
       
   681 
       
   682 	OMX_ERRORTYPE SetParameter(COmxILFsm& aFsm,
       
   683 							   OMX_INDEXTYPE aParamIndex,
       
   684 							   const TAny* apComponentParameterStructure);
       
   685 
       
   686 	OMX_ERRORTYPE PopulateBuffer(COmxILFsm& aFsm,
       
   687 								 OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   688 								 OMX_U32 aPortIndex,
       
   689 								 OMX_PTR apAppPrivate,
       
   690 								 OMX_U32 aSizeBytes,
       
   691 								 OMX_U8* apBuffer,
       
   692 								 TBool& portPopulationCompleted);
       
   693 
       
   694 	OMX_ERRORTYPE FreeBuffer(COmxILFsm& aFsm,
       
   695 							 OMX_U32 aPortIndex,
       
   696 							 OMX_BUFFERHEADERTYPE* apBuffer,
       
   697 							 TBool& aPortDepopulationCompleted);
       
   698 
       
   699 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   700 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   701 
       
   702 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   703 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   704 
       
   705 	OMX_ERRORTYPE ComponentTunnelRequest(COmxILFsm& aFsm,
       
   706 										 OMX_U32 aPort,
       
   707 										 OMX_HANDLETYPE aTunneledComp,
       
   708 										 OMX_U32 aTunneledPort,
       
   709 										 OMX_TUNNELSETUPTYPE* apTunnelSetup);
       
   710 
       
   711 	OMX_ERRORTYPE CommandStateSet(
       
   712 		COmxILFsm& aFsm,
       
   713 		const TOmxILCommand& aCommand);
       
   714 
       
   715 	OMX_ERRORTYPE CommandPortEnable(
       
   716 		COmxILFsm& aFsm,
       
   717 		const TOmxILCommand& aCommand);
       
   718 
       
   719 	};
       
   720 
       
   721 /**
       
   722    Concrete class that implements the intermediate state OMX_StatePause ->
       
   723    OMX_StateIdle.
       
   724 */
       
   725 class COmxILFsm::COmxILStatePauseToIdle
       
   726 	: public COmxILFsm::COmxILStatePause,
       
   727 	  private COmxILFsm::MOmxILPauseOrExecutingToIdle
       
   728 	{
       
   729 
       
   730 public:
       
   731 
       
   732 	OMX_ERRORTYPE EmptyThisBuffer(COmxILFsm& aFsm,
       
   733 								  OMX_BUFFERHEADERTYPE* apBuffer);
       
   734 
       
   735 	OMX_ERRORTYPE FillThisBuffer(COmxILFsm& aFsm,
       
   736 								 OMX_BUFFERHEADERTYPE* apBuffer);
       
   737 
       
   738 	OMX_ERRORTYPE CommandStateSet(
       
   739 		COmxILFsm& aFsm,
       
   740 		const TOmxILCommand& aCommand);
       
   741 
       
   742 	};
       
   743 
       
   744 #include "omxilstate.inl"
       
   745 
       
   746 #endif // OMXILSTATE_H
       
   747 
       
   748