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 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:
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.
Pass the reference to the direct viewfinder observer to the concrete implementation of MCameraV2DirectViewFinder through MCameraV2DirectViewFinder::SetDirectViewFinderObserver().
The next step includes the following steps:
Pass the handle of the Ccamera::CcameraV2DirectViewFinder to the concrete implementation of MCameraV2DirectViewFinder through MCameraV2DirectViewFinder::SetDirectViewFinderHandle().
Implementation might use this handle in implementing MCameraViewFinder:: GetViewFinderHandleL() and provide a unique identity to the given viewfinder handle.
The implementation passes this handle back to the client through direct viewfinder observer callbacks and allows the client to identify the actual direct viewfinder instance that should receive the notification.
Implementation is not supposed to destroy this object. Client will use CCameraViewFinder::GetViewFinderHandleL() to distinguish a particular direct viewfinder instance.
Client creates a new instance of the class CcameraV2DirectViewFinder for every new direct viewfinder.
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.
Before starting the direct viewfinder, client has the following options:
Client can use specific histogram over a direct viewfinder frame by creating specific histogram object through CCamera::CCameraV2DirectViewFinder::CreateHistogramHandleL(). Concrete implementation for MCameraV2DirectViewFinder provides the concrete factory handle (of type MImplementationFactory*) for the histogram implementation to use it for a particular viewfinder.
Histogram related callbacks that would be issued to the client are MDirectViewFinderObserver::DirectHistogramDisplayed() and MDirectViewFinderObserver::ClientHistogramReady().
Client can also use specific image processing over the direct viewfinder frame by creating a dedicated image processing object using CCamera:: CCameraV2DirectViewFinder ::GetTransformationHandleL().
MCameraV2DirectViewFinder concrete implementation provides the concrete factory handle of type , for the image processing implementation to use it for a particular viewfinder. Image processing related callbacks would be issued to the client through MCameraObserver2::HandleEvent().
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.
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.
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.
If the implementation finds any error during direct viewfinder processing, it stops the specific direct viewfinder and issue the callback MDirectViewFinderObserver::DirectViewFinderFailed().
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.