|
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 #include "log.h" |
|
23 #include "omxilstate.h" |
|
24 #include "omxilfsm.h" |
|
25 #include <openmax/il/common/omxilstatedefs.h> |
|
26 #include "omxilcommand.h" |
|
27 #include <openmax/il/common/omxilconfigmanager.h> |
|
28 #include "omxilcallbackmanager.h" |
|
29 |
|
30 |
|
31 OMX_ERRORTYPE |
|
32 COmxILFsm::COmxILState::GetParameter( |
|
33 const COmxILFsm& aFsm, |
|
34 OMX_INDEXTYPE aParamIndex, |
|
35 TAny* apComponentParameterStructure) const |
|
36 { |
|
37 DEBUG_PRINTF(_L8("COmxILState::GetParameter")); |
|
38 |
|
39 // This API can be used independently of the current state of the |
|
40 // component. Let's try first the Port Manager to check if the index is |
|
41 // known there |
|
42 OMX_ERRORTYPE retValue = |
|
43 aFsm.iPortManager.GetParameter(aParamIndex, |
|
44 apComponentParameterStructure); |
|
45 |
|
46 if (OMX_ErrorUnsupportedIndex == retValue) |
|
47 { |
|
48 // Otherwise, try Config Manager... |
|
49 retValue = aFsm.iConfigManager.GetParameter( |
|
50 aParamIndex, |
|
51 apComponentParameterStructure); |
|
52 } |
|
53 |
|
54 return retValue; |
|
55 |
|
56 } |
|
57 |
|
58 // This SetParameter version must be used in the following states: |
|
59 // - OMX_StateIdle, |
|
60 // - OMX_StateExecuting, |
|
61 // - OMX_StatePaused, and |
|
62 // |
|
63 OMX_ERRORTYPE |
|
64 COmxILFsm::COmxILState::SetParameter( |
|
65 COmxILFsm& aFsm, |
|
66 OMX_INDEXTYPE aParamIndex, |
|
67 const TAny* apComponentParameterStructure) |
|
68 { |
|
69 DEBUG_PRINTF(_L8("COmxILState::SetParameter")); |
|
70 |
|
71 OMX_ERRORTYPE retValue = |
|
72 aFsm.iPortManager.SetParameter( |
|
73 aParamIndex, |
|
74 apComponentParameterStructure, |
|
75 OMX_TRUE // Port must be disabled |
|
76 ); |
|
77 |
|
78 if (OMX_ErrorUnsupportedIndex == retValue) |
|
79 { |
|
80 // Try Config Manager now... |
|
81 retValue = aFsm.iConfigManager.SetParameter( |
|
82 aParamIndex, |
|
83 apComponentParameterStructure, |
|
84 OMX_FALSE // run-time |
|
85 ); |
|
86 } |
|
87 |
|
88 return retValue; |
|
89 |
|
90 } |
|
91 |
|
92 // This SetParameter version must be used in the following states: |
|
93 // - OMX_StateLoaded and derived states, |
|
94 // - OMX_StateWaitForResources |
|
95 // |
|
96 OMX_ERRORTYPE |
|
97 COmxILFsm::COmxILState::SetParameterV2( |
|
98 COmxILFsm& aFsm, |
|
99 OMX_INDEXTYPE aParamIndex, |
|
100 const TAny* apComponentParameterStructure) |
|
101 { |
|
102 DEBUG_PRINTF(_L8("COmxILState::SetParameterV2")); |
|
103 |
|
104 OMX_ERRORTYPE retValue = |
|
105 aFsm.iPortManager.SetParameter(aParamIndex, |
|
106 apComponentParameterStructure); |
|
107 |
|
108 if (OMX_ErrorUnsupportedIndex == retValue) |
|
109 { |
|
110 // Try Config Manager now... |
|
111 retValue = aFsm.iConfigManager.SetParameter( |
|
112 aParamIndex, |
|
113 apComponentParameterStructure); |
|
114 } |
|
115 |
|
116 return retValue; |
|
117 |
|
118 } |
|
119 |
|
120 OMX_ERRORTYPE |
|
121 COmxILFsm::COmxILState::GetConfig( |
|
122 const COmxILFsm& aFsm, |
|
123 OMX_INDEXTYPE aConfigIndex, |
|
124 TAny* apComponentConfigStructure) const |
|
125 { |
|
126 DEBUG_PRINTF(_L8("COmxILState::GetConfig")); |
|
127 |
|
128 OMX_ERRORTYPE retValue = |
|
129 aFsm.iPortManager.GetConfig(aConfigIndex, |
|
130 apComponentConfigStructure); |
|
131 |
|
132 if (OMX_ErrorUnsupportedIndex == retValue) |
|
133 { |
|
134 // Try Config Manager now... |
|
135 retValue = aFsm.iConfigManager.GetConfig( |
|
136 aConfigIndex, |
|
137 apComponentConfigStructure); |
|
138 } |
|
139 |
|
140 return retValue; |
|
141 |
|
142 } |
|
143 |
|
144 OMX_ERRORTYPE |
|
145 COmxILFsm::COmxILState::SetConfig(COmxILFsm& aFsm, |
|
146 OMX_INDEXTYPE aConfigIndex, |
|
147 const TAny* apComponentConfigStructure) |
|
148 { |
|
149 DEBUG_PRINTF(_L8("COmxILState::SetConfig")); |
|
150 |
|
151 OMX_ERRORTYPE retValue = |
|
152 aFsm.iPortManager.SetConfig(aConfigIndex, |
|
153 apComponentConfigStructure); |
|
154 |
|
155 if (OMX_ErrorUnsupportedIndex == retValue) |
|
156 { |
|
157 // Try Config Manager now... |
|
158 retValue = aFsm.iConfigManager.SetConfig( |
|
159 aConfigIndex, |
|
160 apComponentConfigStructure); |
|
161 } |
|
162 |
|
163 return retValue; |
|
164 |
|
165 } |
|
166 |
|
167 OMX_ERRORTYPE |
|
168 COmxILFsm::COmxILState::GetExtensionIndex(const COmxILFsm& aFsm, |
|
169 OMX_STRING aParameterName, |
|
170 OMX_INDEXTYPE* apIndexType) const |
|
171 { |
|
172 DEBUG_PRINTF(_L8("COmxILState::GetExtensionIndex")); |
|
173 |
|
174 OMX_ERRORTYPE retValue = |
|
175 aFsm.iPortManager.GetExtensionIndex(aParameterName, |
|
176 apIndexType); |
|
177 |
|
178 if (OMX_ErrorUnsupportedIndex == retValue) |
|
179 { |
|
180 // Try Config Manager now... |
|
181 retValue = aFsm.iConfigManager.GetExtensionIndex( |
|
182 aParameterName, |
|
183 apIndexType); |
|
184 } |
|
185 |
|
186 return retValue; |
|
187 |
|
188 } |
|
189 |
|
190 // |
|
191 // |
|
192 // |
|
193 |
|
194 OMX_ERRORTYPE |
|
195 COmxILFsm::COmxILState::CommandFlush(COmxILFsm& aFsm, |
|
196 const TOmxILCommand& aCommand) |
|
197 { |
|
198 DEBUG_PRINTF(_L8("COmxILState::CommandFlush")); |
|
199 |
|
200 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandFlush, |
|
201 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
202 |
|
203 return aFsm.iPortManager.BufferFlushIndicationFlushCommand( |
|
204 aCommand.iParam1); |
|
205 |
|
206 } |
|
207 |
|
208 OMX_ERRORTYPE |
|
209 COmxILFsm::COmxILState::CommandPortDisable(COmxILFsm& aFsm, |
|
210 const TOmxILCommand& aCommand) |
|
211 { |
|
212 DEBUG_PRINTF(_L8("COmxILState::CommandPortDisable")); |
|
213 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandPortDisable, |
|
214 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
215 |
|
216 // First, flush all buffers in the port(s) that is(are) to be disabled. |
|
217 return aFsm.iPortManager.PortDisableIndication( |
|
218 aCommand.iParam1); |
|
219 |
|
220 } |
|
221 |
|
222 OMX_ERRORTYPE |
|
223 COmxILFsm::COmxILState::CommandPortEnable(COmxILFsm& aFsm, |
|
224 const TOmxILCommand& aCommand) |
|
225 { |
|
226 DEBUG_PRINTF(_L8("COmxILState::CommandPortEnable")); |
|
227 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandPortEnable, |
|
228 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
229 |
|
230 TBool indicationIsFinal = EFalse; |
|
231 return aFsm.iPortManager.PortEnableIndication( |
|
232 aCommand.iParam1, |
|
233 indicationIsFinal); |
|
234 |
|
235 } |
|
236 |
|
237 OMX_ERRORTYPE |
|
238 COmxILFsm::COmxILState::CommandMarkBuffer(COmxILFsm& aFsm, |
|
239 const TOmxILCommand& aCommand) |
|
240 { |
|
241 DEBUG_PRINTF(_L8("COmxILState::CommandMarkBuffer")); |
|
242 |
|
243 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandMarkBuffer, |
|
244 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
245 |
|
246 if (!aCommand.ipCommandData) |
|
247 { |
|
248 return OMX_ErrorBadParameter; |
|
249 } |
|
250 |
|
251 return aFsm.iPortManager.BufferMarkIndication(aCommand.iParam1, |
|
252 aCommand.ipCommandData); |
|
253 |
|
254 } |
|
255 |
|
256 // |
|
257 // COmxILStateInvalid |
|
258 // |
|
259 OMX_ERRORTYPE |
|
260 COmxILFsm::COmxILStateInvalid::GetParameter( |
|
261 const COmxILFsm& /*aFsm*/, |
|
262 OMX_INDEXTYPE /*aParamIndex*/, |
|
263 TAny* /*apComponentParameterStructure*/) const |
|
264 { |
|
265 DEBUG_PRINTF(_L8("COmxILStateInvalid::GetParameter")); |
|
266 return OMX_ErrorInvalidState; |
|
267 } |
|
268 |
|
269 OMX_ERRORTYPE |
|
270 COmxILFsm::COmxILStateInvalid::SetParameter( |
|
271 COmxILFsm& /*aFsm*/, |
|
272 OMX_INDEXTYPE /*aParamIndex*/, |
|
273 const TAny* /*apComponentParameterStructure*/) |
|
274 { |
|
275 DEBUG_PRINTF(_L8("COmxILStateInvalid::SetParameter")); |
|
276 return OMX_ErrorInvalidState; |
|
277 } |
|
278 |
|
279 OMX_ERRORTYPE |
|
280 COmxILFsm::COmxILStateInvalid::GetConfig( |
|
281 const COmxILFsm& /*aFsm*/, |
|
282 OMX_INDEXTYPE /*aConfigIndex*/, |
|
283 TAny* /*apComponentConfigStructure*/) const |
|
284 { |
|
285 DEBUG_PRINTF(_L8("COmxILStateInvalid::GetConfig")); |
|
286 return OMX_ErrorInvalidState; |
|
287 } |
|
288 |
|
289 OMX_ERRORTYPE |
|
290 COmxILFsm::COmxILStateInvalid::SetConfig( |
|
291 COmxILFsm& /*aFsm*/, |
|
292 OMX_INDEXTYPE /*aConfigIndex*/, |
|
293 const TAny* /*apComponentConfigStructure*/) |
|
294 { |
|
295 DEBUG_PRINTF(_L8("COmxILStateInvalid::SetConfig")); |
|
296 return OMX_ErrorInvalidState; |
|
297 } |
|
298 |
|
299 OMX_ERRORTYPE |
|
300 COmxILFsm::COmxILStateInvalid::GetExtensionIndex( |
|
301 const COmxILFsm& /*aFsm*/, |
|
302 OMX_STRING /*aParameterName*/, |
|
303 OMX_INDEXTYPE* /*apIndexType*/) const |
|
304 { |
|
305 DEBUG_PRINTF(_L8("COmxILStateInvalid::GetExtensionIndex")); |
|
306 return OMX_ErrorInvalidState; |
|
307 } |
|
308 |
|
309 OMX_STATETYPE |
|
310 COmxILFsm::COmxILStateInvalid::GetState() const |
|
311 { |
|
312 DEBUG_PRINTF(_L8("COmxILStateInvalid::GetState")); |
|
313 return OMX_StateInvalid; |
|
314 } |
|
315 |
|
316 OMX_ERRORTYPE |
|
317 COmxILFsm::COmxILStateInvalid::ComponentTunnelRequest( |
|
318 COmxILFsm& /*aFsm*/, |
|
319 OMX_U32 /*aPort*/, |
|
320 OMX_HANDLETYPE /*aTunneledComp*/, |
|
321 OMX_U32 /*aTunneledPort*/, |
|
322 OMX_TUNNELSETUPTYPE* /*apTunnelSetup*/) |
|
323 { |
|
324 DEBUG_PRINTF(_L8("COmxILStateInvalid::ComponentTunnelRequest")); |
|
325 |
|
326 return OMX_ErrorInvalidState; |
|
327 |
|
328 } |
|
329 |
|
330 OMX_ERRORTYPE |
|
331 COmxILFsm::COmxILStateInvalid::PopulateBuffer( |
|
332 COmxILFsm& /*aFsm*/, |
|
333 OMX_BUFFERHEADERTYPE** /*appBufferHdr*/, |
|
334 OMX_U32 /*aPortIndex*/, |
|
335 OMX_PTR /*apAppPrivate*/, |
|
336 OMX_U32 /*aSizeBytes*/, |
|
337 OMX_U8* /*apBuffer*/, |
|
338 TBool& /*portPopulationCompleted*/) |
|
339 { |
|
340 DEBUG_PRINTF(_L8("COmxILStateInvalid::PopulateBuffer")); |
|
341 |
|
342 return OMX_ErrorInvalidState; |
|
343 |
|
344 } |
|
345 |
|
346 OMX_ERRORTYPE |
|
347 COmxILFsm::COmxILStateInvalid::FreeBuffer(COmxILFsm& aFsm, |
|
348 OMX_U32 aPortIndex, |
|
349 OMX_BUFFERHEADERTYPE* apBuffer, |
|
350 TBool& aPortDepopulationCompleted) |
|
351 { |
|
352 DEBUG_PRINTF(_L8("COmxILStateInvalid::FreeBuffer")); |
|
353 |
|
354 return COmxILState::FreeBufferV2( |
|
355 aFsm, |
|
356 aPortIndex, |
|
357 apBuffer, |
|
358 aPortDepopulationCompleted); |
|
359 |
|
360 } |
|
361 |
|
362 OMX_ERRORTYPE |
|
363 COmxILFsm::COmxILStateInvalid::EmptyThisBuffer( |
|
364 COmxILFsm& /*aFsm*/, |
|
365 OMX_BUFFERHEADERTYPE* /*apBuffer*/) |
|
366 { |
|
367 DEBUG_PRINTF(_L8("COmxILStateInvalid::EmptyThisBuffer")); |
|
368 |
|
369 return OMX_ErrorInvalidState; |
|
370 |
|
371 } |
|
372 |
|
373 OMX_ERRORTYPE |
|
374 COmxILFsm::COmxILStateInvalid::FillThisBuffer( |
|
375 COmxILFsm& /*aFsm*/, |
|
376 OMX_BUFFERHEADERTYPE* /*apBuffer*/) |
|
377 { |
|
378 DEBUG_PRINTF(_L8("COmxILStateInvalid::FillThisBuffer")); |
|
379 |
|
380 return OMX_ErrorInvalidState; |
|
381 |
|
382 } |
|
383 |
|
384 OMX_ERRORTYPE |
|
385 COmxILFsm::COmxILStateInvalid::CommandStateSet( |
|
386 COmxILFsm& /*aFsm*/, |
|
387 const TOmxILCommand& /*aCommand*/) |
|
388 { |
|
389 DEBUG_PRINTF(_L8("COmxILStateInvalid::CommandStateSet")); |
|
390 return OMX_ErrorInvalidState; |
|
391 } |
|
392 |
|
393 OMX_ERRORTYPE |
|
394 COmxILFsm::COmxILStateInvalid::CommandFlush( |
|
395 COmxILFsm& /*aFsm*/, |
|
396 const TOmxILCommand& /*aCommand*/) |
|
397 { |
|
398 DEBUG_PRINTF(_L8("COmxILStateInvalid::CommandFlush")); |
|
399 return OMX_ErrorInvalidState; |
|
400 } |
|
401 |
|
402 OMX_ERRORTYPE |
|
403 COmxILFsm::COmxILStateInvalid::CommandPortEnable( |
|
404 COmxILFsm& /*aFsm*/, |
|
405 const TOmxILCommand& /*aCommand*/) |
|
406 { |
|
407 DEBUG_PRINTF(_L8("COmxILStateInvalid::CommandPortEnable")); |
|
408 return OMX_ErrorInvalidState; |
|
409 } |
|
410 |
|
411 OMX_ERRORTYPE |
|
412 COmxILFsm::COmxILStateInvalid::CommandPortDisable( |
|
413 COmxILFsm& /*aFsm*/, |
|
414 const TOmxILCommand& /*aCommand*/) |
|
415 { |
|
416 DEBUG_PRINTF(_L8("COmxILStateInvalid::CommandPortDisable")); |
|
417 return OMX_ErrorInvalidState; |
|
418 } |
|
419 |
|
420 OMX_ERRORTYPE |
|
421 COmxILFsm::COmxILStateInvalid::CommandMarkBuffer( |
|
422 COmxILFsm& /*aFsm*/, |
|
423 const TOmxILCommand& /*aCommand*/) |
|
424 { |
|
425 DEBUG_PRINTF(_L8("COmxILStateInvalid::CommandMarkBuffer")); |
|
426 return OMX_ErrorInvalidState; |
|
427 } |
|
428 |
|
429 // |
|
430 // COmxILStateLoaded |
|
431 // |
|
432 OMX_STATETYPE |
|
433 COmxILFsm::COmxILStateLoaded::GetState() const |
|
434 { |
|
435 DEBUG_PRINTF(_L8("COmxILStateLoaded::GetState")); |
|
436 return OMX_StateLoaded; |
|
437 } |
|
438 |
|
439 OMX_ERRORTYPE |
|
440 COmxILFsm::COmxILStateLoaded::SetParameter( |
|
441 COmxILFsm& aFsm, |
|
442 OMX_INDEXTYPE aParamIndex, |
|
443 const TAny* apComponentParameterStructure) |
|
444 { |
|
445 DEBUG_PRINTF(_L8("COmxILStateLoaded::SetParameter")); |
|
446 |
|
447 return COmxILState::SetParameterV2(aFsm, |
|
448 aParamIndex, |
|
449 apComponentParameterStructure); |
|
450 |
|
451 } |
|
452 |
|
453 OMX_ERRORTYPE |
|
454 COmxILFsm::COmxILStateLoaded::PopulateBuffer( |
|
455 COmxILFsm& aFsm, |
|
456 OMX_BUFFERHEADERTYPE** appBufferHdr, |
|
457 OMX_U32 aPortIndex, |
|
458 OMX_PTR apAppPrivate, |
|
459 OMX_U32 aSizeBytes, |
|
460 OMX_U8* apBuffer, |
|
461 TBool& portPopulationCompleted) |
|
462 { |
|
463 DEBUG_PRINTF(_L8("COmxILStateLoaded::PopulateBuffer")); |
|
464 |
|
465 |
|
466 #ifdef _OMXIL_COMMON_IL516C_ON |
|
467 |
|
468 if (!apBuffer) |
|
469 { |
|
470 // ... AllocateBuffer |
|
471 // |
|
472 // At this point, the command requesting the transition from Loaded to |
|
473 // Idle has not been received yet.. (see |
|
474 // COmxILStateLoadedToIdle). Therefore, this can only be successful if |
|
475 // the port is disabled |
|
476 return COmxILState::PopulateBuffer(aFsm, |
|
477 appBufferHdr, |
|
478 aPortIndex, |
|
479 apAppPrivate, |
|
480 aSizeBytes, |
|
481 apBuffer, |
|
482 portPopulationCompleted); |
|
483 } |
|
484 else |
|
485 { |
|
486 //... UseBuffer... |
|
487 OMX_ERRORTYPE omxError = |
|
488 COmxILState::PopulateBufferV2(aFsm, |
|
489 appBufferHdr, |
|
490 aPortIndex, |
|
491 apAppPrivate, |
|
492 aSizeBytes, |
|
493 apBuffer, |
|
494 portPopulationCompleted); |
|
495 if (apBuffer && OMX_ErrorNone == omxError) |
|
496 { |
|
497 DEBUG_PRINTF2(_L8("COmxILStateLoaded::PopulateBuffer : PORT [%u] : Buffer population occurring in OMX_StateLoaded"), aPortIndex); |
|
498 } |
|
499 return omxError; |
|
500 } |
|
501 #else |
|
502 |
|
503 // At this point, the command requesting the transition from Loaded to Idle |
|
504 // has not been received yet.. (see COmxILStateLoadedToIdle). Therefore, |
|
505 // this can only be successful if the port is disabled |
|
506 return COmxILState::PopulateBuffer(aFsm, |
|
507 appBufferHdr, |
|
508 aPortIndex, |
|
509 apAppPrivate, |
|
510 aSizeBytes, |
|
511 apBuffer, |
|
512 portPopulationCompleted); |
|
513 #endif |
|
514 |
|
515 } |
|
516 |
|
517 |
|
518 OMX_ERRORTYPE |
|
519 COmxILFsm::COmxILStateLoaded::FreeBuffer(COmxILFsm& aFsm, |
|
520 OMX_U32 aPortIndex, |
|
521 OMX_BUFFERHEADERTYPE* apBuffer, |
|
522 TBool& aPortDepopulationCompleted) |
|
523 { |
|
524 DEBUG_PRINTF(_L8("COmxILStateLoaded::FreeBuffer")); |
|
525 |
|
526 return COmxILState::FreeBuffer(aFsm, |
|
527 aPortIndex, |
|
528 apBuffer, |
|
529 aPortDepopulationCompleted); |
|
530 |
|
531 } |
|
532 |
|
533 OMX_ERRORTYPE |
|
534 COmxILFsm::COmxILStateLoaded::EmptyThisBuffer(COmxILFsm& aFsm, |
|
535 OMX_BUFFERHEADERTYPE* apBuffer) |
|
536 { |
|
537 DEBUG_PRINTF(_L8("COmxILStateLoaded::EmptyThisBuffer")); |
|
538 |
|
539 #ifdef _OMXIL_COMMON_IL516C_ON |
|
540 return COmxILState::EmptyThisBufferV2(aFsm, |
|
541 apBuffer); |
|
542 #endif |
|
543 |
|
544 return COmxILState::EmptyThisBuffer(aFsm, |
|
545 apBuffer); |
|
546 |
|
547 } |
|
548 |
|
549 OMX_ERRORTYPE |
|
550 COmxILFsm::COmxILStateLoaded::FillThisBuffer(COmxILFsm& aFsm, |
|
551 OMX_BUFFERHEADERTYPE* apBuffer) |
|
552 { |
|
553 DEBUG_PRINTF(_L8("COmxILStateLoaded::FillThisBuffer")); |
|
554 |
|
555 #ifdef _OMXIL_COMMON_IL516C_ON |
|
556 return COmxILState::FillThisBufferV2(aFsm, |
|
557 apBuffer); |
|
558 #endif |
|
559 |
|
560 return COmxILState::FillThisBuffer(aFsm, |
|
561 apBuffer); |
|
562 |
|
563 } |
|
564 |
|
565 OMX_ERRORTYPE |
|
566 COmxILFsm::COmxILStateLoaded::ComponentTunnelRequest( |
|
567 COmxILFsm& aFsm, |
|
568 OMX_U32 aPort, |
|
569 OMX_HANDLETYPE aTunneledComp, |
|
570 OMX_U32 aTunneledPort, |
|
571 OMX_TUNNELSETUPTYPE* apTunnelSetup) |
|
572 { |
|
573 DEBUG_PRINTF(_L8("COmxILStateLoaded::ComponentTunnelRequest")); |
|
574 |
|
575 return COmxILState::ComponentTunnelRequestV2(aFsm, |
|
576 aPort, |
|
577 aTunneledComp, |
|
578 aTunneledPort, |
|
579 apTunnelSetup); |
|
580 |
|
581 } |
|
582 |
|
583 |
|
584 OMX_ERRORTYPE |
|
585 COmxILFsm::COmxILStateLoaded::CommandStateSet( |
|
586 COmxILFsm& aFsm, |
|
587 const TOmxILCommand& aCommand) |
|
588 { |
|
589 DEBUG_PRINTF(_L8("COmxILStateLoaded::CommandStateSet")); |
|
590 |
|
591 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandStateSet, |
|
592 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
593 |
|
594 // The only two transitions allowed are : |
|
595 // - OMX_StateIdle and |
|
596 // - OMX_StateWaitForResources. |
|
597 TStateIndex nextState = EStateMax; |
|
598 switch(aCommand.iParam1) |
|
599 { |
|
600 case OMX_StateIdle: |
|
601 { |
|
602 nextState = ESubStateLoadedToIdle; |
|
603 } |
|
604 break; |
|
605 case OMX_StateWaitForResources: |
|
606 { |
|
607 nextState = EStateWaitForResources; |
|
608 } |
|
609 break; |
|
610 case OMX_StateLoaded: |
|
611 { |
|
612 return OMX_ErrorSameState; |
|
613 } |
|
614 case OMX_StateInvalid: |
|
615 { |
|
616 // Notify the IL client... ignore the ret value.. |
|
617 aFsm.iCallbacks.TransitionCompleteNotification(OMX_StateInvalid); |
|
618 // Invalidate component |
|
619 return OMX_ErrorInvalidState; |
|
620 } |
|
621 default: |
|
622 { |
|
623 return OMX_ErrorIncorrectStateTransition; |
|
624 } |
|
625 |
|
626 }; |
|
627 |
|
628 // Initial checks OK. The component is commanded to make a transition to |
|
629 // OMX_StateIdle or OMX_StateWaitForResources. |
|
630 OMX_ERRORTYPE omxRetValue = aFsm.FsmTransition(nextState); |
|
631 if (OMX_ErrorNone != omxRetValue) |
|
632 { |
|
633 return omxRetValue; |
|
634 } |
|
635 |
|
636 if (ESubStateLoadedToIdle == nextState) |
|
637 { |
|
638 // Lets tell port manager in case there are buffer supplier tunnelled ports |
|
639 TBool componentPopulationCompleted = EFalse; |
|
640 omxRetValue = |
|
641 aFsm.iPortManager.TunnellingBufferAllocation( |
|
642 componentPopulationCompleted); |
|
643 if (OMX_ErrorNone != omxRetValue) |
|
644 { |
|
645 return omxRetValue; |
|
646 } |
|
647 |
|
648 if (componentPopulationCompleted) |
|
649 { |
|
650 // Complete here the transition to OMX_StateIdle |
|
651 omxRetValue = aFsm.FsmTransition(EStateIdle); |
|
652 if (OMX_ErrorNone == omxRetValue) |
|
653 { |
|
654 // Notify the IL client that port population has completed |
|
655 // sucessfully |
|
656 omxRetValue = |
|
657 aFsm.iCallbacks.TransitionCompleteNotification( |
|
658 OMX_StateIdle); |
|
659 } |
|
660 |
|
661 } |
|
662 |
|
663 } |
|
664 else |
|
665 { |
|
666 // Notify the IL client that the transition to |
|
667 // OMX_StateWaitForResources has completed sucessfully |
|
668 omxRetValue = aFsm.iCallbacks.TransitionCompleteNotification( |
|
669 OMX_StateWaitForResources); |
|
670 |
|
671 } |
|
672 |
|
673 return omxRetValue; |
|
674 |
|
675 } |
|
676 |
|
677 OMX_ERRORTYPE |
|
678 COmxILFsm::COmxILStateLoaded::CommandPortEnable( |
|
679 COmxILFsm& aFsm, |
|
680 const TOmxILCommand& aCommand) |
|
681 { |
|
682 DEBUG_PRINTF(_L8("COmxILStateLoaded::CommandPortEnable")); |
|
683 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandPortEnable, |
|
684 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
685 |
|
686 TBool indicationIsFinal = ETrue; |
|
687 return aFsm.iPortManager.PortEnableIndication( |
|
688 aCommand.iParam1, |
|
689 indicationIsFinal); |
|
690 |
|
691 } |
|
692 |
|
693 |
|
694 // |
|
695 // COmxILStateLoadedToIdle |
|
696 // |
|
697 OMX_ERRORTYPE |
|
698 COmxILFsm::COmxILStateLoadedToIdle::PopulateBuffer( |
|
699 COmxILFsm& aFsm, |
|
700 OMX_BUFFERHEADERTYPE** appBufferHdr, |
|
701 OMX_U32 aPortIndex, |
|
702 OMX_PTR apAppPrivate, |
|
703 OMX_U32 aSizeBytes, |
|
704 OMX_U8* apBuffer, |
|
705 TBool& portPopulationCompleted) |
|
706 { |
|
707 DEBUG_PRINTF(_L8("COmxILStateLoadedToIdle::PopulateBuffer")); |
|
708 |
|
709 OMX_ERRORTYPE omxError = |
|
710 COmxILState::PopulateBufferV2(aFsm, |
|
711 appBufferHdr, |
|
712 aPortIndex, |
|
713 apAppPrivate, |
|
714 aSizeBytes, |
|
715 apBuffer, |
|
716 portPopulationCompleted); |
|
717 |
|
718 if (apBuffer && OMX_ErrorNone == omxError) |
|
719 { |
|
720 DEBUG_PRINTF2(_L8("COmxILStateLoadedToIdle::PopulateBuffer : PORT [%u] : Buffer population occurring in state LoadedToIdle"), aPortIndex); |
|
721 } |
|
722 |
|
723 return omxError; |
|
724 |
|
725 } |
|
726 |
|
727 |
|
728 OMX_ERRORTYPE |
|
729 COmxILFsm::COmxILStateLoadedToIdle::CommandStateSet( |
|
730 COmxILFsm& aFsm, |
|
731 const TOmxILCommand& aCommand) |
|
732 { |
|
733 DEBUG_PRINTF(_L8("COmxILStateLoadedToIdle::CommandStateSet")); |
|
734 |
|
735 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandStateSet, |
|
736 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
737 |
|
738 switch(aCommand.iParam1) |
|
739 { |
|
740 case OMX_StateWaitForResources: |
|
741 { |
|
742 // Not implemented for now... |
|
743 return OMX_ErrorNotImplemented; |
|
744 } |
|
745 case OMX_StateLoaded: |
|
746 { |
|
747 // Here, return "same state" as the transition to OMX_StateLoaded has |
|
748 // not completed yet. |
|
749 return OMX_ErrorSameState; |
|
750 } |
|
751 case OMX_StateInvalid: |
|
752 { |
|
753 // Notify the IL client... ignore the ret value... |
|
754 aFsm.iCallbacks.TransitionCompleteNotification(OMX_StateInvalid); |
|
755 // Invalidate component |
|
756 return OMX_ErrorInvalidState; |
|
757 } |
|
758 default: |
|
759 { |
|
760 return OMX_ErrorIncorrectStateTransition; |
|
761 } |
|
762 }; |
|
763 |
|
764 } |
|
765 |
|
766 OMX_ERRORTYPE |
|
767 COmxILFsm::COmxILStateLoadedToIdle::CommandPortEnable( |
|
768 COmxILFsm& aFsm, |
|
769 const TOmxILCommand& aCommand) |
|
770 { |
|
771 DEBUG_PRINTF(_L8("COmxILStateLoadedToIdle::CommandPortEnable")); |
|
772 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandPortEnable, |
|
773 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
774 |
|
775 TBool indicationIsFinal = EFalse; |
|
776 OMX_ERRORTYPE omxRetValue = |
|
777 aFsm.iPortManager.PortEnableIndication( |
|
778 aCommand.iParam1, |
|
779 indicationIsFinal); |
|
780 if (OMX_ErrorNone != omxRetValue) |
|
781 { |
|
782 return omxRetValue; |
|
783 } |
|
784 |
|
785 // Lets tell port manager in case the port being enabled is a tunnel |
|
786 // supplier... |
|
787 TBool componentPopulationCompleted = EFalse; |
|
788 omxRetValue = |
|
789 aFsm.iPortManager.TunnellingBufferAllocation( |
|
790 componentPopulationCompleted, aCommand.iParam1); |
|
791 if (OMX_ErrorNone != omxRetValue) |
|
792 { |
|
793 return omxRetValue; |
|
794 } |
|
795 |
|
796 // Let's do this check here although this situation is going to be very |
|
797 // unlikely... |
|
798 if (componentPopulationCompleted) |
|
799 { |
|
800 // Complete here the transition to OMX_StateIdle |
|
801 omxRetValue = aFsm.FsmTransition(EStateIdle); |
|
802 if (OMX_ErrorNone == omxRetValue) |
|
803 { |
|
804 // Notify the IL client that port population has completed sucessfully |
|
805 aFsm.iCallbacks.TransitionCompleteNotification( |
|
806 OMX_StateIdle); |
|
807 } |
|
808 |
|
809 } |
|
810 |
|
811 return omxRetValue; |
|
812 |
|
813 } |
|
814 |
|
815 |
|
816 // |
|
817 // COmxILStateWaitForResources |
|
818 // |
|
819 OMX_STATETYPE |
|
820 COmxILFsm::COmxILStateWaitForResources::GetState() const |
|
821 { |
|
822 DEBUG_PRINTF(_L8("COmxILStateWaitForResources::GetState")); |
|
823 return OMX_StateWaitForResources; |
|
824 } |
|
825 |
|
826 |
|
827 OMX_ERRORTYPE |
|
828 COmxILFsm::COmxILStateWaitForResources::SetParameter( |
|
829 COmxILFsm& aFsm, |
|
830 OMX_INDEXTYPE aParamIndex, |
|
831 const TAny* apComponentParameterStructure) |
|
832 { |
|
833 DEBUG_PRINTF(_L8("COmxILStateWaitForResources::SetParameter")); |
|
834 |
|
835 return COmxILState::SetParameterV2(aFsm, |
|
836 aParamIndex, |
|
837 apComponentParameterStructure); |
|
838 |
|
839 } |
|
840 |
|
841 |
|
842 OMX_ERRORTYPE |
|
843 COmxILFsm::COmxILStateWaitForResources::PopulateBuffer( |
|
844 COmxILFsm& aFsm, |
|
845 OMX_BUFFERHEADERTYPE** appBufferHdr, |
|
846 OMX_U32 aPortIndex, |
|
847 OMX_PTR apAppPrivate, |
|
848 OMX_U32 aSizeBytes, |
|
849 OMX_U8* apBuffer, |
|
850 TBool& portPopulationCompleted) |
|
851 { |
|
852 DEBUG_PRINTF(_L8("COmxILStateWaitForResources::PopulateBuffer")); |
|
853 |
|
854 // NOTE that according to the spec, PopulateBuffer could be used here even |
|
855 // if the port is enabled. However, for now the transition from |
|
856 // OMX_StateWaitForResouces -> OMX_StateIdle is not supported, therefore |
|
857 // buffer population is only allowed for disabled ports. This should be |
|
858 // changed once Resource Management functionality is available and this |
|
859 // state is revisited. |
|
860 return COmxILState::PopulateBuffer(aFsm, |
|
861 appBufferHdr, |
|
862 aPortIndex, |
|
863 apAppPrivate, |
|
864 aSizeBytes, |
|
865 apBuffer, |
|
866 portPopulationCompleted); |
|
867 |
|
868 } |
|
869 |
|
870 |
|
871 OMX_ERRORTYPE |
|
872 COmxILFsm::COmxILStateWaitForResources::FreeBuffer( |
|
873 COmxILFsm& aFsm, |
|
874 OMX_U32 aPortIndex, |
|
875 OMX_BUFFERHEADERTYPE* apBuffer, |
|
876 TBool& aPortDepopulationCompleted) |
|
877 { |
|
878 DEBUG_PRINTF(_L8("COmxILStateWaitForResources::FreeBuffer")); |
|
879 |
|
880 return COmxILState::FreeBuffer(aFsm, |
|
881 aPortIndex, |
|
882 apBuffer, |
|
883 aPortDepopulationCompleted); |
|
884 |
|
885 } |
|
886 |
|
887 OMX_ERRORTYPE |
|
888 COmxILFsm::COmxILStateWaitForResources::EmptyThisBuffer( |
|
889 COmxILFsm& aFsm, |
|
890 OMX_BUFFERHEADERTYPE* apBuffer) |
|
891 { |
|
892 DEBUG_PRINTF(_L8("COmxILStateWaitForResources::EmptyThisBuffer")); |
|
893 |
|
894 #ifdef _OMXIL_COMMON_IL516C_ON |
|
895 return COmxILState::EmptyThisBufferV2(aFsm, |
|
896 apBuffer); |
|
897 #endif |
|
898 |
|
899 return COmxILState::EmptyThisBuffer(aFsm, |
|
900 apBuffer); |
|
901 |
|
902 |
|
903 } |
|
904 |
|
905 OMX_ERRORTYPE |
|
906 COmxILFsm::COmxILStateWaitForResources::FillThisBuffer( |
|
907 COmxILFsm& aFsm, |
|
908 OMX_BUFFERHEADERTYPE* apBuffer) |
|
909 { |
|
910 DEBUG_PRINTF(_L8("COmxILStateWaitForResources::FillThisBuffer")); |
|
911 |
|
912 #ifdef _OMXIL_COMMON_IL516C_ON |
|
913 return COmxILState::FillThisBufferV2(aFsm, |
|
914 apBuffer); |
|
915 #endif |
|
916 |
|
917 return COmxILState::FillThisBuffer(aFsm, |
|
918 apBuffer); |
|
919 |
|
920 } |
|
921 |
|
922 |
|
923 OMX_ERRORTYPE |
|
924 COmxILFsm::COmxILStateWaitForResources::ComponentTunnelRequest( |
|
925 COmxILFsm& aFsm, |
|
926 OMX_U32 aPort, |
|
927 OMX_HANDLETYPE aTunneledComp, |
|
928 OMX_U32 aTunneledPort, |
|
929 OMX_TUNNELSETUPTYPE* apTunnelSetup) |
|
930 { |
|
931 DEBUG_PRINTF(_L8("COmxILStateWaitForResources::ComponentTunnelRequest")); |
|
932 |
|
933 return COmxILState::ComponentTunnelRequest(aFsm, |
|
934 aPort, |
|
935 aTunneledComp, |
|
936 aTunneledPort, |
|
937 apTunnelSetup); |
|
938 |
|
939 } |
|
940 |
|
941 |
|
942 OMX_ERRORTYPE |
|
943 COmxILFsm::COmxILStateWaitForResources::CommandStateSet( |
|
944 COmxILFsm& aFsm, |
|
945 const TOmxILCommand& aCommand) |
|
946 { |
|
947 DEBUG_PRINTF(_L8("COmxILStateWaitForResources::CommandStateSet")); |
|
948 |
|
949 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandStateSet, |
|
950 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
951 |
|
952 // Transition to OMX_StateIdle not implemented for now... |
|
953 TStateIndex nextState = EStateMax; |
|
954 switch(aCommand.iParam1) |
|
955 { |
|
956 case OMX_StateLoaded: |
|
957 { |
|
958 nextState = EStateLoaded; |
|
959 } |
|
960 break; |
|
961 case OMX_StateWaitForResources: |
|
962 { |
|
963 return OMX_ErrorSameState; |
|
964 } |
|
965 case OMX_StateInvalid: |
|
966 { |
|
967 // Notify the IL client... ignore the ret value... |
|
968 aFsm.iCallbacks.TransitionCompleteNotification(OMX_StateInvalid); |
|
969 // Invalidate component |
|
970 return OMX_ErrorInvalidState; |
|
971 } |
|
972 default: |
|
973 { |
|
974 return OMX_ErrorIncorrectStateTransition; |
|
975 } |
|
976 }; |
|
977 |
|
978 // Initial checks OK. The component is commanded to make a transition to |
|
979 // OMX_StateLoaded |
|
980 OMX_ERRORTYPE omxRetValue = aFsm.FsmTransition(nextState); |
|
981 if (OMX_ErrorNone == omxRetValue) |
|
982 { |
|
983 // Notify the IL client that the transition to |
|
984 // OMX_StateLoaded has completed sucessfully |
|
985 omxRetValue = |
|
986 aFsm.iCallbacks.TransitionCompleteNotification(OMX_StateLoaded); |
|
987 } |
|
988 |
|
989 return omxRetValue; |
|
990 |
|
991 } |
|
992 |
|
993 OMX_ERRORTYPE |
|
994 COmxILFsm::COmxILStateWaitForResources::CommandPortEnable( |
|
995 COmxILFsm& aFsm, |
|
996 const TOmxILCommand& aCommand) |
|
997 { |
|
998 DEBUG_PRINTF(_L8("COmxILStateWaitForResources::CommandPortEnable")); |
|
999 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandPortEnable, |
|
1000 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1001 |
|
1002 // NOTE: Here, we only care about the port enabled flag. Transition from |
|
1003 // OMX_StateWaitForResources to OMX_StateIdle is not implemented at this |
|
1004 // stage until a Resource Manager is available. Whenever a Resource Manager |
|
1005 // becomes available, a COmxILStateWaitForResourcesToIdle substate should |
|
1006 // be implemented to handle the allocation of buffers mandated by the |
|
1007 // standard when a port is enabled in this transition. |
|
1008 TBool indicationIsFinal = ETrue; |
|
1009 return aFsm.iPortManager.PortEnableIndication( |
|
1010 aCommand.iParam1, |
|
1011 indicationIsFinal); |
|
1012 |
|
1013 } |
|
1014 |
|
1015 |
|
1016 // |
|
1017 // COmxILStateIdle |
|
1018 // |
|
1019 OMX_STATETYPE |
|
1020 COmxILFsm::COmxILStateIdle::GetState() const |
|
1021 { |
|
1022 DEBUG_PRINTF(_L8("COmxILStateIdle::GetState")); |
|
1023 return OMX_StateIdle; |
|
1024 } |
|
1025 |
|
1026 |
|
1027 OMX_ERRORTYPE |
|
1028 COmxILFsm::COmxILStateIdle::SetParameter( |
|
1029 COmxILFsm& aFsm, |
|
1030 OMX_INDEXTYPE aParamIndex, |
|
1031 const TAny* apComponentParameterStructure) |
|
1032 { |
|
1033 DEBUG_PRINTF(_L8("COmxILStateIdle::SetParameter")); |
|
1034 |
|
1035 return COmxILState::SetParameter(aFsm, |
|
1036 aParamIndex, |
|
1037 apComponentParameterStructure); |
|
1038 |
|
1039 } |
|
1040 |
|
1041 OMX_ERRORTYPE |
|
1042 COmxILFsm::COmxILStateIdle::PopulateBuffer(COmxILFsm& aFsm, |
|
1043 OMX_BUFFERHEADERTYPE** appBufferHdr, |
|
1044 OMX_U32 aPortIndex, |
|
1045 OMX_PTR apAppPrivate, |
|
1046 OMX_U32 aSizeBytes, |
|
1047 OMX_U8* apBuffer, |
|
1048 TBool& portPopulationCompleted) |
|
1049 { |
|
1050 DEBUG_PRINTF(_L8("COmxILStateIdle::PopulateBuffer")); |
|
1051 |
|
1052 // At this point, no buffer population can take place unless the port is disabled |
|
1053 return COmxILState::PopulateBuffer(aFsm, |
|
1054 appBufferHdr, |
|
1055 aPortIndex, |
|
1056 apAppPrivate, |
|
1057 aSizeBytes, |
|
1058 apBuffer, |
|
1059 portPopulationCompleted); |
|
1060 |
|
1061 } |
|
1062 |
|
1063 |
|
1064 OMX_ERRORTYPE |
|
1065 COmxILFsm::COmxILStateIdle::FreeBuffer(COmxILFsm& aFsm, |
|
1066 OMX_U32 aPortIndex, |
|
1067 OMX_BUFFERHEADERTYPE* apBuffer, |
|
1068 TBool& aPortDepopulationCompleted) |
|
1069 { |
|
1070 DEBUG_PRINTF(_L8("COmxILStateIdle::FreeBuffer")); |
|
1071 |
|
1072 // At this point, the command requesting the transition from Idle to Loaded |
|
1073 // has not been received yet.. (see COmxILStateIdleToLoaded). Therefore, |
|
1074 // this can only be successful if the port is disabled |
|
1075 return COmxILState::FreeBuffer(aFsm, |
|
1076 aPortIndex, |
|
1077 apBuffer, |
|
1078 aPortDepopulationCompleted); |
|
1079 |
|
1080 } |
|
1081 |
|
1082 OMX_ERRORTYPE |
|
1083 COmxILFsm::COmxILStateIdle::EmptyThisBuffer( |
|
1084 COmxILFsm& aFsm, |
|
1085 OMX_BUFFERHEADERTYPE* apBuffer) |
|
1086 { |
|
1087 DEBUG_PRINTF(_L8("COmxILStateIdle::EmptyThisBuffer")); |
|
1088 |
|
1089 return COmxILState::EmptyThisBufferV2(aFsm, |
|
1090 apBuffer); |
|
1091 |
|
1092 } |
|
1093 |
|
1094 OMX_ERRORTYPE |
|
1095 COmxILFsm::COmxILStateIdle::FillThisBuffer(COmxILFsm& aFsm, |
|
1096 OMX_BUFFERHEADERTYPE* apBuffer) |
|
1097 { |
|
1098 DEBUG_PRINTF(_L8("COmxILStateIdle::FillThisBuffer")); |
|
1099 |
|
1100 return COmxILState::FillThisBufferV2(aFsm, |
|
1101 apBuffer); |
|
1102 |
|
1103 } |
|
1104 |
|
1105 OMX_ERRORTYPE |
|
1106 COmxILFsm::COmxILStateIdle::ComponentTunnelRequest( |
|
1107 COmxILFsm& aFsm, |
|
1108 OMX_U32 aPort, |
|
1109 OMX_HANDLETYPE aTunneledComp, |
|
1110 OMX_U32 aTunneledPort, |
|
1111 OMX_TUNNELSETUPTYPE* apTunnelSetup) |
|
1112 { |
|
1113 DEBUG_PRINTF(_L8("COmxILStateIdle::ComponentTunnelRequest")); |
|
1114 |
|
1115 return COmxILState::ComponentTunnelRequest(aFsm, |
|
1116 aPort, |
|
1117 aTunneledComp, |
|
1118 aTunneledPort, |
|
1119 apTunnelSetup); |
|
1120 |
|
1121 } |
|
1122 |
|
1123 OMX_ERRORTYPE |
|
1124 COmxILFsm::COmxILStateIdle::CommandStateSet( |
|
1125 COmxILFsm& aFsm, |
|
1126 const TOmxILCommand& aCommand) |
|
1127 { |
|
1128 DEBUG_PRINTF(_L8("COmxILStateIdle::CommandStateSet")); |
|
1129 |
|
1130 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandStateSet, |
|
1131 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1132 |
|
1133 TStateIndex nextState = EStateInvalid; |
|
1134 switch(aCommand.iParam1) |
|
1135 { |
|
1136 case OMX_StateLoaded: |
|
1137 { |
|
1138 nextState = ESubStateIdleToLoaded; |
|
1139 } |
|
1140 break; |
|
1141 case OMX_StateExecuting: |
|
1142 { |
|
1143 nextState = EStateExecuting; |
|
1144 } |
|
1145 break; |
|
1146 case OMX_StatePause: |
|
1147 { |
|
1148 nextState = EStatePause; |
|
1149 } |
|
1150 break; |
|
1151 case OMX_StateIdle: |
|
1152 { |
|
1153 return OMX_ErrorSameState; |
|
1154 } |
|
1155 case OMX_StateInvalid: |
|
1156 { |
|
1157 // Notify the IL client... ignore the ret value... |
|
1158 aFsm.iCallbacks.TransitionCompleteNotification(OMX_StateInvalid); |
|
1159 // Invalidate component |
|
1160 return OMX_ErrorInvalidState; |
|
1161 } |
|
1162 default: |
|
1163 { |
|
1164 return OMX_ErrorIncorrectStateTransition; |
|
1165 } |
|
1166 }; |
|
1167 |
|
1168 // Initial command checks OK |
|
1169 |
|
1170 // Commit transition to the valid state |
|
1171 OMX_ERRORTYPE omxRetValue = aFsm.FsmTransition(nextState); |
|
1172 if (OMX_ErrorNone != omxRetValue) |
|
1173 { |
|
1174 return omxRetValue; |
|
1175 } |
|
1176 |
|
1177 if (ESubStateIdleToLoaded == nextState) |
|
1178 { |
|
1179 // Lets tell port manager in case there are tunnelled ports... |
|
1180 TBool componentDepopulationCompleted = EFalse; |
|
1181 omxRetValue = |
|
1182 aFsm.iPortManager.TunnellingBufferDeallocation( |
|
1183 componentDepopulationCompleted); |
|
1184 if (OMX_ErrorNone != omxRetValue) |
|
1185 { |
|
1186 return omxRetValue; |
|
1187 } |
|
1188 |
|
1189 if (componentDepopulationCompleted) |
|
1190 { |
|
1191 // Complete here the transition to OMX_StateLoaded |
|
1192 omxRetValue = aFsm.FsmTransition(EStateLoaded); |
|
1193 if (OMX_ErrorNone == omxRetValue) |
|
1194 { |
|
1195 // Notify the IL client that port population has completed sucessfully |
|
1196 omxRetValue = aFsm.iCallbacks.TransitionCompleteNotification( |
|
1197 OMX_StateLoaded); |
|
1198 } |
|
1199 } |
|
1200 |
|
1201 } |
|
1202 else |
|
1203 { |
|
1204 // Notify the IL client that the transition to the valid state |
|
1205 // OMX_StatePause or OMX_StateExecuting has completed sucessfully |
|
1206 omxRetValue = aFsm.iCallbacks.TransitionCompleteNotification( |
|
1207 static_cast<OMX_STATETYPE>(aCommand.iParam1)); |
|
1208 |
|
1209 if (OMX_ErrorNone == omxRetValue) |
|
1210 { |
|
1211 // Fire up the tunnelled buffer exchange, if any tunnelled ports are |
|
1212 // found in the component... |
|
1213 omxRetValue = aFsm.iPortManager.InitiateTunnellingDataFlow(); |
|
1214 } |
|
1215 |
|
1216 } |
|
1217 |
|
1218 return omxRetValue; |
|
1219 |
|
1220 } |
|
1221 |
|
1222 OMX_ERRORTYPE |
|
1223 COmxILFsm::COmxILStateIdle::CommandFlush(COmxILFsm& aFsm, |
|
1224 const TOmxILCommand& aCommand) |
|
1225 { |
|
1226 DEBUG_PRINTF(_L8("COmxILStateIdle::CommandFlush")); |
|
1227 |
|
1228 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandFlush, |
|
1229 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1230 |
|
1231 return aFsm.iPortManager.BufferFlushIndicationFlushCommand( |
|
1232 aCommand.iParam1, OMX_FALSE); // Do not eject buffers |
|
1233 |
|
1234 } |
|
1235 |
|
1236 |
|
1237 OMX_ERRORTYPE |
|
1238 COmxILFsm::COmxILStateIdle::CommandPortEnable( |
|
1239 COmxILFsm& aFsm, |
|
1240 const TOmxILCommand& aCommand) |
|
1241 { |
|
1242 DEBUG_PRINTF(_L8("COmxILStateIdle::CommandPortEnable")); |
|
1243 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandPortEnable, |
|
1244 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1245 |
|
1246 // In this state, the port allocation has finished for enabled |
|
1247 // ports. However, a port is being enabled here. The port being enabled |
|
1248 // must populate (if tunnel supplier) or be populated (if non-tunnel |
|
1249 // supplier or IL Client communication) |
|
1250 TBool indicationIsFinal = EFalse; |
|
1251 OMX_ERRORTYPE omxRetValue = |
|
1252 aFsm.iPortManager.PortEnableIndication( |
|
1253 aCommand.iParam1, |
|
1254 indicationIsFinal); |
|
1255 |
|
1256 if (OMX_ErrorNone == omxRetValue) |
|
1257 { |
|
1258 // From section 3.2.2.6, "If the IL client enables a port while the |
|
1259 // component is in any state other than OMX_StateLoaded or |
|
1260 // OMX_WaitForResources, then that port shall allocate its buffers via |
|
1261 // the same call sequence used on a transition from OMX_StateLoaded to |
|
1262 // OMX_StateIdle." |
|
1263 |
|
1264 // Lets tell port manager in case the port being enabled is a tunnel |
|
1265 // supplier... |
|
1266 TBool componentPopulationCompleted = EFalse; |
|
1267 omxRetValue = |
|
1268 aFsm.iPortManager.TunnellingBufferAllocation( |
|
1269 componentPopulationCompleted, aCommand.iParam1); |
|
1270 } |
|
1271 |
|
1272 return omxRetValue; |
|
1273 |
|
1274 } |
|
1275 |
|
1276 |
|
1277 // |
|
1278 // COmxILStateIdleToLoaded |
|
1279 // |
|
1280 OMX_ERRORTYPE |
|
1281 COmxILFsm::COmxILStateIdleToLoaded::FreeBuffer(COmxILFsm& aFsm, |
|
1282 OMX_U32 aPortIndex, |
|
1283 OMX_BUFFERHEADERTYPE* apBuffer, |
|
1284 TBool& aPortDepopulationCompleted) |
|
1285 { |
|
1286 DEBUG_PRINTF(_L8("COmxILStateIdleToLoaded::FreeBuffer")); |
|
1287 |
|
1288 return COmxILState::FreeBufferV2(aFsm, |
|
1289 aPortIndex, |
|
1290 apBuffer, |
|
1291 aPortDepopulationCompleted); |
|
1292 |
|
1293 } |
|
1294 |
|
1295 |
|
1296 OMX_ERRORTYPE |
|
1297 COmxILFsm::COmxILStateIdleToLoaded::CommandStateSet( |
|
1298 COmxILFsm& aFsm, |
|
1299 const TOmxILCommand& aCommand) |
|
1300 { |
|
1301 DEBUG_PRINTF(_L8("COmxILStateIdleToLoaded::CommandStateSet")); |
|
1302 |
|
1303 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandStateSet, |
|
1304 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1305 |
|
1306 switch (aCommand.iParam1) |
|
1307 { |
|
1308 case OMX_StateIdle: |
|
1309 { |
|
1310 // Here, return "same state" as the transition to OMX_StateLoaded has |
|
1311 // not completed yet. |
|
1312 return OMX_ErrorSameState; |
|
1313 } |
|
1314 case OMX_StateInvalid: |
|
1315 { |
|
1316 // Notify the IL client... ignore the ret value... |
|
1317 aFsm.iCallbacks.TransitionCompleteNotification(OMX_StateInvalid); |
|
1318 // Invalidate component |
|
1319 return OMX_ErrorInvalidState; |
|
1320 } |
|
1321 default: |
|
1322 { |
|
1323 __ASSERT_ALWAYS(0, User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1324 } |
|
1325 }; |
|
1326 |
|
1327 return OMX_ErrorNone; |
|
1328 |
|
1329 } |
|
1330 |
|
1331 |
|
1332 // |
|
1333 // COmxILStateExecuting |
|
1334 // |
|
1335 OMX_STATETYPE |
|
1336 COmxILFsm::COmxILStateExecuting::GetState() const |
|
1337 { |
|
1338 DEBUG_PRINTF(_L8("COmxILStateExecuting::GetState")); |
|
1339 return OMX_StateExecuting; |
|
1340 } |
|
1341 |
|
1342 |
|
1343 OMX_ERRORTYPE |
|
1344 COmxILFsm::COmxILStateExecuting::SetParameter(COmxILFsm& aFsm, |
|
1345 OMX_INDEXTYPE aParamIndex, |
|
1346 const TAny* apComponentParameterStructure) |
|
1347 { |
|
1348 DEBUG_PRINTF(_L8("COmxILStateExecuting::SetParameter")); |
|
1349 |
|
1350 return COmxILState::SetParameter(aFsm, |
|
1351 aParamIndex, |
|
1352 apComponentParameterStructure); |
|
1353 |
|
1354 } |
|
1355 |
|
1356 |
|
1357 OMX_ERRORTYPE |
|
1358 COmxILFsm::COmxILStateExecuting::PopulateBuffer(COmxILFsm& aFsm, |
|
1359 OMX_BUFFERHEADERTYPE** appBufferHdr, |
|
1360 OMX_U32 aPortIndex, |
|
1361 OMX_PTR apAppPrivate, |
|
1362 OMX_U32 aSizeBytes, |
|
1363 OMX_U8* apBuffer, |
|
1364 TBool& portPopulationCompleted) |
|
1365 { |
|
1366 DEBUG_PRINTF(_L8("COmxILStateExecuting::PopulateBuffer")); |
|
1367 |
|
1368 return COmxILState::PopulateBuffer(aFsm, |
|
1369 appBufferHdr, |
|
1370 aPortIndex, |
|
1371 apAppPrivate, |
|
1372 aSizeBytes, |
|
1373 apBuffer, |
|
1374 portPopulationCompleted); |
|
1375 |
|
1376 } |
|
1377 |
|
1378 |
|
1379 OMX_ERRORTYPE |
|
1380 COmxILFsm::COmxILStateExecuting::FreeBuffer(COmxILFsm& aFsm, |
|
1381 OMX_U32 aPortIndex, |
|
1382 OMX_BUFFERHEADERTYPE* apBuffer, |
|
1383 TBool& aPortDepopulationCompleted) |
|
1384 { |
|
1385 DEBUG_PRINTF(_L8("COmxILStateExecuting::FreeBuffer")); |
|
1386 |
|
1387 return COmxILState::FreeBuffer(aFsm, |
|
1388 aPortIndex, |
|
1389 apBuffer, |
|
1390 aPortDepopulationCompleted); |
|
1391 |
|
1392 } |
|
1393 |
|
1394 |
|
1395 OMX_ERRORTYPE |
|
1396 COmxILFsm::COmxILStateExecuting::EmptyThisBuffer( |
|
1397 COmxILFsm& aFsm, |
|
1398 OMX_BUFFERHEADERTYPE* apBuffer) |
|
1399 { |
|
1400 DEBUG_PRINTF(_L8("COmxILStateExecuting::EmptyThisBuffer")); |
|
1401 |
|
1402 return COmxILState::EmptyThisBufferV2(aFsm, |
|
1403 apBuffer); |
|
1404 |
|
1405 } |
|
1406 |
|
1407 |
|
1408 OMX_ERRORTYPE |
|
1409 COmxILFsm::COmxILStateExecuting::FillThisBuffer(COmxILFsm& aFsm, |
|
1410 OMX_BUFFERHEADERTYPE* apBuffer) |
|
1411 { |
|
1412 DEBUG_PRINTF(_L8("COmxILStateExecuting::FillThisBuffer")); |
|
1413 |
|
1414 return COmxILState::FillThisBufferV2(aFsm, |
|
1415 apBuffer); |
|
1416 |
|
1417 } |
|
1418 |
|
1419 |
|
1420 OMX_ERRORTYPE |
|
1421 COmxILFsm::COmxILStateExecuting::ComponentTunnelRequest( |
|
1422 COmxILFsm& aFsm, |
|
1423 OMX_U32 aPort, |
|
1424 OMX_HANDLETYPE aTunneledComp, |
|
1425 OMX_U32 aTunneledPort, |
|
1426 OMX_TUNNELSETUPTYPE* apTunnelSetup) |
|
1427 { |
|
1428 DEBUG_PRINTF(_L8("COmxILStateExecuting::ComponentTunnelRequest")); |
|
1429 |
|
1430 return COmxILState::ComponentTunnelRequest(aFsm, |
|
1431 aPort, |
|
1432 aTunneledComp, |
|
1433 aTunneledPort, |
|
1434 apTunnelSetup); |
|
1435 |
|
1436 } |
|
1437 |
|
1438 |
|
1439 OMX_ERRORTYPE |
|
1440 COmxILFsm::COmxILStateExecuting::CommandStateSet( |
|
1441 COmxILFsm& aFsm, |
|
1442 const TOmxILCommand& aCommand) |
|
1443 { |
|
1444 DEBUG_PRINTF(_L8("COmxILStateExecuting::CommandStateSet")); |
|
1445 |
|
1446 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandStateSet, |
|
1447 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1448 |
|
1449 TStateIndex nextState = EStateMax; |
|
1450 switch(aCommand.iParam1) |
|
1451 { |
|
1452 case OMX_StateIdle: |
|
1453 { |
|
1454 nextState = ESubStateExecutingToIdle; |
|
1455 } |
|
1456 break; |
|
1457 case OMX_StatePause: |
|
1458 { |
|
1459 nextState = EStatePause; |
|
1460 } |
|
1461 break; |
|
1462 case OMX_StateExecuting: |
|
1463 { |
|
1464 return OMX_ErrorSameState; |
|
1465 } |
|
1466 case OMX_StateInvalid: |
|
1467 { |
|
1468 // Notify the IL client... ignore the ret value... |
|
1469 aFsm.iCallbacks.TransitionCompleteNotification(OMX_StateInvalid); |
|
1470 // Invalidate component |
|
1471 return OMX_ErrorInvalidState; |
|
1472 } |
|
1473 default: |
|
1474 { |
|
1475 return OMX_ErrorIncorrectStateTransition; |
|
1476 } |
|
1477 }; |
|
1478 |
|
1479 |
|
1480 // Initial checks OK. The component is commanded to make a transition to |
|
1481 // ESubStateExecutingToIdle substate or OMX_StatePause. |
|
1482 OMX_ERRORTYPE omxRetValue = aFsm.FsmTransition(nextState); |
|
1483 if (OMX_ErrorNone != omxRetValue) |
|
1484 { |
|
1485 return omxRetValue; |
|
1486 } |
|
1487 |
|
1488 if (ESubStateExecutingToIdle == nextState) |
|
1489 { |
|
1490 // Lets tell port manager since at this point it is mandated that all |
|
1491 // buffers must be returned to their suppliers (IL Client and/or |
|
1492 // tunnelled components). |
|
1493 TBool allBuffersReturnedToSuppliers = EFalse; |
|
1494 omxRetValue = |
|
1495 aFsm.iPortManager.BufferFlushIndicationPauseOrExeToIdleCommand( |
|
1496 allBuffersReturnedToSuppliers); |
|
1497 if (OMX_ErrorNone != omxRetValue) |
|
1498 { |
|
1499 return omxRetValue; |
|
1500 } |
|
1501 |
|
1502 if (allBuffersReturnedToSuppliers) |
|
1503 { |
|
1504 // Complete here the transition to OMX_StateIdle |
|
1505 omxRetValue = aFsm.FsmTransition(EStateIdle); |
|
1506 if (OMX_ErrorNone == omxRetValue) |
|
1507 { |
|
1508 // Notify the IL client that port population has completed sucessfully |
|
1509 omxRetValue = aFsm.iCallbacks.TransitionCompleteNotification( |
|
1510 OMX_StateIdle); |
|
1511 } |
|
1512 } |
|
1513 |
|
1514 } |
|
1515 else |
|
1516 { |
|
1517 // Notify the IL client that the transition to OMX_StatePause has |
|
1518 // completed sucessfully |
|
1519 omxRetValue = aFsm.iCallbacks.TransitionCompleteNotification( |
|
1520 OMX_StatePause); |
|
1521 |
|
1522 } |
|
1523 |
|
1524 return omxRetValue; |
|
1525 |
|
1526 } |
|
1527 |
|
1528 |
|
1529 OMX_ERRORTYPE |
|
1530 COmxILFsm::COmxILStateExecuting::CommandPortEnable( |
|
1531 COmxILFsm& aFsm, |
|
1532 const TOmxILCommand& aCommand) |
|
1533 { |
|
1534 DEBUG_PRINTF(_L8("COmxILStateExecuting::CommandPortEnable")); |
|
1535 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandPortEnable, |
|
1536 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1537 |
|
1538 // In this state, the port allocation has finished for enabled |
|
1539 // ports. However, a port is being enabled here. The port being enabled |
|
1540 // must populate (if tunnel supplier) or be populated (if non-tunnel |
|
1541 // supplier or IL Client communication) |
|
1542 TBool indicationIsFinal = EFalse; |
|
1543 OMX_ERRORTYPE omxRetValue = |
|
1544 aFsm.iPortManager.PortEnableIndication( |
|
1545 aCommand.iParam1, |
|
1546 indicationIsFinal); |
|
1547 |
|
1548 if (OMX_ErrorNone == omxRetValue) |
|
1549 { |
|
1550 // From section 3.2.2.6, "If the IL client enables a port while the |
|
1551 // component is in any state other than OMX_StateLoaded or |
|
1552 // OMX_WaitForResources, then that port shall allocate its buffers via |
|
1553 // the same call sequence used on a transition from OMX_StateLoaded to |
|
1554 // OMX_StateIdle. If the IL client enables while the component is in |
|
1555 // the OMX_Executing state, then that port shall begin transferring |
|
1556 // buffers" |
|
1557 |
|
1558 // Lets tell port manager in case the port being enabled is a tunnel |
|
1559 // supplier... |
|
1560 TBool componentPopulationCompleted = EFalse; |
|
1561 omxRetValue = |
|
1562 aFsm.iPortManager.TunnellingBufferAllocation( |
|
1563 componentPopulationCompleted, aCommand.iParam1); |
|
1564 |
|
1565 // No need to use here componentPopulationCompleted. A port is being |
|
1566 // enabled in OMX_StateExecuting. If the port is a supplier, after |
|
1567 // being re-enabled it should start the buffer allocation phase, |
|
1568 // regardless of the population state of other ports in the component. |
|
1569 if (OMX_ErrorNone == omxRetValue) |
|
1570 { |
|
1571 // Fire up the tunnelled buffer exchange in the enabled port... |
|
1572 omxRetValue = aFsm.iPortManager.InitiateTunnellingDataFlow( |
|
1573 aCommand.iParam1); |
|
1574 } |
|
1575 } |
|
1576 |
|
1577 return omxRetValue; |
|
1578 |
|
1579 } |
|
1580 |
|
1581 |
|
1582 // |
|
1583 // MOmxILPauseOrExecutingToIdle |
|
1584 // |
|
1585 OMX_ERRORTYPE |
|
1586 COmxILFsm::MOmxILPauseOrExecutingToIdle::ReturnThisBuffer( |
|
1587 COmxILFsm& aFsm, |
|
1588 OMX_BUFFERHEADERTYPE* apBuffer, |
|
1589 OMX_DIRTYPE aDirection) |
|
1590 { |
|
1591 DEBUG_PRINTF(_L8("MOmxILPauseOrExecutingToIdle::ReturnThisBuffer")); |
|
1592 |
|
1593 TBool allBuffersReturned = EFalse; |
|
1594 OMX_ERRORTYPE omxRetValue = |
|
1595 aFsm.iPortManager.BufferReturnIndication( |
|
1596 apBuffer, |
|
1597 aDirection, |
|
1598 allBuffersReturned |
|
1599 ); |
|
1600 |
|
1601 if (OMX_ErrorNone != omxRetValue) |
|
1602 { |
|
1603 return omxRetValue; |
|
1604 } |
|
1605 |
|
1606 if (allBuffersReturned && |
|
1607 aFsm.iPortManager.AllBuffersAtHome()) |
|
1608 { |
|
1609 // Complete here the transition to OMX_StateIdle |
|
1610 omxRetValue = aFsm.FsmTransition(EStateIdle); |
|
1611 if (OMX_ErrorNone == omxRetValue) |
|
1612 { |
|
1613 // Notify the IL client that transition to Idle has completed |
|
1614 // sucessfully |
|
1615 omxRetValue = aFsm.iCallbacks.TransitionCompleteNotification( |
|
1616 OMX_StateIdle); |
|
1617 } |
|
1618 } |
|
1619 |
|
1620 return omxRetValue; |
|
1621 |
|
1622 } |
|
1623 |
|
1624 |
|
1625 |
|
1626 // |
|
1627 // COmxILStateExecutingToIdle |
|
1628 // |
|
1629 OMX_ERRORTYPE |
|
1630 COmxILFsm::COmxILStateExecutingToIdle::EmptyThisBuffer( |
|
1631 COmxILFsm& aFsm, |
|
1632 OMX_BUFFERHEADERTYPE* apBuffer) |
|
1633 { |
|
1634 DEBUG_PRINTF(_L8("COmxILStateExecutingToIdle::EmptyThisBuffer")); |
|
1635 |
|
1636 return ReturnThisBuffer(aFsm, |
|
1637 apBuffer, |
|
1638 OMX_DirInput); |
|
1639 |
|
1640 } |
|
1641 |
|
1642 |
|
1643 OMX_ERRORTYPE |
|
1644 COmxILFsm::COmxILStateExecutingToIdle::FillThisBuffer( |
|
1645 COmxILFsm& aFsm, |
|
1646 OMX_BUFFERHEADERTYPE* apBuffer) |
|
1647 { |
|
1648 DEBUG_PRINTF(_L8("COmxILStateExecutingToIdle::FillThisBuffer")); |
|
1649 |
|
1650 return ReturnThisBuffer(aFsm, |
|
1651 apBuffer, |
|
1652 OMX_DirOutput); |
|
1653 |
|
1654 } |
|
1655 |
|
1656 |
|
1657 OMX_ERRORTYPE |
|
1658 COmxILFsm::COmxILStateExecutingToIdle::CommandStateSet( |
|
1659 COmxILFsm& aFsm, |
|
1660 const TOmxILCommand& aCommand) |
|
1661 { |
|
1662 DEBUG_PRINTF(_L8("COmxILStateExecutingToIdle::CommandStateSet")); |
|
1663 |
|
1664 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandStateSet, |
|
1665 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1666 |
|
1667 switch(aCommand.iParam1) |
|
1668 { |
|
1669 case OMX_StateExecuting: |
|
1670 { |
|
1671 // Here, return "same state" as the transition to OMX_StateIdle has |
|
1672 // not completed yet. |
|
1673 return OMX_ErrorSameState; |
|
1674 } |
|
1675 case OMX_StateInvalid: |
|
1676 { |
|
1677 // Notify the IL client... ignore the ret value... |
|
1678 aFsm.iCallbacks.TransitionCompleteNotification(OMX_StateInvalid); |
|
1679 // Invalidate component |
|
1680 return OMX_ErrorInvalidState; |
|
1681 } |
|
1682 default: |
|
1683 { |
|
1684 return OMX_ErrorIncorrectStateTransition; |
|
1685 } |
|
1686 }; |
|
1687 |
|
1688 } |
|
1689 |
|
1690 |
|
1691 // |
|
1692 // COmxILStatePause |
|
1693 // |
|
1694 OMX_STATETYPE |
|
1695 COmxILFsm::COmxILStatePause::GetState() const |
|
1696 { |
|
1697 DEBUG_PRINTF(_L8("COmxILStatePause::GetState")); |
|
1698 return OMX_StatePause; |
|
1699 } |
|
1700 |
|
1701 |
|
1702 OMX_ERRORTYPE |
|
1703 COmxILFsm::COmxILStatePause::SetParameter( |
|
1704 COmxILFsm& aFsm, |
|
1705 OMX_INDEXTYPE aParamIndex, |
|
1706 const TAny* apComponentParameterStructure) |
|
1707 { |
|
1708 DEBUG_PRINTF(_L8("COmxILStatePause::SetParameter")); |
|
1709 |
|
1710 return COmxILState::SetParameter(aFsm, |
|
1711 aParamIndex, |
|
1712 apComponentParameterStructure); |
|
1713 |
|
1714 } |
|
1715 |
|
1716 |
|
1717 OMX_ERRORTYPE |
|
1718 COmxILFsm::COmxILStatePause::PopulateBuffer( |
|
1719 COmxILFsm& aFsm, |
|
1720 OMX_BUFFERHEADERTYPE** appBufferHdr, |
|
1721 OMX_U32 aPortIndex, |
|
1722 OMX_PTR apAppPrivate, |
|
1723 OMX_U32 aSizeBytes, |
|
1724 OMX_U8* apBuffer, |
|
1725 TBool& portPopulationCompleted) |
|
1726 { |
|
1727 DEBUG_PRINTF(_L8("COmxILStatePause::PopulateBuffer")); |
|
1728 |
|
1729 return COmxILState::PopulateBuffer(aFsm, |
|
1730 appBufferHdr, |
|
1731 aPortIndex, |
|
1732 apAppPrivate, |
|
1733 aSizeBytes, |
|
1734 apBuffer, |
|
1735 portPopulationCompleted); |
|
1736 |
|
1737 } |
|
1738 |
|
1739 |
|
1740 OMX_ERRORTYPE |
|
1741 COmxILFsm::COmxILStatePause::FreeBuffer(COmxILFsm& aFsm, |
|
1742 OMX_U32 aPortIndex, |
|
1743 OMX_BUFFERHEADERTYPE* apBuffer, |
|
1744 TBool& aPortDepopulationCompleted) |
|
1745 { |
|
1746 DEBUG_PRINTF(_L8("COmxILStatePause::FreeBuffer")); |
|
1747 |
|
1748 return COmxILState::FreeBuffer(aFsm, |
|
1749 aPortIndex, |
|
1750 apBuffer, |
|
1751 aPortDepopulationCompleted); |
|
1752 |
|
1753 } |
|
1754 |
|
1755 |
|
1756 OMX_ERRORTYPE |
|
1757 COmxILFsm::COmxILStatePause::EmptyThisBuffer( |
|
1758 COmxILFsm& aFsm, |
|
1759 OMX_BUFFERHEADERTYPE* apBuffer) |
|
1760 { |
|
1761 DEBUG_PRINTF(_L8("COmxILStatePause::EmptyThisBuffer")); |
|
1762 |
|
1763 return COmxILState::EmptyThisBufferV2(aFsm, |
|
1764 apBuffer); |
|
1765 |
|
1766 } |
|
1767 |
|
1768 OMX_ERRORTYPE |
|
1769 COmxILFsm::COmxILStatePause::FillThisBuffer(COmxILFsm& aFsm, |
|
1770 OMX_BUFFERHEADERTYPE* apBuffer) |
|
1771 { |
|
1772 DEBUG_PRINTF(_L8("COmxILStatePause::FillThisBuffer")); |
|
1773 |
|
1774 return COmxILState::FillThisBufferV2(aFsm, |
|
1775 apBuffer); |
|
1776 |
|
1777 } |
|
1778 |
|
1779 OMX_ERRORTYPE |
|
1780 COmxILFsm::COmxILStatePause::ComponentTunnelRequest( |
|
1781 COmxILFsm& aFsm, |
|
1782 OMX_U32 aPort, |
|
1783 OMX_HANDLETYPE aTunneledComp, |
|
1784 OMX_U32 aTunneledPort, |
|
1785 OMX_TUNNELSETUPTYPE* apTunnelSetup) |
|
1786 { |
|
1787 DEBUG_PRINTF(_L8("COmxILStatePause::ComponentTunnelRequest")); |
|
1788 |
|
1789 return COmxILState::ComponentTunnelRequest(aFsm, |
|
1790 aPort, |
|
1791 aTunneledComp, |
|
1792 aTunneledPort, |
|
1793 apTunnelSetup); |
|
1794 |
|
1795 } |
|
1796 |
|
1797 |
|
1798 OMX_ERRORTYPE |
|
1799 COmxILFsm::COmxILStatePause::CommandStateSet( |
|
1800 COmxILFsm& aFsm, |
|
1801 const TOmxILCommand& aCommand) |
|
1802 { |
|
1803 DEBUG_PRINTF(_L8("COmxILStatePause::CommandStateSet")); |
|
1804 |
|
1805 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandStateSet, |
|
1806 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1807 |
|
1808 TStateIndex nextState = EStateInvalid; |
|
1809 switch(aCommand.iParam1) |
|
1810 { |
|
1811 case OMX_StateIdle: |
|
1812 { |
|
1813 nextState = ESubStatePauseToIdle; |
|
1814 } |
|
1815 break; |
|
1816 case OMX_StateExecuting: |
|
1817 { |
|
1818 nextState = EStateExecuting; |
|
1819 } |
|
1820 break; |
|
1821 case OMX_StatePause: |
|
1822 { |
|
1823 return OMX_ErrorSameState; |
|
1824 } |
|
1825 case OMX_StateInvalid: |
|
1826 { |
|
1827 // Notify the IL client... ignore the ret value... |
|
1828 aFsm.iCallbacks.TransitionCompleteNotification(OMX_StateInvalid); |
|
1829 // Invalidate component |
|
1830 return OMX_ErrorInvalidState; |
|
1831 } |
|
1832 default: |
|
1833 { |
|
1834 return OMX_ErrorIncorrectStateTransition; |
|
1835 } |
|
1836 }; |
|
1837 |
|
1838 // Initial command checks OK. The component is commanded to make a |
|
1839 // transition to ESubStatePauseToIdle substate or OMX_StateExecuting. |
|
1840 // Commit transition to the valid state |
|
1841 OMX_ERRORTYPE omxRetValue = aFsm.FsmTransition(nextState); |
|
1842 if (OMX_ErrorNone != omxRetValue) |
|
1843 { |
|
1844 return omxRetValue; |
|
1845 } |
|
1846 |
|
1847 if (ESubStatePauseToIdle == nextState) |
|
1848 { |
|
1849 // Lets tell port manager since at this point it is mandated that all |
|
1850 // buffers must be returned to their suppliers (IL Client and/or |
|
1851 // tunnelled components). |
|
1852 TBool allBuffersReturnedToSuppliers = EFalse; |
|
1853 omxRetValue = |
|
1854 aFsm.iPortManager.BufferFlushIndicationPauseOrExeToIdleCommand( |
|
1855 allBuffersReturnedToSuppliers); |
|
1856 if (OMX_ErrorNone != omxRetValue) |
|
1857 { |
|
1858 return omxRetValue; |
|
1859 } |
|
1860 |
|
1861 if (allBuffersReturnedToSuppliers) |
|
1862 { |
|
1863 // Complete here the transition to OMX_StateIdle |
|
1864 omxRetValue = aFsm.FsmTransition(EStateIdle); |
|
1865 if (OMX_ErrorNone == omxRetValue) |
|
1866 { |
|
1867 // Notify the IL client that port population has completed sucessfully |
|
1868 aFsm.iCallbacks.TransitionCompleteNotification( |
|
1869 OMX_StateIdle); |
|
1870 } |
|
1871 } |
|
1872 |
|
1873 } |
|
1874 else |
|
1875 { |
|
1876 // Notify the IL client that the transition to OMX_StateExecuting has |
|
1877 // completed sucessfully |
|
1878 omxRetValue = aFsm.iCallbacks.TransitionCompleteNotification( |
|
1879 OMX_StateExecuting); |
|
1880 |
|
1881 if (OMX_ErrorNone == omxRetValue) |
|
1882 { |
|
1883 // Fire up the tunnelled buffer exchange, if any tunnelled ports are |
|
1884 // found in the component... |
|
1885 omxRetValue = aFsm.iPortManager.InitiateTunnellingDataFlow(); |
|
1886 } |
|
1887 |
|
1888 } |
|
1889 |
|
1890 return omxRetValue; |
|
1891 |
|
1892 } |
|
1893 |
|
1894 OMX_ERRORTYPE |
|
1895 COmxILFsm::COmxILStatePause::CommandPortEnable( |
|
1896 COmxILFsm& aFsm, |
|
1897 const TOmxILCommand& aCommand) |
|
1898 { |
|
1899 DEBUG_PRINTF(_L8("COmxILStatePause::CommandPortEnable")); |
|
1900 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandPortEnable, |
|
1901 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1902 |
|
1903 // In this state, the port allocation has finished for enabled |
|
1904 // ports. However, a port is being enabled here. The port being enabled |
|
1905 // must populate (if tunnel supplier) or be populated (if non-tunnel |
|
1906 // supplier or IL Client communication) |
|
1907 TBool indicationIsFinal = EFalse; |
|
1908 OMX_ERRORTYPE omxRetValue = aFsm.iPortManager.PortEnableIndication( |
|
1909 aCommand.iParam1, |
|
1910 indicationIsFinal); |
|
1911 |
|
1912 if (OMX_ErrorNone == omxRetValue) |
|
1913 { |
|
1914 // From section 3.2.2.6, "If the IL client enables a port while the |
|
1915 // component is in any state other than OMX_StateLoaded or |
|
1916 // OMX_WaitForResources, then that port shall allocate its buffers via |
|
1917 // the same call sequence used on a transition from OMX_StateLoaded to |
|
1918 // OMX_StateIdle." |
|
1919 |
|
1920 // Lets tell port manager in case the port being enabled is a tunnel |
|
1921 // supplier... |
|
1922 TBool componentPopulationCompleted = EFalse; |
|
1923 omxRetValue = |
|
1924 aFsm.iPortManager.TunnellingBufferAllocation( |
|
1925 componentPopulationCompleted, aCommand.iParam1); |
|
1926 |
|
1927 } |
|
1928 |
|
1929 return omxRetValue; |
|
1930 |
|
1931 } |
|
1932 |
|
1933 |
|
1934 // |
|
1935 // COmxILStatePauseToIdle |
|
1936 // |
|
1937 OMX_ERRORTYPE |
|
1938 COmxILFsm::COmxILStatePauseToIdle::EmptyThisBuffer( |
|
1939 COmxILFsm& aFsm, |
|
1940 OMX_BUFFERHEADERTYPE* apBuffer) |
|
1941 { |
|
1942 DEBUG_PRINTF(_L8("COmxILStatePauseToIdle::EmptyThisBuffer")); |
|
1943 |
|
1944 return ReturnThisBuffer(aFsm, |
|
1945 apBuffer, |
|
1946 OMX_DirInput); |
|
1947 |
|
1948 } |
|
1949 |
|
1950 |
|
1951 OMX_ERRORTYPE |
|
1952 COmxILFsm::COmxILStatePauseToIdle::FillThisBuffer( |
|
1953 COmxILFsm& aFsm, |
|
1954 OMX_BUFFERHEADERTYPE* apBuffer) |
|
1955 { |
|
1956 DEBUG_PRINTF(_L8("COmxILStatePauseToIdle::FillThisBuffer")); |
|
1957 |
|
1958 return ReturnThisBuffer(aFsm, |
|
1959 apBuffer, |
|
1960 OMX_DirOutput); |
|
1961 |
|
1962 } |
|
1963 |
|
1964 |
|
1965 OMX_ERRORTYPE |
|
1966 COmxILFsm::COmxILStatePauseToIdle::CommandStateSet( |
|
1967 COmxILFsm& aFsm, |
|
1968 const TOmxILCommand& aCommand) |
|
1969 { |
|
1970 DEBUG_PRINTF(_L8("COmxILStatePauseToIdle::CommandStateSet")); |
|
1971 |
|
1972 __ASSERT_DEBUG(aCommand.iCommandType == OMX_CommandStateSet, |
|
1973 User::Panic(KOmxILFsmPanicCategory, 1)); |
|
1974 |
|
1975 switch(aCommand.iParam1) |
|
1976 { |
|
1977 case OMX_StatePause: |
|
1978 { |
|
1979 // Here, return "same state" as the transition to OMX_StateIdle has not |
|
1980 // completed yet. |
|
1981 return OMX_ErrorSameState; |
|
1982 } |
|
1983 case OMX_StateInvalid: |
|
1984 { |
|
1985 // Notify the IL client... ignore the ret value... |
|
1986 aFsm.iCallbacks.TransitionCompleteNotification(OMX_StateInvalid); |
|
1987 // Invalidate component |
|
1988 return OMX_ErrorInvalidState; |
|
1989 } |
|
1990 default: |
|
1991 { |
|
1992 return OMX_ErrorIncorrectStateTransition; |
|
1993 } |
|
1994 }; |
|
1995 |
|
1996 } |
|
1997 |
|
1998 |