Symbian
 Developer Library

DEVELOPER LIBRARY

[Index] [Glossary] [Previous] [Next]



Location: ecam.h
Link against: ecam.lib

Class CCamera

CCamera

Support

Supported from 7.0s

Description

Base class for camera devices.

Provides the interface that an application uses to control, and acquire images from, the camera.

An application must supply an implementation of MCameraObserver.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CCameraBase class for camera devices

Defined in CCamera:
Brightness(), BuffersInUse(), CameraInfo(), CamerasAvailable(), CancelCaptureImage(), CaptureImage(), Contrast(), DigitalZoomFactor(), EBrightnessAuto, EContrastAuto, EExposureAuto, EExposureBacklight, EExposureCenter, EExposureNight, EFlashAuto, EFlashFillIn, EFlashForced, EFlashNone, EFlashRedEyeReduce, EFormat16BitRGB565, EFormat16bitRGB444, EFormat32BitRGB888, EFormatFbsBitmapColor16M, EFormatFbsBitmapColor4K, EFormatFbsBitmapColor64K, EFormatJpeg, EFormatMonochrome, EFormatUserDefined, EFormatYUV420Interleaved, EFormatYUV420Planar, EFormatYUV422, EFormatYUV422Reversed, EFormatYUV444, EWBAuto, EWBCloudy, EWBDaylight, EWBFlash, EWBFlourescent, EWBTungsten, EnumerateCaptureSizes(), EnumerateVideoFrameRates(), EnumerateVideoFrameSizes(), Exposure(), Flash(), FrameRate(), FramesPerBuffer(), GetFrameSize(), Handle(), JpegQuality(), NewDuplicateL(), NewL(), PowerOff(), PowerOn(), PrepareImageCaptureL(), PrepareImageCaptureL(), PrepareVideoCaptureL(), PrepareVideoCaptureL(), Release(), Reserve(), SetBrightnessL(), SetContrastL(), SetDigitalZoomFactorL(), SetExposureL(), SetFlashL(), SetJpegQuality(), SetViewFinderMirrorL(), SetWhiteBalanceL(), SetZoomFactorL(), StartVideoCapture(), StartViewFinderBitmapsL(), StartViewFinderBitmapsL(), StartViewFinderDirectL(), StartViewFinderDirectL(), StopVideoCapture(), StopViewFinder(), TBrightness, TContrast, TExposure, TFlash, TFormat, TWhiteBalance, VideoCaptureActive(), ViewFinderActive(), ViewFinderMirror(), WhiteBalance(), ZoomFactor()

Inherited from CBase:
operator new()


Construction and destruction


NewL()

static CCamera* NewL(MCameraObserver& aObserver, TInt aCameraIndex);

Description

Allocates and constructs a camera object.

May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is out of range.

Parameters

MCameraObserver& aObserver

Reference to an observer.

TInt aCameraIndex

Camera device index.

Return value

CCamera*

Camera object.

[Top]


Member functions


CamerasAvailable()

static TInt CamerasAvailable();

Description

Gets the number of cameras on the device.

Return value

TInt

The number of cameras on the device.


NewDuplicateL()

static CCamera* NewDuplicateL(MCameraObserver& aObserver, TInt aCameraHandle);

Description

Duplicates the original camera object for use by, for example, multimedia systems.

May leave with KErrNoMemory or KErrNotFound if aCameraHandle is not valid.

Parameters

MCameraObserver& aObserver

Rreference to an observer.

TInt aCameraHandle

Handle of an existing camera object.

Return value

CCamera *

Duplicate of the original camera object.


CameraInfo()

virtual void CameraInfo(TCameraInfo& aInfo) const=0;

Description

Gets information about the camera device.

Parameters

TCameraInfo& aInfo

On return, information about the camera device. See TCameraInfo.


Reserve()

virtual void Reserve()=0;

Description

Asynchronous function that performs any required initialisation and reserves the camera for exclusive use.

Calls MCameraObserver:: ReserveComplete() when complete.


Release()

virtual void Release()=0;

Description

De-initialises the camera, allowing it to be used by other clients.


PowerOn()

virtual void PowerOn()=0;

Description

Asynchronous function to switch on camera power.

User must have successfully called Reserve() previously to calling this function.

Calls MCameraObserver::PowerOnComplete() when power on is complete.


