imagingandcamerafws/camerafw/Include/ecamcapturecontrol.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedPartner
       
    19  @prototype
       
    20 */
       
    21 #ifndef  ECAMCAPTURECONTROL_H
       
    22 #define  ECAMCAPTURECONTROL_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <ecam.h>
       
    26 #include <ecamadvsettings.h>
       
    27 
       
    28 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    29 #include <ecamconst.h>
       
    30 #include <ecamadvsettingsconst.h>
       
    31 #endif
       
    32 
       
    33 #include <mm/conversioncoefficient.h>
       
    34 
       
    35 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    36 #include <ecamcapturecontrolconst.h>
       
    37 #endif
       
    38 
       
    39 class MCameraPreImageCaptureControl;
       
    40 class MCameraImageCapture;
       
    41 class MCameraPostImageCaptureControl;
       
    42 class MCameraVideoCaptureControl;
       
    43 
       
    44 class MHistogramV2Buffer;
       
    45 
       
    46 /** 
       
    47 Special ImageMaxMemorySize when client does not have any specific preference. Also used when 
       
    48 this setting of maximum memory size is not supported. 
       
    49 */
       
    50 static const TInt KECamNoSpecificMaxMemorySize = -1;
       
    51 
       
    52 /** 
       
    53 The current Version of the TPrepareImageParameters class.
       
    54 */
       
    55 static const TUint KECamPrepareImageParametersCurrentVersion = 1;
       
    56 
       
    57 /** 
       
    58 The current Version of the TPrepareVideoParameters class.
       
    59 */
       
    60 static const TUint KECamPrepareVideoParametersCurrentVersion = 1;
       
    61 
       
    62 /**
       
    63 The current Version of the TDriveModeDependentAttributes class. 
       
    64 
       
    65 @publishedPartner
       
    66 @prototype
       
    67 */
       
    68 static const TUint KECamDriveModeDependentAttributesCurrentVersion = 1;
       
    69 
       
    70 /**
       
    71 	Uid used to identify the CCameraPreImageCaptureControl API.
       
    72 	This API is used to control the pre-imagecapture operations.
       
    73 	
       
    74 	@see CCamera::CCameraPreImageCaptureControl
       
    75 */
       
    76 static const TUid  KECamPreImageCaptureControlUid 	= {KECamPreImageCaptureControlUidValue};
       
    77 
       
    78 /**
       
    79 	Uid used to identify the CCameraImageCapture API.
       
    80 	This API is used to capture the image and perform other control operations after capture the image.
       
    81 	
       
    82 	@see CCamera::CCameraImageCapture
       
    83 */
       
    84 static const TUid  KECamImageCaptureUid 	= {KECamImageCaptureUidValue};
       
    85 
       
    86 /**
       
    87 	Uid used to identify the CCameraPostImageCaptureControl API.
       
    88 	This API is used to control the post-imagecapture operations.
       
    89 	
       
    90 	@see CCamera::CCameraPostImageCaptureControl
       
    91 */
       
    92 static const TUid  KECamPostImageCaptureControlUid 	= {KECamPostImageCaptureControlUidValue};
       
    93 
       
    94 /**
       
    95 	Uid used to identify the CCamera Video Capture Control API.
       
    96 	This API is used to control the video capture operations.
       
    97 	
       
    98 	@see CCamera::CCameraVideoCaptureControl
       
    99 */
       
   100 static const TUid  KECamVideoCaptureControlUid 	= {KECamVideoCaptureControlUidValue};
       
   101 
       
   102 /** 
       
   103 Notification that the camera is ready for next prepare. Next prepare can either be still or video.
       
   104 @note  If drive mode is EDriveModeTimeNudgeCapture this callback will only be received when the client deletes the 
       
   105 	   existing CCameraImageCapture object as more than one instance can not be created if this drive mode is used.
       
   106 */
       
   107 static const TUid  KUidECamEventReadyForNextPrepare = {KUidECamEventReadyForNextPrepareUidValue};
       
   108 
       
   109 /** 
       
   110 Notification that the camera is ready for next capture. Next capture can either be still or video.
       
   111 @note  If drive mode is EDriveModeTimeNudgeCapture this callback will only be received once the total required amount
       
   112 	   of images are captured (ie. pre-capture images + 1 + post-capture images) and the implementation is ready with
       
   113 	   another set of pre-capture images (so implementation is prepared for next CaptureImage() call).
       
   114 */
       
   115 static const TUid  KUidECamEventReadyForNextCapture = {KUidECamEventReadyForNextCaptureUidValue};
       
   116 
       
   117 /** 
       
   118 Notification that the image has been exposed to the sensor.
       
   119 ECam implementation will notify the client that the image has been exposed to the sensor.
       
   120 @see CCamera::CCameraPreImageCaptureControl::GetCaptureEventSupportInfoL
       
   121 */
       
   122 static const TUid  KUidECamEventImageCaptureEvent = {KUidECamEventImageCaptureEventUidValue};
       
   123 
       
   124 /**
       
   125 Specifies the priority which may be assigned to the captured images which are still pending.
       
   126 
       
   127 The enumeration list may be extended in future.
       
   128 */
       
   129 enum TECamImagePriority
       
   130 	{
       
   131 	/** Low Priority */
       
   132 	EECamImagePriorityLow,
       
   133 	/** Medium Priority */
       
   134 	EECamImagePriorityMedium,
       
   135 	/** Standard Priority */
       
   136 	EECamImagePriorityStandard,
       
   137 	/** High Priority */
       
   138 	EECamImagePriorityHigh,
       
   139 	/** Very High Priority */
       
   140 	EECamImagePriorityVeryHigh
       
   141 	};
       
   142 
       
   143 /**	
       
   144 A mixin class to be implemented by the client in order to use the PreImageCaptureControl API. The derived class methods 
       
   145 are called by the implementation when the pre image capture operations are ready to be notified accordingly.
       
   146 
       
   147 @see CCamera::CCameraPreImageCaptureControl
       
   148 */	
       
   149 class MPreImageCaptureControlObserver
       
   150 	{
       
   151 public:
       
   152 	/**
       
   153 	Implementation sends this callback as a result of PrepareImageCapture completion. Every time client calls 
       
   154 	CCameraPreImageCaptureControl::PrepareImageCapture, a new CCameraImageCapture* will be passed to the client for
       
   155 	image capture operations. Implementation will create the CCameraImageCapture* object after allocating the memory 
       
   156 	resources required. Ownership of CCameraImageCapture* object will be passed to the client.
       
   157 	
       
   158 	@param aCaptureImageHandle
       
   159 		   Retrieves pointer to the CCameraImageCapture object created by the implementation.
       
   160 		   
       
   161 	@param aErrorCode
       
   162 		   Appropriate error code. 
       
   163 		   KErrECamImageResourceNotReleased when camera device is capable of preparing only still or video.
       
   164 		   KErrECamVideoResourceNotReleased when camera device is capable of preparing only still or video.
       
   165 	
       
   166 	@note  Every time client needs to change the prepare image settings, a new instance of CCameraImageCapture will be 
       
   167 		   provided to it by the implementation.
       
   168 		   
       
   169 	@note  If error is KErrECamImageResourceNotReleased and client wants to successfully call the Prepare method again, 
       
   170 		   client needs to delete all CCameraImageCapture objects and any Snapshot and Histogram objects associated with
       
   171 		   it as well.   
       
   172 	
       
   173 	@note  If error is KErrECamVideoResourceNotReleased and client wants to successfully call the Prepare method again,
       
   174 		   client needs to call ReleaseVideoResource to unprepare video and then delete any Snapshot and Histogram 
       
   175 		   objects associated with it as well.
       
   176 	
       
   177 	@note  If drive mode is set to EDriveModeTimeNudgeCapture the client will only receive this callback once the implementation
       
   178 		   is ready with the number of pre-capture images specified in TDriveModeDependentAttributes.
       
   179 	*/
       
   180 	virtual void PrepareImageComplete(CCamera::CCameraImageCapture* aCaptureImageHandle, TInt aErrorCode)=0;
       
   181 	
       
   182 	/**
       
   183 	Gets a custom interface for future callbacks. This method will be called by the implementation to get a new interface
       
   184 	which would support future callbacks.
       
   185 
       
   186 	@param  aInterface
       
   187 		    The Uid of the particular interface function required for callbacks.
       
   188 		   
       
   189 	@param  aPtrInterface
       
   190 		    The implementation has to type-cast the retrieved custom interface pointer to the appropriate type.	
       
   191 
       
   192 	@return The error code.
       
   193 	*/
       
   194 	virtual TInt CustomInterface(TUid aInterface, TAny*& aPtrInterface)=0;
       
   195 	}; 
       
   196 
       
   197 /**
       
   198 A mixin class to be implemented by the client in order to use the Capture Image API. The derived class methods are 
       
   199 called by the implementation when the image capture operations are ready to be notified accordingly.
       
   200 Implementation shall keep track of CCameraImageCapture object deletion. It has to ensure that a callback is not send 
       
   201 should the client destroy the CCameraImageCapture class object when the callback is queued to be send across. 
       
   202 Ownership of CCameraImageCapture is retained by the client.
       
   203 
       
   204 @see CCamera::CCameraImageCapture
       
   205 @see CCamera::CCameraPostImageCaptureControl
       
   206 */
       
   207 class MCaptureImageObserver
       
   208 	{
       
   209 public:
       
   210 	/**
       
   211 	Implementation sends this callback to provide client the handle to control individual images to be captured. For
       
   212 	example, client may want to destroy the image even before the completion for some reasons.
       
   213 	This callback may be send to the client after the image is exposed to the sensor.
       
   214 	
       
   215 	@param  aCaptureImageHandle
       
   216 			Reference to CCameraImageCapture class object which was used to issue the capture image operation.
       
   217 			CCameraPostImageCaptureControl instances will be owned by CCameraImageCapture and would be available until 
       
   218 			new capture command is issued using the owning CCameraImageCapture instance. If client wishes to initiate new 
       
   219 			capture but preserve the CCameraPostImageCaptureControl instances from previous capture, it would have to 
       
   220 			create a new CCameraImageCapture instance and use that for the new capture.
       
   221 			
       
   222 	@param  aPostCaptureControlId
       
   223 			Id used to identify a particular CCameraPostImageCaptureControl object associated with the given 
       
   224 			CCameraImageCapture class object. This will be used to control the individual image.
       
   225 	
       
   226 	@note   If, in case, there is some problem at implementation level while the image capture operation, for example, not
       
   227 			enough memory to create the class object CCameraPostImageCaptureControl, this callback may not be send. In such
       
   228 			cases, ImageCaptureComplete callback can be send with appropriate error code.
       
   229 			
       
   230 	@note   Whether direct saving option is used or buffers are used for images, this callback will be received in both 
       
   231 			the cases.
       
   232 	*/
       
   233 	virtual void IndividualImageControlHandle(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId)=0;
       
   234 																									  
       
   235 	/**
       
   236 	Implementation sends this callback when the individual image is ready and direct saving option is not used.
       
   237 	
       
   238 	@param  aCaptureImageHandle
       
   239 			Reference to CCameraImageCapture class object which was used to issue the capture image operation.
       
   240 			CCameraPostImageCaptureControl instances will be owned by CCameraImageCapture and would be available until 
       
   241 			new capture command is issued using the owning CCameraImageCapture instance. If client wishes to initiate new 
       
   242 			capture but preserve the CCameraPostImageCaptureControl instances from previous capture, it would have to 
       
   243 			create a new CCameraImageCapture instance and use that for the new capture.
       
   244 	
       
   245 	@param  aPostCaptureControlId
       
   246 			Id used to identify a particular CCameraPostImageCaptureControl object associated with the given 
       
   247 			CCameraImageCapture class object. This will be used to retrieve the individual image buffer.
       
   248 	
       
   249 	@param  aErrorCode
       
   250 			Appropriate error code. 
       
   251 	
       
   252 	@note	If direct saving option is not used, this callback will be received by the client. 
       
   253 	*/
       
   254 	virtual void ImageBufferReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)=0;
       
   255 	
       
   256 	/** 
       
   257 	Implementation sends this callback when a particular client snapshot data is available. The snapshot data represents
       
   258 	the individual image which may be in any drive mode. 
       
   259 
       
   260 	If a call to CCameraSnapshot::EnableSnapshotL() (on the CCameraImageCapture instance) is made without a successful call 
       
   261 	to CCameraSnapshot::PrepareSnapshotL(const TSnapshotParameters& aSnapshotParameters) (on the CCameraImageCapture 
       
   262 	instance), then the callback returns KErrBadHandle.
       
   263 
       
   264 	@param  aCaptureImageHandle
       
   265 			Reference to CCameraImageCapture class object which was used to issue the capture image operation.
       
   266 	
       
   267 	@param  aPostCaptureControlId
       
   268 			Id used to identify a particular CCameraPostImageCaptureControl object associated with the given 
       
   269 			CCameraImageCapture class object. This is needed to identify the image which is represented by this snapshot.
       
   270 	
       
   271 	@param  aSnapshotBuffer
       
   272 			Pointer to MCameraBuffer2 which retrieves the snapshot data for the individual image. The ownership will be 
       
   273 			retained by the implementation. Client needs to call Release in order to indicate the implementation
       
   274 			that the buffer can be re-used. Client shall never try to delete the pointer. NULL, if error.
       
   275 	
       
   276 	@param  aErrorCode
       
   277 			Appropriate error code.
       
   278 	*/
       
   279 	virtual void ClientSnapshotForImageReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MCameraBuffer2* aSnapshotBuffer, TInt aErrorCode)=0;
       
   280 	
       
   281 	/** 
       
   282 	Implementation sends this callback when the cut down version(lower resolution) of the individual image has
       
   283 	been directly saved to the file.
       
   284 	Client may use the cut down version of the actual image to view the image beforehand and may cancel the actual
       
   285 	individual image.
       
   286 	
       
   287 	@param  aCaptureImageHandle
       
   288 			Reference to CCameraImageCapture class object which was used to issue the capture image operation.
       
   289 	
       
   290 	@param  aPostCaptureControlId
       
   291 			Id used to identify a particular CCameraPostImageCaptureControl object associated with the given 
       
   292 			CCameraImageCapture class object. This may be used to cancel the actual image which might be currently 
       
   293 			undergoing any processing options or even pause/resume ongoing processing options.
       
   294 	
       
   295 	@param  aErrorCode
       
   296 			Appropriate error code.
       
   297 	
       
   298 	@note	If direct saving option is being used, this callback may be received by the client.
       
   299 	*/
       
   300 	virtual void CutDownImageDirectSavingCompleted(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)=0;
       
   301 	
       
   302 	/** 
       
   303 	Implementation sends this callback when the individual image has been directly saved to the file.
       
   304 	This implies that the processing options associated with the image has been finally completed.
       
   305 
       
   306 	@param  aCaptureImageHandle
       
   307 			Reference to CCameraImageCapture class object which was used to issue the capture image operation.
       
   308 			CCameraPostImageCaptureControl instances will be owned by CCameraImageCapture and would be available until 
       
   309 			new capture command is issued using the owning CCameraImageCapture instance. If client wishes to initiate new 
       
   310 			capture but preserve the CCameraPostImageCaptureControl instances from previous capture, it would have to 
       
   311 			create a new CCameraImageCapture instance and use that for the new capture.
       
   312 	
       
   313 	@param  aPostCaptureControlId
       
   314 			Id used to identify a particular CCameraPostImageCaptureControl object associated with the given 
       
   315 			CCameraImageCapture class object.
       
   316 	
       
   317 	@param  aErrorCode
       
   318 			Appropriate error code.
       
   319 	
       
   320 	@note	If direct saving option is being used, this callback will be received by the client.
       
   321 	*/
       
   322 	virtual void ImageDirectSavingCompleted(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)=0;
       
   323 
       
   324 	/**
       
   325 	Implementation sends this callback when the Capture Image operation has been completed. This will be send to mark the 
       
   326 	completion of the image capture even if direct saving option is being used.
       
   327 	
       
   328 	@param  aCaptureImageHandle
       
   329 			Reference to CCameraImageCapture class object which was used to issue the capture image operation.
       
   330 			CCameraPostImageCaptureControl instances will be owned by CCameraImageCapture and would be available until 
       
   331 			new capture command is issued using the owning CCameraImageCapture instance. If client wishes to initiate new 
       
   332 			capture but preserve the CCameraPostImageCaptureControl instances from previous capture, it would have to 
       
   333 			create a new CCameraImageCapture instance and use that for the new capture. 
       
   334 			
       
   335 	@param  aErrorCode
       
   336 			Appropriate error code. 
       
   337 			
       
   338 	@note	This callback marks the completion of image capture operation. So, whether direct saving option is used or 
       
   339 			buffers are used for images, this callback will be received in both the cases.
       
   340 			
       
   341 	@note  If drive mode is EDriveModeTimeNudgeCapture this callback will only be received once the total required amount
       
   342 		   of images are captured (ie. pre-capture images + 1 + post-capture images) and the implementation is ready with
       
   343 		   another set of pre-capture images (so implementation is prepared for next CaptureImage() call).
       
   344 	*/
       
   345 	virtual void ImageCaptureComplete(CCamera::CCameraImageCapture& aCaptureImageHandle, TInt aErrorCode)=0;
       
   346 	
       
   347 	/**
       
   348 	Implementation sends this callback in order to notify the client about availability of the histogram data for the
       
   349 	individual image. If a call to CCameraV2Histogram::StartHistogram() (on the CCameraImageCapture instance) is made 
       
   350 	without	a previous successful call to CCameraV2Histogram::PrepareClientHistogramL() (on the CCameraImageCapture 
       
   351 	instance) then the callback returns KErrBadHandle.
       
   352 	
       
   353 	@param  aCaptureImageHandle
       
   354 			Reference to CCameraImageCapture class object which was used to issue the capture image operation.
       
   355 	
       
   356 	@param  aPostCaptureControlId
       
   357 			Id used to identify a particular CCameraPostImageCaptureControl object associated with the given 
       
   358 			CCameraImageCapture class object. This provides the individual image for which the client histogram data 
       
   359 			is available.
       
   360 	
       
   361 	@param  aClientHistogramBuffer
       
   362 			Pointer to MHistogramV2Buffer which retrieves a single histogram for the individual image alongwith 
       
   363 			relevant information about it. The ownership will be retained by the implementation. Client needs to call 
       
   364 			Release in order to indicate the implementation that the buffer can be re-used. Client shall never try to 
       
   365 			delete the pointer. NULL, if error.
       
   366 	
       
   367 	@param  aErrorCode
       
   368 			Appropriate error code.
       
   369 	*/
       
   370 	virtual void ClientHistogramForImageReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MHistogramV2Buffer* aClientHistogramBuffer, TInt aErrorCode)=0;
       
   371 	
       
   372 	/**
       
   373 	Implementation sends this callback in order to notify the client about availability of the histogram data for the
       
   374 	snapshot of the individual image. If a call to CCameraV2Histogram::StartHistogram() (on the snapshot) is made without
       
   375 	a previous successful call to CCameraV2Histogram::PrepareClientHistogramL() (on the snapshot) then the callback 
       
   376 	returns KErrBadHandle.
       
   377 	
       
   378 	@param  aCaptureImageHandle
       
   379 			Reference to CCameraImageCapture class object which was used to issue the capture image operation. This 
       
   380 			provides handle to the snapshot(CCameraImageCapture::GetSnapshotHandleL()) for which the histogram data 
       
   381 			is available.
       
   382 	
       
   383 	@param  aPostCaptureControlId
       
   384 			Id used to identify a particular CCameraPostImageCaptureControl object associated with the given 
       
   385 			CCameraImageCapture class object. This provides a mapping between the individual image and the snapshot for 
       
   386 			which the client histogram data is available.
       
   387 	
       
   388 	@param  aClientHistogramBuffer
       
   389 			Pointer to MHistogramV2Buffer which retrieves a single histogram for the snapshot of the individual image 
       
   390 			alongwith relevant information about it. The ownership will be retained by the implementation. Client needs to call 
       
   391 			Release in order to indicate the implementation that the buffer can be re-used. Client shall never try to 
       
   392 			delete the pointer. NULL, if error.
       
   393 	
       
   394 	@param  aErrorCode
       
   395 			Appropriate error code. 
       
   396 	*/
       
   397 	virtual void ClientHistogramForSnapshotReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MHistogramV2Buffer* aClientHistogramBuffer, TInt aErrorCode)=0;
       
   398 
       
   399 	/**
       
   400 	Implementation sends this callback in order to notify the client about the failure of processing options for the 
       
   401 	individual image.
       
   402 	
       
   403 	@param  aCaptureImageHandle
       
   404 			Reference to CCameraImageCapture class object which was used to issue the capture image operation.
       
   405 	
       
   406 	@param  aPostCaptureControlId
       
   407 			Id used to identify a particular CCameraPostImageCaptureControl object associated with the given
       
   408 			CCameraImageCapture class object. This provides the individual image for which the processing options
       
   409 			has failed.
       
   410 
       
   411 	@param  aProcessingTypes
       
   412 			Bitfield of TEcamProcessingOptions associated with the image that have failed.
       
   413 	
       
   414 	@param  aErrorCode
       
   415 			Appropriate error code.
       
   416 	*/
       
   417 	virtual void ProcessingFailed(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TUint aProcessingTypes, TInt aErrorCode) = 0;
       
   418 	/**
       
   419 	Gets a custom interface for future callbacks. This method will be called by the implementation to get a new interface
       
   420 	which would support future callbacks.
       
   421 
       
   422 	@param  aInterface
       
   423 		    The Uid of the particular interface function required for callbacks.
       
   424 		   
       
   425 	@param  aPtrInterface
       
   426 		    The implementation has to type-cast the retrieved custom interface pointer to the appropriate type.	
       
   427 
       
   428 	@return The error code.
       
   429 	*/
       
   430 	virtual TInt CustomInterface(TUid aInterface, TAny*& aPtrInterface)=0;
       
   431 	};
       
   432 
       
   433 /** 
       
   434 CCameraPreImageCaptureControl class exposes an API for controlling image operations/settings prior to image capture. 
       
   435 
       
   436 @note  This class is not intended for sub-classing and used to standardise existing
       
   437        varieties of implementations.
       
   438        
       
   439 @note  If the class methods leave, the output type parameter value is not guaranteed to be valid.
       
   440 
       
   441 @note  Client should not use old Capture methods present in class CCamera. Class CCameraImageCapture and class 
       
   442 	   CCameraPostImageCaptureControl should be used rather.
       
   443 
       
   444 @publishedPartner
       
   445 @prototype
       
   446 */
       
   447 class CCamera::CCameraPreImageCaptureControl : public CBase
       
   448 	{
       
   449 	/* so can use internal factory functions etc. */
       
   450 	friend class CCamera;
       
   451 
       
   452 public:
       
   453 
       
   454 	/**
       
   455 	Specifies the type of direct saving.
       
   456 	The enumeration list may be extended in future.
       
   457 	*/
       
   458 	enum TDirectSavingType
       
   459 		{
       
   460 		/** Image saved in buffers. Direct saving to file not being used. Callback used is 
       
   461 		MCaptureImageObserver::ImageBufferReady. */
       
   462 		EDirectSavingNotUsed					= 0x00,
       
   463 		/** Image saved to file as per the format specified. Image saved after any processing options have completed. 
       
   464 		Callback used is MCaptureImageObserver::ImageDirectSavingCompleted(). */
       
   465 		EDirectSavingHighResolutionFileOnly		= 0x01,
       
   466 		/** Image saved to file as per the format specified. Also, a lower resolution image gets saved in a separately 
       
   467 		specified file. This helps in retrieving the lower resolution image sooner than the higher resolution
       
   468 		image gets saved. Callback used for lower resolution image saving is MCaptureImageObserver::
       
   469 		CutDownImageDirectSavingCompleted(). */
       
   470 		EDirectSavingWithLowerResolutionFile	= 0x02
       
   471 		};
       
   472 	
       
   473 	/**
       
   474 	Specifies the various type of direct snapshot support.
       
   475 	The enumeration list may be extended in future.
       
   476 	*/	
       
   477 	enum TDirectSnapshotType
       
   478 		{
       
   479 		/** Direct snapshot not supported. */
       
   480 		EDirectSnapshotNotSupported			= 0x00,
       
   481 		/** Direct Snapshot supported. It will be displayed on the same direct viewfinder screen, out of which it has 
       
   482 		been created */
       
   483 		EDirectSnapshotSupported			= 0x01
       
   484 		};
       
   485 
       
   486 	/** Provides any extra drive mode dependent parameters to be used for image capture. */ 
       
   487 	class TDriveModeDependentAttributes
       
   488 		{
       
   489 	public:
       
   490 		IMPORT_C TDriveModeDependentAttributes();
       
   491 
       
   492 		IMPORT_C TUint Size() const;
       
   493 		IMPORT_C TUint Version() const;
       
   494 
       
   495 	private:
       
   496 		//for future expansion
       
   497 		TUint iSize:24;
       
   498 		TUint iVersion:8;
       
   499 
       
   500 		//for future use
       
   501 		TInt iReserved1;
       
   502 		TInt iReserved2;
       
   503 		TInt iReserved3;
       
   504 
       
   505 	public:
       
   506 		/** If drive mode is EDriveModeTimeNudgeCapture this represents the number of images to be captured
       
   507 		(pre-capture images) before client initiates actual image capture operation. */
       
   508 		TInt iParam1;
       
   509 		/** If drive mode is EDriveModeTimeNudgeCapture this represents the number of images to be captured
       
   510 		(post-capture images) after client initiates actual image capture operation. */
       
   511 		TInt iParam2;
       
   512 		};
       
   513 
       
   514 	/**
       
   515 	Specifies the available processing options.
       
   516 	The enumeration list may be extended in future.
       
   517 	
       
   518 	@publishedPartner
       
   519 	@prototype
       
   520 	*/	
       
   521 	enum TEcamProcessingOptions
       
   522 		{
       
   523 		/** Processing options are not supported.*/
       
   524 		EEcamProcessingNone 		= 0x00000000,
       
   525 		/** Enable normal processing when image capture is initiated.*/
       
   526 		EEcamNormalProcessing 		= 0x00000001,
       
   527 		/** Enable background processing when image capture is initiated.*/
       
   528 		EEcamBackgroundProcessing 	= 0x00000002
       
   529 		};
       
   530 		
       
   531 	/** Provides the parameters necessary to perform set-up and allocation of memory for the images to be captured.	*/
       
   532 	class TPrepareImageParameters
       
   533 		{
       
   534 	public:
       
   535 		IMPORT_C TPrepareImageParameters();
       
   536 		
       
   537 		IMPORT_C TUint Size() const;
       
   538 		IMPORT_C TUint Version() const;
       
   539 		
       
   540 		IMPORT_C void SetImageProcessingOptions(TUint aImageProcessingOptions);
       
   541 		IMPORT_C void GetImageProcessingOptions(TUint& aImageProcessingOptions) const;
       
   542 				
       
   543 	private:
       
   544 		//for future expansion
       
   545 		TUint iSize:24;
       
   546 		TUint iVersion:8;
       
   547 		
       
   548 		//for future use
       
   549 		TInt iReserved1;
       
   550 		TInt iReserved2;
       
   551 		/** Bitfield of selected TEcamProcessingOptions which should be used after the images are captured from the sensor. */
       
   552 		TUint iImageProcessingOptions;
       
   553 		
       
   554 	public:
       
   555 		/** The image format. */
       
   556 		CCamera::TFormat iImageFormat;
       
   557 		/** The image size. */
       
   558 		TSize iImageSize;
       
   559 		/** Pixel aspect ratio to be used for the image. */
       
   560 		CCamera::CCameraAdvancedSettings::TPixelAspectRatio iPixelAspectRatio;
       
   561 		/** The drive mode in which the images will be captured. */
       
   562 		CCamera::CCameraAdvancedSettings::TDriveMode iDriveMode;
       
   563 		/** The number of images to be captured if the drive mode is burst. */
       
   564 		TInt iBurstImages;
       
   565 		/** The maximum memory size in kilo bytes when encoding to the image format. This shall be 
       
   566 		KECamNoSpecificMaxMemorySize if client has no specific preference or if this setting is not supported.
       
   567 		In case of JPEG, the maximum memory size will take preference over JPEG quality if the maximum memory size is 
       
   568 		not sufficient to achieve the desired quality. Refer CCamera::JpegQuality(). */ 
       
   569 		TInt iImageMaxMemorySize;
       
   570 		/** Identifies the rectangle to which the image is to be clipped.
       
   571 		If no specifc clipping rectangle desired by the client, the clipping region can be given by 
       
   572 		origin as the top-left corner and size as iImageSize. */
       
   573 		TRect iClipRect;
       
   574 		/** The attributes dependent on the type of drive mode used. */
       
   575 		TDriveModeDependentAttributes iDriveModeAttributes;
       
   576 		};
       
   577 	
       
   578 private:
       
   579 	/**
       
   580 	Different types of color space. Camera will print or capture images in given color space.
       
   581 	The enumeration list may be extended in future.
       
   582 	
       
   583 	@internalTechnology
       
   584 	*/	
       
   585 	enum TColorSpace
       
   586 		{
       
   587 		/** not known */
       
   588 		EColorSpaceUnknown 				= 0x0000,
       
   589 		/** sRGB color space */
       
   590 		EColorSpacesRGB					= 0x0001,
       
   591 		/** adobeRGB color space */
       
   592 		EColorSpaceAdobeRGB				= 0x0002,
       
   593 		/** adobeWideGamutRGB color space */
       
   594 		EColorSpaceAdobeWideGamutRGB	= 0x0004,
       
   595 		/** CMY(K) color space */
       
   596 		EColorSpaceCMYK					= 0x0008,
       
   597 		/** YIQ color space*/
       
   598 		EColorSpaceYIQ					= 0x0010,
       
   599 		/** YUV color space */
       
   600 		EColorSpaceYUV					= 0x0020,
       
   601 		/** YDbDr color space */
       
   602 		EColorSpaceYDbDr				= 0x0040,
       
   603 		/** YCbCr color space */
       
   604 		EColorSpaceYCbCr				= 0x0080,
       
   605 		/** HSB color space */
       
   606 		EColorSpaceHSB					= 0x0100,
       
   607 		/** HSL color space */
       
   608 		EColorSpaceHSL					= 0x0200
       
   609 		};
       
   610 		
       
   611 	/** 
       
   612 	Specifies direction of panning. 
       
   613 	The enumeration list may be extended in future.
       
   614 	
       
   615 	@internalTechnology
       
   616 	*/
       
   617 	enum TPanoDirection
       
   618 		{
       
   619 		/** Viewfinder displays towards the right of already captured images */
       
   620 		EPanoRight,
       
   621 		/** Viewfinder displays towards the left of already captured images */
       
   622 		EPanoLeft,
       
   623 		/** Viewfinder displays towards the top of already captured images */
       
   624 		EPanoUp,
       
   625 		/** Viewfinder displays towards the bottom of already captured images */
       
   626 		EPanoDown  
       
   627 		};
       
   628 	
       
   629 	/** 
       
   630 	Specifies the stitching options when panning is started.
       
   631 	The enumeration list may be extended in future.
       
   632 	
       
   633 	@internalTechnology
       
   634 	*/
       
   635 	enum TStitchingOption
       
   636 		{
       
   637 		/** Stitching of panned images is not supported by the ECAM Implementation.*/
       
   638 		EStitchingOptionNone			= 0x00,
       
   639 		/** Stitching of panned images can be done by the ECAM Implementation.*/
       
   640 		EStitchingOptionEnable			= 0x01,
       
   641 		/** Stitching of panned images can be disabled/discarded by the ECAM Implementation.*/
       
   642 		EStitchingOptionDisable			= 0x02
       
   643 		};
       
   644 		
       
   645 	/** 
       
   646 	Specifies whether the panned images captured under 'stitching enabled option' would be discarded by the implementation.
       
   647 	The enumeration list may be extended in future.
       
   648 	
       
   649 	@internalTechnology
       
   650 	*/
       
   651 	enum TStitchedImageRetrieval
       
   652 		{
       
   653 		/** allow ecam implementation to provide the stitched images. */
       
   654 		EStitchedImageRetrieve,
       
   655 		/** instruct ECAM Implementation to discard the stitched images. */
       
   656 		EStitchedImageDiscard
       
   657 		};
       
   658 	
       
   659 public:
       
   660 	/** 
       
   661 	Provides information regarding streamed image buffers or sub-frames. 
       
   662 	@publishedPartner
       
   663 	*/
       
   664 	class TImageBufferInfo
       
   665 		{
       
   666 	public:
       
   667 		IMPORT_C TImageBufferInfo(); 
       
   668 		
       
   669 		IMPORT_C TUint Size() const;
       
   670 		IMPORT_C TUint Version() const;
       
   671 
       
   672 		IMPORT_C TBool IsSubFrameUsed() const ;
       
   673 		
       
   674 		IMPORT_C void SetSubFrameState(TBool aIsSubFrameUsed);
       
   675 		
       
   676 		IMPORT_C TBool IsParallelStreamedBufferUsed() const;
       
   677 		
       
   678 		IMPORT_C void SetParallelStreamedBufferState(TBool aIsParallelStreamedBufferUsed);
       
   679 		
       
   680 		IMPORT_C TUint SubFrameSequenceNumber() const;
       
   681 		
       
   682 		IMPORT_C TInt SetSubFrameSequenceNumber(TUint aSubFrameSequenceNumber);
       
   683 		
       
   684 		IMPORT_C TUint TotalSubFrames() const;
       
   685 		
       
   686 		IMPORT_C TInt SetTotalSubFrames(TUint aTotalSubFrames);
       
   687 				
       
   688 	private:
       
   689 		//for future expansion
       
   690 		TUint iSize:24;
       
   691 		TUint iVersion:8; 
       
   692 		
       
   693 		//for future use
       
   694 		TInt iReserved1;
       
   695 		TInt iReserved2;
       
   696 		TInt iReserved3;
       
   697 		TInt iReserved4;
       
   698 		TInt iReserved5;
       
   699 		TInt iReserved6;
       
   700 		TUint iReservedBits:11;
       
   701 				
       
   702 		/** Indicates whether the streamed image scheme or sub-frame scheme is being used. 
       
   703 		One bit is enough to provide such information */
       
   704 		TUint iIsSubFrameUsed:1;
       
   705 		/** Indicates whether the parallel buffering is being used by the implementation in order to speed up the streamed
       
   706 		image operation, as a whole. One bit is enough to provide such information. 
       
   707 		Parallel buffering indicates that implementation is using more than one buffer to handle the various sub-frames;
       
   708 		hence speeding up the operation.*/
       
   709 		TUint iIsParallelBufferUsed:1;
       
   710 		/** Sequence number of the sub-frame. 
       
   711 		9 bits used for sequence no. assuming that KECamMaxTotalSubFrames sub-frames would be used at max */
       
   712 		TUint iSubFrameSequenceNumber:9;
       
   713 		/** Total number of sub-frames to be retrieved by the client in order to properly reconstruct the actual image.
       
   714 		It does not give the number of outstanding sub-frames needed to reconstruct the image. 
       
   715 		This value will be same for every sub-frames needed to re-construct the actual image. 
       
   716 		Maximum no. of total sub-frames is KECamMaxTotalSubFrames.*/ 
       
   717 		TUint iTotalSubFrames:10;
       
   718 		
       
   719 	public:
       
   720 		/** The exact position of the sub-frame within the actual image frame. The actual image frame's bounding rectangle
       
   721 		is defined by origin as top-left and TSize parameter used to prepare the image capture. */
       
   722 		TRect iSubFramePosition;
       
   723 		
       
   724 		/** The parameters used for this image */
       
   725 		TPrepareImageParameters iImageParameters;
       
   726 		};
       
   727 	
       
   728 public:
       
   729 	
       
   730     IMPORT_C static CCameraPreImageCaptureControl* NewL(CCamera& aCamera, MPreImageCaptureControlObserver& aPreImageCaptureControlObserver);
       
   731     
       
   732    	IMPORT_C void GetDirectSnapshotSupportInfoL(TUint& aIsDirectSnapshotSupported) const;
       
   733 	
       
   734 	IMPORT_C void GetSupportedEmbeddedStillCaptureSettingsL(RArray<TUid>& aSupportedEmbeddedStillCaptureSettings) const;
       
   735 	
       
   736 	IMPORT_C void GetSupportedDirectSavingTypeL(TDirectSavingType& aSupportedDirectSavingType) const;
       
   737 	
       
   738 	IMPORT_C void SetSequentialImageFilenameL(const TDesC8& aFilename, TInt aStartingSequenceNumber);
       
   739 	
       
   740 	IMPORT_C void SetLowerResolutionSequentialImageFilenameL(const TDesC8& aLowerResolutionFilename, TInt aStartingSequenceNumber);
       
   741 
       
   742     IMPORT_C void GetDirectSavingTypeL(TDirectSavingType& aDirectSavingType) const;
       
   743     
       
   744     IMPORT_C void SetDirectSavingTypeL(TDirectSavingType aDirectSavingType);
       
   745     
       
   746     IMPORT_C void GetCaptureEventSupportInfoL(TUint& aSupportedDriveModes) const;
       
   747 	
       
   748 	IMPORT_C void GetImageFormatsSupportedL(TUint& aImageFormatsSupported, const TSize& aSize) const;
       
   749 	
       
   750 	IMPORT_C void GetPixelAspectsSupportedL(TUint& aPixelAspectsSupported, CCamera::TFormat aImageFormat, const TSize& aSize) const;
       
   751 	
       
   752 	IMPORT_C void PrepareImageCapture(const TPrepareImageParameters& aPrepareImageParameters, MCaptureImageObserver& aCaptureImageObserver);
       
   753 	
       
   754 	IMPORT_C void GetImageMaxMemorySizeSettingSupportInfoL(TBool& aIsImageMaxMemorySizeSettingSupported) const;
       
   755 	
       
   756 	IMPORT_C void GetImageMaxMemorySizeL(TUint& aMemorySize) const;
       
   757 	
       
   758     IMPORT_C ~CCameraPreImageCaptureControl();
       
   759 	
       
   760     IMPORT_C void GetSupportedProcessingOptionsL(TUint& aECamProcessingOptionsSupported) const;
       
   761 	
       
   762 private:
       
   763 	CCameraPreImageCaptureControl(CCamera& aOwner);
       
   764 	void ConstructL(MPreImageCaptureControlObserver& aPreImageCaptureControlObserver);
       
   765 	
       
   766 private:
       
   767 	void GetMaximumSpotsL(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode, TInt& aMaximumSpots) const;
       
   768 	void GetSupportedSpotsCombinationL(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode, RArray<TUint>& aPossibleSpotCombinations) const;
       
   769 	void GetSpotsCombinationL(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode, TUint& aSpotsCombination) const;
       
   770 	void SetSpotsCombination(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode, TUint aSpotsCombination);
       
   771 
       
   772 	void GetStreamedImageSupportInfoL(TBool& aIsStreamedImageSupported) const;
       
   773     void EnableSubFramesL();
       
   774     void DisableSubFramesL();
       
   775 	void GetSubFramesStateL(TBool& aIsSubFrameEnabled) const;
       
   776 	void GetStreamedImageSupportedTransformationsL(RArray<TUid>& aStreamedImageSupportedTransformations) const;
       
   777 	
       
   778 	void GetPanoModeSupportInfoL(TBool& aIsPanoModeSupported, TInt& aSupportedStitchingOption) const;
       
   779 	void StartPanoMode(TStitchingOption aStitchingOption);
       
   780 	void StartPanoMode(TStitchingOption aStitchingOption, const RArray<TInt>& aVFHandle);
       
   781 	void GetPanoDirectionL(TPanoDirection& aPanoDirection) const;
       
   782 	void SetPanoDirection(TPanoDirection aPanoDirection);
       
   783 	void StopPanoModeL(TStitchedImageRetrieval aStitchedImageRetrieval);
       
   784 	
       
   785 	void GetSupportedColorSpaceL(TUint& aSupportedColorSpace) const;
       
   786 	void GetColorSpaceL(TColorSpace& aColorSpace) const;
       
   787 	void SetColorSpace(TColorSpace aColorSpace);
       
   788 	
       
   789 	void StartEmbeddedStillCaptureSettingsL();
       
   790 	void EndEmbeddedStillCaptureSettingsL();
       
   791 	void GetFailedEmbeddedStillCaptureSettingsL(RArray<TUid>& aFailedEmbeddedStillCaptureSettings) const;
       
   792 	
       
   793 private:
       
   794 	CCamera& iOwner;
       
   795 	MCameraPreImageCaptureControl* iImpl;  // not owned
       
   796 	};
       
   797 	
       
   798 /** 
       
   799 CCameraImageCapture class exposes an API for capturing the image and controlling the overall capture. This class gets 
       
   800 created by the implementation of MCameraPreImageCaptureControl::PrepareImageCapture and passed to the client through 
       
   801 callback MPreImageCaptureControlObserver::PrepareImageComplete.
       
   802 Destruction of this class is equivalent to releasing the resources owned in order to prepare and allocate memory for 
       
   803 capturing images.
       
   804 
       
   805 @note  This class is not intended for sub-classing and used to standardise existing
       
   806        varieties of implementations.
       
   807        
       
   808 @note  If the class methods leave, the output type parameter value is not guaranteed to be valid.
       
   809 
       
   810 @note  The use of this class implies that client will be able to issue image capture call even if previous
       
   811 	   captures are still outstanding. 
       
   812 	   
       
   813 @note  Clients must implement an MCaptureImageObserver in order to use this CCameraImageCapture API. 
       
   814 	   MCameraObserver2::ImageBufferReady will not be used with this class.
       
   815 
       
   816 @publishedPartner
       
   817 @prototype
       
   818 */
       
   819 class CCamera::CCameraImageCapture : public CBase
       
   820 	{
       
   821 	/* so can use internal factory functions etc. */
       
   822 	friend class CCamera;
       
   823 	
       
   824 	/* so can use the MCameraImageCapture* as well. */
       
   825 	friend class CCameraPostImageCaptureControl;
       
   826 	
       
   827 public:
       
   828 	IMPORT_C static CCameraImageCapture* CreateL(CCamera& aCamera, const CCamera::CCameraPreImageCaptureControl::
       
   829 				        TPrepareImageParameters& aPrepareImageParameters, MCaptureImageObserver& aCaptureImageObserver);
       
   830 
       
   831 	IMPORT_C CCamera::CCameraV2Histogram* CreateHistogramHandleL() const;
       
   832 	
       
   833 	IMPORT_C CCamera::CCameraSnapshot* GetSnapshotHandleL(TInt aClientViewFinderId) const;
       
   834 	
       
   835 	IMPORT_C CCamera::CCameraImageProcessing* GetTransformationHandleL() const;
       
   836 	
       
   837 	IMPORT_C void GetPrepareImageParametersL(CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters& aPrepareImageParameters) const;
       
   838 
       
   839 	IMPORT_C void CaptureImage();
       
   840 	
       
   841 	IMPORT_C void CancelCaptureImage();
       
   842 	
       
   843 	IMPORT_C void GetNumImagesExposedL(TUint& aNumImagesExposed) const;
       
   844 	
       
   845 	IMPORT_C void GetNumTotalImagesL(TUint& aNumTotalImages) const;
       
   846 	
       
   847 	IMPORT_C void GetPostCaptureControlHandleL(CCamera::CCameraPostImageCaptureControl*& aPostCaptureControlHandle, TPostCaptureControlId aPostCaptureControlId) const;
       
   848 
       
   849 	IMPORT_C void SetCaptureImagePriorityL(TECamImagePriority aCaptureImagePriority);
       
   850 	
       
   851 	IMPORT_C void GetCaptureImagePriorityL(TECamImagePriority& aCaptureImagePriority) const;
       
   852 	
       
   853 	IMPORT_C void PauseProcessing(TUint aProcessingTypes);
       
   854 	
       
   855 	IMPORT_C void ResumeProcessingL(TUint aProcessingTypes);
       
   856 	
       
   857 	IMPORT_C ~CCameraImageCapture();
       
   858 
       
   859 private:
       
   860 	CCameraImageCapture(CCamera& aOwner);
       
   861 	void ConstructL(const CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters& aPrepareImageParameters, 
       
   862 												MCaptureImageObserver& aCaptureImageObserver);
       
   863 	
       
   864 	MCameraImageCapture* Impl() const;
       
   865 	
       
   866 private:
       
   867 	CCamera& iOwner;
       
   868 	MCameraImageCapture* iImpl;  // not owned
       
   869 	};
       
   870 	
       
   871 /** This class is used to provide further information about still image data.
       
   872 
       
   873 @see MCameraBuffer
       
   874 @see MCameraBuffer2
       
   875 
       
   876 @publishedPartner
       
   877 @prototype
       
   878 */
       
   879 class MCameraImageBuffer : public MCameraBuffer2
       
   880 	{
       
   881 public:
       
   882 	/**
       
   883 	Retrieves information regarding the image data received.
       
   884 	
       
   885 	@param aImageBufferInfo
       
   886 		   Retrieves the info regarding the image data received.
       
   887 	
       
   888 	@return KErrArgument if implementation finds a different extended version of the TImageBufferInfo class.
       
   889 
       
   890 	@return May leave with other error codes.
       
   891 		    
       
   892 	@note  When there is a sub-frame, each image buffer retrieved contains only one sub-frame. If any of the subframe 
       
   893 		   delivery reports an error, then no further subframes of this image would be delivered to the client.
       
   894 	
       
   895 	@note  Also retrieves information in order to distinguish the retrieved image buffer when shot-to-shot reduced latency 
       
   896 		   scheme is used.
       
   897 	*/
       
   898 	virtual TInt GetImageBufferInfo(CCamera::CCameraPreImageCaptureControl::TImageBufferInfo& aImageBufferInfo) const=0;
       
   899 	};
       
   900 	
       
   901 /** 
       
   902 CCameraPostImageCaptureControl class exposes an API for retrieving the image data from individual images (in case 
       
   903 continuous drive mode is used for capturing the images) and also to apply control on the captured images individually.
       
   904 
       
   905 CCameraPostImageCaptureControl instances will be owned by CCameraImageCapture and would be available until new capture 
       
   906 command is issued using the owning CCameraImageCapture instance. If client wishes to initiate new capture but preserve 
       
   907 the CCameraPostImageCaptureControl instances from previous capture, it would have to create a new CCameraImageCapture 
       
   908 instance and use that for the new capture.
       
   909 
       
   910 @note  This class is not intended for sub-classing and used to standardise existing
       
   911        varieties of implementations.
       
   912        
       
   913 @note  If the class methods leave, the output type parameter value is not guaranteed to be valid.
       
   914 
       
   915 @note  The use of this class implies that client will be able to issue image capture call even if previous
       
   916 	   captures are still outstanding. 
       
   917 	   
       
   918 @note  Clients must implement an MCaptureImageObserver in order to use this CCameraPostImageCaptureControl API. 
       
   919 	   MCameraObserver2::ImageBufferReady will not be used with this class.
       
   920 
       
   921 @publishedPartner
       
   922 @prototype
       
   923 */
       
   924 class CCamera::CCameraPostImageCaptureControl : public CBase
       
   925 	{
       
   926 public:
       
   927 	/**
       
   928 	Specifies the various states in which the individual images could be.
       
   929 	The enumeration list may be extended in future.
       
   930 	*/
       
   931 	enum TImageState
       
   932 		{
       
   933 		/** The image has been exposed to the sensor but still pending for any processing options. */
       
   934 		EProcessingPending,
       
   935 		/** The image is undergoing processing for the required processing options. */
       
   936 		EProcessingOngoing,
       
   937 		/** The processing options associated with the image has been cancelled. */
       
   938 		EProcessingCancelled,
       
   939 		/** The processing options associated with the image has been completed. This implies that either the
       
   940 			image buffers are ready or the image is directly saved to the file. */
       
   941 		EProcessingCompleted
       
   942 		};
       
   943 		
       
   944 	/**
       
   945 	Specifies the various states in which the individual image buffers could be.
       
   946 	The enumeration list may be extended in future.
       
   947 	*/
       
   948 	enum TBufferState
       
   949 		{
       
   950 		/** If Direct Saving option used, then user accessible buffers are not present. Hence buffer state will always be EBufferNotPresent.
       
   951 			If Direct Saving option not used, this buffer state implies that processing options have not been completed. */
       
   952 		EBufferNotPresent,
       
   953 		/** This buffer state implies that processing options have been completed. Client may retrieve the image buffers 
       
   954 			once this state is reached. */
       
   955 		EBufferReady,
       
   956 		/** This buffer state implies that client has released the image buffers after retrieving the data. */
       
   957 		EBufferReleased
       
   958 		};
       
   959 		
       
   960 public:
       
   961 	IMPORT_C static CCameraPostImageCaptureControl* CreateL(CCameraImageCapture* aCameraImageCapture, TPostCaptureControlId aPostCaptureControlId);
       
   962 	
       
   963 	IMPORT_C void GetPostCaptureControlId(TPostCaptureControlId& aPostCaptureControlId) const;
       
   964 	
       
   965 	IMPORT_C CCamera::CCameraImageCapture* ImageCaptureHandle() const;
       
   966 	
       
   967 	IMPORT_C void GetImageSequenceNumberL(TUint& aSequenceNumber) const;
       
   968 	
       
   969 	IMPORT_C void CancelImage();
       
   970 
       
   971 	IMPORT_C void SetImagePriorityL(TECamImagePriority aImagePriority);
       
   972 	
       
   973 	IMPORT_C void GetImagePriorityL(TECamImagePriority& aImagePriority) const;
       
   974 	
       
   975 	IMPORT_C void PauseProcessing(TUint aProcessingTypes);
       
   976 	
       
   977 	IMPORT_C void ResumeProcessingL(TUint aProcessingTypes);
       
   978 
       
   979 	IMPORT_C void GetImageBufferL(MCameraImageBuffer& aCameraImageBuffer) const;
       
   980 	
       
   981 	IMPORT_C void GetImageStateL(TImageState& aImageState) const;
       
   982 	
       
   983 	IMPORT_C void GetBufferStateL(TBufferState& aBufferState) const;
       
   984 	
       
   985 	IMPORT_C ~CCameraPostImageCaptureControl();
       
   986 
       
   987 private:
       
   988 	CCameraPostImageCaptureControl(CCamera::CCameraImageCapture* aCameraImageCapture, TPostCaptureControlId aPostCaptureControlId);
       
   989 	void ConstructL();
       
   990 	
       
   991 private:
       
   992 	TPostCaptureControlId iPostCaptureControlId;
       
   993 	CCamera::CCameraImageCapture* iCameraImageCapture;	// not owned
       
   994 	MCameraPostImageCaptureControl* iImpl;  // not owned
       
   995 	};
       
   996 	
       
   997 /** 
       
   998 Notification of set-up completion before video capture.
       
   999 @note  If error is KErrECamImageResourceNotReleased and client wants to successfully call the Prepare method again, 
       
  1000 	   client needs to delete all CCameraImageCapture objects and any Snapshot and Histogram objects associated with
       
  1001 	   it as well.   
       
  1002 	
       
  1003 @note  If error is KErrECamVideoResourceNotReleased and client wants to successfully call the Prepare method again,
       
  1004 	   client needs to call ReleaseVideoResource to unprepare video and then delete any Snapshot and Histogram 
       
  1005 	   objects associated with it as well.
       
  1006 */
       
  1007 static const TUid KUidECamEventVideoCaptureControlPrepareComplete = {KUidECamEventVideoCaptureControlPrepareCompleteUidValue};
       
  1008 
       
  1009 /**
       
  1010 Notifies that range of certain camera settings have been changed because of desired video settings.
       
  1011 Client may call GetRangeAffectedSettingsL(RArray<TUid>& aRangeAffectedSettings) const to get the list of affected camera settings.
       
  1012 */
       
  1013 static const TUid KUidECamEventVideoCaptureControlSettingsRangeChanged = {KUidECamEventVideoCaptureControlSettingsRangeChangedUidValue};
       
  1014 
       
  1015 /**
       
  1016 Notifies that value of certain camera settings have been changed because of desired video settings.
       
  1017 Client may call GetValueAffectedSettingsL(RArray<TUid>& aValueAffectedSettings) const to get the list of affected camera settings.
       
  1018 */
       
  1019 static const TUid KUidECamEventVideoCaptureControlSettingsValueChanged = {KUidECamEventVideoCaptureControlSettingsValueChangedUidValue};
       
  1020 
       
  1021 /**
       
  1022 Notifies that value of certain camera settings have been disabled because of desired video settings.
       
  1023 Client may call GetDisabledSettingsL(RArray<TUid>& aDisabledSettings) const to get the list of affected camera settings.
       
  1024 */
       
  1025 static const TUid KUidECamEventVideoCaptureControlSettingsDisabled = {KUidECamEventVideoCaptureControlSettingsDisabledUidValue};
       
  1026 
       
  1027 /**
       
  1028 A mixin class to be implemented by the client in order to use the video capture control API(CCameraVideoCaptureControl). 
       
  1029 The derived class methods are called by the implementation when the video capture operations are ready to be notified 
       
  1030 accordingly.
       
  1031 
       
  1032 @see CCamera::CCameraVideoCaptureControl
       
  1033 */
       
  1034 class MCaptureVideoObserver
       
  1035 	{
       
  1036 public:
       
  1037 	/**
       
  1038 	Implementation sends this callback in order to notify the client about the availability of video frames.
       
  1039 	
       
  1040 	@param  aVideoBuffer
       
  1041 			Pointer to MCameraBuffer2 class object which retrieves the video frames. The ownership will be retained by 
       
  1042 			the implementation. Client needs to call Release in order to indicate the implementation that the buffer can 
       
  1043 			be re-used. Client shall never try to delete the pointer. NULL, if error.
       
  1044 						
       
  1045 	@param  aErrorCode
       
  1046 			Appropriate error code.
       
  1047 	*/
       
  1048 	virtual void VideoBufferReady(MCameraBuffer2* aVideoBuffer, TInt aErrorCode)=0;
       
  1049 																									  
       
  1050 	/**
       
  1051 	Implementation sends this callback in order to notify the client about the availability of client snapshot data for the
       
  1052 	video being captured.
       
  1053 	
       
  1054 	If a call to CCameraSnapshot::EnableSnapshotL() (on the CCameraVideoCaptureControl instance) is made without a 
       
  1055 	successful call to CCameraSnapshot::PrepareSnapshotL(const TSnapshotParameters& aSnapshotParameters) (on the 
       
  1056 	CCameraVideoCaptureControl instance), then the callback returns KErrBadHandle.
       
  1057 	
       
  1058 	@param  aSnapshotBuffer
       
  1059 			Pointer to MCameraBuffer2 class object which retrieves the snapshot for the video being captured. The 
       
  1060 			ownership will be retained by the implementation. Client needs to call Release in order to indicate the 
       
  1061 			implementation that the buffer can be re-used. Client shall never try to delete the pointer. NULL, if error.
       
  1062 	
       
  1063 	@param  aErrorCode
       
  1064 			Appropriate error code. 
       
  1065 	*/
       
  1066 	virtual void ClientSnapshotReady(MCameraBuffer2* aSnapshotBuffer, TInt aErrorCode)=0;
       
  1067 	
       
  1068 	/**
       
  1069 	Implementation sends this callback in order to notify the client about availability of the histogram data. If a call 
       
  1070 	to CCameraV2Histogram::StartHistogram() is made without a previous successful call to CCameraV2Histogram::
       
  1071 	PrepareClientHistogramL() then the callback returns KErrBadHandle.
       
  1072 	
       
  1073 	@param  aClientHistogramBuffer
       
  1074 			Pointer to MHistogramV2Buffer which retrieves a single histogram alongwith relevant information about it. The 
       
  1075 			ownership will be retained by the implementation. Client needs to call Release in order to indicate the 
       
  1076 			implementation that the buffer can be re-used. Client shall never try to delete the pointer. NULL, if error.
       
  1077 			
       
  1078 	@param  aErrorCode
       
  1079 			Appropriate error code. 
       
  1080 	
       
  1081 	@note   Client shall use the currently available histogram for the video frames until a new histogram is available.
       
  1082 	*/
       
  1083 	virtual void ClientHistogramReady(MHistogramV2Buffer* aClientHistogramBuffer, TInt aErrorCode)=0;
       
  1084 	
       
  1085 	/**
       
  1086 	Implementation sends this callback in order to notify the client about the failure of image processing for the video 
       
  1087 	frames.
       
  1088 	
       
  1089 	@param  aErrorCode
       
  1090 			The reason of failure of the image processing. 
       
  1091 	*/
       
  1092 	virtual void ImageProcessingFailed(TInt aErrorCode)=0;
       
  1093 	
       
  1094 	/**
       
  1095 	Implementation sends this callback in order to notify the client about the failure of direct video capture operation.
       
  1096 	
       
  1097 	@param  aErrorCode
       
  1098 			The reason of failure of the direct video capture. The error code could be ECam specific. Client shall 
       
  1099 			be prepared to handle unrecognized error code.
       
  1100 	*/
       
  1101 	virtual void DirectVideoCaptureFailed(TInt aErrorCode)=0;
       
  1102 	
       
  1103 	/**
       
  1104 	Gets a custom interface for future callbacks. This method will be called by the implementation to get a new interface
       
  1105 	which would support future callbacks.
       
  1106 
       
  1107 	@param  aInterface
       
  1108 		    The Uid of the particular interface function required for callbacks.
       
  1109 		   
       
  1110 	@param  aPtrInterface
       
  1111 		    The implementation has to type-cast the retrieved custom interface pointer to the appropriate type.	
       
  1112 
       
  1113 	@return The error code.
       
  1114 	*/
       
  1115 	virtual TInt CustomInterface(TUid aInterface, TAny*& aPtrInterface)=0;
       
  1116 	};
       
  1117 
       
  1118 /** 
       
  1119 CCamera Video Capture Control class exposes an API for controlling operations related to video capture. This gives priority
       
  1120 to the low latency aspect by postponing the post processing activity involved with current video captured data(while 
       
  1121 stopping the video capture) in order to capture/prepare for next still image.
       
  1122 
       
  1123 @note This class is not intended for sub-classing and used to standardise existing varieties of implementations.
       
  1124        
       
  1125 @note  If the class methods leave, any reference argument is not guaranteed to be valid.
       
  1126 
       
  1127 @note  Clients must implement an MCaptureVideoObserver in order to use this CCameraVideoCaptureControl API. 
       
  1128 	   MCameraObserver2::VideoBufferReady will not be used with this class.
       
  1129 
       
  1130 @publishedPartner
       
  1131 @prototype
       
  1132 */
       
  1133 class CCamera::CCameraVideoCaptureControl : public CBase
       
  1134 	{
       
  1135 	/* so can use internal factory functions etc. */
       
  1136 	friend class CCamera;
       
  1137 	
       
  1138 public:
       
  1139 	
       
  1140 	/** 
       
  1141 	Specifies video capture state. 
       
  1142 	The enumeration list may be extended in future.
       
  1143 	*/ 
       
  1144 	enum TVideoCaptureState
       
  1145 		{
       
  1146 		/** Video Capture has been prepared but not yet started */  
       
  1147 		EVideoCapturePrepared, 	 
       
  1148 		/** Video Capture has been started and is running */
       
  1149 		EVideoCaptureActive,	 
       
  1150 		/** Video Capture has been started and is paused */
       
  1151 		EVideoCapturePaused,
       
  1152 		/** Video Capture has been stopped or not yet prepared */
       
  1153 		EVideoCaptureInActive
       
  1154 		};
       
  1155 	
       
  1156 	/** 
       
  1157 	Specifies the various embedded still capture support. 
       
  1158 	The enumeration list may be extended in future.
       
  1159 	*/	
       
  1160 	enum TEmbeddedStillCaptureTypes
       
  1161 		{
       
  1162 		/** Embedded still capture not supported */
       
  1163 		EEmbeddedStillCaptureNotSupported = 0x00,
       
  1164 		/** Embedded still capture supported */
       
  1165 		EEmbeddedStillCaptureSupported	= 0x01
       
  1166 		};
       
  1167 		
       
  1168 	/** 
       
  1169 	Specifies the various video capture types. 
       
  1170 	The enumeration list may be extended in future.
       
  1171 	*/	
       
  1172 	enum TVideoCaptureType
       
  1173 		{
       
  1174 		/** Video capture not supported. */
       
  1175 		EVideoCaptureNotSupported = 0x00,
       
  1176 		/** Client video capture - Client video capture is a concept under which
       
  1177 		video buffers will be available to the clients of ECam through the 
       
  1178 		dedicated observer MCaptureVideoObserver::VideoBufferReady(). Video frame 
       
  1179 		formats used under this client video capture can be either compressed video 
       
  1180 		frames or uncompressed video frames which are available through CCamera::TFormat. */
       
  1181 		EClientVideoCapture = 0x01,
       
  1182 		/** Direct video capture - Direct video capture is a concept under which
       
  1183 		video buffers will not be available to the clients of ECam through the dedicated observers. Video frames will be used
       
  1184 		by the ECam adaptation and could be passed internally to other components. Video frame formats used under this direct
       
  1185 		video capture can be either compressed video frames or uncompressed video frames which are available through 
       
  1186 		CCamera::TFormat. */
       
  1187 		EDirectVideoCapture = 0x02
       
  1188 		};
       
  1189 		
       
  1190 	/** 
       
  1191 	Specifies the fading effect for video captured frames. 
       
  1192 	The enumeration list may be extended in future.
       
  1193 	
       
  1194 	@internalTechnology
       
  1195 	*/
       
  1196 	enum TFadingEffectState
       
  1197 		{
       
  1198 		/** The fading effect will be visible on video captured frames as well, 
       
  1199 		whenever the viewfinder fading is enabled */
       
  1200 		EFadingEffectEnabled,
       
  1201 		/** The fading effect will not be visible on video captured frames, 
       
  1202 		whenever the viewfinder fading is enabled */
       
  1203 		EFadingEffectDisabled
       
  1204 		};
       
  1205 		
       
  1206 	/** 
       
  1207 	Provides information regarding parameters needed to prepare for video capture. 
       
  1208 	*/
       
  1209 	class TPrepareVideoParameters
       
  1210 		{
       
  1211 	public:
       
  1212 		IMPORT_C TPrepareVideoParameters(); 
       
  1213 		
       
  1214 		IMPORT_C TUint Size() const;
       
  1215 		IMPORT_C TUint Version() const;
       
  1216 		
       
  1217 		IMPORT_C TBool IsEmbeddedStillCaptureEnabled() const;
       
  1218 		IMPORT_C void  SetEmbeddedStillCaptureState(TBool aIsEmbeddedStillCaptureEnabled);
       
  1219 		
       
  1220 		IMPORT_C CCamera::CCameraVideoCaptureControl::TVideoCaptureType VideoCaptureType() const;
       
  1221 		IMPORT_C void SetVideoCaptureType(CCamera::CCameraVideoCaptureControl::TVideoCaptureType aVideoCaptureType);
       
  1222 					
       
  1223 	private:
       
  1224 		//for future expansion
       
  1225 		TUint iSize:24;
       
  1226 		TUint iVersion:8; 
       
  1227 		
       
  1228 		//for future use
       
  1229 		TInt iReserved1;
       
  1230 		TInt iReserved2;
       
  1231 		TInt iReserved3;
       
  1232 	
       
  1233 		TUint iReservedBits:26;
       
  1234 		
       
  1235 		TUint iVideoCaptureType:3;
       
  1236 		
       
  1237 		TUint iReservedBits2:2;
       
  1238 				
       
  1239 		/** Indicates whether the embedded still capture is enabled. 
       
  1240 		One bit is enough to provide such information */
       
  1241 		TUint iIsEmbeddedStillCaptureEnabled:1;
       
  1242 
       
  1243 	public:
       
  1244 		/** Format must be one of the video frame formats supported (see TCameraInfo::iVideoFrameFormatsSupported). */
       
  1245 		CCamera::TFormat iFormat;
       
  1246 		
       
  1247 		/** Pixel aspect ratio to be used for the image. */
       
  1248 		CCamera::CCameraAdvancedSettings::TPixelAspectRatio iPixelAspectRatio;
       
  1249 		
       
  1250 		/** Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 inclusive. */
       
  1251 		TInt iSizeIndex;
       
  1252 		
       
  1253 		/** The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 inclusive. */
       
  1254 		TInt iRateIndex;
       
  1255 		
       
  1256 		/** The number of discrete buffers to use. */
       
  1257 		TInt iBuffersToUse;
       
  1258 		
       
  1259 		/** This indirectly indicates how large the buffers are to be. Number of frames per buffer must be less than or 
       
  1260 		equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned to MCaptureVideoObserver::
       
  1261 		VideoBufferReady() at a time. */
       
  1262 		TInt iFramesPerBuffer;
       
  1263 		
       
  1264 		/** Identifies the rectangle to which the video frame has to be clipped.
       
  1265 		If no specifc clipping rectangle desired by the client, the clipping region can be given by 
       
  1266 		origin as the top-left corner and size as given by iSizeIndex. */
       
  1267 		TRect iClipRect;
       
  1268 		};
       
  1269 		
       
  1270 public:
       
  1271 	
       
  1272     IMPORT_C static CCameraVideoCaptureControl* NewL(CCamera& aCamera, MCaptureVideoObserver& aCaptureVideoObserver);
       
  1273     
       
  1274     IMPORT_C CCamera::CCameraV2Histogram* CreateHistogramHandleL() const;
       
  1275     
       
  1276     IMPORT_C CCamera::CCameraSnapshot* GetSnapshotHandleL(TInt aClientViewFinderId) const;
       
  1277     
       
  1278     IMPORT_C CCamera::CCameraImageProcessing* GetTransformationHandleL() const;
       
  1279     
       
  1280     IMPORT_C void GetVideoFormatsSupportedL(TUint& aVideoFormatsSupported, const TSize& aSize) const;
       
  1281 	
       
  1282 	IMPORT_C void GetPixelAspectsSupportedL(TUint& aPixelAspectsSupported, CCamera::TFormat aVideoFormat, const TSize& aSize) const;
       
  1283 	
       
  1284 	IMPORT_C void GetEmbeddedStillCaptureSupportInfoL(TInt& aSupportedEmbeddedStillCaptureTypes) const;
       
  1285 	
       
  1286     IMPORT_C void PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters);
       
  1287 	
       
  1288 	IMPORT_C void GetRangeAffectedSettingsL(RArray<TUid>& aRangeAffectedSettings) const;
       
  1289 	
       
  1290 	IMPORT_C void GetValueAffectedSettingsL(RArray<TUid>& aValueAffectedSettings) const;
       
  1291 	
       
  1292 	IMPORT_C void GetDisabledSettingsL(RArray<TUid>& aDisabledSettings) const;
       
  1293 	
       
  1294 	IMPORT_C void ReleaseVideoResource();
       
  1295 	
       
  1296 	IMPORT_C void StartVideoCaptureL();												
       
  1297 	
       
  1298 	IMPORT_C void StopVideoCapture();
       
  1299 	
       
  1300 	IMPORT_C void PauseVideoCapture();
       
  1301 	
       
  1302 	IMPORT_C void ResumeVideoCaptureL();
       
  1303 	
       
  1304 	IMPORT_C void GetFadingEffectStateL(TFadingEffectState& aFadingEffectState) const;
       
  1305 	
       
  1306 	IMPORT_C void SetFadingEffectState(TFadingEffectState aFadingEffectState);
       
  1307 	
       
  1308 	IMPORT_C void GetVideoCaptureStateL(TVideoCaptureState& aVideoCaptureState) const;
       
  1309     
       
  1310     IMPORT_C ~CCameraVideoCaptureControl();
       
  1311     
       
  1312     IMPORT_C void GetVideoCaptureSupportInfoL(TInt& aSupportedVideoCaptureTypes) const;
       
  1313     
       
  1314     IMPORT_C void GetPrepareVideoParametersL(TPrepareVideoParameters& aPrepareVideoParameters) const;
       
  1315     
       
  1316 private:
       
  1317 	CCameraVideoCaptureControl(CCamera& aOwner);
       
  1318 	void ConstructL(MCaptureVideoObserver& aCaptureVideoObserver);
       
  1319 	
       
  1320 private:
       
  1321 	void GetSupportedConversionCoefficientsL(TUint& aSupportedConversionCoefficients) const;
       
  1322     void GetConversionCoefficientL(TYuvCoefficients& aConversionCoefficients) const;
       
  1323     void SetConversionCoefficient(TYuvCoefficients aConversionCoefficients);
       
  1324  	
       
  1325 private:
       
  1326 	CCamera& iOwner;
       
  1327 	MCameraVideoCaptureControl* iImpl;  // not owned
       
  1328 	};
       
  1329 	
       
  1330 #endif //ECAMCAPTURECONTROL_H