This document explains how to configure the camera before using it for still image capture.
The PreImageCaptureControl API allows the client to retrieve the following information:
Direct snapshot support
Embedded still capture setting support
Direct saving support
Image format and pixel aspect ratio supported for a given resolution
Maximum memory size setting support
Maximum memory size currently used in camera
This new API creates a new set of camera configuration with improved speed. The new camera configuration is created, when there is an on-going still image capture based on previous configuration.
Introduction
This classes provide the necessary framework to control the image operations and settings prior to image capture. An observer class is associated with this class so that client may be notified of various relevant activities. This API provides replacement for few image capture related methods in class Ccamera.
Required Background
This is an extension API associated with Ccamera class. To create an object of the extension API facade class, a client application would need to provide a valid Ccamera reference as a parameter for the factory method.
Clients use New2L or NewDuplicate2L method to create camera object. So, clients that uses NewL or NewDuplicateL will not be able to create instance of this extension. This prepares the clients to receive unrecognized enum or ids that can be included in future.
Licensee should provide concrete implementation for MCameraPreImageCaptureControl class. Configuring the camera before using it for still image capture includes the following steps:
Use CcameraPreImageCaptureControl::NewL() factory method to create a class pointer.
This maps the exported call to an internal object of class CCameraPreImageCaptureControl that provides the functionality.
Get this pointer using a call to Ccamera::CustomInterface() with UID value KECamMCameraPreImageCaptureControlUid.
Use pointer to the MCameraPreImageCaptureControl derived class to initialize CCameraPreImageCaptureControl::iImpl during the second phase construction of the class CCamera::CCameraPreImageCaptureControl.
Use MpreImageCaptureControlObserver that contains call-back to provide instance of image capture class object after successfully preparing the image parameters.
Check if camera can provide capture event notification to the client using CCamera::CCameraPreImageCaptureControl::GetCaptureEventSupportInfoL method. If capture event notification is supported, ECam implementation will use KUidECamEventImageCaptureEvent event to notify the clients that the image has been exposed to the camera sensor.
Clients can decide whether to play a capture sound.
Client retrieves the information about direct snapshot support, embedded still capture setting support and direct saving support from the camera, and filled the desired TPrepareImageParameters to issue PrepareImageCapture call.
Implementation sets up and allocates memory for image capture operation. It creates a new CCameraImageCapture object using the prepare image parameters passed by the client.
The callback MPreImageCaptureControlObserver::PrepareImageComplete passes the ownership of the CCameraImageCapture object to the client.
Note:
Client should provide implementation of MpreImageCaptureControlObserver class.
Licensees should provide a concrete implementation of McameraPreImageCaptureControl interface class.
The following example code snippets illustrates the use of PreImageCaptureControl classes.
CCamera* camera; Use MCameraObserver2* observer2; Use camera = CCamera::New2L(*observer2, 0); CCamera::CCameraPreImageCaptureControl* preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, MPreImageCaptureControlObserver* preImageCaptureControlObserver)); CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters; MCaptureImageObserver* captureImageObserver ; preImgCapture->PrepareImageCapture(prepareImageParameters, *captureImageObserver);
Setting Maximum Memory Size
To set maximum memory size for a JPEG still image do the following:
Check if memory size is set to maximum using CCamera::CCameraPreImageCaptureControl::GetImageMaxMemorySizeSettingSupportInfoL method.
Get the maximum memory size in KB using CCamera::CCameraPreImageCaptureControl::GetImageMaxMemorySizeL method.
Use CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters:: iImageMaxMemorySize method to get the maximum memory size in kilo bytes. If client has no specific preference or if this setting is not supported, it will be KECamNoSpecificMaxMemorySize. The maximum memory size will take preference over JPEG quality if it is not sufficient to achieve the desired quality.
Providing image file saving support
To save the still images do the following steps:
Get the settings supported for embedded still captures using CCamera::CCameraPreImageCaptureControl::GetSupportedEmbeddedStillCaptureSettingsL method.
Get the information about the direct saving state supported by the camera using CCamera::CCameraPreImageCaptureControl::GetSupportedDirectSavingTypeL method. If supported, still images are saved in files instead of providing it to clients through MCameraImageBuffer callback.
Get the direct saving type currently used using CCamera::CCameraPreImageCaptureControl::GetDirectSavingTypeL method. Enum value TDirectSavingType will represent the direct saving type used by the camera.
Set the required type of direct saving option specified by its state using CCamera::CCameraPreImageCaptureControl::SetDirectSavingTypeL method.
Note: Before capturing still images by direct saving option, clients need to provide the filename.