1 /* |
|
2 * Copyright (c) 2002-2009 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: This class is used for playing camera. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <jdebug.h> |
|
21 #include <fbs.h> |
|
22 #include "cmmacameraplayer.h" |
|
23 #include "tmmaparametervalidator.h" |
|
24 #include "mmmadisplay.h" |
|
25 #include "cmmacamerasound.h" |
|
26 |
|
27 #if defined( __WINS__ ) |
|
28 #include <w32std.h> |
|
29 #endif |
|
30 |
|
31 // CONSTANTS |
|
32 _LIT8(KImageJpegMime, "image/jpeg"); |
|
33 _LIT8(KJpegMime, "jpeg"); |
|
34 _LIT(KVideoControlName, "VideoControl"); |
|
35 |
|
36 CMMACameraPlayer* CMMACameraPlayer::NewLC(TInt aCameraIndex) |
|
37 { |
|
38 CMMACameraPlayer* self = new(ELeave) CMMACameraPlayer; |
|
39 CleanupStack::PushL(self); |
|
40 self->ConstructL(aCameraIndex); |
|
41 return self; |
|
42 } |
|
43 |
|
44 CMMACameraPlayer::~CMMACameraPlayer() |
|
45 { |
|
46 DEBUG("CMMACameraPlayer::~CMMACameraPlayer"); |
|
47 |
|
48 // Free (duplicated) UI camera resources first. |
|
49 // Window is not able to send any |
|
50 // callback requests to UI from now. |
|
51 if (iWindow) |
|
52 { |
|
53 iWindow->SetDisplay(NULL); |
|
54 } |
|
55 |
|
56 if (iCamera) |
|
57 { |
|
58 iCamera->CancelCaptureImage(); |
|
59 iCamera->Release(); |
|
60 delete iCamera; |
|
61 } |
|
62 |
|
63 delete iSnapshotEncoded; |
|
64 delete iSnapshotBitmap; |
|
65 delete iRealizeWait; |
|
66 |
|
67 if (iDisplay && iDisplay->HasContainer()) |
|
68 { |
|
69 // Window will delete itself |
|
70 // after all pending events are processed |
|
71 // (lazy delete) |
|
72 iDisplay->UIGetCallback( |
|
73 *iWindow, CMMACameraWindow::EDestroyWindow); |
|
74 } |
|
75 else |
|
76 { |
|
77 delete iWindow; |
|
78 } |
|
79 iWindow = NULL; |
|
80 } |
|
81 |
|
82 |
|
83 CMMACameraPlayer::CMMACameraPlayer(): |
|
84 iDisplay(NULL), |
|
85 iSourceSizeIndex(KErrNotFound), |
|
86 iStartTime(KErrNotFound) |
|
87 { |
|
88 iStopViewFinder = ETrue; |
|
89 } |
|
90 |
|
91 |
|
92 void CMMACameraPlayer::ConstructL(TInt aCameraIndex) |
|
93 { |
|
94 CMMAPlayer::ConstructL(); |
|
95 |
|
96 if (aCameraIndex >= CCamera::CamerasAvailable()) |
|
97 { |
|
98 // image capture is not supported |
|
99 User::Leave(KErrNotFound); |
|
100 } |
|
101 |
|
102 iCamera = CCamera::NewL(*this, aCameraIndex); |
|
103 |
|
104 iWindow = CMMACameraWindow::NewL(iCamera->Handle()); |
|
105 |
|
106 TCameraInfo cameraInfo; |
|
107 iCamera->CameraInfo(cameraInfo); |
|
108 |
|
109 if (cameraInfo.iNumImageSizesSupported < 1) |
|
110 { |
|
111 // image capture is not supported |
|
112 User::Leave(KErrNotFound); |
|
113 } |
|
114 |
|
115 // default snapshot size |
|
116 iSourceSizeIndex = cameraInfo.iNumImageSizesSupported - 1; |
|
117 |
|
118 iRealizeWait = new(ELeave)CRealizeWait; |
|
119 } |
|
120 |
|
121 TInt64 CMMACameraPlayer::CurrentTime() |
|
122 { |
|
123 TTime time; |
|
124 time.HomeTime(); |
|
125 return time.Int64(); |
|
126 } |
|
127 |
|
128 void CMMACameraPlayer::ResolveViewFinderSizeL(TSize& aSize) |
|
129 { |
|
130 DEBUG("CMMACameraPlayer::ResolveViewFinderSizeL"); |
|
131 |
|
132 TSize resultSize; |
|
133 |
|
134 // The only way to find out the size is to start the view finder |
|
135 // with a proper size (screen size). |
|
136 |
|
137 ResolveScreenSizeL(resultSize); |
|
138 |
|
139 // StartViewFinderBitmapsL changes resultSize to |
|
140 // the used view finder size. |
|
141 // Used to get the source size only. |
|
142 iCamera->StartViewFinderBitmapsL(resultSize); |
|
143 |
|
144 // Bitmap viewfinder is not used anymore. |
|
145 iCamera->StopViewFinder(); |
|
146 |
|
147 aSize = resultSize; |
|
148 } |
|
149 |
|
150 void CMMACameraPlayer::ResolveScreenSizeL(TSize& aSize) |
|
151 { |
|
152 DEBUG("CMMACameraPlayer::ResolveScreenSizeL"); |
|
153 |
|
154 #if defined( __WINS__ ) |
|
155 TSize size(0,0); |
|
156 RWsSession ws; |
|
157 |
|
158 if (ws.Connect() == KErrNone) |
|
159 { |
|
160 CleanupClosePushL(ws); |
|
161 |
|
162 CWsScreenDevice* wsScreenDevice = new(ELeave)CWsScreenDevice(ws); |
|
163 CleanupStack::PushL(wsScreenDevice); |
|
164 |
|
165 User::LeaveIfError(wsScreenDevice->Construct()); |
|
166 |
|
167 size = wsScreenDevice->SizeInPixels(); |
|
168 |
|
169 CleanupStack::PopAndDestroy(2); // wsScreenDevice, ws.Close() |
|
170 } |
|
171 |
|
172 aSize = size; |
|
173 |
|
174 #else |
|
175 TScreenInfoV01 info; |
|
176 TPckgBuf< TScreenInfoV01 > buf(info); |
|
177 |
|
178 UserSvr::ScreenInfo(buf); |
|
179 info = buf(); |
|
180 |
|
181 aSize = info.iScreenSize; |
|
182 #endif |
|
183 } |
|
184 |
|
185 void CMMACameraPlayer::ResolveCaptureSizes(const CCamera::TFormat aFormat, |
|
186 const TInt aNumImageSizesSupported, |
|
187 const TSize& aRequestSize, |
|
188 TSize& aSourceSize, |
|
189 TInt& aSourceIndex, |
|
190 TInt& aLargestIndex) |
|
191 { |
|
192 // Largest image size |
|
193 TSize largestSize; |
|
194 // Index to largest image size |
|
195 TInt largestSizeIndex = 0; |
|
196 // Source size |
|
197 TSize sourceSize; |
|
198 // Default source size index not set |
|
199 TInt sourceSizeIndex = KErrNotFound; |
|
200 // Temporary size for iterating capture sizes |
|
201 TSize tmpSize; |
|
202 |
|
203 DEBUG_INT("MMA::CMMACameraPlayer::ResolveCaptureSizes: aFormat = 0x%x", aFormat); |
|
204 |
|
205 // go through all supported sizes. |
|
206 // Notice: Capture sizes are assumed to be in order from smaller to larger sizes |
|
207 for (TInt i = 0; i < aNumImageSizesSupported; i++) |
|
208 { |
|
209 iCamera->EnumerateCaptureSizes(tmpSize, |
|
210 i, |
|
211 aFormat); |
|
212 |
|
213 DEBUG_INT("MMA::CMMACameraPlayer::ResolveCaptureSizes: tmpSize.iWidth = %d", tmpSize.iWidth); |
|
214 DEBUG_INT("MMA::CMMACameraPlayer::ResolveCaptureSizes: tmpSize.iHeight = %d", tmpSize.iHeight); |
|
215 |
|
216 // Check if current is the largest |
|
217 if ((largestSize.iWidth < tmpSize.iWidth) && |
|
218 (largestSize.iHeight < tmpSize.iHeight)) |
|
219 { |
|
220 largestSize = tmpSize; |
|
221 largestSizeIndex = i; |
|
222 } |
|
223 |
|
224 // If wanted size is smaller than tmpSize we can use it |
|
225 if ((aRequestSize.iWidth <= tmpSize.iWidth) && |
|
226 (aRequestSize.iHeight <= tmpSize.iHeight)) |
|
227 { |
|
228 sourceSize = tmpSize; |
|
229 sourceSizeIndex = i; |
|
230 } |
|
231 } |
|
232 |
|
233 DEBUG_INT("MMA::CMMACameraPlayer::ResolveCaptureSizes: sourceSizeIndex = %d", sourceSizeIndex); |
|
234 DEBUG_INT("MMA::CMMACameraPlayer::ResolveCaptureSizes: largestSizeIndex = %d", largestSizeIndex); |
|
235 |
|
236 aSourceSize = sourceSize; |
|
237 aSourceIndex = sourceSizeIndex; |
|
238 aLargestIndex = largestSizeIndex; |
|
239 } |
|
240 |
|
241 void CMMACameraPlayer::StartL(TBool aPostEvent) |
|
242 { |
|
243 DEBUG_INT("CMMACameraPlayer:StartL iState %d", iState); |
|
244 |
|
245 // start can't be called to not ready player |
|
246 if (iState == EPrefetched) |
|
247 { |
|
248 // camera passes ready images through |
|
249 // ViewFinderFrameReady method |
|
250 |
|
251 // set time when started |
|
252 iStartTime = CurrentTime(); |
|
253 |
|
254 // inform java side |
|
255 ChangeState(EStarted); |
|
256 |
|
257 TInt64 time; |
|
258 GetMediaTime(&time); |
|
259 |
|
260 // Notify the camera window |
|
261 // about the status change |
|
262 iWindow->SetStarted(ETrue); |
|
263 |
|
264 if (aPostEvent) |
|
265 { |
|
266 // inform java side |
|
267 PostLongEvent(CMMAPlayerEvent::EStarted, time); |
|
268 } |
|
269 } |
|
270 PostActionCompleted(KErrNone); // java start return |
|
271 } |
|
272 |
|
273 void CMMACameraPlayer::StopL(TBool aPostEvent) |
|
274 { |
|
275 DEBUG_INT("CMMACameraPlayer::StopL", iState); |
|
276 if (iState == EStarted) |
|
277 { |
|
278 TInt64 time; |
|
279 GetMediaTime(&time); // add played time to media time |
|
280 |
|
281 if (iStopViewFinder && iWindow->ViewFinderActive()) |
|
282 { |
|
283 iWindow->SetStarted(EFalse); |
|
284 } |
|
285 iStartTime = KErrNotFound; |
|
286 |
|
287 if (aPostEvent) |
|
288 { |
|
289 PostLongEvent(CMMAPlayerEvent::EStopped, time); |
|
290 } |
|
291 |
|
292 // go back to prefetched state |
|
293 ChangeState(EPrefetched); |
|
294 } |
|
295 } |
|
296 |
|
297 void CMMACameraPlayer::DeallocateL() |
|
298 { |
|
299 // If player is started when deallocate is called, |
|
300 // player is stopped from java side -> state is changed to |
|
301 // prefetched. |
|
302 // In prefetched state only reserved resource is |
|
303 // camera reserve( released with iCamera->Release() ) |
|
304 // In realized state no resources have been reserved. |
|
305 // CHANGED: not releasing camera anymore, since it is already |
|
306 // done in realized state |
|
307 if (iState == EPrefetched) |
|
308 { |
|
309 ChangeState(ERealized); |
|
310 } |
|
311 } |
|
312 |
|
313 |
|
314 void CMMACameraPlayer::RealizeL() |
|
315 { |
|
316 iCamera->Reserve(); |
|
317 // this lock will be released when power on is completed (or error) |
|
318 if (!iRealizeWait->IsStarted()) |
|
319 { |
|
320 iRealizeWait->Start(); |
|
321 } |
|
322 User::LeaveIfError(iRealizeWait->iError); |
|
323 CMMAPlayer::RealizeL(); |
|
324 } |
|
325 |
|
326 |
|
327 void CMMACameraPlayer::PrefetchL() |
|
328 { |
|
329 DEBUG("MMA::CMMACameraPlayer::PrefetchL"); |
|
330 // nothing to do here |
|
331 ChangeState(EPrefetched); |
|
332 PostActionCompleted(KErrNone); |
|
333 } |
|
334 |
|
335 |
|
336 void CMMACameraPlayer::GetDuration(TInt64* aDuration) |
|
337 { |
|
338 // camera viewer has no duration. |
|
339 *aDuration = KTimeUnknown; |
|
340 } |
|
341 |
|
342 |
|
343 void CMMACameraPlayer::SetMediaTimeL(TInt64* /*aTime*/) |
|
344 { |
|
345 DEBUG("MMA::CMMACameraPlayer::SetMediaTimeL "); |
|
346 // with camera media time is not supported. |
|
347 } |
|
348 |
|
349 |
|
350 void CMMACameraPlayer::GetMediaTime(TInt64* aMediaTime) |
|
351 { |
|
352 if (iState == EStarted) |
|
353 { |
|
354 // add play time to media time |
|
355 iMediaTime += CurrentTime() - iStartTime; |
|
356 // set new start time |
|
357 iStartTime = CurrentTime(); |
|
358 } |
|
359 |
|
360 // set value to parameter |
|
361 (*aMediaTime) = iMediaTime; |
|
362 } |
|
363 |
|
364 void CMMACameraPlayer::CloseL() |
|
365 { |
|
366 DEBUG("MMA::CMMACameraPlayer::CloseL()"); |
|
367 |
|
368 // cancel all activity |
|
369 iCamera->CancelCaptureImage(); |
|
370 |
|
371 // Stop and release UI Camera instance |
|
372 iWindow->SetDisplay(NULL); |
|
373 |
|
374 // we don't need reserve camera anymore |
|
375 iCamera->Release(); |
|
376 |
|
377 CMMAPlayer::CloseL(); |
|
378 } |
|
379 |
|
380 const TDesC& CMMACameraPlayer::Type() |
|
381 { |
|
382 return KMMACameraPlayer; |
|
383 } |
|
384 |
|
385 // MCameraObserver |
|
386 void CMMACameraPlayer::ReserveComplete(TInt aError) |
|
387 { |
|
388 DEBUG_INT("MMA::CMMACameraPlayer::ReserveComplete %d", aError); |
|
389 if (aError == KErrNone) |
|
390 { |
|
391 // camera will notify completion with PowerOnComplete method. |
|
392 iCamera->PowerOn(); |
|
393 } |
|
394 else |
|
395 { |
|
396 // release lock and store error. State doesn't change. |
|
397 iRealizeWait->iError = aError; |
|
398 iRealizeWait->AsyncStop(); |
|
399 } |
|
400 |
|
401 } |
|
402 |
|
403 void CMMACameraPlayer::PowerOnComplete(TInt aError) |
|
404 { |
|
405 DEBUG_INT("MMA::CMMACameraPlayer::PowerOnComplete %d", aError); |
|
406 |
|
407 TSize viewFinderSize; |
|
408 TInt error = aError; |
|
409 |
|
410 if (error == KErrNone) |
|
411 { |
|
412 // The view finder size must be known after prefetching. |
|
413 TRAP(error, ResolveViewFinderSizeL(viewFinderSize)); |
|
414 } |
|
415 |
|
416 if (error == KErrNone) |
|
417 { |
|
418 iSize = viewFinderSize; |
|
419 |
|
420 if (iDisplay) |
|
421 { |
|
422 iDisplay->SourceSizeChanged(iSize); |
|
423 NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName); |
|
424 } |
|
425 } |
|
426 |
|
427 iRealizeWait->iError = error; |
|
428 iRealizeWait->AsyncStop(); |
|
429 } |
|
430 |
|
431 void CMMACameraPlayer::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/) |
|
432 { |
|
433 // Empty implementation of an interface method. |
|
434 // DirectViewFinder is used |
|
435 // instead of BitmapViewFinder |
|
436 } |
|
437 |
|
438 void CMMACameraPlayer::ImageReady(CFbsBitmap* aBitmap, |
|
439 HBufC8* aData, |
|
440 TInt aError) |
|
441 { |
|
442 DEBUG_INT("MMA::CMMACameraPlayer::ImageReady %d", aError); |
|
443 |
|
444 // This method should never be called, |
|
445 // unless we are taking snapshot |
|
446 __ASSERT_DEBUG(iSnapshotStatus, User::Invariant()); |
|
447 |
|
448 __ASSERT_DEBUG(!iSnapshotBitmap, User::Invariant()); |
|
449 __ASSERT_DEBUG(!iSnapshotEncoded, User::Invariant()); |
|
450 |
|
451 if (aError == KErrNone) |
|
452 { |
|
453 // this class has ownership of the bitmap until |
|
454 // snapshot bitmap is got from this class. |
|
455 iSnapshotBitmap = aBitmap; |
|
456 iSnapshotEncoded = aData; |
|
457 } |
|
458 |
|
459 // notify the caller, error code or KErrNone |
|
460 User::RequestComplete(iSnapshotStatus, aError); |
|
461 iWindow->SetStarted(ETrue); |
|
462 // Status is not needed anymore |
|
463 // and this class don't own the status. |
|
464 iSnapshotStatus = NULL; |
|
465 } |
|
466 |
|
467 void CMMACameraPlayer::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/, |
|
468 TInt /*aError*/) |
|
469 { |
|
470 DEBUG("MMA::CMMACameraPlayer::FrameBufferReady"); |
|
471 // this callback will never be called |
|
472 // Asserted in debug build to be sure. |
|
473 __ASSERT_DEBUG(EFalse, User::Invariant()); |
|
474 } |
|
475 |
|
476 void CMMACameraPlayer::SetDisplayL(MMMADisplay* aDisplay) |
|
477 { |
|
478 DEBUG("MMA::CMMACameraPlayer::SetDisplay"); |
|
479 |
|
480 // now it is ready to draw |
|
481 iDisplay = aDisplay; |
|
482 |
|
483 // Passes display into iWindow. |
|
484 // Allocates all resources needed to use a camera DirectViewFinder. |
|
485 iWindow->SetDisplay(aDisplay); |
|
486 |
|
487 iDisplay->SetWindowL(iWindow); |
|
488 |
|
489 // Set view finder size to the display only if the view finder |
|
490 // size has been resolved. |
|
491 if (iSize != TSize(0, 0)) |
|
492 { |
|
493 iDisplay->SourceSizeChanged(iSize); |
|
494 NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName); |
|
495 } |
|
496 } |
|
497 |
|
498 TSize CMMACameraPlayer::SourceSize() |
|
499 { |
|
500 return iSize; |
|
501 } |
|
502 |
|
503 MMMASnapshot::TEncoding CMMACameraPlayer::TakeSnapshotL(TRequestStatus* aStatus, |
|
504 const TSize& aSize, |
|
505 const CMMAImageSettings& aSettings) |
|
506 { |
|
507 __ASSERT_DEBUG(!iSnapshotStatus, User::Invariant()); |
|
508 __ASSERT_DEBUG(!iSnapshotBitmap, User::Invariant()); |
|
509 __ASSERT_DEBUG(!iSnapshotEncoded, User::Invariant()); |
|
510 |
|
511 // snapshots can not be taken if player is not realized |
|
512 if (iState < ERealized) |
|
513 { |
|
514 User::Leave(KErrNotReady); |
|
515 } |
|
516 // save status which will be notified |
|
517 iSnapshotStatus = aStatus; |
|
518 |
|
519 // changing status to pending |
|
520 *iSnapshotStatus = KRequestPending; |
|
521 |
|
522 // Source size not set in the beginning |
|
523 TSize sourceSize; |
|
524 |
|
525 // Use default if size is not specified. |
|
526 TInt sourceSizeIndex = iSourceSizeIndex; |
|
527 |
|
528 // Largest image size index |
|
529 TInt largestSizeIndex = 0; |
|
530 |
|
531 // Get camera characteristics |
|
532 TCameraInfo cameraInfo; |
|
533 iCamera->CameraInfo(cameraInfo); |
|
534 |
|
535 // Set default snapshot encoding type |
|
536 TEncoding encoding = EBitmap; |
|
537 |
|
538 // Set default image capture format |
|
539 CCamera::TFormat format = CCamera::EFormatFbsBitmapColor16M; |
|
540 |
|
541 DEBUG_INT("MMA::CMMACameraPlayer::TakeSnapshotL: cameraInfo.iImageFormatsSupported = 0x%x", cameraInfo.iImageFormatsSupported); |
|
542 DEBUG_INT("MMA::CMMACameraPlayer::TakeSnapshotL: cameraInfo.iNumImageSizesSupported = %d", cameraInfo.iNumImageSizesSupported); |
|
543 |
|
544 // Check if size was set in Java |
|
545 if (aSize.iWidth != KErrNotFound && |
|
546 aSize.iHeight != KErrNotFound) |
|
547 { |
|
548 // Determine if jpeg capture was requested |
|
549 if ((*aSettings.iMimeType == KJpegMime) || |
|
550 (*aSettings.iMimeType == KImageJpegMime)) |
|
551 { |
|
552 // Shortcut for supported image formats |
|
553 TUint32 imageFormats = cameraInfo.iImageFormatsSupported; |
|
554 |
|
555 // Jpeg subtype constants |
|
556 _LIT8(KJpegJfif, "jfif"); |
|
557 _LIT8(KJpegExif, "exif"); |
|
558 |
|
559 // Resolve requested jpeg subtype from settings and camerainfo |
|
560 if ((imageFormats & CCamera::EFormatJpeg) && |
|
561 (*aSettings.iType == KJpegJfif)) |
|
562 { |
|
563 // JFIF JPEG |
|
564 format = CCamera::EFormatJpeg; |
|
565 encoding = EEncoded; |
|
566 } |
|
567 else if ((imageFormats & CCamera::EFormatExif) && |
|
568 (*aSettings.iType == KJpegExif)) |
|
569 { |
|
570 // EXIF JPEG |
|
571 format = CCamera::EFormatExif; |
|
572 encoding = EEncoded; |
|
573 } |
|
574 } |
|
575 |
|
576 // Try to resolve nearest source size to the one requested, |
|
577 // except for the JFIF and EXIF jpeg subtypes the match has |
|
578 // to be exact otherwise non-encode capture format will be |
|
579 // used |
|
580 ResolveCaptureSizes(format, |
|
581 cameraInfo.iNumImageSizesSupported, |
|
582 aSize, |
|
583 sourceSize, |
|
584 sourceSizeIndex, |
|
585 largestSizeIndex); |
|
586 |
|
587 // Format was either of the jpeg formats and requested size |
|
588 // didn't match the source size |
|
589 if ((format >= CCamera::EFormatJpeg && |
|
590 format <= CCamera::EFormatExif) && |
|
591 (aSize != sourceSize)) |
|
592 { |
|
593 // Try again with an non-encoded format |
|
594 format = CCamera::EFormatFbsBitmapColor16M; |
|
595 encoding = EBitmap; |
|
596 ResolveCaptureSizes(format, |
|
597 cameraInfo.iNumImageSizesSupported, |
|
598 aSize, |
|
599 sourceSize, |
|
600 sourceSizeIndex, |
|
601 largestSizeIndex); |
|
602 } |
|
603 |
|
604 if (sourceSizeIndex == KErrNotFound) |
|
605 { |
|
606 // If correct index was not found use the largest. |
|
607 sourceSizeIndex = largestSizeIndex; |
|
608 } |
|
609 } |
|
610 // else use default iSourceSizeIndex and default image capture format |
|
611 |
|
612 iCamera->PrepareImageCaptureL(format, |
|
613 sourceSizeIndex); |
|
614 |
|
615 // play sound when capturing image |
|
616 CMMACameraSound::PlayImageCaptureSoundL(); |
|
617 |
|
618 // start capture, ImageReady will be called when ready |
|
619 iWindow->SetStarted(EFalse); |
|
620 |
|
621 iCamera->CaptureImage(); |
|
622 |
|
623 DEBUG_INT("MMA::CMMACameraPlayer::TakeSnapshotL: format = 0x%x", format); |
|
624 DEBUG_INT("MMA::CMMACameraPlayer::TakeSnapshotL: sourceSizeIndex = %d", sourceSizeIndex); |
|
625 DEBUG_INT("MMA::CMMACameraPlayer::TakeSnapshotL: encoding = %d", encoding); |
|
626 |
|
627 // Inform caller which snapshot encoding was ultimately used |
|
628 return encoding; |
|
629 } |
|
630 |
|
631 CFbsBitmap* CMMACameraPlayer::SnapshotBitmap() |
|
632 { |
|
633 CFbsBitmap* bitmap = iSnapshotBitmap; |
|
634 |
|
635 // ownership transfers to the caller |
|
636 iSnapshotBitmap = NULL; |
|
637 return bitmap; |
|
638 } |
|
639 |
|
640 HBufC8* CMMACameraPlayer::SnapshotEncoded() |
|
641 { |
|
642 HBufC8* encoded = iSnapshotEncoded; |
|
643 |
|
644 // ownership transfers to the caller |
|
645 iSnapshotEncoded = NULL; |
|
646 return encoded; |
|
647 } |
|
648 |
|
649 void CMMACameraPlayer::NotifyWithStringEvent( |
|
650 CMMAPlayerEvent::TEventType aEventType, |
|
651 const TDesC& aStringEventData) |
|
652 { |
|
653 PostStringEvent(aEventType, aStringEventData); |
|
654 } |
|
655 |
|
656 MMMASnapshot* CMMACameraPlayer::SnapshoterL() |
|
657 { |
|
658 return this; |
|
659 } |
|
660 |
|
661 TInt CMMACameraPlayer::CameraHandle() |
|
662 { |
|
663 return iCamera->Handle(); |
|
664 } |
|
665 |
|
666 void CMMACameraPlayer::SetViewFinderMode(TBool aStopViewFinder) |
|
667 { |
|
668 iStopViewFinder = aStopViewFinder; |
|
669 } |
|
670 |
|
671 // END OF FILE |
|