PowerOff()

virtual void PowerOff()=0;

Description

Synchronous function for switching off camera power.


Handle()

virtual TInt Handle()=0;

Description

Gets the device-unique handle of this camera object.

Return value

TInt

The device-unique handle of this camera object.


SetZoomFactorL()

virtual void SetZoomFactorL(TInt aZoomFactor=0)=0;

Description

Sets the zoom factor.

This must be in the range of TCameraInfo::iMinZoom to TCameraInfo::iMaxZoom inclusive. May leave with KErrNotSupported if the specified zoom factor is out of range.

Parameters

TInt aZoomFactor=0

Required zoom factor.


ZoomFactor()

virtual TInt ZoomFactor() const=0;

Description

Gets the currently set zoom factor.

Return value

TInt

The currently set zoom factor.


SetDigitalZoomFactorL()

virtual void SetDigitalZoomFactorL(TInt aDigitalZoomFactor=0)=0;

Description

Sets the digital zoom factor.

This must be in the range of 0 to TCameraInfo::iMaxDigitalZoom inclusive.

May leave with KErrNotSupported if the zoom factor is out of range.

Parameters

TInt aDigitalZoomFactor=0

The required digital zoom factor.


DigitalZoomFactor()

virtual TInt DigitalZoomFactor() const=0;

Description

Gets the currently set digital zoom factor.

Return value

TInt

The currently set digital zoom factor.


SetContrastL()

virtual void SetContrastL(TInt aContrast)=0;

Description

Sets the contrast adjustment of the device.

This must be in the range of –100 to +100 or EContrastAuto. May leave with KErrNotSupported if the specified contrast value is out of range.

Parameters

TInt aContrast

Required contrast value. See TCameraInfo::iContrastSupported


Contrast()

virtual TInt Contrast() const=0;

Description

Gets the currently set contrast value.

Return value

TInt

The currently set contrast value.


SetBrightnessL()

virtual void SetBrightnessL(TInt aBrightness)=0;

Description

Sets the brightness adjustment of the device.

No effect if this is not supported, see TCameraInfo::iBrightnessSupported.

This must be in the range of –100 to +100 or EBrightnessAuto. May leave with KErrNotSupported if the brightness adjustment is out of range.

Parameters

TInt aBrightness

The required brightness adjustment.


Brightness()

virtual TInt Brightness() const=0;

Description

Gets the currently set brightness adjustment value.

Return value

TInt

The currently set brightness adjustment value.


SetFlashL()

virtual void SetFlashL(TFlash aFlash=EFlashNone)=0;

Description

Sets the flash mode.

No effect if this is not supported, see TCameraInfo::iFlashModesSupported.

May leave with KErrNotSupported if the specified flash mode is invalid.

Parameters

TFlash aFlash=EFlashNone

The required flash mode.


Flash()

virtual TFlash Flash() const=0;

Description

Gets the currently set flash mode.

Return value

TFlash

The currently set flash mode.


SetExposureL()

virtual void SetExposureL(TExposure aExposure=EExposureAuto)=0;

Description

Sets the exposure adjustment of the device.

No effect if this is not supported, see CameraInfo::iExposureModesSupported.

May leave with KErrNotSupported if the specified exposure adjustment is invalid.

Parameters

TExposure aExposure=EExposureAuto

The required exposure adjustment.


Exposure()

virtual TExposure Exposure() const=0;

Description

Gets the currently set exposure setting value.

Return value

TExposure

The currently set exposure setting value.


SetWhiteBalanceL()

virtual void SetWhiteBalanceL(TWhiteBalance aWhiteBalance=EWBAuto)=0;

Description

Sets the white balance adjustment of the device.

No effect if this is not supported, see TCameraInfo::iWhiteBalanceModesSupported.

May leave with KErrNotSupported if the specified white balance adjustment is invalid.

Parameters

TWhiteBalance aWhiteBalance=EWBAuto

The required white balance adjustment.


WhiteBalance()

virtual TWhiteBalance WhiteBalance() const=0;

Description

Gets the currently set white balance adjustment value.

Return value

TWhiteBalance

The currently set white balance adjustment value.


StartViewFinderDirectL()

virtual void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect)=0;

Description

Starts transfer of view finder data to the given portion of the screen using direct screen access.

