omxil_generic/omxilcomplib/src/omxilportmanager.h
changeset 0 0e4a32b9112d
child 5 fb6faddbb212
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 OMXILPORTMANAGER_H
       
    23 #define OMXILPORTMANAGER_H
       
    24 
       
    25 #include <openmax/il/khronos/v1_x/OMX_Component.h>
       
    26 
       
    27 #include <openmax/il/common/omxilport.h>
       
    28 #include "omxilindexmanager.h"
       
    29 #include "omxilportmanagerif.h"
       
    30 
       
    31 /**
       
    32    Port Manager Panic category
       
    33 */
       
    34 _LIT(KOmxILPortManagerPanicCategory, "OmxILPortManager");
       
    35 
       
    36 
       
    37 // Forward declarations
       
    38 class COmxILProcessingFunction;
       
    39 class MOmxILCallbackManagerIf;
       
    40 
       
    41 /**
       
    42    OpenMAX IL Port Manager.
       
    43 
       
    44    It keeps and manages a list of the ports configured in the component. The
       
    45    Port Manager is used by the FSM object (@see COmxILFsm) to communicate with
       
    46    the ports.
       
    47 
       
    48 */
       
    49 NONSHARABLE_CLASS(COmxILPortManager) : public COmxILIndexManager,
       
    50 									   public MOmxILPortManagerIf
       
    51 	{
       
    52 
       
    53 public:
       
    54 
       
    55 	static COmxILPortManager* NewL(
       
    56 		COmxILProcessingFunction& aProcessingFunction,
       
    57 		MOmxILCallbackManagerIf& aCallbacks,
       
    58 		const OMX_VERSIONTYPE& aOmxVersion,
       
    59 		OMX_U32 aNumberOfAudioPorts,
       
    60 		OMX_U32 aStartAudioPortNumber,
       
    61 		OMX_U32 aNumberOfImagePorts,
       
    62 		OMX_U32 aStartImagePortNumber,
       
    63 		OMX_U32 aNumberOfVideoPorts,
       
    64 		OMX_U32 aStartVideoPortNumber,
       
    65 		OMX_U32 aNumberOfOtherPorts,
       
    66 		OMX_U32 aStartOtherPortNumber,
       
    67 		OMX_BOOL aImmediateReturnTimeBuffer = OMX_TRUE);
       
    68 
       
    69 	~COmxILPortManager();
       
    70 
       
    71 	TInt AddPort(const COmxILPort* aPort,
       
    72 						  OMX_DIRTYPE aDirection);
       
    73 
       
    74 	OMX_ERRORTYPE GetParameter(
       
    75 		OMX_INDEXTYPE aParamIndex,
       
    76 		TAny* apComponentParameterStructure) const;
       
    77 
       
    78 	OMX_ERRORTYPE SetParameter(OMX_INDEXTYPE aParamIndex,
       
    79 							   const TAny* apComponentParameterStructure,
       
    80 							   OMX_BOOL aPortIsDisabled = OMX_FALSE);
       
    81 
       
    82 	OMX_ERRORTYPE GetConfig(OMX_INDEXTYPE aConfigIndex,
       
    83 							TAny* apComponentConfigStructure) const;
       
    84 
       
    85 	OMX_ERRORTYPE SetConfig(OMX_INDEXTYPE aConfigIndex,
       
    86 							const TAny* apComponentConfigStructure);
       
    87 
       
    88 	OMX_ERRORTYPE GetExtensionIndex(OMX_STRING aParameterName,
       
    89 									OMX_INDEXTYPE* apIndexType) const;
       
    90 
       
    91 	OMX_ERRORTYPE PopulateBuffer(OMX_BUFFERHEADERTYPE** appBufferHdr,
       
    92 								 OMX_U32 aPortIndex,
       
    93 								 OMX_PTR apAppPrivate,
       
    94 								 OMX_U32 aSizeBytes,
       
    95 								 OMX_U8* apBuffer,
       
    96 								 TBool& portPopulationCompleted,
       
    97 								 OMX_BOOL aPortIsDisabled = OMX_FALSE);
       
    98 
       
    99 	OMX_ERRORTYPE FreeBuffer(OMX_U32 aPortIndex,
       
   100 							 OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   101 							 TBool& portDepopulationCompleted,
       
   102 							 OMX_BOOL aPortIsDisabled = OMX_FALSE);
       
   103 
       
   104 	OMX_ERRORTYPE TunnelRequest(OMX_U32 aPortIndex,
       
   105 								OMX_HANDLETYPE aTunneledComp,
       
   106 								OMX_U32 aTunneledPort,
       
   107 								OMX_TUNNELSETUPTYPE* apTunnelSetup,
       
   108 								OMX_BOOL aPortIsDisabled = OMX_FALSE);
       
   109 
       
   110 	OMX_ERRORTYPE TunnellingBufferAllocation(
       
   111 		TBool& aComponentPopulationCompleted,
       
   112 		TUint32 aPortIndex = OMX_ALL);
       
   113 
       
   114 	OMX_ERRORTYPE TunnellingBufferDeallocation(
       
   115 		TBool& aComponentDePopulationCompleted);
       
   116 
       
   117 	OMX_ERRORTYPE InitiateTunnellingDataFlow(
       
   118 		OMX_U32 aPortIndex = OMX_ALL,
       
   119 		OMX_BOOL aSuppliersAndNonSuppliers = OMX_FALSE);
       
   120 
       
   121 	OMX_ERRORTYPE BufferIndication(
       
   122 		OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   123 		OMX_DIRTYPE aDirection,
       
   124 		OMX_BOOL aPortIsDisabled = OMX_FALSE);
       
   125 
       
   126 	OMX_ERRORTYPE BufferReturnIndication(
       
   127 		OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   128 		OMX_DIRTYPE aDirection,
       
   129 		TBool& aAllBuffersReturned);
       
   130 
       
   131 	OMX_ERRORTYPE BufferFlushIndicationFlushCommand(
       
   132 		TUint32 aPortIndex, TBool aEjectBuffers = ETrue);
       
   133 
       
   134 	OMX_ERRORTYPE BufferFlushIndicationPauseOrExeToIdleCommand(
       
   135 		TBool& aAllBuffersReturnedToSuppliers);
       
   136 
       
   137 	OMX_ERRORTYPE PortEnableIndication(
       
   138 		TUint32 aPortIndex,
       
   139 		TBool aIndicationIsFinal);
       
   140 
       
   141 	OMX_ERRORTYPE PortDisableIndication(
       
   142 		TUint32 aPortIndex);
       
   143 
       
   144 	OMX_ERRORTYPE BufferMarkIndication(OMX_U32 aPortIndex,
       
   145 									   OMX_PTR ipMarkData);
       
   146 
       
   147 #ifdef _OMXIL_COMMON_IL516C_ON
       
   148 	OMX_ERRORTYPE BufferEjectIndication(
       
   149 		TUint32 aPortIndex);
       
   150 #endif
       
   151 
       
   152 	OMX_ERRORTYPE ComponentRoleIndication(TUint aComponentRoleIndex);
       
   153 
       
   154 	OMX_ERRORTYPE PortSettingsChangeIndication(OMX_U32 aPortIndex,
       
   155 											   TUint aPortSettingsIndex,
       
   156 											   const TDesC8& aPortSettings,
       
   157 											   OMX_EVENTTYPE& aEventForILClient);
       
   158 
       
   159 	//
       
   160 	//
       
   161 	//
       
   162 	TBool AllPortsPopulated() const;
       
   163 
       
   164 	TBool AllPortsDePopulated() const;
       
   165 
       
   166 	TBool AllBuffersAtHome() const;
       
   167 
       
   168 
       
   169 private:
       
   170 
       
   171 	COmxILPortManager(COmxILProcessingFunction& aProcessingFunction,
       
   172 					  MOmxILCallbackManagerIf& aCallbacks);
       
   173 
       
   174 	// From MOmxILPortManagerIf
       
   175 	void ConstructL(COmxILProcessingFunction& aProcessingFunction,
       
   176 					MOmxILCallbackManagerIf& aCallbacks,
       
   177 					const OMX_VERSIONTYPE& aOmxVersion,
       
   178 					OMX_U32 aNumberOfAudioPorts,
       
   179 					OMX_U32 aStartAudioPortNumber,
       
   180 					OMX_U32 aNumberOfImagePorts,
       
   181 					OMX_U32 aStartImagePortNumber,
       
   182 					OMX_U32 aNumberOfVideoPorts,
       
   183 					OMX_U32 aStartVideoPortNumber,
       
   184 					OMX_U32 aNumberOfOtherPorts,
       
   185 					OMX_U32 aStartOtherPortNumber,
       
   186 					OMX_BOOL aImmediateReturnTimeBuffer = OMX_TRUE);
       
   187 
       
   188 
       
   189 	void AppendPortL(const COmxILPort* aPort);
       
   190 	void RemoveLastAppendedPort();
       
   191 
       
   192 	inline OMX_ERRORTYPE CheckPortIndex(OMX_U32 aPortIndex) const;
       
   193 
       
   194 	inline OMX_ERRORTYPE GetPortIndexFromOmxStruct(
       
   195 		const TAny*& apComponentParameterStructure,
       
   196 		OMX_U32& aIndex) const;
       
   197 
       
   198 	inline OMX_ERRORTYPE GetPortIndexFromOmxStruct(
       
   199 		TAny*& apComponentParameterStructure,
       
   200 		OMX_U32& aIndex) const;
       
   201 
       
   202 	TBool RemoveBuffersFromPfOrCm(COmxILPort* apPort,
       
   203 								  OMX_BOOL aRemoveFromPfOnly = OMX_FALSE) const;
       
   204 
       
   205 private:
       
   206 
       
   207 	COmxILProcessingFunction& iProcessingFunction;
       
   208 	MOmxILCallbackManagerIf& iCallbacks;
       
   209 
       
   210 	RPointerArray<COmxILPort> iAllPorts;
       
   211 	RArray<TBool> iTimePorts;		// Indicate the corresponding port is OMX_OTHER_FormatTime
       
   212 
       
   213 	OMX_PORT_PARAM_TYPE iAudioParamInit;
       
   214 	OMX_PORT_PARAM_TYPE iImageParamInit;
       
   215 	OMX_PORT_PARAM_TYPE iVideoParamInit;
       
   216 	OMX_PORT_PARAM_TYPE iOtherParamInit;
       
   217 	OMX_BOOL iImmediateReturnTimeBuffer;
       
   218 	};
       
   219 
       
   220 #include "omxilportmanager.inl"
       
   221 
       
   222 #endif // OMXILPORTMANAGER_H