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 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:
When appropriate UIDs are provided, retrieve the handle to the concrete implementation for MCameraClientViewFinder and MCameraViewFinder through a call to Ccamera::CustomInterface.
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.
Pass the reference to the client viewfinder observer to the concrete implementation of MCameraClientViewFinder through MCameraClientViewFinder::SetClientViewFinderObserver().
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.
Note:
Client retains the ownership of CcameraClientViewFinder class object.
MCameraObserver2::ViewFinderReady() will not be used with CCameraClientViewFinder class.
Working with Client Viewfinder
The following steps describes working with client viewfinder:
Before starting the client viewfinder, client has the following options:
Client can use specific histogram over the client viewfinder frame by creating a dedicated histogram object through CCamera::CCameraClientViewFinder::CreateHistogramHandleL(). Concrete implementation for MCameraClientViewFinder provides the concrete factory handle of type MImplementationFactory, for the histogram implementation of a particular viewfinder.
Histogram related callbacks which would eventually be issued to the client are MClientViewFinderObserver::DirectHistogramDisplayed() and MClientViewFinderObserver::ClientHistogramReady().
Client can also use specific image processing over the client viewfinder frame by creating a dedicated image processing object through CCamera::CCameraClientViewFinder::GetTransformationHandleL(). Concrete implementation for MCameraClientViewFinder provides the concrete factory handle of type MImplementationFactory, for the image processing implementation to use it specifically for a particular viewfinder.
Image processing related callbacks which would be issued to the client through MCameraObserver2::HandleEvent().
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.
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.
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 CCameraClientViewFinder::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.