May leave with KErrNotSupported or KErrNotReady if Reserve() has either not been called, or has not yet completed.

Parameters

RWsSession& aWs

Window server session.

CWsScreenDevice& aScreenDevice

Screen device.

RWindowBase& aWindow

Displayable window.

TRect& aScreenRect

Portion of the screen to which view finder data is to be transferred. This is in screen co-ordinates and may be modified if, for example, the camera requires the destination to have a certain byte alignment.


StartViewFinderDirectL()

virtual void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect)=0;

Description

Starts transfer of view finder data to the given portion of the screen using direct screen access and also clips to the specified portion of the screen.

The view finder has the same size and position as aScreenRect but is only visible in the intersection of aScreenRect and aClipRect. May leave with KErrNotSupported or KErrNotReady if Reserve() has not been called, or has not yet completed.

Parameters

RWsSession& aWs

Window server session.

CWsScreenDevice& aScreenDevice

Screen device.

RWindowBase& aWindow

Displayable window.

TRect& aScreenRect

Portion of the screen to which view finder data is to be transferred. This is in screen co-ordinates and may be modified if, for example, the camera requires the destination to have a certain byte alignment.

TRect& aClipRect

The rectangle to which the screen will be clipped.


StartViewFinderBitmapsL()

virtual void StartViewFinderBitmapsL(TSize& aSize)=0;

Description

Starts transfer of view finder data.

Bitmaps are returned by MCameraObserver::ViewFinderFrameReady().

May leave with KErrNotSupported or KErrNotReady if Reserve() has not been called, or has not yet completed.

Parameters

TSize& aSize

On return, the size used.


StartViewFinderBitmapsL()

virtual void StartViewFinderBitmapsL(TSize& aSize, TRect& aClipRect)=0;

Description

Starts transfer of view finder data and clips the bitmap to the specified clip rectangle.

The bitmap is the size of the intersection of aSize and aClipRect, not simply aSize padded with white space.

Parameters

TSize& aSize

On return, the size used.

TRect& aClipRect

Required clip rectangle. May be modified if, for example, the camera only supports certain byte alignments.


StopViewFinder()

virtual void StopViewFinder()=0;

Description

Stops transfer of view finder data to the screen.


ViewFinderActive()

virtual TBool ViewFinderActive() const=0;

Description

Queries whether the view finder is active.

Return value

TBool

ETrue if the view finder is active. EFalse if the view finder is not active.


SetViewFinderMirrorL()

virtual void SetViewFinderMirrorL(TBool aMirror)=0;

Description

Sets whether view finder mirroring is on.

Used to switch between what the camera sees and what you would see if the device were a mirror.

May leave with KErrNotSupported.

Parameters

TBool aMirror

ETrue to set mirroring on, EFalse to set mirroring off.


ViewFinderMirror()

virtual TBool ViewFinderMirror() const=0;

Description

Gets whether view finder mirroring is active.

Return value

TBool

ETrue if mirroring is set, EFalse if mirroring is not set.


PrepareImageCaptureL()

virtual void PrepareImageCaptureL(TFormat aImageFormat, TInt aSizeIndex)=0;

Description

Performs setup and allocation of memory.

Called prior to calling CaptureImage() to keep the latency of that function to a minimum.

Needs to be called only once for multiple CaptureImage() calls. May leave with KErrNotSupported or KErrNoMemory.

The specified image format must be one of the formats supported (see TCameraInfo::iImageFormatsSupported).

The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 inclusive.

Parameters

TFormat aImageFormat

The image format.

TInt aSizeIndex

Size index.


PrepareImageCaptureL()

virtual void PrepareImageCaptureL(TFormat aImageFormat, TInt aSizeIndex, const TRect& aClipRect)=0;

Description

Performs setup and allocation of memory and clips the image to the specified rectangle.

No effect unless TCameraInfo::iImageClippingSupported is set to ETrue. The image captured is the intersection of aClipRect and the rectangle from (0,0) to aSize. Needs to be called only once for multiple CaptureImage() calls. May leave with KErrNotSupported or KErrNoMemory.

The specified image format must be one of the formats supported (see TCameraInfo::iImageFormatsSupported).

The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 inclusive.

Parameters

TFormat aImageFormat

The image format.

TInt aSizeIndex

