Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2006

    Camera API on Symbian 9.1 (Nokia N80)

    Has anyone used the CCamera class on the Nokia N80? The code that used to work for the N70 (v8.1) doesn't work anymore on N80 running v9.1. Does anyone have a solution to this?

  2. #2
    Super Contributor
    Join Date
    Aug 2005

    Re: Camera API on Symbian 9.1 (Nokia N80)



    How to use the Camera API
    To use the Camera API, to capture a still image for example, a client application must have the UserEnvironment capability listed in its .mmp project file. It can then call the CCamera::NewL() function to get a CCamera object. The application can then call the CCamera functions on the CCamera object to specify, for example zoom, flash or contrast and to capture an image. The application must supply an MCameraObserver-derived object to receive callbacks when, for instance, an image is ready. If the UserEnvironment security capability is absent CCamera::NewL() will leave with KErrPermissionDenied.

    Camera control
    Once a client application has obtained a camera object, to actually use the camera the application must call the CCamera::Reserve() function, then CCamera::PowerOn(). The client is informed that power on is complete by MCameraObserver::PowerOnComplete().

    No other client can use the camera once CCamera::Reserve() has been called successfully. If another client wishes to use the camera, it must call the CCamera::NewDuplicateL() factory function. Note that this function can be called only with the handle of an existing camera object. This allows, for example, a video conferencing application to have a camera object open for control of its functions and for the multimedia system to have another camera object open for reading frames of data.

    The client application can now specify the image format and then capture still / video images or use the view finder.

    Specifying image format
    Before a client application captures still, or video, images it can first specify the required image format. There may be complicated dependencies between frame sizes and formats, so the required format must be specified as follows:

    Select the format from those available from either the TCameraInfo::iImageFrameFormatsSupported or TCameraInfo::iVideoFrameFormatsSupported bitfield for still or video images respectively.

    Select the required size using either CCamera::EnumerateCaptureSizes() or CCamera::EnumerateVideoFrameSizes() for still or video images respectively. Note that not all possible sizes are guaranteed to be supported for any given format. Unsupported sizes will be returned as (0,0).

    For video capture, select the frame rate using CCamera::EnumerateVideoFrameRates(). Again, not all rates are guaranteed to be supported if dependencies exist in the device between the format, size, exposure mode and rate. Unsupported rates are returned as 0.


    Capturing still images
    Still image capture involves transferring the current image from the camera to the client via MCameraObserver::ImageReady().

    A client calls CCamera::PrepareImageCaptureL() to set image format, size and clipping rectangle. This must be called at least once before requesting images to allow the camera device to allocate any resources necessary for capturing images. The client then calls CCamera::CaptureImage() to capture an image which MCameraObserver::ImageReady() returns. Any errors that occur during image capture are also returned to the client, in which case no valid image data is returned.

    Capturing video images
    Video capture involves the following:

    Before video can be captured, a client calls the CCamera::PrepareVideoCaptureL() function to initialise the required resources. This function enables the client application to set the number of buffers to use and the number of frames per buffer. Buffers are then filled as frames become available. Once a buffer has been filled it is passed to the client via MCameraObserver::FrameBufferReady(). Once the data has been used the buffer should be released by calling the MFrameBuffer::Release() function.

    If an error occurs during video capture, the client is notified through MCameraObserver::FrameBufferReady() in which case no valid frame data is returned. If the error is fatal to the process of capturing video, such as the camera being switched off, then video capture stops and outstanding buffers are deleted by the camera object.

    If the available number of frame buffers is exceeded, there are no further callbacks until the client application calls MFrameBuffer::Release(). After this, MCameraObserver::FrameBufferReady() will be called again with the MFrameBuffer::iIndexOfFirstFrameInBuffer member set to reflect the current frame. This allows the client to calculate the number of frames dropped if they recorded the previous buffer's value of MFrameBuffer::iIndexOfFirstFrameInBuffer.

    Using a view finder
    The view finder can, if supported, transfer frames from the camera directly to the display memory at a location of the client's choosing. Alternatively, if supported, the user may implement a view finder function themselves using a bitmap-based alternative.

    A client calls the following functions as required:

    CCamera::StartViewFinderDirectL() to transfer view finder data to a specified portion of the screen using direct screen access.

    CCamera::StartViewFinderBitmapsL() to transfer view finder data as a bitmap.

    CCamera::SetViewFinderMirrorL() to specify view finder mirroring on or off. Mirroring flips the image horizontally so that the user can use the device as a virtual mirror.

    CCamera::StopViewFinder() to stop transfer of view finder data to the screen.


    See also
    Introduction to the Onboard Camera API

    How to implement the Camera API
    check the sdk help for the 3rd edition on how to implement it ...

    Mateen Maldar
    "Whatever the mind can conceive and believe, the mind can achieve"

  3. #3
    Registered User
    Join Date
    May 2006

    Re: Camera API on Symbian 9.1 (Nokia N80)

    I appreciate your reply, thanks. Can you please tell me how a client application can have the UserEnvironment capability listed in its .mmp project file.

    An example would be great. Is this something new or specific to v9.1? Please note that the same code has been working with v8.1 and previous versions. It doesn't work just on this new phone Nokia N80 which runs OS v9.1.

    Please look at this link. According to it, it will not work. That is what I'm scared of. Search for Camera on the release notes:



  4. #4
    Registered User
    Join Date
    May 2006

    Re: Camera API on Symbian 9.1 (Nokia N80)

  5. #5
    Registered User
    Join Date
    Oct 2007

    Re: Camera API on Symbian 9.1 (Nokia N80)

    Quote Originally Posted by srigans1 View Post
    Could you point me to an updated resource?

Similar Threads

  1. User Comments and Examples into API Docs
    By jyrkiettila in forum Feedback - Nokia Developer Services & Infrastructure
    Replies: 4
    Last Post: 2006-04-21, 11:04
  2. Nokia 6630 Camera API
    By ryanrst in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2005-03-22, 21:21
  3. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 10:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts