mmplugins/cameraplugins/source/webcamera/ecamwebcameraplugin.h
branchRCL_3
changeset 9 9ae0fe04e757
child 64 92a82bc706f7
equal deleted inserted replaced
8:bc06d8566074 9:9ae0fe04e757
       
     1 /*
       
     2 * Copyright (c) 2010 ISB.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * ISB - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef ECAMWEBCAMERAPLUGIN_H
       
    19 #define ECAMWEBCAMERAPLUGIN_H
       
    20 
       
    21 #include <w32std.h>
       
    22 #include <bitdev.h>
       
    23 #include <ecam/ecamplugin.h>
       
    24 #include <ecam/ecaminfoplugin.h>
       
    25 #include <webcamera_driver.h>
       
    26 
       
    27 
       
    28 class CWebCameraBuffer;
       
    29 class CWebCameraActive;
       
    30 class CWebCameraVfActive;
       
    31 class CWebCameraAdvSet;
       
    32 
       
    33 /**  Min of Camera Zoom */
       
    34 const TInt KMinTestCameraZoom = -3;
       
    35 /**  Max of Camera Zoom */
       
    36 const TInt KMaxTestCameraZoom = 3;
       
    37 /**  Max of Camera Digital Zoom Factor */
       
    38 const TReal32 KMaxTestCameraDigitalZoomFactor = 1.0;
       
    39 /**  Max of Camera Digital Zoom */
       
    40 const TInt KMaxTestCameraDigitalZoom = 0;
       
    41 /**  Size of Viewfinder buffer, Capture buffer */
       
    42 const TInt KMaxBufSize = 1024 * 100;
       
    43 
       
    44 
       
    45 // Callback Class of WebCameraActive
       
    46 class MWebCameraActiveCallBack
       
    47 	{
       
    48 public:
       
    49 	virtual void ReserveCallBack(TInt aError) = 0;
       
    50 	virtual void PowerOnCallBack(TInt aError) = 0;
       
    51 	virtual void ImageCaptureCallBackL(TInt aError) = 0;
       
    52 	};
       
    53 
       
    54 // Callback Class of WebCameraVfActive
       
    55 class MWebCameraVfActiveCallBack
       
    56 	{
       
    57 public:
       
    58 	virtual void ViewFinderCallBack(TInt aError) = 0;
       
    59 	};
       
    60 
       
    61 /**
       
    62  *  Perform WebCamera function.
       
    63  */
       
    64 class CWebCamera : public CCameraPlugin
       
    65 				 , public MWebCameraActiveCallBack
       
    66 				 , public MWebCameraVfActiveCallBack
       
    67 	{
       
    68 public:
       
    69 	static CWebCamera* NewL();
       
    70 	~CWebCamera();
       
    71 	
       
    72 protected:
       
    73 
       
    74 	//from CCameraPlugin
       
    75 	/** 
       
    76 	from CCameraPlugin
       
    77 	
       
    78 	A call to one of the factory functions firstly loads the plugin, followed by a
       
    79 	call to this function to complete construction.
       
    80 	
       
    81 	Creates an object representing a camera.
       
    82 	
       
    83 	@param  aObserver
       
    84 	        Reference to class derived from MCameraObserver2 designed to receive
       
    85 	        notification of asynchronous event completion.
       
    86 	@param	aCameraIndex
       
    87 	        Index from 0 to CamerasAvailable()-1 inclusive specifying the
       
    88 	        camera device to use.
       
    89 	@return Pointer to a fully constructed CCamera object. Ownership is passed
       
    90 	        to the caller.
       
    91 
       
    92 	@leave  May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is
       
    93 	        out of range.	
       
    94 	*/
       
    95 	void Construct2L(MCameraObserver& aObserver,TInt aCameraIndex);
       
    96 
       
    97 	/** 
       
    98 	from CCameraPlugin
       
    99 
       
   100 	A call to one of the factory functions firstly loads the plugin, followed by a
       
   101 	call to this function to complete construction.
       
   102 	
       
   103 	Duplicates the original camera object for use by, for example, multimedia systems.
       
   104 
       
   105 	May leave with KErrNoMemory or KErrNotFound if aCameraHandle is not valid.
       
   106 
       
   107 	@param  aObserver
       
   108 	        Reference to an observer.
       
   109 	@param  aCameraHandle Handle of an existing camera object.
       
   110 
       
   111 	@return Duplicate of the original camera object. 
       
   112 	*/
       
   113 	void Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle);
       
   114 
       
   115     /** 
       
   116 	from CCameraPlugin
       
   117 
       
   118     A call to one of the factory functions firstly loads the plugin, followed by a
       
   119 	call to this function to complete construction.
       
   120     
       
   121 	Creates an object representing a camera.
       
   122 	
       
   123 	@param  aObserver
       
   124 	        Reference to class derived from MCameraObserver2 designed to receive
       
   125 	        notification of asynchronous event completion.
       
   126 	@param	aCameraIndex
       
   127 	        Index from 0 to CamerasAvailable()-1 inclusive specifying the
       
   128 	        camera device to use.
       
   129 	@param	aPriority
       
   130 	        Value from -100 to 100 indicating relative priority of client to
       
   131 	        use camera.
       
   132 
       
   133 	@return Pointer to a fully constructed CCamera object. Ownership is passed
       
   134 	        to the caller.
       
   135 
       
   136 	@leave  May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is
       
   137 	        out of range.
       
   138 	*/
       
   139 	void Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority);
       
   140 
       
   141 	/** 
       
   142 	from CCameraPlugin
       
   143 
       
   144 	Duplicates the original camera object for use by, for example, multimedia systems.
       
   145 
       
   146 	@leave  KErrNoMemory if out of memory.
       
   147 	@leave  KErrNotFound if aCameraHandle is not valid.	   
       
   148 	@leave  KErrPermissionDenied if the application does not have
       
   149 	        the UserEnvironment capability.
       
   150 
       
   151 	@param  aObserver
       
   152 	        Reference to an observer.
       
   153 	@param  aCameraHandle Handle of an existing camera object.
       
   154 
       
   155 	@return Duplicate of the original camera object. 
       
   156 	
       
   157 	@capability	UserEnvironment
       
   158 				An application that creates a CCamera object must have
       
   159 				the UserEnvironment capability.
       
   160 				
       
   161 	@note   Applications using this method to create camera object may not receive enums/uids added in future(after being baselined). 
       
   162 			To receive them, they should rather use New2L() or NewDuplicate2L(), in which case, they should prepare 
       
   163 			themselves to receive unrecognised values.
       
   164 	*/
       
   165 	void Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle);
       
   166 
       
   167 	// from CCamera
       
   168 	/**
       
   169 	from CCamera
       
   170 	
       
   171 	Gets information about the camera device.
       
   172 
       
   173 	@param  aInfo 
       
   174 	        On return, information about the camera device. See TCameraInfo. 
       
   175 	*/
       
   176 	void CameraInfo(TCameraInfo& aInfo) const;
       
   177 	
       
   178 	/** 
       
   179 	from CCamera
       
   180 
       
   181 	Asynchronous function that performs any required initialisation and reserves
       
   182 	the camera for exclusive use.
       
   183 
       
   184 	Calls MCameraObserver:: ReserveComplete() when complete. 
       
   185 	*/
       
   186 	void Reserve();
       
   187 
       
   188 	/** 
       
   189 	from CCamera
       
   190 
       
   191 	De-initialises the camera, allowing it to be used by other clients. 
       
   192 	*/
       
   193 	void Release();
       
   194 
       
   195 
       
   196 	/** 
       
   197 	from CCamera
       
   198 
       
   199 	Asynchronous method to switch on camera power.
       
   200 
       
   201 	User must have successfully called Reserve() prior to calling this function.
       
   202 
       
   203 	Calls MCameraObserver::PowerOnComplete() when power on is complete. 
       
   204 	*/
       
   205 	void PowerOn();
       
   206 
       
   207 	/** 
       
   208 	from CCamera
       
   209 
       
   210 	Synchronous function for switching off camera power. 
       
   211 	*/
       
   212 	void PowerOff();
       
   213 
       
   214 
       
   215 	/**
       
   216 	from CCamera
       
   217 
       
   218 	Gets the device-unique handle of this camera object.
       
   219 
       
   220 	@return  The device-unique handle of this camera object. 
       
   221 	*/
       
   222 	TInt Handle();
       
   223 
       
   224 
       
   225 	/** 
       
   226 	from CCamera
       
   227 
       
   228 	Sets the zoom factor.
       
   229 
       
   230 	This must be in the range of TCameraInfo::iMinZoom to TCameraInfo::iMaxZoom
       
   231 	inclusive. May leave with KErrNotSupported if the specified zoom factor is
       
   232 	out of range.
       
   233 
       
   234 	@param aZoomFactor 
       
   235 	       Required zoom factor.
       
   236 	*/
       
   237 	void SetZoomFactorL(TInt aZoomFactor = 0);
       
   238 
       
   239 
       
   240 	/** 
       
   241 	from CCamera
       
   242 
       
   243 	Gets the currently set zoom factor.
       
   244 
       
   245 	@return  The currently set zoom factor.
       
   246 	*/
       
   247 	TInt ZoomFactor() const;
       
   248 
       
   249 	/** 
       
   250 	from CCamera
       
   251 
       
   252 	Sets the digital zoom factor.
       
   253 
       
   254 	This must be in the range of 0 to TCameraInfo::iMaxDigitalZoom inclusive.
       
   255 
       
   256 	May leave with KErrNotSupported if the zoom factor is out of range.
       
   257 
       
   258 	@param  aDigitalZoomFactor
       
   259 	        The required digital zoom factor. 
       
   260 	*/
       
   261 	void SetDigitalZoomFactorL(TInt aDigitalZoomFactor = 0);
       
   262 
       
   263 
       
   264 	/** 
       
   265 	from CCamera
       
   266 
       
   267 	Gets the currently set digital zoom factor.
       
   268 
       
   269 	@return  The currently set digital zoom factor. 
       
   270 	*/
       
   271 	TInt DigitalZoomFactor() const;
       
   272 
       
   273 
       
   274 	/**
       
   275 	from CCamera
       
   276 
       
   277 	Sets the contrast adjustment of the device.
       
   278 
       
   279 	This must be in the range of -100 to +100 or EContrastAuto. May leave with
       
   280 	KErrNotSupported if the specified contrast value is out of range.
       
   281 
       
   282 	@param  aContrast 
       
   283 	        Required contrast value. See TCameraInfo::iContrastSupported 
       
   284 	*/
       
   285 	void SetContrastL(TInt aContrast);
       
   286 
       
   287 
       
   288 	/** 
       
   289 	from CCamera
       
   290 
       
   291 	Gets the currently set contrast value.
       
   292 
       
   293 	@return  The currently set contrast value.
       
   294 	*/
       
   295 	TInt Contrast() const;
       
   296 
       
   297 	/** 
       
   298 	from CCamera
       
   299 
       
   300 	Sets the brightness adjustment of the device.
       
   301 
       
   302 	No effect if this is not supported, see TCameraInfo::iBrightnessSupported.
       
   303 
       
   304 	This must be in the range of -100 to +100 or EBrightnessAuto. May leave
       
   305 	with KErrNotSupported if the brightness adjustment is out of range.
       
   306 
       
   307 	@param  aBrightness
       
   308 	        The required brightness adjustment. 
       
   309 	*/
       
   310 	void SetBrightnessL(TInt aBrightness);
       
   311 
       
   312 	/** 
       
   313 	from CCamera
       
   314 
       
   315 	Gets the currently set brightness adjustment value.
       
   316 
       
   317 	@return  The currently set brightness adjustment value. 
       
   318 	*/
       
   319 	TInt Brightness() const;
       
   320 
       
   321 	/** 
       
   322 	from CCamera
       
   323 
       
   324 	Sets the flash mode.
       
   325 
       
   326 	No effect if this is not supported, see TCameraInfo::iFlashModesSupported.
       
   327 
       
   328 	May leave with KErrNotSupported if the specified flash mode is invalid.
       
   329 
       
   330 	@param  aFlash
       
   331 	        The required flash mode. 
       
   332 	*/
       
   333 	void SetFlashL(TFlash aFlash = EFlashNone);
       
   334 
       
   335 	/** 
       
   336 	from CCamera
       
   337 
       
   338 	Gets the currently set flash mode.
       
   339 
       
   340 	@return  The currently set flash mode. 
       
   341 	@note	if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that 
       
   342     application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised)
       
   343     (set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation.
       
   344     To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() 
       
   345     to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set.
       
   346     In this case, application is assumed to be prepared to receive unrecognised enum values.
       
   347     
       
   348     @see CCamera::CCameraAdvancedSettings::FlashMode()	
       
   349 	*/
       
   350 	TFlash Flash() const;
       
   351 
       
   352 	/** 
       
   353 	from CCamera
       
   354 
       
   355 	Sets the exposure adjustment of the device.
       
   356 
       
   357 	No effect if this is not supported, see CameraInfo::iExposureModesSupported.
       
   358 
       
   359 	May leave with KErrNotSupported if the specified exposure adjustment is invalid.
       
   360 
       
   361 	@param  aExposure
       
   362 	        The required exposure adjustment. 
       
   363 	*/
       
   364 	void SetExposureL(TExposure aExposure = EExposureAuto);
       
   365 
       
   366 	/** 
       
   367 	from CCamera
       
   368 
       
   369 	Gets the currently set exposure setting value.
       
   370 
       
   371 	@return  The currently set exposure setting value. 
       
   372 	*/
       
   373 	TExposure Exposure() const;
       
   374 
       
   375 	/** 
       
   376 	from CCamera
       
   377 
       
   378 	Sets the white balance adjustment of the device.
       
   379 
       
   380 	No effect if this is not supported, see TCameraInfo::iWhiteBalanceModesSupported.
       
   381 
       
   382 	@param  aWhiteBalance
       
   383 	        The required white balance adjustment.
       
   384 
       
   385 	@leave  KErrNotSupported if the specified white balance adjustment
       
   386 	        is invalid.
       
   387 	*/
       
   388 	void SetWhiteBalanceL(TWhiteBalance aWhiteBalance = EWBAuto);
       
   389 
       
   390 	/** 
       
   391 	from CCamera
       
   392 
       
   393 	Gets the currently set white balance adjustment value.
       
   394 
       
   395 	@return  The currently set white balance adjustment value.
       
   396 	
       
   397 	@note	if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that 
       
   398     application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised)
       
   399     (set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation.
       
   400     To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() 
       
   401     to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set.
       
   402     In this case, application is assumed to be prepared to receive unrecognised enum values.
       
   403     Refer  CCamera::CCameraAdvancedSettings::WhiteBalanceMode() implementation
       
   404     
       
   405     @see CCamera::CCameraAdvancedSettings::WhiteBalanceMode()
       
   406     */
       
   407 	TWhiteBalance WhiteBalance() const;
       
   408 
       
   409 	/** 
       
   410 	from CCamera
       
   411 
       
   412 	Starts transfer of view finder data to the given portion of the screen using
       
   413 	direct screen access.
       
   414 
       
   415 	The aScreenRect parameter is in screen co-ordinates and may be modified if,
       
   416 	eg, the camera requires the destination to have a certain byte alignment, etc.
       
   417 
       
   418     @param  aWs 
       
   419 	        Window server session.
       
   420 	@param  aScreenDevice 
       
   421 	        Screen device.
       
   422 	@param  aWindow 
       
   423 	        Displayable window.
       
   424 	@param  aScreenRect 
       
   425 	        Portion of the screen to which view finder data is to be
       
   426 	        transferred. This is in screen co-ordinates and may be modified if, for example,
       
   427 	        the camera requires the destination to have a certain byte alignment.
       
   428 
       
   429 	@leave  KErrNotReady if PowerOn() has either not
       
   430 	        been called, or has not yet completed.
       
   431 	
       
   432 	@note   This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to 
       
   433 			refer viewfinders started using CCamera methods. 
       
   434 	
       
   435 	@see	CCamera::CCameraV2DirectViewFinder
       
   436 	*/
       
   437 	void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect);
       
   438 
       
   439 	/** 
       
   440 	from CCamera
       
   441 
       
   442 	Starts transfer of view finder data to the given portion of the screen using
       
   443 	direct screen access and also clips to the specified portion of the screen.
       
   444 
       
   445 	The view finder has the same size and position as aScreenRect but is only
       
   446 	visible in the intersection of aScreenRect and aClipRect. May leave with KErrNotSupported
       
   447 	or KErrNotReady if Reserve() has not been called, or has not yet completed.
       
   448 
       
   449 	@param  aWs 
       
   450 	        Window server session.
       
   451 	@param  aScreenDevice 
       
   452 	        Screen device.
       
   453 	@param  aWindow 
       
   454 	        Displayable window.
       
   455 	@param  aScreenRect 
       
   456 	        Portion of the screen to which view finder data is to be
       
   457 	        transferred. This is in screen co-ordinates and may be modified if, for example,
       
   458 	        the camera requires the destination to have a certain byte alignment.
       
   459 	@param  aClipRect
       
   460 	        The rectangle to which the screen will be clipped.
       
   461 
       
   462     @leave  KErrNotReady if PowerOn() hasn't been called successfully. 
       
   463     
       
   464     @note   This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to 
       
   465     		refer viewfinders started using CCamera methods.
       
   466 	
       
   467 	@see	CCamera::CCameraClientViewFinder
       
   468 	*/
       
   469 	void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect,TRect& aClipRect);
       
   470 
       
   471 	/** 
       
   472 	from CCamera
       
   473 
       
   474 	Starts transfer of view finder data.
       
   475 
       
   476 	Bitmaps are returned by MCameraObserver::ViewFinderFrameReady().
       
   477 
       
   478 	@param  aSize 
       
   479 	        On return, the size used.
       
   480 	@leave  KErrNotReady if PowerOn() has not been called, or has not yet completed.
       
   481 	
       
   482 	@note   This method is assumed to be meant for default display only. 
       
   483 	
       
   484 	@see	CCamera::CCameraClientViewFinder 
       
   485 	*/
       
   486 	void StartViewFinderBitmapsL(TSize& aSize);	
       
   487 
       
   488 	/** 
       
   489 	from CCamera
       
   490 
       
   491 	Starts transfer of view finder data and clips the bitmap to the specified clip
       
   492 	rectangle.
       
   493 
       
   494 	The bitmap is the size of the intersection of aSize and aClipRect, not simply
       
   495 	aSize padded with white space.
       
   496 
       
   497 	@param  aSize
       
   498 	        On return, the size used.
       
   499 	@param  aClipRect 
       
   500 	        Required clip rectangle. May be modified if, for example,
       
   501 	        the camera only supports certain byte alignments.
       
   502 
       
   503 	@leave  KErrInUse if Reserve() hasn't been called successfully.
       
   504 	@leave  KErrNotReady if PowerOn() hasn't been called successfully.
       
   505 	
       
   506 	@note   This method is assumed to be meant for default display only. 
       
   507 	
       
   508 	@see	CCamera::CCameraClientViewFinder
       
   509 	*/
       
   510 	void StartViewFinderBitmapsL(TSize& aSize,TRect& aClipRect);
       
   511 
       
   512 	/** 
       
   513 	from CCamera
       
   514 
       
   515 	Starts transfer of view finder data.
       
   516 
       
   517 	Picture data is returned by MCameraObserver2::ViewFinderReady().
       
   518 
       
   519 	@param  aImageFormat 
       
   520 	        The image format requested by the client.
       
   521 	@param  aSize 
       
   522 	        On return, the size used.
       
   523 	@leave  KErrNotSupported 
       
   524 	@leave  KErrNotReady if Reserve() has not been
       
   525 	        called, or has not yet completed. 
       
   526 	
       
   527 	@note   This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to 
       
   528 			refer viewfinders started using CCamera methods.
       
   529 	
       
   530 	@see	CCamera::CCameraClientViewFinder
       
   531 	*/
       
   532 	void StartViewFinderL(TFormat aImageFormat,TSize& aSize);
       
   533 
       
   534 	/** 
       
   535 	from CCamera
       
   536 
       
   537 	Starts transfer of view finder data and clips the picture to the specified clip
       
   538 	rectangle. Picture data is returned by MCameraObserver2::ViewFinderReady().
       
   539 
       
   540 	The picture is the size of the intersection of aSize and aClipRect, not simply
       
   541 	aSize padded with white space.
       
   542 
       
   543 	@param  aImageFormat 
       
   544 	        The image format.
       
   545 	@param  aSize
       
   546 	        On return, the size used.
       
   547 	@param  aClipRect 
       
   548 	        Required clip rectangle. May be modified if, for example,
       
   549 	        the camera only supports certain byte alignments.
       
   550 
       
   551 	@leave  KErrInUse if Reserve() hasn't been called successfully,
       
   552 	@leave  KErrNotReady if PowerOn() hasn't been called successfully.
       
   553 	
       
   554 	@note   This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to 
       
   555 			refer viewfinders started using CCamera methods.
       
   556 	
       
   557 	@see	CCamera::CCameraClientViewFinder
       
   558 	*/
       
   559 	void StartViewFinderL(TFormat aImageFormat,TSize& aSize,TRect& aClipRect);
       
   560 
       
   561 	/** 
       
   562 	Stops transfer of view finder data to the screen. 
       
   563 	
       
   564 	@note   This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to 
       
   565 			refer viewfinders started using CCamera methods.
       
   566 	
       
   567 	@see	CCamera::CCameraV2DirectViewFinder
       
   568 	@see	CCamera::CCameraClientViewFinder
       
   569 	*/
       
   570 	void StopViewFinder();
       
   571 
       
   572 	/** 
       
   573 	from CCamera
       
   574 
       
   575 	Queries whether the view finder is active.
       
   576 
       
   577 	@return  ETrue if the view finder is active. EFalse if the view finder is not
       
   578 	         active. 
       
   579 	         
       
   580 	@note   This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to 
       
   581 			refer viewfinders started using CCamera methods.
       
   582 	
       
   583 	@see	CCamera::CCameraV2DirectViewFinder
       
   584 	@see	CCamera::CCameraClientViewFinder
       
   585 	*/
       
   586 	TBool ViewFinderActive() const;
       
   587 
       
   588 	/** 
       
   589 	from CCamera
       
   590 
       
   591 	Sets whether view finder mirroring is on.
       
   592 
       
   593 	Used to switch between what the camera sees and what you would see if the
       
   594 	device were a mirror.
       
   595 
       
   596 	@param  aMirror 
       
   597 	        ETrue to set mirroring on, EFalse to set mirroring off.
       
   598 
       
   599 	@leave  KErrNotSupported.
       
   600 	
       
   601 	@note   This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to 
       
   602 			refer viewfinders started using CCamera methods.
       
   603 	
       
   604 	@see	CCamera::CCameraV2DirectViewFinder
       
   605 	@see	CCamera::CCameraClientViewFinder
       
   606 	*/
       
   607 	void SetViewFinderMirrorL(TBool aMirror);
       
   608 
       
   609 	/** 
       
   610 	from CCamera
       
   611 
       
   612 	Gets whether view finder mirroring is active.
       
   613 
       
   614 	@return  ETrue if mirroring is set, EFalse if mirroring is not set. 
       
   615 	
       
   616 	@note   This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to 
       
   617 			refer viewfinders started using CCamera methods.
       
   618 	
       
   619 	@see	CCamera::CCameraV2DirectViewFinder
       
   620 	@see	CCamera::CCameraClientViewFinder
       
   621 	*/
       
   622 	TBool ViewFinderMirror() const;
       
   623 
       
   624 	/** 
       
   625 	from CCamera
       
   626 
       
   627 	Performs setup and allocation of memory.
       
   628 
       
   629 	Called prior to calling CaptureImage() to keep the latency of that function
       
   630 	to a minimum.
       
   631 
       
   632 	Needs to be called only once for multiple CaptureImage() calls. May leave
       
   633 	with KErrNotSupported or KErrNoMemory or KErrInUse or KErrNotReady.
       
   634 
       
   635 	The specified image format must be one of the formats supported
       
   636 	(see TCameraInfo::iImageFormatsSupported).
       
   637 
       
   638 	The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1
       
   639 	inclusive.
       
   640 
       
   641 	@param  aImageFormat 
       
   642 	        The image format.
       
   643 	@param  aSizeIndex 
       
   644 	        Size index.
       
   645 
       
   646 	@leave  KErrNotSupported
       
   647 	@leave  KErrNoMemory
       
   648 	@leave  KErrNotReady if PowerOn() hasn't been called successfully.
       
   649 	
       
   650 	@see 	CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters)
       
   651 	*/
       
   652 	void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex);
       
   653 
       
   654 	/** 
       
   655 	from CCamera
       
   656 
       
   657 	Performs setup and allocation of memory and clips the image to the specified
       
   658 	rectangle.
       
   659 
       
   660 	No effect unless TCameraInfo::iImageClippingSupported is set to ETrue. The
       
   661 	image captured is the intersection of aClipRect and the rectangle from (0,0)
       
   662 	to aSize. Needs to be called only once for multiple CaptureImage() calls.
       
   663 	May leave with KErrNotSupported or KErrNoMemory.
       
   664 
       
   665 	The specified image format must be one of the formats supported (see TCameraInfo::iImageFormatsSupported).
       
   666 
       
   667 	The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1
       
   668 	inclusive.
       
   669 
       
   670 	@param  aImageFormat 
       
   671 	        The image format.
       
   672 	@param  aSizeIndex 
       
   673 	        Size index.
       
   674 	@param  aClipRect
       
   675 	        The rectangle to which the image is to be clipped.
       
   676 
       
   677 	@leave   KErrNotSupported
       
   678 	@leave   KErrNoMemory
       
   679 	@leave   KErrInUse if Reserve() hasn't been called successfully
       
   680 	@leave   KErrNotReady if PowerOn()
       
   681 	         hasn't been called successfully.
       
   682 	
       
   683 	@see 	CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters)
       
   684 	*/
       
   685 	void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex,const TRect& aClipRect);
       
   686 
       
   687 	/** 
       
   688 	from CCamera
       
   689 
       
   690 	Asynchronously performs still image capture.
       
   691 
       
   692 	Calls MCameraObserver::ImageReady() when complete. 
       
   693 	
       
   694 	@see CCamera::CCameraImageCapture
       
   695 	@see CCamera::CCameraPreImageCaptureControl
       
   696 	*/
       
   697 	void CaptureImage();
       
   698 
       
   699 	/** 
       
   700 	from CCamera
       
   701 
       
   702 	Cancels the asynchronous still image capture. 
       
   703 	
       
   704 	@see CCamera::CCameraImageCapture
       
   705 	*/
       
   706 	void CancelCaptureImage();
       
   707 
       
   708 	/** 
       
   709 	from CCamera
       
   710 
       
   711 	Enumerates through the available image capture sizes, based on the specified
       
   712 	size index and format
       
   713 
       
   714 	The size index must be in the range 0 to TCameraInfo::iNumImageSizesSupported-1
       
   715 	inclusive.
       
   716 
       
   717 	@param  aSize 
       
   718 	        Image size.
       
   719 	@param  aSizeIndex 
       
   720 	        Size index.
       
   721 	@param  aFormat 
       
   722 	        The image format.
       
   723 	*/
       
   724 	void EnumerateCaptureSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const;
       
   725 
       
   726 	/** 
       
   727 	from CCamera
       
   728 
       
   729 	Prepares for video capture.
       
   730 
       
   731 	Performs setup and allocation of memory prior to calling StartVideoCapture()
       
   732 	to keep the latency of that function to a minimum.
       
   733 
       
   734 	May leave with KErrNotSupported or KErrNoMemory.
       
   735 
       
   736 	@param  aFormat 
       
   737 	        Format must be one of the video frame formats supported (see
       
   738 	        TCameraInfo::iVideoFrameFormatsSupported).
       
   739 	@param  aSizeIndex 
       
   740 	        Size index  must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1
       
   741 	        inclusive.
       
   742 	@param  aRateIndex 
       
   743 	        The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1
       
   744 	        inclusive.
       
   745 	@param  aBuffersToUse 
       
   746 	        The number of discrete buffers to use.
       
   747 	@param  aFramesPerBuffer 
       
   748 	        How large the buffers are to be. Must be less than
       
   749 	        or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned
       
   750 	        to MCameraObserver::FrameBufferReady() at a time.
       
   751 
       
   752 	@leave  May leave with KErrNotSupported, KErrNoMemory, or KErrNotReady if PowerOn() 
       
   753 			hasn't been called successfully.
       
   754 	
       
   755 	@see 	CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters)
       
   756 	*/
       
   757 	void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer);
       
   758 
       
   759 	/** 
       
   760 	from CCamera
       
   761 
       
   762 	Prepares for video capture and clips the frames to the given rectangle.
       
   763 
       
   764 	Performs setup and allocation of memory prior to calling StartVideoCapture()
       
   765 	to keep the latency of that function to a minimum.
       
   766 
       
   767 	May leave with KErrNotSupported or KErrNoMemory.
       
   768 
       
   769 	@param  aFormat 
       
   770 	        Format must be one of the video frame formats supported (see
       
   771 	        TCameraInfo::iVideoFrameFormatsSupported).
       
   772 	@param  aSizeIndex 
       
   773 	        Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1
       
   774 	        inclusive.
       
   775 	@param  aRateIndex 
       
   776 	        The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1
       
   777 	        inclusive.
       
   778 	@param  aBuffersToUse 
       
   779 	        The number of discrete buffers to use.
       
   780 	@param  aFramesPerBuffer 
       
   781 	        How large the buffers are to be. Must be less than
       
   782 	        or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned
       
   783 	        to MCameraObserver::FrameBufferReady() at a time.
       
   784 	@param  aClipRect 
       
   785 	        The rectangle to which the image is to be clipped.
       
   786 	@leave  KErrNotSupported
       
   787 	@leave  KErrNoMemory, 
       
   788 	@leave  KErrInUse if Reserve() hasn't been called successfully
       
   789 	@leave  KErrNotReady if PowerOn() hasn't been called successfully.
       
   790 
       
   791 	@see 	CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters)
       
   792 	*/
       
   793 	void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer,const TRect& aClipRect);
       
   794 
       
   795 	/** 
       
   796 	from CCamera
       
   797 
       
   798 	Starts capturing video.
       
   799 
       
   800 	Calls MCameraObserver::FrameBufferReady() when each buffer has been filled
       
   801 	with the required number of frames, as set by PrepareVideoCaptureL(). 
       
   802 	*/
       
   803 	void StartVideoCapture();
       
   804 
       
   805 	/** 
       
   806 	from CCamera
       
   807 
       
   808 	Stops video capture. 
       
   809 	*/
       
   810 	void StopVideoCapture();
       
   811 
       
   812 	/** 
       
   813 	from CCamera
       
   814 
       
   815 	Tests whether video capture is active.
       
   816 
       
   817 	@return  ETrue if video capture is active. EFalse if video capture is not active 
       
   818 	*/
       
   819 	TBool VideoCaptureActive() const;
       
   820 
       
   821 	/** 
       
   822 	from CCamera
       
   823 
       
   824 	Enumerates through the available video frame sizes, based on the specified
       
   825 	size index and format.
       
   826 
       
   827 	@param  aSize 
       
   828 	        On return the available video frame sizes. Sizes should be returned
       
   829 	        in order, largest first, so clients do not have to iterate through every one.
       
   830 	@param  aSizeIndex 
       
   831 	        Size index. Must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1
       
   832 	        inclusive
       
   833 	@param  aFormat 
       
   834 	        Image format. 
       
   835 	*/
       
   836 	void EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const;
       
   837 
       
   838 	/** 
       
   839 	from CCamera
       
   840 
       
   841 	Enumerates through the available video frame rates, based on the specified
       
   842 	rate index, video frame format, size index and exposure mode.
       
   843 
       
   844 	@param  aRate 
       
   845 	        On return, the available video frame rates. Some rates may not
       
   846 	        be available due to, for example, current flash mode setting. In those cases
       
   847 	        a rate of 0 will be returned. Rates should be returned in order, highest first,
       
   848 	        so clients do not have to iterate through every one.
       
   849 	@param  aRateIndex 
       
   850 	        The rate index. Must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1
       
   851 	        inclusive.
       
   852 	@param  aFormat 
       
   853 	        The format.
       
   854 	@param  aSizeIndex 
       
   855 	        The size index.
       
   856 	@param  aExposure 
       
   857 	        The exposure mode. 
       
   858 	*/
       
   859 	void EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,TFormat aFormat,TInt aSizeIndex,TExposure aExposure = EExposureAuto) const;
       
   860 
       
   861 	/** 
       
   862 	from CCamera
       
   863 
       
   864 	Gets the frame size currently in use.
       
   865 
       
   866 	@param  aSize 
       
   867 	        The frame size currently in use. 
       
   868 	*/
       
   869 	void GetFrameSize(TSize& aSize) const;
       
   870 
       
   871 	/** 
       
   872 	from CCamera
       
   873 
       
   874 	Gets the frame rate currently in use.
       
   875 
       
   876 	@return  The frame rate currently in use. 
       
   877 	*/
       
   878 	TReal32 FrameRate() const;
       
   879 
       
   880 	/** 
       
   881 	from CCamera
       
   882 
       
   883 	Gets the number of buffers currently in use.
       
   884 
       
   885 	@return  The number of buffers currently in use. 
       
   886 	*/
       
   887 	TInt BuffersInUse() const;
       
   888 
       
   889 	/** 
       
   890 	from CCamera
       
   891 
       
   892 	Gets the number of frames per buffer currently in use.
       
   893 
       
   894 	@return  The number of frames per buffer currently in use. 
       
   895 	*/
       
   896 	TInt FramesPerBuffer() const;
       
   897 
       
   898 	/** 
       
   899 	from CCamera
       
   900 
       
   901 	Sets the quality value to use if jpeg is a supported image for video format.
       
   902 
       
   903 	Ignored if jpeg is not a supported image for video format.
       
   904 
       
   905 	@param  aQuality
       
   906 	        The quality value to use, clamped to the range 1 to 100.
       
   907 	        
       
   908 	@see	CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters::iImageMaxMemorySize
       
   909 	*/
       
   910 	void SetJpegQuality(TInt aQuality);
       
   911 
       
   912 	/**
       
   913 	from CCamera
       
   914 
       
   915 	Gets the currently set jpeg quality value.
       
   916 
       
   917 	Returns 0 if not supported.
       
   918 
       
   919 	@return The currently set jpeg quality value.
       
   920 	
       
   921 	@see    CCamera::CCameraPreImageCaptureControl::GetImageMaxMemorySizeL(TUint& aMemorySize)
       
   922 	*/
       
   923 	TInt JpegQuality() const;
       
   924 
       
   925     /**
       
   926 	from CCamera
       
   927 
       
   928 	Gets a custom interface. The client has to cast the returned pointer
       
   929 	to the appropriate type.
       
   930 
       
   931 	@param aInterface
       
   932 		   The Uid of the particular interface function required.
       
   933 
       
   934 	@return Custom interface pointer. NULL if the requested interface is not supported.
       
   935 	*/
       
   936 	TAny* CustomInterface(TUid aInterface);
       
   937 
       
   938 private:
       
   939 	CWebCamera();
       
   940 	void ConstructL();
       
   941 
       
   942 private: // from MWebCameraActiveCallBack
       
   943 	/**
       
   944 	from MWebCameraActiveCallBack
       
   945 	
       
   946 	CallBack function of the Reserve
       
   947 	*/
       
   948 	virtual void ReserveCallBack(TInt aError);
       
   949 
       
   950 	/**
       
   951 	from MWebCameraActiveCallBack
       
   952 	
       
   953 	CallBack function of the PowerOn
       
   954 	*/
       
   955 	virtual void PowerOnCallBack(TInt aError);
       
   956 
       
   957 	/**
       
   958 	from MWebCameraActiveCallBack
       
   959 	
       
   960 	CallBack function of the ImageCapture
       
   961 	*/
       
   962 	virtual void ImageCaptureCallBackL(TInt aError);
       
   963 
       
   964 private: // from MWebCameraActiveCallBack
       
   965 	/**
       
   966 	from MWebCameraActiveCallBack
       
   967 	
       
   968 	CallBack function of the ViewFinder
       
   969 	*/
       
   970 	virtual void ViewFinderCallBack(TInt aError);
       
   971 
       
   972 private:
       
   973 	
       
   974 	RWebcameraDevice		iDriver;			///< Camera driver.
       
   975 	MCameraObserver*		iObserver;			///< The callback 'notify' party
       
   976 	MCameraObserver2*		iObserver2;			///< The callback 'notify' party(V2).
       
   977 	CWebCameraActive*		iActive;			///< For async demand.
       
   978 	CWebCameraVfActive*		iVfActive;			///< For viewfinder.
       
   979 	CWebCameraAdvSet* 		iAdvSettingsImpl;	///< Expansion setting class.
       
   980 
       
   981 	TCameraInfo				iInfo;				///< Camera Information.
       
   982 	TInt					iCameraIndex;		///< Camera Index.
       
   983 	TInt					iCameraHandle;		///< Camera handle.
       
   984 	TInt					iPriority;			///< priority.
       
   985 
       
   986 	TBool					iReserved;			///< Reserved Flag.
       
   987 	TBool					iPowerOn;			///< PowerOn Flag.
       
   988 	TBool					iImageCaptureActive;///< Flag during the still image .
       
   989 
       
   990 	CWebCameraBuffer*		iCaptureCameraBuf;	///< Camera buffer for capture.
       
   991 	CFbsBitmap*				iCaptureBitmap;		///< Bitmap Data for capture.
       
   992 	HBufC8*					iCaptureBuf;		///< Data buffer for capture.
       
   993 	TPtr8					iCaptureBufPtr;		///< pointer to Data buffer for capture.
       
   994 
       
   995 	RArray<TSize>			iImageSizes;		///< Image size.
       
   996 	};
       
   997 
       
   998 
       
   999 class CWebCameraInfo : public CCameraInfoPlugin
       
  1000 	{
       
  1001 public:
       
  1002 
       
  1003     /**
       
  1004      * Two-phased constructor.
       
  1005      */
       
  1006 	static CWebCameraInfo* NewL();
       
  1007 	
       
  1008 	/**> Destructor */
       
  1009 	~CWebCameraInfo();
       
  1010 
       
  1011 // from CCameraInfoPlugin
       
  1012 public:
       
  1013 	/** 
       
  1014 	from CCameraInfoPlugin
       
  1015 	
       
  1016 	Determines the number of cameras on the device.
       
  1017 
       
  1018     @return Count of cameras present on the device.
       
  1019 	*/
       
  1020 	TInt CamerasAvailable();
       
  1021 
       
  1022 private:
       
  1023 	CWebCameraInfo();
       
  1024 	};
       
  1025 
       
  1026 
       
  1027 #endif // ECAMWEBCAMERAPLUGIN_H