1 /* |
|
2 * Copyright (c) 2005 - 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Camera Application Engine still image burst capturing |
|
15 * interface implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CaeEngineImp.h" // Engine implementation header. |
|
22 #include "CaeStillBurst.h" // Still capturing burst mode class. |
|
23 #include "CaeStillStatesActive.h" // Still capturing burst mode class. |
|
24 |
|
25 #ifdef CAE_TEST_VERSION |
|
26 #include "CaeEngineImpTestErrors.h" // For TEST_VERSION compilation only |
|
27 #endif |
|
28 |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CCaeStillStatesActive::SetCaeStillBurstObserver |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 void CCaeStillStatesActive::SetCaeStillBurstObserver( |
|
37 MCaeStillBurstObserver& aObserver ) |
|
38 { |
|
39 LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetCaeStillBurstObserver()" ) ); |
|
40 iCaeStillBurstObserver = &aObserver; |
|
41 } |
|
42 |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CCaeStillStatesActive::SetStillCaptureImageCountL |
|
46 // Delete old instance and create a new burst object if required. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 TInt CCaeStillStatesActive::SetStillCaptureImageCountL( |
|
50 TInt aImageCount ) |
|
51 { |
|
52 LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillCaptureImageCountL() entering" ) ); |
|
53 |
|
54 // Leave if still capturing is running. |
|
55 if ( IsRunning() ) |
|
56 { |
|
57 LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillCaptureImageCountL() leaving KErrNotReady (IsRunning)" ) ); |
|
58 User::Leave( KErrNotReady ); |
|
59 } |
|
60 |
|
61 // Leave if the image count requested is invalid. |
|
62 if ( aImageCount <= 0 ) |
|
63 { |
|
64 LOGTEXT2( _L( "Cae: invalid input argument aImageCount = %d, leaving KErrArgument" ), aImageCount ); |
|
65 User::Leave( KErrArgument ); |
|
66 } |
|
67 |
|
68 // Delete possible old still burst instance. |
|
69 DeleteStillBurst(); |
|
70 |
|
71 // Prepare for burst capturing if requested image count more than 1. |
|
72 // Otherwise iStillBurst stays NULL. |
|
73 if ( aImageCount > 1 ) |
|
74 { |
|
75 // Create new instance of still image burst object. |
|
76 iStillBurst = CCaeStillBurst::NewL(); |
|
77 |
|
78 // Set parameter(s). |
|
79 iStillBurst->SetLengthL( aImageCount ); |
|
80 |
|
81 LOGTEXT2( _L( "Cae: image count set successfully = %d" ), aImageCount ); |
|
82 } |
|
83 |
|
84 LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillCaptureImageCountL() returning" ) ); |
|
85 |
|
86 return aImageCount; |
|
87 } |
|
88 |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CCaeStillStatesActive::StillCaptureImageCount |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 TInt CCaeStillStatesActive::StillCaptureImageCount() const |
|
95 { |
|
96 LOGTEXT( _L( "Cae: CCaeStillStatesActive::StillCaptureImageCount() entering" ) ); |
|
97 |
|
98 // Nonexistence of still burst object implies image count of 1 |
|
99 // (= normal single still capture). |
|
100 TInt imageCount( 1 ); |
|
101 if ( iStillBurst ) |
|
102 { |
|
103 imageCount = iStillBurst->Length(); |
|
104 } |
|
105 |
|
106 LOGTEXT2( _L( "Cae: CCaeStillStatesActive::StillCaptureImageCount() returning: %d" ), imageCount ); |
|
107 |
|
108 return imageCount; |
|
109 } |
|
110 |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CCaeStillStatesActive::SetStillBurstCaptureIntervalL |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 void CCaeStillStatesActive::SetStillBurstCaptureIntervalL( |
|
117 TTimeIntervalMicroSeconds aInterval ) |
|
118 { |
|
119 LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillBurstCaptureIntervalL()" ) ); |
|
120 |
|
121 if ( IsRunning() ) |
|
122 { |
|
123 LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillBurstCaptureIntervalL(), leaving KErrNotReady" ) ); |
|
124 User::Leave( KErrNotReady ); |
|
125 } |
|
126 |
|
127 // Note: KMaxTInt32 in microseconds is about 35 minutes |
|
128 if ( aInterval < TTimeIntervalMicroSeconds( 0 ) || |
|
129 aInterval > TTimeIntervalMicroSeconds( KMaxTInt32 ) ) |
|
130 { |
|
131 LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillBurstCaptureIntervalL(), leaving KErrArgument" ) ); |
|
132 User::Leave( KErrArgument ); |
|
133 } |
|
134 |
|
135 iStillBurstCaptureInterval = I64INT( aInterval.Int64() ); |
|
136 } |
|
137 |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // CCaeStillStatesActive::StillBurstCaptureInterval |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 TTimeIntervalMicroSeconds CCaeStillStatesActive::StillBurstCaptureInterval() const |
|
144 { |
|
145 LOGTEXT( _L( "Cae: CCaeStillStatesActive::StillBurstCaptureInterval()" ) ); |
|
146 |
|
147 TInt64 intInterval = iStillBurstCaptureInterval.Int(); |
|
148 |
|
149 TTimeIntervalMicroSeconds interval( intInterval ); |
|
150 |
|
151 return interval; |
|
152 } |
|
153 |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CCaeStillStatesActive::StopStillBurstCapture |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 void CCaeStillStatesActive::StopStillBurstCapture() |
|
160 { |
|
161 LOGTEXT( _L( "Cae: CCaeStillStatesActive::StopStillBurstCapture()" ) ); |
|
162 |
|
163 iStillBurstStopped = ETrue; |
|
164 |
|
165 // Complete early any pending delayed event |
|
166 if ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone ) |
|
167 { |
|
168 iDelayedCallTimer.Cancel(); |
|
169 } |
|
170 } |
|
171 |
|
172 |
|
173 // ==================== PRIVATE MEMBER FUNCTIONS =============================== |
|
174 |
|
175 |
|
176 // --------------------------------------------------------------------------- |
|
177 // CCaeStillStatesActive::HandleAppendCapturedBurstImageReady() |
|
178 // Fetch the first burst image from the array, or continue burst capturing. |
|
179 // --------------------------------------------------------------------------- |
|
180 // |
|
181 void CCaeStillStatesActive::HandleAppendCapturedBurstImageReady() |
|
182 { |
|
183 LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()" )); |
|
184 |
|
185 iStatus = CCaeStillStatesActive::ECaeEventNone; |
|
186 |
|
187 if ( iStillBurst->IsBurstCaptured() || iStillBurstStopped ) |
|
188 { |
|
189 // Fetch the first burst image from the array |
|
190 |
|
191 iCurrentState = CCaeStillStatesActive::ECaeStateFetchingNextBurstImage; |
|
192 iStillBurstDeliveryStarted = ETrue; |
|
193 DoFetchNextBurstImage(); |
|
194 } |
|
195 else |
|
196 { |
|
197 // Continue burst capturing. |
|
198 // If view finder is enabled, at least one view finder image |
|
199 // should be received before the next capture. |
|
200 // Otherwise, start directly the next capture. |
|
201 |
|
202 // wait alway next iViewFinderFrameReceived if optimization is not used |
|
203 // with optimization old VF updates are acccepted |
|
204 if ( iIsViewFinderEnabled && |
|
205 !(iBurstModeVFOptimization && iViewFinderFrameReceived ) ) |
|
206 { |
|
207 LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleAppendCapturedBurstImageReady(). Waiting for the view finder." ) ); |
|
208 iCurrentState = CCaeStillStatesActive::ECaeStateBurstWaitingForViewFinder; |
|
209 } |
|
210 else |
|
211 { |
|
212 iCurrentState = CCaeStillStatesActive::ECaeStateCapturingBurst; |
|
213 DoCaptureStillBurstImage(); |
|
214 } |
|
215 } |
|
216 } |
|
217 |
|
218 |
|
219 // --------------------------------------------------------------------------- |
|
220 // CCaeStillStatesActive::HandleBurstImageFetchReady() |
|
221 // Decode the captured image, extract Exif metadata, or process the |
|
222 // image by the extensions. |
|
223 // --------------------------------------------------------------------------- |
|
224 // |
|
225 void CCaeStillStatesActive::HandleBurstImageFetchReady() |
|
226 { |
|
227 LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleBurstImageFetchReady()" )); |
|
228 |
|
229 iStatus = CCaeStillStatesActive::ECaeEventNone; |
|
230 |
|
231 if ( !iBitmap // Does not already exist |
|
232 && ( iCreateSnapImage ) ) // Snap bitmap required by UI |
|
233 { |
|
234 // Need to decode first. |
|
235 iCurrentState = CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap; |
|
236 DoDecodeCapturedImageToBitmap(); |
|
237 } |
|
238 else |
|
239 { |
|
240 // No need to decode. |
|
241 { |
|
242 iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage; |
|
243 DoExtensionsProcessCapturedImage(); |
|
244 } |
|
245 } |
|
246 } |
|
247 |
|
248 |
|
249 // --------------------------------------------------------------------------- |
|
250 // CCaeStillStatesActive::HandleDeliverStillBurstImageReady() |
|
251 // Complete still burst or fetch the next image. |
|
252 // --------------------------------------------------------------------------- |
|
253 // |
|
254 void CCaeStillStatesActive::HandleDeliverStillBurstImageReady() |
|
255 { |
|
256 LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleDeliverStillBurstImageReady()" )); |
|
257 CAE_ASSERT_ALWAYS( iStillBurst && ( iBitmap == NULL ) && ( iImageData == NULL ) && ( iSnapBitmap == NULL ) ); |
|
258 |
|
259 iStatus = CCaeStillStatesActive::ECaeEventNone; |
|
260 if ( CheckForStillBurstCompletion() ) |
|
261 { |
|
262 iCurrentState = CCaeStillStatesActive::ECaeStateCompletingStillBurst; |
|
263 DoCompleteStillBurst(); |
|
264 } |
|
265 else |
|
266 { |
|
267 iCurrentState = CCaeStillStatesActive::ECaeStateFetchingNextBurstImage; |
|
268 DoFetchNextBurstImage(); |
|
269 } |
|
270 } |
|
271 |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // CCaeStillStatesActive::DoCaptureStillBurst |
|
275 // Start the burst and capture the first burst image. |
|
276 // ----------------------------------------------------------------------------- |
|
277 // |
|
278 void CCaeStillStatesActive::DoCaptureStillBurst() |
|
279 { |
|
280 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurst() entering" ) ); |
|
281 MEM(); |
|
282 |
|
283 iFirstStillBurstError = KErrNone; |
|
284 iStillBurstDeliveryStarted = EFalse; |
|
285 |
|
286 // Do not wait for the view finder for the first capture |
|
287 iViewFinderFrameReceived = ETrue; |
|
288 iStillCancelled = EFalse; |
|
289 |
|
290 // Capture the first image in the burst. |
|
291 DoCaptureStillBurstImage(); |
|
292 |
|
293 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurst() returning" ) ); |
|
294 } |
|
295 |
|
296 |
|
297 // ----------------------------------------------------------------------------- |
|
298 // CCaeStillStatesActive::DoCaptureStillBurstImage |
|
299 // Capture one image for the burst. |
|
300 // ----------------------------------------------------------------------------- |
|
301 // |
|
302 void CCaeStillStatesActive::DoCaptureStillBurstImage() |
|
303 { |
|
304 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage() entering" ) ); |
|
305 MEM(); |
|
306 CAE_ASSERT_ALWAYS( !iStillCancelled ); |
|
307 |
|
308 // Notify client about capturing moment. |
|
309 if ( !iStillBurstStopped ) |
|
310 { |
|
311 iCaeStillBurstObserver->McaesboStillBurstCaptureMoment( KErrNone ); |
|
312 } |
|
313 |
|
314 // Note: If still burst is cancelled in the callback, the state |
|
315 // machine has already been reseted. Any member data is not allowed |
|
316 // to be changed any more. Just return from this function. |
|
317 |
|
318 if ( !iStillCancelled && !iStillBurstStopped ) |
|
319 { |
|
320 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage() capture next image" ) ); |
|
321 iViewFinderFrameReceived = EFalse; |
|
322 iCamera.CaptureImage(); |
|
323 } |
|
324 |
|
325 // Separate "if" (instead of "else if") due |
|
326 // the possibility of stopping or cancelling in callback above. |
|
327 if ( !iStillCancelled ) // Return immediately, if cancelled |
|
328 { |
|
329 if ( iStillBurstStopped ) |
|
330 { |
|
331 // Deliver the images to the client if the burst was stopped. |
|
332 // This call delivers the first image in the burst. |
|
333 if ( !iStillBurstDeliveryStarted ) |
|
334 { |
|
335 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage(): burst stopped, starting delivery" ) ); |
|
336 iStillBurstDeliveryStarted = ETrue; |
|
337 Event( CCaeStillStatesActive::ECaeEventBurstCaptureReady ); |
|
338 } |
|
339 |
|
340 } |
|
341 } |
|
342 |
|
343 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage() returning" ) ); |
|
344 } |
|
345 |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // CCaeStillStatesActive::DoAppendCapturedBurstImageToArray |
|
349 // Append the captured image to the still burst array. |
|
350 // ----------------------------------------------------------------------------- |
|
351 // |
|
352 void CCaeStillStatesActive::DoAppendCapturedBurstImageToArray() |
|
353 { |
|
354 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoAppendCapturedBurstImageToArray() entering" ) ); |
|
355 CAE_ASSERT_ALWAYS( !iStillCancelled ); |
|
356 MEM(); |
|
357 |
|
358 TInt error = iFirstStillBurstError; // We may have had error during previous capture phase |
|
359 |
|
360 if ( !error ) |
|
361 { |
|
362 // Put the image into buffer. |
|
363 // All appended images will have KErrNone code. |
|
364 // AppendImage does not delete the image if unable to append (error is returned). |
|
365 error = iStillBurst->AppendImage( iBitmap, iImageData, KErrNone ); |
|
366 } |
|
367 |
|
368 if ( !error ) |
|
369 { |
|
370 // Ownership transferred |
|
371 iBitmap = NULL; |
|
372 iImageData = NULL; |
|
373 } |
|
374 else |
|
375 { |
|
376 LOGTEXT2( _L( "Cae: CCaeStillStatesActive::DoAppendCapturedBurstImageToArray(): error detected: %d" ), error ); |
|
377 |
|
378 // Delete images |
|
379 delete( iBitmap ); |
|
380 iBitmap = NULL; |
|
381 delete( iImageData ); |
|
382 iImageData = NULL; |
|
383 |
|
384 iFirstStillBurstError = iFirstStillBurstError ? iFirstStillBurstError : error; |
|
385 iStillBurstStopped = ETrue; // Stop burst if an error was detected. |
|
386 } |
|
387 |
|
388 if ( !iStillBurstStopped && !iStillBurst->IsBurstCaptured() ) |
|
389 { |
|
390 // Activate (delayed) capturing of new image if burst is not complete yet. |
|
391 Event( CCaeStillStatesActive::ECaeEventAppendCapturedBurstImageReady, iStillBurstCaptureInterval ); |
|
392 } |
|
393 else |
|
394 { |
|
395 // Start delivering immediately |
|
396 Event( CCaeStillStatesActive::ECaeEventAppendCapturedBurstImageReady ); |
|
397 } |
|
398 |
|
399 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoAppendCapturedBurstImageToArray() returning" ) ); |
|
400 } |
|
401 |
|
402 |
|
403 // ----------------------------------------------------------------------------- |
|
404 // CCaeStillStatesActive::DoFetchNextBurstImage |
|
405 // Get the next image from the burst array. |
|
406 // ----------------------------------------------------------------------------- |
|
407 // |
|
408 void CCaeStillStatesActive::DoFetchNextBurstImage() |
|
409 { |
|
410 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoFetchNextBurstImage() entering" ) ); |
|
411 MEM(); |
|
412 CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iImageData == NULL ) && ( iSnapBitmap == NULL ) ); |
|
413 CAE_ASSERT_ALWAYS( !iStillCancelled ); |
|
414 CAE_ASSERT_ALWAYS( iStillBurst ); |
|
415 |
|
416 if ( ExtModeActive() ) // Extension processing mode |
|
417 { |
|
418 Event( CCaeStillStatesActive::ECaeEventEnd ); // extension mode operation is completed when queue is empty |
|
419 } |
|
420 else // Normal mode |
|
421 { |
|
422 LOGTEXT2( _L( "Cae: CCaeStillStatesActive::DoFetchNextBurstImage(): count of burst images in queue = %d" ), iStillBurst->ImageCount() ); |
|
423 |
|
424 // Get next image from the array |
|
425 |
|
426 CFbsBitmap* bitmap = NULL; |
|
427 HBufC8* imageData = NULL; |
|
428 TInt imageError( KErrNone ); |
|
429 |
|
430 TInt error = iStillBurst->GetNextImage( bitmap, imageData, imageError ); |
|
431 |
|
432 // If there is no items in the array, return the first error |
|
433 if ( (error == KErrUnderflow) && iFirstStillBurstError) |
|
434 { |
|
435 error = iFirstStillBurstError; |
|
436 } |
|
437 |
|
438 error = error ? error : imageError; |
|
439 iImageData = imageData; |
|
440 iBitmap = bitmap; |
|
441 |
|
442 if ( error ) |
|
443 { |
|
444 // Handle error |
|
445 ErrorRecovery( error ); |
|
446 } |
|
447 else |
|
448 { |
|
449 Event( CCaeStillStatesActive::ECaeEventBurstImageFetchReady ); |
|
450 } |
|
451 } |
|
452 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoFetchNextBurstImage() returning" ) ); |
|
453 } |
|
454 |
|
455 |
|
456 // ----------------------------------------------------------------------------- |
|
457 // CCaeStillStatesActive::CheckForStillBurstCompletion |
|
458 // ----------------------------------------------------------------------------- |
|
459 // |
|
460 TBool CCaeStillStatesActive::CheckForStillBurstCompletion() |
|
461 { |
|
462 LOGTEXT( _L( "Cae: CCaeStillStatesActive::CheckForStillBurstCompletion()" ) ); |
|
463 MEM(); |
|
464 |
|
465 TBool burstShouldBeCompleted( EFalse ); |
|
466 |
|
467 if ( iStillBurst ) |
|
468 { |
|
469 if ( ExtModeActive() ) // In extension mode client knows when completed |
|
470 { |
|
471 burstShouldBeCompleted = iLastImageExtPro; |
|
472 } |
|
473 else if ( iCountOfProcessedBurstImages >= iStillBurst->CaptureCount() ) // Normal mode |
|
474 { |
|
475 // All captures have now been processed, ready to complete the burst. |
|
476 LOGTEXT2( _L( "Cae: CCaeStillStatesActive::CheckForStillBurstCompletion(): Burst complete, count of images = %d" ), iCountOfProcessedBurstImages ); |
|
477 burstShouldBeCompleted = ETrue; |
|
478 } |
|
479 } |
|
480 |
|
481 return( burstShouldBeCompleted ); |
|
482 } |
|
483 |
|
484 |
|
485 // ----------------------------------------------------------------------------- |
|
486 // CCaeStillStatesActive::BurstErrorRecovery |
|
487 // Recover from burst errors. |
|
488 // ----------------------------------------------------------------------------- |
|
489 // |
|
490 void CCaeStillStatesActive::BurstErrorRecovery( TInt aError ) |
|
491 { |
|
492 // Handle burst image mode errors |
|
493 |
|
494 // Store error code |
|
495 iFirstStillBurstError = iFirstStillBurstError ? iFirstStillBurstError : aError; |
|
496 |
|
497 iCountOfProcessedBurstImages++; |
|
498 |
|
499 // Delete all images which are not deleted already. |
|
500 delete iSnapBitmap; |
|
501 iSnapBitmap = NULL; |
|
502 delete iBitmap; |
|
503 iBitmap = NULL; |
|
504 delete iImageData; |
|
505 iImageData = NULL; |
|
506 |
|
507 // Ignore error and continue processing |
|
508 Event( CCaeStillStatesActive::ECaeEventDeliverStillBurstImageReady ); |
|
509 } |
|
510 |
|
511 |
|
512 // ----------------------------------------------------------------------------- |
|
513 // CCaeStillStatesActive::DoCompleteStillBurst |
|
514 // Complete still image burst capture. |
|
515 // Calls the observer method McaesboStillBurstComplete if capturing was not |
|
516 // cancelled. |
|
517 // ----------------------------------------------------------------------------- |
|
518 // |
|
519 void CCaeStillStatesActive::DoCompleteStillBurst() |
|
520 { |
|
521 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCompleteStillBurst() entering" ) ); |
|
522 |
|
523 if ( !iStillCancelled && IsRunning() ) |
|
524 { |
|
525 // Notify client about completing the burst. |
|
526 iCaeStillBurstObserver->McaesboStillBurstComplete( iCountOfDeliveredBurstImages, iFirstStillBurstError ); |
|
527 LOGTEXT2( _L( "Cae: CCaeStillStatesActive::DoCompleteStillBurst(): Count of delivered burst images = %d" ), iCountOfDeliveredBurstImages ); |
|
528 } |
|
529 iFirstStillBurstError = KErrNone; |
|
530 CompleteStillBurst(); |
|
531 Event( CCaeStillStatesActive::ECaeEventEnd ); // The end. Actuall does not issue any event. |
|
532 |
|
533 MEM(); |
|
534 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCompleteStillBurst() returning" ) ); |
|
535 } |
|
536 |
|
537 // ----------------------------------------------------------------------------- |
|
538 // CCaeStillStatesActive::DoDeliverStillBurstImage |
|
539 // |
|
540 // Deliver the still burst image to the client and delete internal images after that. |
|
541 // Note: If ownership is transferred, the image pointers should be NULLed before |
|
542 // calling the observer method. That is because the observer method can call back |
|
543 // CancelStill() which tries to delete images. That is no allowed as images |
|
544 // should be owned by the observer. |
|
545 // ----------------------------------------------------------------------------- |
|
546 // |
|
547 void CCaeStillStatesActive::DoDeliverStillBurstImage() |
|
548 { |
|
549 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDeliverStillBurstImage()" ) ); |
|
550 CAE_ASSERT_ALWAYS( !iStillCancelled && ( iSnapBitmap == NULL ) ); |
|
551 |
|
552 // Deliver the still burst image to the client. |
|
553 if ( IsBitmapOutput() ) |
|
554 { |
|
555 // Give original image to the client even if there is decoding error. |
|
556 CFbsBitmap* tmpBitmap = iBitmap; |
|
557 iBitmap = NULL; // ownership is transferred |
|
558 iCaeObserver->McaeoStillImageReady( tmpBitmap, NULL, KErrNone ); |
|
559 } |
|
560 else |
|
561 { |
|
562 // Give original image to the client even if there is encoding error |
|
563 HBufC8* tmpImageData = iImageData; |
|
564 iImageData = NULL; // Ownership is tranferred |
|
565 iCaeObserver->McaeoStillImageReady( NULL, tmpImageData, KErrNone ); |
|
566 } |
|
567 |
|
568 iCountOfDeliveredBurstImages++; |
|
569 iCountOfProcessedBurstImages++; |
|
570 |
|
571 // Delete all that is not NULL already. |
|
572 delete iImageData; |
|
573 iImageData = NULL; |
|
574 delete iImageHeaderData; |
|
575 iImageHeaderData = NULL; |
|
576 delete iBitmap; |
|
577 iBitmap = NULL; |
|
578 |
|
579 Event( CCaeStillStatesActive::ECaeEventDeliverStillBurstImageReady ); |
|
580 } |
|
581 |
|
582 |
|
583 // ----------------------------------------------------------------------------- |
|
584 // CCaeStillStatesActive::CompleteStillBurst() |
|
585 // Complete still image burst capture but do not delete still burst object. |
|
586 // Calls the observer method McaesboStillBurstComplete if capturing was not |
|
587 // cancelled. |
|
588 // ----------------------------------------------------------------------------- |
|
589 // |
|
590 void CCaeStillStatesActive::CompleteStillBurst() |
|
591 { |
|
592 LOGTEXT( _L( "Cae: CCaeStillStatesActive::CompleteStillBurst() entering" ) ); |
|
593 MEM(); |
|
594 if ( iStillBurst ) |
|
595 { |
|
596 iStillBurst->ResetAndDestroyImages(); |
|
597 } |
|
598 |
|
599 iCountOfProcessedBurstImages = 0; |
|
600 iCountOfDeliveredBurstImages = 0; |
|
601 iStillBurstStopped = EFalse; |
|
602 MEM(); |
|
603 LOGTEXT( _L( "Cae: CCaeStillStatesActive::CompleteStillBurst() returning" ) ); |
|
604 } |
|
605 |
|
606 // ----------------------------------------------------------------------------- |
|
607 // CCaeStillStatesActive::DeleteStillBurst |
|
608 // Delete still burst object and reset burst related variables. |
|
609 // ----------------------------------------------------------------------------- |
|
610 // |
|
611 void CCaeStillStatesActive::DeleteStillBurst() |
|
612 { |
|
613 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DeleteStillBurst() entering" ) ); |
|
614 |
|
615 delete iStillBurst; |
|
616 iStillBurst = NULL; |
|
617 |
|
618 iCountOfProcessedBurstImages = 0; |
|
619 iCountOfDeliveredBurstImages = 0; |
|
620 |
|
621 iStillBurstStopped = EFalse; |
|
622 |
|
623 MEM(); |
|
624 LOGTEXT( _L( "Cae: CCaeStillStatesActive::DeleteStillBurst() returning" ) ); |
|
625 } |
|
626 |
|
627 |
|
628 // End of File |
|