Client Viewfinder

This tutorial introduces to the Client Viewfinder API of the Ecam component.


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

Setup and Configuration Requirements

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

  • Client needs to implement the dedicated observer MclientViewFinderObserver to use the client viewfinder API.

    The Ecam implementation will issue the call-backs in this observer class, when the client viewfinder operations are ready to be notified.

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

Client Viewfinder

Client Viewfinder Implementation

The following tasks will be covered during Client Viewfinder implementation:

  • Create an instance of class CcameraClientViewFinder through CcameraClientViewFinder::NewL() factory method. Client also needs to pass the reference to the instance of class for providing concrete implementation of MClientViewFinderObserver .

    This class maps the exported call to an internal object of class McameraClientViewFinder , which provides the camera version2 client viewfinder functionality.

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

    1. When appropriate UIDs are provided, retrieve the handle to the concrete implementation for MCameraClientViewFinder and MCameraViewFinder through a call to Ccamera::CustomInterface .

    2. KECamMCameraClientViewFinderUid UID is used to retrieve the handle for concrete implementation of MCameraClientViewFinder .

      KECamMCameraBaseClientViewFinderUid UID is used to retrieve the handle to concrete implementation for MCameraViewFinder.

    3. Pass the reference to the client viewfinder observer to the concrete implementation of MCameraClientViewFinder through MCameraClientViewFinder::SetClientViewFinderObserver() .

    4. Pass the handle of the Ccamera::CcameraClientViewFinder() to the concrete implementation of MCameraClientViewFinder through MCameraClientViewFinder::SetClienttViewFinderHandle() .

      Implementation can use this handle to implement MCameraViewFinder::GetViewFinderHandleL() and provide a unique identity to the given viewfinder handle.

      Implementation passes this handle to the client through client viewfinder observer callbacks, and allows the client to identify the actual client viewfinder instance that should receive the notification.

      Note :Implementation should not destroy this object. Client will use CCameraViewFinder::GetViewFinderHandleL() to distinguish a particular client viewfinder instance.

  • If multiple client viewfinders need to be run, client needs to create a new object for CcameraClientViewFinder each time.

  • Ecam implementation keeps track of CcameraClientViewFinder object deletion.

    Makes sure that a call-back is not sent, if the client destroys the particular CcameraClientViewFinder class object.

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


Working with Client Viewfinder

The following steps describes working with client viewfinder:

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

  2. Use CCameraClientViewFinder::StartClientViewFinderL() to start client viewfinder and to retrieve viewfinder frames in the specified format and size. Client specifies the format and size for the viewfinder frames.

  3. ECam adaptation owns the buffer that passes the viewfinder frames to the client through McameraOberver2 notification. The client releases the buffers passed to it by the adaptation, when it has handled the viewfinder frame. The adaptation should not reuse the buffers passed, until the client releases them. The Ecam adaptation secures it against the clients that do not release the buffers within a specific time interval.

  4. Implementation issues callback ViewFinderBufferReady() to notify the client that viewfinder frames of client are available. Implementation passes the viewfinder handle along with the callback. Client identifies the actual client viewfinder object and retrieve the viewfinder data through C CameraClientViewFinder::GetViewFinderBufferL() .

A client calls the following functions to control the view finder:

If the implementation finds any error during client viewfinder operation, it stops the specific client viewfinder and issue the callback MDirectViewFinderObserver::ViewFinderBufferReady() with the appropriate error code.

See also

Overview of Viewfinder API

The Viewfinder Tutorial

The Direct Viewfinder Tutorial