|
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 /** |
|
19 * @file |
|
20 * @internalTechnology |
|
21 */ |
|
22 |
|
23 #include <uri8.h> |
|
24 #include "omxilcallbackmanager.h" |
|
25 #include "omxilfilesourceprocessingfunction.h" |
|
26 |
|
27 const TInt KMaxMsgQueueEntries = 25; |
|
28 |
|
29 |
|
30 COmxILFileSourceProcessingFunction* COmxILFileSourceProcessingFunction::NewL(MOmxILCallbackNotificationIf& aCallbacks) |
|
31 { |
|
32 COmxILFileSourceProcessingFunction* self = new (ELeave) COmxILFileSourceProcessingFunction(aCallbacks); |
|
33 CleanupStack::PushL(self); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(self); |
|
36 return self; |
|
37 } |
|
38 |
|
39 COmxILFileSourceProcessingFunction::COmxILFileSourceProcessingFunction(MOmxILCallbackNotificationIf& aCallbacks) |
|
40 : COmxILProcessingFunction(aCallbacks) |
|
41 { |
|
42 } |
|
43 |
|
44 void COmxILFileSourceProcessingFunction::ConstructL() |
|
45 { |
|
46 iState = OMX_StateLoaded; |
|
47 iFileSourceAccess = CFileSourceAccess::NewL(*this); |
|
48 iPFHelper = CPFHelper::NewL(*this, *iFileSourceAccess); |
|
49 } |
|
50 |
|
51 COmxILFileSourceProcessingFunction::~COmxILFileSourceProcessingFunction() |
|
52 { |
|
53 if(iPFHelper && |
|
54 (iState == OMX_StateInvalid || |
|
55 iState == OMX_StateExecuting || |
|
56 iState == OMX_StatePause)) |
|
57 { |
|
58 iPFHelper->StopSync(); |
|
59 } |
|
60 |
|
61 delete iPFHelper; |
|
62 delete iFileSourceAccess; |
|
63 delete iUri; |
|
64 delete iFileName; |
|
65 |
|
66 // Buffer headers are not owned by the processing function |
|
67 iBuffersToFill.Close(); |
|
68 } |
|
69 |
|
70 OMX_ERRORTYPE COmxILFileSourceProcessingFunction::StateTransitionIndication(COmxILFsm::TStateIndex aNewState) |
|
71 { |
|
72 OMX_ERRORTYPE err = OMX_ErrorNone; |
|
73 switch(aNewState) |
|
74 { |
|
75 case COmxILFsm::EStateExecuting: |
|
76 { |
|
77 if (iPFHelper->ExecuteAsync() != KErrNone) |
|
78 { |
|
79 err = OMX_ErrorInsufficientResources; |
|
80 } |
|
81 } |
|
82 break; |
|
83 |
|
84 case COmxILFsm::EStateInvalid: |
|
85 { |
|
86 if (iPFHelper && iPFHelper->StopAsync() != KErrNone) |
|
87 { |
|
88 err = OMX_ErrorInsufficientResources; |
|
89 } |
|
90 |
|
91 } |
|
92 break; |
|
93 |
|
94 case COmxILFsm::EStatePause: |
|
95 { |
|
96 iPFHelper->PauseAsync(); |
|
97 } |
|
98 break; |
|
99 |
|
100 case COmxILFsm::EStateIdle: |
|
101 { |
|
102 iPFHelper->IdleAsync(); |
|
103 } |
|
104 break; |
|
105 |
|
106 case COmxILFsm::EStateLoaded: |
|
107 case COmxILFsm::EStateWaitForResources: |
|
108 { |
|
109 if (iPFHelper && iPFHelper->StopAsync() != KErrNone) |
|
110 { |
|
111 err = OMX_ErrorInsufficientResources; |
|
112 } |
|
113 } |
|
114 break; |
|
115 |
|
116 case COmxILFsm::ESubStateExecutingToIdle: |
|
117 { |
|
118 iPFHelper->StopAsync(); |
|
119 } |
|
120 break; |
|
121 case COmxILFsm::ESubStatePauseToIdle: |
|
122 case COmxILFsm::ESubStateLoadedToIdle: |
|
123 case COmxILFsm::ESubStateIdleToLoaded: |
|
124 break; |
|
125 |
|
126 default: |
|
127 { |
|
128 err = OMX_ErrorIncorrectStateTransition; |
|
129 } |
|
130 }; |
|
131 |
|
132 return err; |
|
133 } |
|
134 |
|
135 OMX_ERRORTYPE COmxILFileSourceProcessingFunction::BufferFlushingIndication(TUint32 aPortIndex, OMX_DIRTYPE aDirection) |
|
136 { |
|
137 OMX_ERRORTYPE err = OMX_ErrorNone; |
|
138 if ((aPortIndex == OMX_ALL && aDirection == OMX_DirMax) || |
|
139 (aPortIndex == 0 && aDirection == OMX_DirOutput)) |
|
140 { |
|
141 // Send BufferDone notifications for each bufer... |
|
142 for (TUint i=0, bufferCount=iBuffersToFill.Count(); i<bufferCount; ++i) |
|
143 { |
|
144 OMX_BUFFERHEADERTYPE* pBufferHeader = iBuffersToFill[i]; |
|
145 iCallbacks.BufferDoneNotification(pBufferHeader, |
|
146 pBufferHeader->nOutputPortIndex, |
|
147 OMX_DirOutput); |
|
148 } |
|
149 // Empty buffer lists... |
|
150 iBuffersToFill.Reset(); |
|
151 } |
|
152 else |
|
153 { |
|
154 err = OMX_ErrorBadParameter; |
|
155 } |
|
156 return err; |
|
157 } |
|
158 |
|
159 OMX_ERRORTYPE COmxILFileSourceProcessingFunction::ParamIndication(OMX_INDEXTYPE aParamIndex, const TAny* apComponentParameterStructure) |
|
160 { |
|
161 OMX_ERRORTYPE err = OMX_ErrorNone; |
|
162 switch(aParamIndex) |
|
163 { |
|
164 case OMX_IndexParamPortDefinition: |
|
165 { |
|
166 //const OMX_PARAM_PORTDEFINITIONTYPE* portDefinition = static_cast<const OMX_PARAM_PORTDEFINITIONTYPE*>(apComponentParameterStructure); |
|
167 //nothing to do |
|
168 // |
|
169 //the number of buffers may change depending on capture mode (single shot vs burst mode) |
|
170 //in that case, we need to do something for PF... |
|
171 break; |
|
172 } |
|
173 case OMX_IndexParamContentURI: |
|
174 { |
|
175 const OMX_PARAM_CONTENTURITYPE* contentUriType = reinterpret_cast<const OMX_PARAM_CONTENTURITYPE*>(apComponentParameterStructure); |
|
176 err = SetFileName(contentUriType); |
|
177 break; |
|
178 } |
|
179 default: |
|
180 { |
|
181 err = OMX_ErrorUnsupportedIndex; |
|
182 } |
|
183 } |
|
184 return err; |
|
185 } |
|
186 |
|
187 OMX_ERRORTYPE COmxILFileSourceProcessingFunction::ConfigIndication(OMX_INDEXTYPE /*aConfigIndex*/, const TAny* /*apComponentConfigStructure*/) |
|
188 { |
|
189 return OMX_ErrorNone; |
|
190 } |
|
191 |
|
192 OMX_ERRORTYPE COmxILFileSourceProcessingFunction::BufferIndication(OMX_BUFFERHEADERTYPE* apBufferHeader, OMX_DIRTYPE aDirection) |
|
193 { |
|
194 if (aDirection == OMX_DirOutput) |
|
195 { |
|
196 if (iPFHelper->BufferIndication(apBufferHeader) != KErrNone) |
|
197 { |
|
198 return OMX_ErrorInsufficientResources; |
|
199 } |
|
200 } |
|
201 else |
|
202 { |
|
203 return OMX_ErrorBadParameter; |
|
204 } |
|
205 |
|
206 return OMX_ErrorNone; |
|
207 } |
|
208 |
|
209 OMX_BOOL COmxILFileSourceProcessingFunction::BufferRemovalIndication(OMX_BUFFERHEADERTYPE* apBufferHeader, OMX_DIRTYPE /*aDirection*/) |
|
210 { |
|
211 OMX_BOOL headerDeletionResult = OMX_TRUE; |
|
212 |
|
213 TInt headerIndexInArray = KErrNotFound; |
|
214 if (KErrNotFound !=(headerIndexInArray = iBuffersToFill.Find(apBufferHeader))) |
|
215 { |
|
216 iBuffersToFill.Remove(headerIndexInArray); |
|
217 } |
|
218 else |
|
219 { |
|
220 headerDeletionResult = OMX_FALSE; |
|
221 } |
|
222 |
|
223 return headerDeletionResult; |
|
224 } |
|
225 |
|
226 MOmxILCallbackNotificationIf& COmxILFileSourceProcessingFunction::GetCallbacks() |
|
227 { |
|
228 return iCallbacks; |
|
229 } |
|
230 |
|
231 OMX_ERRORTYPE COmxILFileSourceProcessingFunction::SetFileName(const OMX_PARAM_CONTENTURITYPE* aContentUriType) |
|
232 { |
|
233 ASSERT(aContentUriType); |
|
234 delete iFileName; |
|
235 iFileName = NULL; |
|
236 delete iUri; |
|
237 iUri = NULL; |
|
238 |
|
239 TInt sizeOfUri = aContentUriType->nSize - _FOFF(OMX_PARAM_CONTENTURITYPE, contentURI); //Actual size of URI |
|
240 if (sizeOfUri <= 0) |
|
241 { |
|
242 return OMX_ErrorBadParameter; |
|
243 } |
|
244 |
|
245 // Don't include the zero character at the end. |
|
246 TPtrC8 uriDes(aContentUriType->contentURI,sizeOfUri); |
|
247 |
|
248 TInt err = KErrNone; |
|
249 do |
|
250 { |
|
251 TUriParser8 parser; |
|
252 err = parser.Parse(uriDes); |
|
253 if (err != KErrNone) |
|
254 { |
|
255 break; |
|
256 } |
|
257 |
|
258 TRAP(err, iFileName = parser.GetFileNameL()); |
|
259 if (err != KErrNone) |
|
260 { |
|
261 break; |
|
262 } |
|
263 |
|
264 // Remove Null charcter '\0' if any. |
|
265 TPtr filePtr(iFileName->Des()); |
|
266 TInt index = filePtr.LocateReverse('\0'); |
|
267 if (index != KErrNotFound && index == filePtr.Length()-1) |
|
268 { |
|
269 filePtr.Delete(index,1); |
|
270 } |
|
271 |
|
272 uriDes.Set(reinterpret_cast<const TUint8 *>(aContentUriType), aContentUriType->nSize ); |
|
273 iUri = uriDes.Alloc(); |
|
274 if (!iUri) |
|
275 { |
|
276 err = KErrNoMemory; |
|
277 break; |
|
278 } |
|
279 |
|
280 return OMX_ErrorNone; |
|
281 } |
|
282 while (EFalse); |
|
283 |
|
284 // Something failed. |
|
285 ASSERT(err != KErrNone); |
|
286 delete iFileName; |
|
287 iFileName = NULL; |
|
288 delete iUri; |
|
289 iUri = NULL; |
|
290 return (err == KErrNoMemory ? OMX_ErrorInsufficientResources : OMX_ErrorBadParameter); |
|
291 } |
|
292 |
|
293 |
|
294 const HBufC* COmxILFileSourceProcessingFunction::FileName() const |
|
295 { |
|
296 return iFileName; |
|
297 } |
|
298 |
|
299 const HBufC8* COmxILFileSourceProcessingFunction::Uri() const |
|
300 { |
|
301 return iUri; |
|
302 } |
|
303 |
|
304 COmxILFileSourceProcessingFunction::CFileSourceAccess* COmxILFileSourceProcessingFunction::CFileSourceAccess::NewL(COmxILFileSourceProcessingFunction& aParent) |
|
305 { |
|
306 CFileSourceAccess* self = new (ELeave) CFileSourceAccess(aParent); |
|
307 CleanupStack::PushL(self); |
|
308 self->ConstructL(); |
|
309 CleanupStack::Pop(self); |
|
310 return self; |
|
311 } |
|
312 |
|
313 COmxILFileSourceProcessingFunction::CFileSourceAccess::CFileSourceAccess(COmxILFileSourceProcessingFunction& aParent) |
|
314 : CActive(EPriorityStandard), |
|
315 iParent(aParent), |
|
316 iBufferOffset(0), |
|
317 iReadBuffer(0,0) |
|
318 { |
|
319 CActiveScheduler::Add(this); |
|
320 } |
|
321 |
|
322 void COmxILFileSourceProcessingFunction::CFileSourceAccess::ConstructL() |
|
323 { |
|
324 User::LeaveIfError(iFs.Connect()); |
|
325 } |
|
326 |
|
327 COmxILFileSourceProcessingFunction::CFileSourceAccess::~CFileSourceAccess() |
|
328 { |
|
329 Cancel(); |
|
330 |
|
331 iFileHandle.Close(); |
|
332 iFs.Close(); |
|
333 } |
|
334 |
|
335 void COmxILFileSourceProcessingFunction::CFileSourceAccess::RunL() |
|
336 { |
|
337 // The buffer is not on the list implies that they have already been flushed/spotted |
|
338 // via BufferFlushingIndication/BufferRemovalIndication |
|
339 TInt index = iParent.iBuffersToFill.Find(iCurrentBuffer); |
|
340 if (KErrNotFound != index) |
|
341 { |
|
342 switch(iStatus.Int()) |
|
343 { |
|
344 case KErrNone: |
|
345 { |
|
346 if (iReadBuffer.Length()==0) //the end of the file |
|
347 { |
|
348 iFileHandle.Close(); |
|
349 iCurrentBuffer->nFlags |= OMX_BUFFERFLAG_EOS; |
|
350 iParent.GetCallbacks().EventNotification(OMX_EventBufferFlag, iCurrentBuffer->nOutputPortIndex, OMX_BUFFERFLAG_EOS, NULL); |
|
351 } |
|
352 iCurrentBuffer->nFilledLen=iReadBuffer.Length(); |
|
353 iCurrentBuffer->nOffset = 0; |
|
354 break; |
|
355 } |
|
356 default: |
|
357 { |
|
358 User::Leave(iStatus.Int()); |
|
359 } |
|
360 }; |
|
361 |
|
362 iParent.GetCallbacks().BufferDoneNotification(iCurrentBuffer,iCurrentBuffer->nOutputPortIndex,OMX_DirOutput); |
|
363 iParent.iBuffersToFill.Remove(index); |
|
364 iCurrentBuffer = NULL; |
|
365 if(iFileHandle.SubSessionHandle() != 0) |
|
366 { |
|
367 ProcessNextBuffer(); |
|
368 } |
|
369 } |
|
370 } |
|
371 |
|
372 TInt COmxILFileSourceProcessingFunction::CFileSourceAccess::ProcessNextBuffer() |
|
373 { |
|
374 TInt err = KErrNone; |
|
375 if ((iParent.iBuffersToFill.Count() > 0) && !IsActive() && iParent.iState == OMX_StateExecuting) |
|
376 { |
|
377 iCurrentBuffer = iParent.iBuffersToFill[0]; |
|
378 iReadBuffer.Set(iCurrentBuffer->pBuffer, iCurrentBuffer->nAllocLen, iCurrentBuffer->nAllocLen); |
|
379 if (iFileHandle.SubSessionHandle() == 0) |
|
380 { |
|
381 SetActive(); |
|
382 TRequestStatus* status(&iStatus); |
|
383 User::RequestComplete(status, KErrNone); |
|
384 } |
|
385 else |
|
386 { |
|
387 iFileHandle.Read(iReadBuffer, iCurrentBuffer->nAllocLen, iStatus); |
|
388 SetActive(); |
|
389 } |
|
390 } |
|
391 |
|
392 return err; |
|
393 } |
|
394 |
|
395 void COmxILFileSourceProcessingFunction::CFileSourceAccess::DoCancel() |
|
396 { |
|
397 if (iFileHandle.SubSessionHandle() != 0) |
|
398 { |
|
399 iFileHandle.Close(); |
|
400 } |
|
401 iCurrentBuffer = NULL; |
|
402 } |
|
403 |
|
404 TInt COmxILFileSourceProcessingFunction::CFileSourceAccess::Execute() |
|
405 { |
|
406 iParent.iState = OMX_StateExecuting; |
|
407 return ProcessNextBuffer(); |
|
408 } |
|
409 |
|
410 void COmxILFileSourceProcessingFunction::CFileSourceAccess::Pause() |
|
411 { |
|
412 iParent.iState = OMX_StatePause; |
|
413 } |
|
414 |
|
415 void COmxILFileSourceProcessingFunction::CFileSourceAccess::Idle() |
|
416 { |
|
417 iParent.iState = OMX_StateIdle; |
|
418 iParent.iBuffersToFill.Reset(); |
|
419 } |
|
420 |
|
421 |
|
422 |
|
423 void COmxILFileSourceProcessingFunction::CFileSourceAccess::Stop() |
|
424 { |
|
425 if(iParent.iState == OMX_StateExecuting || iParent.iState == OMX_StatePause) |
|
426 { |
|
427 Cancel(); |
|
428 iParent.iState = OMX_StateIdle; |
|
429 } |
|
430 } |
|
431 |
|
432 COmxILFileSourceProcessingFunction::CPFHelper* COmxILFileSourceProcessingFunction::CPFHelper::NewL(COmxILFileSourceProcessingFunction& aParent, CFileSourceAccess& aFileSourceAccess) |
|
433 { |
|
434 CPFHelper* self = new (ELeave) CPFHelper(aParent, aFileSourceAccess); |
|
435 CleanupStack::PushL(self); |
|
436 self->ConstructL(); |
|
437 CleanupStack::Pop(self); |
|
438 return self; |
|
439 } |
|
440 |
|
441 COmxILFileSourceProcessingFunction::CPFHelper::CPFHelper(COmxILFileSourceProcessingFunction& aParent, CFileSourceAccess& aFileSourceAccess) |
|
442 : CActive(EPriorityStandard), |
|
443 iParent(aParent), |
|
444 iFileSourceAccess(aFileSourceAccess) |
|
445 { |
|
446 CActiveScheduler::Add(this); |
|
447 } |
|
448 |
|
449 void COmxILFileSourceProcessingFunction::CPFHelper::ConstructL() |
|
450 { |
|
451 User::LeaveIfError(iMsgQueue.CreateLocal(KMaxMsgQueueEntries)); |
|
452 SetActive(); |
|
453 iMsgQueue.NotifyDataAvailable(iStatus); |
|
454 } |
|
455 |
|
456 COmxILFileSourceProcessingFunction::CPFHelper::~CPFHelper() |
|
457 { |
|
458 Cancel(); |
|
459 iMsgQueue.Close(); |
|
460 } |
|
461 |
|
462 |
|
463 |
|
464 void COmxILFileSourceProcessingFunction::CPFHelper::RunL() |
|
465 { |
|
466 TInt err = ProcessQueue(); |
|
467 if (err != KErrNone) |
|
468 { |
|
469 iParent.GetCallbacks().ErrorEventNotification( ConvertSymbianErrorType(err) ); |
|
470 } |
|
471 |
|
472 // setup for next callbacks |
|
473 SetActive(); |
|
474 iMsgQueue.NotifyDataAvailable(iStatus); |
|
475 } |
|
476 |
|
477 void COmxILFileSourceProcessingFunction::CPFHelper::DoCancel() |
|
478 { |
|
479 if (iMsgQueue.Handle()) |
|
480 { |
|
481 ProcessQueue(); |
|
482 iMsgQueue.CancelDataAvailable(); |
|
483 } |
|
484 } |
|
485 |
|
486 TInt COmxILFileSourceProcessingFunction::CPFHelper::ProcessQueue() |
|
487 { |
|
488 TProcMessage msg; |
|
489 TInt err = KErrNone; |
|
490 |
|
491 while (iMsgQueue.Receive(msg) == KErrNone) |
|
492 { |
|
493 switch (msg.iType) |
|
494 { |
|
495 case EExecuteCommand: |
|
496 { |
|
497 const HBufC* fileName = iParent.FileName(); |
|
498 if (fileName && iFileSourceAccess.iFileHandle.SubSessionHandle() == 0) |
|
499 { |
|
500 err = iFileSourceAccess.iFileHandle.Open(iFileSourceAccess.iFs, *fileName, EFileRead | EFileShareReadersOnly); |
|
501 } |
|
502 else |
|
503 { |
|
504 //#define KHRONOS_CONFORMANCE |
|
505 // The KHRONOS_CONFORMANCE is required to pass the following khronos conformance component tests (FlushTest, |
|
506 // BaseMultiThreadedTest, StateTransitionTest, PortDisableEnableTest, IncompleteStopTest and PortCommunicationTest) |
|
507 // that expects no error to be returned when a filesource filename is not set. |
|
508 |
|
509 #ifdef KHRONOS_CONFORMANCE |
|
510 // do nothing, don't report any error |
|
511 #else |
|
512 err = KErrPathNotFound; |
|
513 #endif |
|
514 } |
|
515 if ( err == KErrNone) |
|
516 { |
|
517 err = iFileSourceAccess.Execute(); |
|
518 } |
|
519 break; |
|
520 } |
|
521 |
|
522 case EStopCommand: |
|
523 { |
|
524 iFileSourceAccess.Stop(); |
|
525 break; |
|
526 } |
|
527 |
|
528 case EPauseCommand: |
|
529 { |
|
530 iFileSourceAccess.Pause(); |
|
531 break; |
|
532 } |
|
533 |
|
534 case EIdleCommand: |
|
535 { |
|
536 iFileSourceAccess.Idle(); |
|
537 break; |
|
538 } |
|
539 case EBufferIndication: |
|
540 { |
|
541 OMX_BUFFERHEADERTYPE* bufferHeader = reinterpret_cast<OMX_BUFFERHEADERTYPE*>(msg.iPtr); |
|
542 |
|
543 if ( bufferHeader && (iParent.iState == OMX_StateExecuting || |
|
544 iParent.iState == OMX_StatePause || iParent.iState == OMX_StateIdle) ) |
|
545 { |
|
546 err = iParent.iBuffersToFill.Append(bufferHeader); |
|
547 if(err == KErrNone) |
|
548 { |
|
549 if(iParent.iState != OMX_StateIdle) |
|
550 { |
|
551 err = iFileSourceAccess.ProcessNextBuffer(); |
|
552 } |
|
553 } |
|
554 else |
|
555 { |
|
556 // to prevent potential buffer leakage if the Append operation fails |
|
557 iParent.GetCallbacks().BufferDoneNotification(bufferHeader, bufferHeader->nOutputPortIndex,OMX_DirOutput); |
|
558 } |
|
559 } |
|
560 break; |
|
561 } |
|
562 default: |
|
563 { |
|
564 break; |
|
565 } |
|
566 } |
|
567 |
|
568 if (err) |
|
569 { |
|
570 break; |
|
571 } |
|
572 } |
|
573 return err; |
|
574 } |
|
575 |
|
576 TInt COmxILFileSourceProcessingFunction::CPFHelper::ExecuteAsync() |
|
577 { |
|
578 TProcMessage message; |
|
579 message.iType = EExecuteCommand; |
|
580 return iMsgQueue.Send(message); |
|
581 } |
|
582 |
|
583 TInt COmxILFileSourceProcessingFunction::CPFHelper::StopAsync() |
|
584 { |
|
585 TProcMessage message; |
|
586 message.iType = EStopCommand; |
|
587 return iMsgQueue.Send(message); |
|
588 } |
|
589 |
|
590 TInt COmxILFileSourceProcessingFunction::CPFHelper::PauseAsync() |
|
591 { |
|
592 TProcMessage message; |
|
593 message.iType = EPauseCommand; |
|
594 return iMsgQueue.Send(message); |
|
595 } |
|
596 |
|
597 |
|
598 TInt COmxILFileSourceProcessingFunction::CPFHelper::BufferIndication(OMX_BUFFERHEADERTYPE* apBufferHeader) |
|
599 { |
|
600 TProcMessage message; |
|
601 message.iType = EBufferIndication; |
|
602 message.iPtr = apBufferHeader; |
|
603 return iMsgQueue.Send(message); |
|
604 } |
|
605 |
|
606 void COmxILFileSourceProcessingFunction::CPFHelper::StopSync() |
|
607 { |
|
608 // Cancel to process the existing queue before handling this command |
|
609 Cancel(); |
|
610 iFileSourceAccess.Stop(); |
|
611 |
|
612 // setup for next callbacks |
|
613 SetActive(); |
|
614 iMsgQueue.NotifyDataAvailable(iStatus); |
|
615 } |
|
616 |
|
617 TInt COmxILFileSourceProcessingFunction::CPFHelper::IdleAsync() |
|
618 { |
|
619 TProcMessage message; |
|
620 message.iType = EIdleCommand; |
|
621 return iMsgQueue.Send(message); |
|
622 } |
|
623 |
|
624 |
|
625 /** |
|
626 Converts a Symbian error code to an OpenMAX error code. |
|
627 @param aError The Symbian error code. |
|
628 @return The OpenMAX error code. |
|
629 */ |
|
630 OMX_ERRORTYPE COmxILFileSourceProcessingFunction::CPFHelper::ConvertSymbianErrorType(TInt aError) |
|
631 { |
|
632 // In the current implementation this function is only used for the return code in the |
|
633 // callback methods. Currently the only expected errors KErrNone and KErrOverflow. |
|
634 |
|
635 OMX_ERRORTYPE err = OMX_ErrorNone; |
|
636 switch (aError) |
|
637 { |
|
638 case KErrNone: |
|
639 err = OMX_ErrorNone; |
|
640 break; |
|
641 case KErrOverflow: |
|
642 case KErrNoMemory: |
|
643 err = OMX_ErrorInsufficientResources; |
|
644 break; |
|
645 case KErrNotSupported: |
|
646 err = OMX_ErrorNotImplemented; |
|
647 break; |
|
648 case KErrNotReady: |
|
649 err = OMX_ErrorNotReady; |
|
650 break; |
|
651 case KErrGeneral: |
|
652 default: |
|
653 err = OMX_ErrorUndefined; |
|
654 } |
|
655 return err; |
|
656 } |