Size index.

const TRect& aClipRect

The rectangle to which the image is to be clipped.


CaptureImage()

virtual void CaptureImage()=0;

Description

Asynchronously performs still image capture.

Calls MCameraObserver::ImageReady() when complete.


CancelCaptureImage()

virtual void CancelCaptureImage()=0;

Description

Cancels the asynchronous still image capture.


EnumerateCaptureSizes()

virtual void EnumerateCaptureSizes(TSize& aSize, TInt aSizeIndex, TFormat aFormat) const=0;

Description

Enumerates through the available image capture sizes, based on the specified size index and format

The size index must be in the range 0 to TCameraInfo::iNumImageSizesSupported-1 inclusive.

Parameters

TSize& aSize

Image size.

TInt aSizeIndex

Size index.

TFormat aFormat

The image format.


PrepareVideoCaptureL()

virtual void PrepareVideoCaptureL(TFormat aFormat, TInt aSizeIndex, TInt aRateIndex, TInt aBuffersToUse, TInt aFramesPerBuffer)=0;

Description

Prepares for video capture.

Performs setup and allocation of memory prior to calling StartVideoCapture() to keep the latency of that function to a minimum.

May leave with KErrNotSupported or KErrNoMemory.

Parameters

TFormat aFormat

Format. Must be one of the video frame formats supported (see TCameraInfo::iVideoFrameFormatsSupported).

TInt aSizeIndex

Size index. Must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 inclusive.

TInt aRateIndex

The rate. Must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 inclusive.

TInt aBuffersToUse

The number of discrete buffers to use.

TInt aFramesPerBuffer

How large the buffers are to be. Must be less than or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned to MCameraObserver::FrameBufferReady() at a time.


PrepareVideoCaptureL()

virtual void PrepareVideoCaptureL(TFormat aFormat, TInt aSizeIndex, TInt aRateIndex, TInt aBuffersToUse, TInt aFramesPerBuffer, const TRect& aClipRect)=0;

Description

Prepares for video capture and clips the frames to the given rectangle.

Performs setup and allocation of memory prior to calling StartVideoCapture() to keep the latency of that function to a minimum.

May leave with KErrNotSupported or KErrNoMemory.

Parameters

TFormat aFormat

Format. Must be one of the video frame formats supported (see TCameraInfo::iVideoFrameFormatsSupported).

TInt aSizeIndex

Size index. Must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 inclusive.

TInt aRateIndex

The rate. Must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 inclusive.

TInt aBuffersToUse

The number of discrete buffers to use.

TInt aFramesPerBuffer

How large the buffers are to be. Must be less than or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned to MCameraObserver::FrameBufferReady() at a time.

const TRect& aClipRect

The rectangle to which the image is to be clipped.


StartVideoCapture()

virtual void StartVideoCapture()=0;

Description

Starts capturing video.

Calls MCameraObserver::FrameBufferReady() when each buffer has been filled with the required number of frames, as set by PrepareVideoCaptureL().


StopVideoCapture()

virtual void StopVideoCapture()=0;

Description

Stops video capture.


VideoCaptureActive()

virtual TBool VideoCaptureActive() const=0;

Description

Tests whether video capture is active.

Return value

TBool

ETrue if video capture is active. EFalse if video capture is not active


EnumerateVideoFrameSizes()

virtual void EnumerateVideoFrameSizes(TSize& aSize, TInt aSizeIndex, TFormat aFormat) const=0;

Description

Enumerates through the available video frame sizes, based on the specified size index and format.

Parameters

TSize& aSize

On return the available video frame sizes. Sizes should be returned in order, largest first, so clients do not have to iterate through every one.

TInt aSizeIndex

Size index. Must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 inclusive

TFormat aFormat

Image format.


EnumerateVideoFrameRates()

virtual void EnumerateVideoFrameRates(TReal32& aRate, TInt aRateIndex, TFormat aFormat, TInt aSizeIndex, TExposure aExposure=EExposureAuto) const=0;

Description

Enumerates through the available video frame rates, based on the specified rate index, video frame format, size index and exposure mode.

Parameters

TReal32& aRate

On return, the available video frame rates. Some rates may not be available due to, for example, current flash mode setting. In those cases a rate of 0 will be returned. Rates should be returned in order, highest first, so clients do not have to iterate through every one.

