Snapshot shows the captured images on the display almost instantaneously. Snapshots may be created for video as well and the client may further specify the video frames from which the snapshot can be generated.
The client can specify the properties of the snapshot, such as size, background colour and position to be used if the snapshot has been scaled and so on.
Setup and Configuration Requirements
The following are the setup and configuration requirements you need to follow before doing snapshot implementation:
Make sure that you provide a concrete implementation of McameraSnapshot interface class, which provides the functionality.
Make sure that providers of the extension API for camera direct snapshot provides the implementation of MCameraDirectSnapshot mixin class.
The CCamera::CCameraSnapshot class allows a client to request snapshot data in a specified image format for both still images and video. The following tasks will be covered during snapshot implementation:
Create specific snapshot object using CCamera::CCameraImageCapture::GetSnapshotHandleL(TInt aClientViewFinderId) or CCamera::CCameraVideoCaptureControl::GetSnapshotHandleL(TInt aClientViewFinderId). Each client snapshot is linked to a specific client viewfinder handle.
Concrete implementation for MCameraImageCapture or MCameraVideoCaptureControl provides the implementation factory used to retrieve concrete implementation for MCameraSnapshot and MCameraSnapshot2 based on the values of the passed UIDs .
The UID values can be KECamMCameraSnapshotUid and KECamMCameraSnapshot2Uid.
Snapshot data is passed to the client using the observer callbacks MCaptureImageObserver::ClientSnapshotForImageReady() and MCaptureVideoObserver::ClientSnapshotReady().
After the snapshot is instantiated, client can request for camera formats supported by the snapshot feature in the camera.
Set the properties of the snapshot using CCameraSnapshot::PrepareSnapshotL call. Use PrepareSnapshotL(const CCamera::CCameraSnapshot::TSnapshotParameters& aSnapshotParameters) to set the properties of snapshot.
The following example shows how to do this:
// Gets the list of supported formats for snapshots TUint suppFormats = snap->SupportedFormats(); snap->PrepareSnapshotL(aSnapshotParameters);
The client uses CCameraSnapshot::EnableSnapshotL API to activate snapshot feature and to get snapshot notifications from Ecam implementation.
If a call to CCameraSnapshot::EnableSnapshotL is made without a successful call to , then the callback returns KErrBadHandle.
Client should implement the observers; MCaptureImageObserver and MCaptureVideoObserver.
Note: Snapshot notifications will be send to the clients through these observers and not through events.
Snapshot data is retrieved using MCaptureImageObserver::ClientSnapshotForImageReady() or MCaptureVideoObserver::ClientSnapshotReady() depending on whether snapshot is for image or video.
The client uses CCameraSnapshot::DisableSnapshotL call to stop getting notifications from Ecam implementation. It deactivates the snapshot feature if active.
You can also perform the above tasks using direct snapshot. The high level steps are explained below:
Create a new direct snapshot object using CCamera::CCameraDirectSnapshot::CreateL.
Retrieve the information about the direct viewfinder object for which direct snapshot is created using CCamera::CCameraDirectSnapshot::GetDirectViewFinderL method.
Enable direct snapshot using CCamera::CCameraDirectSnapshot::EnableDirectSnapshotL.
Disable direct snapshot using CCamera::CCameraDirectSnapshot::DisableDirectSnapshot.
Get the current state of the direct snapshot using CCamera::CCameraDirectSnapshot::GetDirectSnapshotStateL.
Retrieve the direct snapshot parameters using CCamera::CCameraDirectSnapshot::GetDirectSnapshotParametersL.
Set the direct snapshot parameters using CCamera::CCameraDirectSnapshot::SetDirectSnapshotParametersL.
You can create the following types of snapshots:
Note: You cannot create direct snapshot for video.
Direct snapshot for still images
This section explains how the implementation notifies about display for direct snapshot for still images.
The client enables the direct snapshot through successful call of Ccamera::CCameraDirectSnapshot::EnableDirectSnapshotL(). If the implementation displays the snapshot for individual still images, it notifies the client through observer MDirectViewFinderObserver::DirectSnapshotForImageDisplayed().
This provides reference to CCameraV2DirectViewFinder class object which refers a particular direct viewfinder on which the direct snapshot data for still images have been displayed.
Identify the specific still image for which the direct snapshot is displayed usingCCamera::CCameraImageCapture& and TPostCaptureControlId.
Client snapshot for still images
In client snapshot, the buffer containing snapshot data is sent to the camera client, and you can view the still image captured in the client side.
Display the captured still image in the client side using MCaptureImageObserver::ClientSnapshotForImageReady callback.
This provides reference to CCameraImageCapture class object which was used to issue the capture image operation.
This provides a pointer to MCameraBuffer2 which retrieves the snapshot data for the individual still image.
Identify the individual still image for which the implementation has provided the snapshot data using TPostCaptureControlId.
Client snapshot for video
In client snapshot, the buffer containing snapshot data is sent to the camera client, and you can view the video captured in the client side.
Notify the client about the snapshot data for the captured video using MCaptureVideoObserver::ClientSnapshotReady callback.
This provides pointer to MCameraBuffer2 class object which retrieves the snapshot for the video being captured.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.