Working with Snapshots

Introduction

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.

Snapshot Implementation

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:

  1. 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.

  2. 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 .

  3. Snapshot data is passed to the client using the observer callbacks MCaptureImageObserver::ClientSnapshotForImageReady() and MCaptureVideoObserver::ClientSnapshotReady() .

  4. After the snapshot is instantiated, client can request for camera formats supported by the snapshot feature in the camera.

  5. 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);
            
  6. 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 .

  7. Client should implement the observers; MCaptureImageObserver and MCaptureVideoObserver .

    Note : Snapshot notifications will be send to the clients through these observers and not through events.

  8. Snapshot data is retrieved using MCaptureImageObserver::ClientSnapshotForImageReady() or MCaptureVideoObserver::ClientSnapshotReady() depending on whether snapshot is for image or video.

  9. 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:

You can create the following types of snapshots:

  • Direct snapshot for still images

  • Client snapshot for still images

  • Client snapshot for video

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 using CCamera::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.

See also

Overview of Camera SnapShot

Creating Snapshots