Direct Viewfinder Tutorials

This tutorial introduces you to the Direct Viewfinder API of the Ecam component.


This documents provides a detailed description about the Direct Viewfinder API.

Setup and Configuration Requirements

The following are the setup and configuration requirements you need to follow before Direct Viewfinder implementation:

  • Client needs to implement the MdirectViewFinderObserver , an observer class to use version 2 direct viewfinder API. This class contains the call-backs necessary to provide notifications in relation to version2 direct viewfinder operations.

  • Licensee must provide concrete implementation for an interface class MCameraV2DirectViewFinder , and McameraViewFinder .

Direct viewfinder

Direct viewfinder provides the necessary framework for multiple direct viewfinder support. The direct viewfinder classes are provided as a part of Version2 direct viewfinder implementation.

Direct Viewfinder Implementation

The following tasks will be covered during Direct Viewfinder implementation:

  • Create an instance of class CcameraV2DirectViewFinder using CcameraV2DirectViewFinder::NewL() method. Client also needs to pass the reference to the instance of class that provides concrete implementation for MdirectViewFinderObserver .

  • In second phase construction for class Ccamera::CcameraV2DirectViewFinder , do the following:

    1. Retrieve the handle to the concrete implementation for MCameraV2DirectViewFinder and MCameraViewFinder through a call to Ccamera::CustomInterface() , when appropriate UIDs are provided.

      UID KECamMCameraV2DirectViewFinderUid is used to retrieve the handle for concrete implementation of MCameraV2DirectViewFinder .

      Uid KECamMCameraBaseV2DirectViewFinderUid is used to retrieve the handle to concrete implementation for MCameraViewFinder .

    2. Pass the reference to the direct viewfinder observer to the concrete implementation of MCameraV2DirectViewFinder through MCameraV2DirectViewFinder::SetDirectViewFinderObserver() .

    3. The next step includes the following steps:

    4. Client creates a new instance of the class CcameraV2DirectViewFinder for every new direct viewfinder.

    5. Ecam implementation should keep track of CcameraV2DirectViewFinder object deletion.

      Makes sure that a call-back is not sent, if the client destroys the particular version2 direct viewfinder object.

      This situation may arise when the call-back gets queued by the Ecam implementation in order to send it across to the client.

    Note: Client retains the ownership of CcameraV2DirectViewFinder class object.

Working with Direct Viewfinder

The following steps describe working with direct viewfinder.

  1. Before starting the direct viewfinder, client has the following options:

  2. Use CCameraV2DirectViewFinder::StartViewFinderDirectL() method to start direct viewfinder. In case of direct viewfinder, you can specify the in-screen co-ordinates, to which view finder data is to be transferred. The in-screen co-ordinates can be modified, for example, the camera requires the destination to have a certain byte alignment.

  3. If there is a conflict, the size of image returned by the view finder will not be the exact size requested. This occurs when the requirement of the view finder to show the unclipped view in the ratio required for image capture or video capture. The camera will return the best match.

  4. Implementation issues callback MDirectViewFinderObserver::DirectViewFinderFirstFrameDisplayed() and notifies the client that the first viewfinder frame has been displayed successfully. Implementation passes the viewfinder handle along with the callback.

  5. If the implementation finds any error during direct viewfinder processing, it stops the specific direct viewfinder and issue the callback MDirectViewFinderObserver::DirectViewFinderFailed() .

  6. Client can use direct snapshot for still images captured over the direct viewfinder screen by creating a dedicated direct snapshot object through CCamera::CCameraV2DirectViewFinder::GetDirectSnapshotHandleL() .

    See also CCamera::CCameraDirectSnapshot and their related M class MCameraDirectSnapshot .