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