Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Using a Camera in a Brew MP Application

Base version:

Brew MP SDK 1.0 rev 5.3.977535

Tested version:

Brew MP SDK 1.0 rev 5.3.977535

Phone tested:

Yes

Objective

This document describes how to create and set up an ICamera object, preview a snapshot or movie, and save a snapshot or movie within a Brew® Mobile Platform (Brew MP) application.

The example code included is from the c_samplecamera application, which you can download from the How To section of the Brew Mobile Library. You can extract the contents of the .zip file, compile the application, and run it on the Brew MP Simulator.

Note: Brew MP devices do not display camera preview frames on screen sizes 176x144, 128x96, and 96x80. This is a problem in the platform code. This capability will be added in a future release.

Requirements

To use the ICamera interface, you must have:

  • A Brew MP enabled device with camera hardware and support.
  • If testing on the Simulator, a direct-show compliant web cam attached to the computer.
  • Brew MP 1.0 SDK rev 1.0 or greater.
  • A MIF file with privileges for AEEPRIVID_PLFILE and AEECLSID_CAMERA. If your device has multiple cameras, then AEECLSID_CAMERA2, AEECLSID_CAMERA3, and AEECLSID_CAMERA4 might be necessary.

This document assumes that you are familiar with the Brew MP C Application Primer.

ICamera Modes

ICamera has four modes: Ready, Preview, Snapshot and Movie. These modes are a state machine. You can find the current mode by calling the ICAMERA_GetMode() function.

ICamera starts in the Ready mode, and can transition to the other modes. The Preview, Snapshot, and Movie modes can only transition to the Ready mode. To transition from the Preview mode to the Movie mode, you must transition to the Ready mode, and then from the Ready mode to the Movie mode.

State transitions are not complete until the callback function is called. For transitions to the Ready mode, the callback function has the status CAM_STATUS_DONE in nStatus. For transitions to the other modes, the callback function has the status CAM_STATUS_START in nStatus.

Return Values

ICamera has both synchronous and asynchronous functions. A return value of SUCCESS for a synchronous function means the operation was successfully completed.

An asynchronous function initiates an action and returns control to the application. A return value of SUCCESS for an asynchronous function means the command was accepted. You find out about the result of the action from the callback function.

If a function returns CAM_PENDING, the operation is asynchronous and the success of the operation will be in the AEECameraNotify structure in the callback function. An asynchronous operation is complete when the callback function nStatus is equal to CAM_STATUS_DONE.

Refer to the Brew MP API Reference for information on specific ICamera functions, their use, and return values.

Sample code location

ZIP filename

Location

Run app

c_samplecamera

Brew MP Library

  • Download and extract the ZIP file.

  • Compile the app.

  • Run it on the Brew MP Simulator.

Comments

tpschmidt 19 Nov 2010 12:33pm

Where is c_samplecamera.zip?
It's not attached to this article and does not download from the SDK Manager.
Thanks!

adhudase 01 Dec 2010 11:12pm

Please see on left side there is sample code