TInt aRateIndex

The rate index. Must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 inclusive.

TFormat aFormat

The format.

TInt aSizeIndex

The size index.

TExposure aExposure=EExposureAuto

The exposure mode.


GetFrameSize()

virtual void GetFrameSize(TSize& aSize) const=0;

Description

Gets the frame size currently in use.

Parameters

TSize& aSize

The frame size currently in use.


FrameRate()

virtual TReal32 FrameRate() const=0;

Description

Gets the frame rate currently in use.

Return value

TReal32

The frame rate currently in use.


BuffersInUse()

virtual TInt BuffersInUse() const=0;

Description

Gets the number of buffers currently in use.

Return value

TInt

The number of buffers currently in use.


FramesPerBuffer()

virtual TInt FramesPerBuffer() const=0;

Description

Gets the number of frames per buffer currently in use.

Return value

TInt

The number of frames per buffer currently in use.


SetJpegQuality()

virtual void SetJpegQuality(TInt aQuality)=0;

Description

Sets the quality value to use if jpeg is a supported image for video format.

Ignored if jpeg is not a supported image for video format.

Parameters

TInt aQuality

The quality value to use, clamped to the range 1 to 100.


JpegQuality()

virtual TInt JpegQuality() const=0;

Description

Gets the currently set jpeg quality value.

Returns 0 if not supported.

Return value

TInt

The currently set jpeg quality value.

[Top]


Member enumerations


Enum TFormat

TFormat

Description

Possible still image and video frame formats

Formats are read from left to right, starting at the top of the image. YUV format is as defined by ITU-R BT.601-4.

EFormatMonochrome

8 bit greyscale values, 0=black, 255=white.

EFormat16bitRGB444

Packed RGB triplets, 4 bits per pixel with red in the least significant bits and the 4 most significant bits unused.

EFormat16BitRGB565

Packed RGB triplets, 5 bits per pixel for red and blue and 6 bits for green, with red in the least significant bits.

EFormat32BitRGB888

Packed RGB triplets, 8 bits per pixel with red in the least significant bits and the 8 most significant bits unused.

EFormatJpeg

JFIF JPEG.

EFormatFbsBitmapColor4K

CFbsBitmap object with display mode EColor4K.

EFormatFbsBitmapColor64K

CFbsBitmap object with display mode EColor64K.

EFormatFbsBitmapColor16M

CFbsBitmap object with display mode EColor16M.

EFormatUserDefined

Implementation dependent.

EFormatYUV420Interleaved

4:2:0 format, 8 bits per sample, Y00Y01Y10Y11UV.

EFormatYUV420Planar

4:2:0 format, 8 bits per sample, Y00Y01Y02Y03...U0...V0...

EFormatYUV422

4:2:2 format, 8 bits per sample, UY0VY1.

EFormatYUV422Reversed

4:2:2 format, 8 bits per sample, Y1VY0U.

EFormatYUV444

4:4:4 format, 8 bits per sample, Y00U00V00 Y01U01V01...


Enum TContrast

TContrast

Description

Specifies whether contrast is set automatically.

EContrastAuto

Sets the contrast automatically.


Enum TBrightness

TBrightness

Description

Specifies whether brightness is set automatically.

EBrightnessAuto

Sets the brightness automatically.


Enum TFlash

TFlash

Description

Specifies the type of flash.

EFlashNone

No flash, always supported.

EFlashAuto

Flash will automatically fire when required.

EFlashForced

Flash will always fire.

EFlashFillIn

Reduced flash for general lighting

EFlashRedEyeReduce

Red-eye reduction mode.


Enum TExposure

TExposure

Description

Specifies the type of exposure.

EExposureAuto

Set exposure automatically. Default, always supported.

EExposureNight

Night-time setting for long exposures.

EExposureBacklight

Backlight setting for bright backgrounds.

EExposureCenter

Centered mode for ignoring surroundings.


Enum TWhiteBalance

TWhiteBalance

Description

Specifies how the white balance is set.

EWBAuto

Set white balance automatically. Default, always supported.

EWBDaylight

Normal daylight.

EWBCloudy

Overcast daylight.

EWBTungsten

Tungsten filament lighting.

EWBFlourescent

Flourescent tube lighting.

EWBFlash

Flash lighting.