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 "omxilport.h" |
|
28 #include "omxilindexmanager.h" |
|
29 |
|
30 /** |
|
31 Port Manager Panic category |
|
32 */ |
|
33 _LIT(KOmxILPortManagerPanicCategory, "OmxILPortManager"); |
|
34 |
|
35 |
|
36 // Forward declarations |
|
37 class COmxILProcessingFunction; |
|
38 class MOmxILCallbackManagerIf; |
|
39 |
|
40 /** |
|
41 OpenMAX IL Port Manager. |
|
42 |
|
43 It keeps and manages a list of the ports configured in the component. The |
|
44 Port Manager is used by the FSM object (@see COmxILFsm) to communicate with |
|
45 the ports. |
|
46 |
|
47 */ |
|
48 NONSHARABLE_CLASS(COmxILPortManager) : public COmxILIndexManager |
|
49 { |
|
50 |
|
51 public: |
|
52 /* |
|
53 @param aImmediateReturnTimeBuffer Indicates whether the component needs to |
|
54 return the arriving buffer to the sender immediately or not . This is particularly |
|
55 related to time port (e.g. COmxILClientClockPort), where notification |
|
56 could be requested on every frame. Returning the buffer immediately to the |
|
57 the sender (e.g. Clock Component) would avoid the sender from buffer starvation. |
|
58 By default, time related component will need to return the buffer sooner, except |
|
59 Clock Component (the buffer sender) |
|
60 */ |
|
61 IMPORT_C static COmxILPortManager* NewL( |
|
62 COmxILProcessingFunction& aProcessingFunction, |
|
63 MOmxILCallbackManagerIf& aCallbacks, |
|
64 const OMX_VERSIONTYPE& aOmxVersion, |
|
65 OMX_U32 aNumberOfAudioPorts, |
|
66 OMX_U32 aStartAudioPortNumber, |
|
67 OMX_U32 aNumberOfImagePorts, |
|
68 OMX_U32 aStartImagePortNumber, |
|
69 OMX_U32 aNumberOfVideoPorts, |
|
70 OMX_U32 aStartVideoPortNumber, |
|
71 OMX_U32 aNumberOfOtherPorts, |
|
72 OMX_U32 aStartOtherPortNumber, |
|
73 OMX_BOOL aImmediateReturnTimeBuffer = OMX_TRUE); |
|
74 |
|
75 ~COmxILPortManager(); |
|
76 |
|
77 IMPORT_C TInt AddPort(const COmxILPort* aPort, |
|
78 OMX_DIRTYPE aDirection); |
|
79 |
|
80 OMX_ERRORTYPE GetParameter( |
|
81 OMX_INDEXTYPE aParamIndex, |
|
82 TAny* apComponentParameterStructure) const; |
|
83 |
|
84 OMX_ERRORTYPE SetParameter(OMX_INDEXTYPE aParamIndex, |
|
85 const TAny* apComponentParameterStructure, |
|
86 OMX_BOOL aPortIsDisabled = OMX_FALSE); |
|
87 |
|
88 OMX_ERRORTYPE GetConfig(OMX_INDEXTYPE aConfigIndex, |
|
89 TAny* apComponentConfigStructure) const; |
|
90 |
|
91 OMX_ERRORTYPE SetConfig(OMX_INDEXTYPE aConfigIndex, |
|
92 const TAny* apComponentConfigStructure); |
|
93 |
|
94 OMX_ERRORTYPE GetExtensionIndex(OMX_STRING aParameterName, |
|
95 OMX_INDEXTYPE* apIndexType) const; |
|
96 |
|
97 OMX_ERRORTYPE PopulateBuffer(OMX_BUFFERHEADERTYPE** appBufferHdr, |
|
98 OMX_U32 aPortIndex, |
|
99 OMX_PTR apAppPrivate, |
|
100 OMX_U32 aSizeBytes, |
|
101 OMX_U8* apBuffer, |
|
102 TBool& portPopulationCompleted, |
|
103 OMX_BOOL aPortIsDisabled = OMX_FALSE); |
|
104 |
|
105 OMX_ERRORTYPE FreeBuffer(OMX_U32 aPortIndex, |
|
106 OMX_BUFFERHEADERTYPE* apBufferHeader, |
|
107 TBool& portDepopulationCompleted, |
|
108 OMX_BOOL aPortIsDisabled = OMX_FALSE); |
|
109 |
|
110 OMX_ERRORTYPE TunnelRequest(OMX_U32 aPortIndex, |
|
111 OMX_HANDLETYPE aTunneledComp, |
|
112 OMX_U32 aTunneledPort, |
|
113 OMX_TUNNELSETUPTYPE* apTunnelSetup, |
|
114 OMX_BOOL aPortIsDisabled = OMX_FALSE); |
|
115 |
|
116 OMX_ERRORTYPE TunnellingBufferAllocation( |
|
117 TBool& aComponentPopulationCompleted, |
|
118 TUint32 aPortIndex = OMX_ALL); |
|
119 |
|
120 OMX_ERRORTYPE TunnellingBufferDeallocation( |
|
121 TBool& aComponentDePopulationCompleted); |
|
122 |
|
123 OMX_ERRORTYPE InitiateTunnellingDataFlow( |
|
124 OMX_U32 aPortIndex = OMX_ALL); |
|
125 |
|
126 OMX_ERRORTYPE BufferIndication( |
|
127 OMX_BUFFERHEADERTYPE* apBufferHeader, |
|
128 OMX_DIRTYPE aDirection, |
|
129 OMX_BOOL aPortIsDisabled = OMX_FALSE); |
|
130 |
|
131 OMX_ERRORTYPE BufferReturnIndication( |
|
132 OMX_BUFFERHEADERTYPE* apBufferHeader, |
|
133 OMX_DIRTYPE aDirection, |
|
134 TBool& aAllBuffersReturned); |
|
135 |
|
136 OMX_ERRORTYPE BufferFlushIndicationFlushCommand( |
|
137 TUint32 aPortIndex, TBool aEjectBuffers = ETrue); |
|
138 |
|
139 OMX_ERRORTYPE BufferFlushIndicationPauseOrExeToIdleCommand( |
|
140 TBool& aAllBuffersReturnedToSuppliers); |
|
141 |
|
142 OMX_ERRORTYPE PortEnableIndication( |
|
143 TUint32 aPortIndex, |
|
144 TBool aIndicationIsFinal); |
|
145 |
|
146 OMX_ERRORTYPE PortDisableIndication( |
|
147 TUint32 aPortIndex); |
|
148 |
|
149 OMX_ERRORTYPE BufferMarkIndication(OMX_U32 aPortIndex, |
|
150 OMX_PTR ipMarkData); |
|
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 const OMX_VERSIONTYPE& aOmxVersion, |
|
174 OMX_U32 aNumberOfAudioPorts, |
|
175 OMX_U32 aStartAudioPortNumber, |
|
176 OMX_U32 aNumberOfImagePorts, |
|
177 OMX_U32 aStartImagePortNumber, |
|
178 OMX_U32 aNumberOfVideoPorts, |
|
179 OMX_U32 aStartVideoPortNumber, |
|
180 OMX_U32 aNumberOfOtherPorts, |
|
181 OMX_U32 aStartOtherPortNumber, |
|
182 OMX_BOOL aImmediateReturnTimeBuffer); |
|
183 |
|
184 void ConstructL(); |
|
185 |
|
186 void AppendPortL(const COmxILPort* aPort); |
|
187 |
|
188 inline OMX_ERRORTYPE CheckPortIndex(OMX_U32 aPortIndex) const; |
|
189 |
|
190 inline OMX_ERRORTYPE GetPortIndexFromOmxStruct( |
|
191 const TAny*& apComponentParameterStructure, |
|
192 OMX_U32& aIndex) const; |
|
193 |
|
194 inline OMX_ERRORTYPE GetPortIndexFromOmxStruct( |
|
195 TAny*& apComponentParameterStructure, |
|
196 OMX_U32& aIndex) const; |
|
197 |
|
198 TBool RemoveBuffersFromPfOrCm(COmxILPort* apPort, |
|
199 OMX_BOOL aRemoveFromPfOnly = OMX_FALSE) const; |
|
200 |
|
201 private: |
|
202 |
|
203 COmxILProcessingFunction& iProcessingFunction; |
|
204 MOmxILCallbackManagerIf& iCallbacks; |
|
205 |
|
206 RPointerArray<COmxILPort> iAllPorts; |
|
207 RArray<TBool> iTimePorts; // Indicate the corresponding port is OMX_OTHER_FormatTime |
|
208 |
|
209 OMX_PORT_PARAM_TYPE iAudioParamInit; |
|
210 OMX_PORT_PARAM_TYPE iImageParamInit; |
|
211 OMX_PORT_PARAM_TYPE iVideoParamInit; |
|
212 OMX_PORT_PARAM_TYPE iOtherParamInit; |
|
213 OMX_BOOL iImmediateReturnTimeBuffer; |
|
214 }; |
|
215 |
|
216 #include "omxilportmanager.inl" |
|
217 |
|
218 #endif // OMXILPORTMANAGER_H |
|