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