Bug 737196 - Make camera code build on gonk-ics, r=cjones

This commit is contained in:
Michael Wu 2012-03-23 15:45:47 -04:00
parent d7f0bfa25b
commit ecf90b6e1a
5 changed files with 982 additions and 3 deletions

View File

@ -18,7 +18,7 @@
#define USE_GS2_LIBCAMERA
#define CameraHardwareInterface CameraHardwareInterface_SGS2
#define HAL_openCameraHardware HAL_openCameraHardware_SGS2
#include "camera/CameraHardwareInterface.h"
#include "gonk/CameraHardwareInterface.h"
#undef CameraHardwareInterface
#undef USE_GS2_LIBCAMERA
#undef HAL_openCameraHardware
@ -31,7 +31,7 @@
#define USE_MAGURO_LIBCAMERA
#define CameraHardwareInterface CameraHardwareInterface_MAGURO
#define HAL_openCameraHardware HAL_openCameraHardware_MAGURO
#include "camera/CameraHardwareInterface.h"
#include "gonk/CameraHardwareInterface.h"
#undef CameraHardwareInterface
#undef USE_MAGURO_LIBCAMERA
#undef HAL_openCameraHardware
@ -42,7 +42,7 @@
#define image_rect_type image_rect_type3
#define image_rect_struct image_rect_struct3
#define CameraHardwareInterface CameraHardwareInterface_DEFAULT
#include "camera/CameraHardwareInterface.h"
#include "gonk/CameraHardwareInterface.h"
#undef CameraHardwareInterface
using namespace android;

View File

@ -0,0 +1,256 @@
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_CAMERA_H
#define ANDROID_HARDWARE_CAMERA_H
#include <utils/Timers.h>
#include "ICameraClient.h"
namespace android {
class ISurface;
/*
* A set of bit masks for specifying how the received preview frames are
* handled before the previewCallback() call.
*
* The least significant 3 bits of an "int" value are used for this purpose:
*
* ..... 0 0 0
* ^ ^ ^
* | | |---------> determine whether the callback is enabled or not
* | |-----------> determine whether the callback is one-shot or not
* |-------------> determine whether the frame is copied out or not
*
* WARNING:
* When a frame is sent directly without copying, it is the frame receiver's
* responsiblity to make sure that the frame data won't get corrupted by
* subsequent preview frames filled by the camera. This flag is recommended
* only when copying out data brings significant performance price and the
* handling/processing of the received frame data is always faster than
* the preview frame rate so that data corruption won't occur.
*
* For instance,
* 1. 0x00 disables the callback. In this case, copy out and one shot bits
* are ignored.
* 2. 0x01 enables a callback without copying out the received frames. A
* typical use case is the Camcorder application to avoid making costly
* frame copies.
* 3. 0x05 is enabling a callback with frame copied out repeatedly. A typical
* use case is the Camera application.
* 4. 0x07 is enabling a callback with frame copied out only once. A typical use
* case is the Barcode scanner application.
*/
#define FRAME_CALLBACK_FLAG_ENABLE_MASK 0x01
#define FRAME_CALLBACK_FLAG_ONE_SHOT_MASK 0x02
#define FRAME_CALLBACK_FLAG_COPY_OUT_MASK 0x04
// Typical use cases
#define FRAME_CALLBACK_FLAG_NOOP 0x00
#define FRAME_CALLBACK_FLAG_CAMCORDER 0x01
#define FRAME_CALLBACK_FLAG_CAMERA 0x05
#define FRAME_CALLBACK_FLAG_BARCODE_SCANNER 0x07
// msgType in notifyCallback and dataCallback functions
enum {
CAMERA_MSG_ERROR = 0x001,
CAMERA_MSG_SHUTTER = 0x002,
CAMERA_MSG_FOCUS = 0x004,
CAMERA_MSG_ZOOM = 0x008,
CAMERA_MSG_PREVIEW_FRAME = 0x010,
CAMERA_MSG_VIDEO_FRAME = 0x020,
CAMERA_MSG_POSTVIEW_FRAME = 0x040,
CAMERA_MSG_RAW_IMAGE = 0x080,
CAMERA_MSG_COMPRESSED_IMAGE = 0x100,
CAMERA_MSG_ALL_MSGS = 0x1FF
};
// cmdType in sendCommand functions
enum {
CAMERA_CMD_START_SMOOTH_ZOOM = 1,
CAMERA_CMD_STOP_SMOOTH_ZOOM = 2,
// Set the clockwise rotation of preview display (setPreviewDisplay) in
// degrees. This affects the preview frames and the picture displayed after
// snapshot. This method is useful for portrait mode applications. Note that
// preview display of front-facing cameras is flipped horizontally before
// the rotation, that is, the image is reflected along the central vertical
// axis of the camera sensor. So the users can see themselves as looking
// into a mirror.
//
// This does not affect the order of byte array of CAMERA_MSG_PREVIEW_FRAME,
// CAMERA_MSG_VIDEO_FRAME, CAMERA_MSG_POSTVIEW_FRAME, CAMERA_MSG_RAW_IMAGE,
// or CAMERA_MSG_COMPRESSED_IMAGE. This is not allowed to be set during
// preview.
CAMERA_CMD_SET_DISPLAY_ORIENTATION = 3,
};
// camera fatal errors
enum {
CAMERA_ERROR_UKNOWN = 1,
CAMERA_ERROR_SERVER_DIED = 100
};
enum {
CAMERA_FACING_BACK = 0, /* The facing of the camera is opposite to that of the screen. */
CAMERA_FACING_FRONT = 1 /* The facing of the camera is the same as that of the screen. */
};
struct CameraInfo {
/**
* The direction that the camera faces to. It should be
* CAMERA_FACING_BACK or CAMERA_FACING_FRONT.
*/
int facing;
/**
* The orientation of the camera image. The value is the angle that the
* camera image needs to be rotated clockwise so it shows correctly on
* the display in its natural orientation. It should be 0, 90, 180, or 270.
*
* For example, suppose a device has a naturally tall screen. The
* back-facing camera sensor is mounted in landscape. You are looking at
* the screen. If the top side of the camera sensor is aligned with the
* right edge of the screen in natural orientation, the value should be
* 90. If the top side of a front-facing camera sensor is aligned with
* the right of the screen, the value should be 270.
*/
int orientation;
};
class ICameraService;
class ICamera;
class Surface;
class Mutex;
class String8;
// ref-counted object for callbacks
class CameraListener: virtual public RefBase
{
public:
virtual void notify(int32_t msgType, int32_t ext1, int32_t ext2) = 0;
virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr) = 0;
virtual void postDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr) = 0;
};
class Camera : public BnCameraClient, public IBinder::DeathRecipient
{
public:
// construct a camera client from an existing remote
static sp<Camera> create(const sp<ICamera>& camera);
static int32_t getNumberOfCameras();
static status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo);
static sp<Camera> connect(int cameraId);
~Camera();
void init();
status_t reconnect();
void disconnect();
status_t lock();
status_t unlock();
status_t getStatus() { return mStatus; }
// pass the buffered ISurface to the camera service
status_t setPreviewDisplay(const sp<Surface>& surface);
status_t setPreviewDisplay(const sp<ISurface>& surface);
// start preview mode, must call setPreviewDisplay first
status_t startPreview();
// stop preview mode
void stopPreview();
// get preview state
bool previewEnabled();
// start recording mode, must call setPreviewDisplay first
status_t startRecording();
// stop recording mode
void stopRecording();
// get recording state
bool recordingEnabled();
// release a recording frame
void releaseRecordingFrame(const sp<IMemory>& mem);
// autoFocus - status returned from callback
status_t autoFocus();
// cancel auto focus
status_t cancelAutoFocus();
// take a picture - picture returned from callback
status_t takePicture();
// set preview/capture parameters - key/value pairs
status_t setParameters(const String8& params);
// get preview/capture parameters - key/value pairs
String8 getParameters() const;
// send command to camera driver
status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2);
void setListener(const sp<CameraListener>& listener);
void setPreviewCallbackFlags(int preview_callback_flag);
// ICameraClient interface
virtual void notifyCallback(int32_t msgType, int32_t ext, int32_t ext2);
virtual void dataCallback(int32_t msgType, const sp<IMemory>& dataPtr);
virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr);
sp<ICamera> remote();
private:
Camera();
Camera(const Camera&);
Camera& operator=(const Camera);
virtual void binderDied(const wp<IBinder>& who);
class DeathNotifier: public IBinder::DeathRecipient
{
public:
DeathNotifier() {
}
virtual void binderDied(const wp<IBinder>& who);
};
static sp<DeathNotifier> mDeathNotifier;
// helper function to obtain camera service handle
static const sp<ICameraService>& getCameraService();
sp<ICamera> mCamera;
status_t mStatus;
sp<CameraListener> mListener;
friend class DeathNotifier;
static Mutex mLock;
static sp<ICameraService> mCameraService;
};
}; // namespace android
#endif

View File

@ -0,0 +1,267 @@
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H
#define ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H
#include <binder/IMemory.h>
#include <utils/RefBase.h>
#include <surfaceflinger/ISurface.h>
#include "Camera.h"
#include "CameraParameters.h"
namespace android {
class Overlay;
/**
* The size of image for display.
*/
typedef struct image_rect_struct
{
uint32_t width; /* Image width */
uint32_t height; /* Image height */
} image_rect_type;
typedef void (*notify_callback)(int32_t msgType,
int32_t ext1,
int32_t ext2,
void* user);
typedef void (*data_callback)(int32_t msgType,
const sp<IMemory>& dataPtr,
void* user);
typedef void (*data_callback_timestamp)(nsecs_t timestamp,
int32_t msgType,
const sp<IMemory>& dataPtr,
void* user);
/**
* CameraHardwareInterface.h defines the interface to the
* camera hardware abstraction layer, used for setting and getting
* parameters, live previewing, and taking pictures.
*
* It is a referenced counted interface with RefBase as its base class.
* CameraService calls openCameraHardware() to retrieve a strong pointer to the
* instance of this interface and may be called multiple times. The
* following steps describe a typical sequence:
*
* -# After CameraService calls openCameraHardware(), getParameters() and
* setParameters() are used to initialize the camera instance.
* CameraService calls getPreviewHeap() to establish access to the
* preview heap so it can be registered with SurfaceFlinger for
* efficient display updating while in preview mode.
* -# startPreview() is called. The camera instance then periodically
* sends the message CAMERA_MSG_PREVIEW_FRAME (if enabled) each time
* a new preview frame is available. If data callback code needs to use
* this memory after returning, it must copy the data.
*
* Prior to taking a picture, CameraService calls autofocus(). When auto
* focusing has completed, the camera instance sends a CAMERA_MSG_FOCUS notification,
* which informs the application whether focusing was successful. The camera instance
* only sends this message once and it is up to the application to call autoFocus()
* again if refocusing is desired.
*
* CameraService calls takePicture() to request the camera instance take a
* picture. At this point, if a shutter, postview, raw, and/or compressed callback
* is desired, the corresponding message must be enabled. As with CAMERA_MSG_PREVIEW_FRAME,
* any memory provided in a data callback must be copied if it's needed after returning.
*/
class CameraHardwareInterface : public virtual RefBase {
public:
virtual ~CameraHardwareInterface() { }
/** Return the IMemoryHeap for the preview image heap */
virtual sp<IMemoryHeap> getPreviewHeap() const = 0;
/** Return the IMemoryHeap for the raw image heap */
virtual sp<IMemoryHeap> getRawHeap() const = 0;
/** Set the notification and data callbacks */
virtual void setCallbacks(notify_callback notify_cb,
data_callback data_cb,
data_callback_timestamp data_cb_timestamp,
void* user) = 0;
/**
* The following three functions all take a msgtype,
* which is a bitmask of the messages defined in
* include/ui/Camera.h
*/
/**
* Enable a message, or set of messages.
*/
virtual void enableMsgType(int32_t msgType) = 0;
/**
* Disable a message, or a set of messages.
*/
virtual void disableMsgType(int32_t msgType) = 0;
/**
* Query whether a message, or a set of messages, is enabled.
* Note that this is operates as an AND, if any of the messages
* queried are off, this will return false.
*/
virtual bool msgTypeEnabled(int32_t msgType) = 0;
/**
* Start preview mode.
*/
virtual status_t startPreview() = 0;
#ifdef USE_MAGURO_LIBCAMERA
/**
* Query the recording buffer information from HAL.
* This is needed because the opencore expects the buffer
* information before starting the recording.
*/
virtual status_t getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) = 0;
/**
* Encode the YUV data.
*/
virtual void encodeData() = 0;
#endif
/**
* Only used if overlays are used for camera preview.
*/
virtual bool useOverlay() {return false;}
virtual status_t setOverlay(const sp<Overlay> &overlay) {return BAD_VALUE;}
#ifdef USE_GS2_LIBCAMERA
/**
* XXX Something in the binary blob but I don't know what it is to do.
*/
virtual void something() {}
#endif
/**
* Stop a previously started preview.
*/
virtual void stopPreview() = 0;
/**
* Returns true if preview is enabled.
*/
virtual bool previewEnabled() = 0;
/**
* Start record mode. When a record image is available a CAMERA_MSG_VIDEO_FRAME
* message is sent with the corresponding frame. Every record frame must be released
* by calling releaseRecordingFrame().
*/
virtual status_t startRecording() = 0;
/**
* Stop a previously started recording.
*/
virtual void stopRecording() = 0;
/**
* Returns true if recording is enabled.
*/
virtual bool recordingEnabled() = 0;
/**
* Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME.
*/
virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0;
/**
* Start auto focus, the notification callback routine is called
* with CAMERA_MSG_FOCUS once when focusing is complete. autoFocus()
* will be called again if another auto focus is needed.
*/
virtual status_t autoFocus() = 0;
/**
* Cancels auto-focus function. If the auto-focus is still in progress,
* this function will cancel it. Whether the auto-focus is in progress
* or not, this function will return the focus position to the default.
* If the camera does not support auto-focus, this is a no-op.
*/
virtual status_t cancelAutoFocus() = 0;
/**
* Take a picture.
*/
virtual status_t takePicture() = 0;
/**
* Cancel a picture that was started with takePicture. Calling this
* method when no picture is being taken is a no-op.
*/
virtual status_t cancelPicture() = 0;
/**
* Set the camera parameters. This returns BAD_VALUE if any parameter is
* invalid or not supported. */
virtual status_t setParameters(const CameraParameters& params) = 0;
/** Return the camera parameters. */
virtual CameraParameters getParameters() const = 0;
/**
* Send command to camera driver.
*/
virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
/**
* Release the hardware resources owned by this object. Note that this is
* *not* done in the destructor.
*/
virtual void release() = 0;
/**
* Dump state of the camera hardware
*/
virtual status_t dump(int fd, const Vector<String16>& args) const = 0;
#ifdef USE_MAGURO_LIBCAMERA
/**
* Take a LiveSnapshot - Picture while recording
*/
virtual status_t takeLiveSnapshot() = 0;
#endif
};
/**
* The functions need to be provided by the camera HAL.
*
* If getNumberOfCameras() returns N, the valid cameraId for getCameraInfo()
* and openCameraHardware() is 0 to N-1.
*/
extern "C" int HAL_getNumberOfCameras();
extern "C" void HAL_getCameraInfo(int cameraId, struct CameraInfo* cameraInfo);
#ifdef USE_MAGURO_LIBCAMERA
/* HAL should return NULL if it fails to open camera hardware. */
extern "C" sp<CameraHardwareInterface> HAL_openCameraHardware(int cameraId, int mode);
/* Returns whether the camera is in 3D mode or not */
extern "C" int HAL_isIn3DMode();
#else
/* HAL should return NULL if it fails to open camera hardware. */
extern "C" sp<CameraHardwareInterface> HAL_openCameraHardware(int cameraId);
#endif
}; // namespace android
#endif

View File

@ -0,0 +1,405 @@
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_CAMERA_PARAMETERS_H
#define ANDROID_HARDWARE_CAMERA_PARAMETERS_H
#include <utils/KeyedVector.h>
#include <utils/String8.h>
namespace android {
struct Size {
int width;
int height;
Size() {
width = 0;
height = 0;
}
Size(int w, int h) {
width = w;
height = h;
}
};
class CameraParameters
{
public:
CameraParameters();
CameraParameters(const String8 &params) { unflatten(params); }
~CameraParameters();
String8 flatten() const;
void unflatten(const String8 &params);
void set(const char *key, const char *value);
void set(const char *key, int value);
void setFloat(const char *key, float value);
const char *get(const char *key) const;
int getInt(const char *key) const;
float getFloat(const char *key) const;
void remove(const char *key);
void setPreviewSize(int width, int height);
void getPreviewSize(int *width, int *height) const;
void getSupportedPreviewSizes(Vector<Size> &sizes) const;
void setPreviewFrameRate(int fps);
int getPreviewFrameRate() const;
void getPreviewFpsRange(int *min_fps, int *max_fps) const;
void setPreviewFormat(const char *format);
const char *getPreviewFormat() const;
void setPictureSize(int width, int height);
void getPictureSize(int *width, int *height) const;
void getSupportedPictureSizes(Vector<Size> &sizes) const;
void setPictureFormat(const char *format);
const char *getPictureFormat() const;
void dump() const;
status_t dump(int fd, const Vector<String16>& args) const;
// Parameter keys to communicate between camera application and driver.
// The access (read/write, read only, or write only) is viewed from the
// perspective of applications, not driver.
// Preview frame size in pixels (width x height).
// Example value: "480x320". Read/Write.
static const char KEY_PREVIEW_SIZE[];
// Supported preview frame sizes in pixels.
// Example value: "800x600,480x320". Read only.
static const char KEY_SUPPORTED_PREVIEW_SIZES[];
// The current minimum and maximum preview fps. This controls the rate of
// preview frames received (CAMERA_MSG_PREVIEW_FRAME). The minimum and
// maximum fps must be one of the elements from
// KEY_SUPPORTED_PREVIEW_FPS_RANGE parameter.
// Example value: "10500,26623"
static const char KEY_PREVIEW_FPS_RANGE[];
// The supported preview fps (frame-per-second) ranges. Each range contains
// a minimum fps and maximum fps. If minimum fps equals to maximum fps, the
// camera outputs frames in fixed frame rate. If not, the camera outputs
// frames in auto frame rate. The actual frame rate fluctuates between the
// minimum and the maximum. The list has at least one element. The list is
// sorted from small to large (first by maximum fps and then minimum fps).
// Example value: "(10500,26623),(15000,26623),(30000,30000)"
static const char KEY_SUPPORTED_PREVIEW_FPS_RANGE[];
// The image format for preview frames. See CAMERA_MSG_PREVIEW_FRAME in
// frameworks/base/include/camera/Camera.h.
// Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read/write.
static const char KEY_PREVIEW_FORMAT[];
// Supported image formats for preview frames.
// Example value: "yuv420sp,yuv422i-yuyv". Read only.
static const char KEY_SUPPORTED_PREVIEW_FORMATS[];
// Number of preview frames per second. This is the target frame rate. The
// actual frame rate depends on the driver.
// Example value: "15". Read/write.
static const char KEY_PREVIEW_FRAME_RATE[];
// Supported number of preview frames per second.
// Example value: "24,15,10". Read.
static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[];
// The dimensions for captured pictures in pixels (width x height).
// Example value: "1024x768". Read/write.
static const char KEY_PICTURE_SIZE[];
// Supported dimensions for captured pictures in pixels.
// Example value: "2048x1536,1024x768". Read only.
static const char KEY_SUPPORTED_PICTURE_SIZES[];
// The image format for captured pictures. See CAMERA_MSG_COMPRESSED_IMAGE
// in frameworks/base/include/camera/Camera.h.
// Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write.
static const char KEY_PICTURE_FORMAT[];
// Supported image formats for captured pictures.
// Example value: "jpeg,rgb565". Read only.
static const char KEY_SUPPORTED_PICTURE_FORMATS[];
// The width (in pixels) of EXIF thumbnail in Jpeg picture.
// Example value: "512". Read/write.
static const char KEY_JPEG_THUMBNAIL_WIDTH[];
// The height (in pixels) of EXIF thumbnail in Jpeg picture.
// Example value: "384". Read/write.
static const char KEY_JPEG_THUMBNAIL_HEIGHT[];
// Supported EXIF thumbnail sizes (width x height). 0x0 means not thumbnail
// in EXIF.
// Example value: "512x384,320x240,0x0". Read only.
static const char KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[];
// The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100,
// with 100 being the best.
// Example value: "90". Read/write.
static const char KEY_JPEG_THUMBNAIL_QUALITY[];
// Jpeg quality of captured picture. The range is 1 to 100, with 100 being
// the best.
// Example value: "90". Read/write.
static const char KEY_JPEG_QUALITY[];
// The rotation angle in degrees relative to the orientation of the camera.
// This affects the pictures returned from CAMERA_MSG_COMPRESSED_IMAGE. The
// camera driver may set orientation in the EXIF header without rotating the
// picture. Or the driver may rotate the picture and the EXIF thumbnail. If
// the Jpeg picture is rotated, the orientation in the EXIF header will be
// missing or 1 (row #0 is top and column #0 is left side).
//
// Note that the JPEG pictures of front-facing cameras are not mirrored
// as in preview display.
//
// For example, suppose the natural orientation of the device is portrait.
// The device is rotated 270 degrees clockwise, so the device orientation is
// 270. Suppose a back-facing camera sensor is mounted in landscape and the
// top side of the camera sensor is aligned with the right edge of the
// display in natural orientation. So the camera orientation is 90. The
// rotation should be set to 0 (270 + 90).
//
// Example value: "0" or "90" or "180" or "270". Write only.
static const char KEY_ROTATION[];
// GPS latitude coordinate. GPSLatitude and GPSLatitudeRef will be stored in
// JPEG EXIF header.
// Example value: "25.032146" or "-33.462809". Write only.
static const char KEY_GPS_LATITUDE[];
// GPS longitude coordinate. GPSLongitude and GPSLongitudeRef will be stored
// in JPEG EXIF header.
// Example value: "121.564448" or "-70.660286". Write only.
static const char KEY_GPS_LONGITUDE[];
// GPS altitude. GPSAltitude and GPSAltitudeRef will be stored in JPEG EXIF
// header.
// Example value: "21.0" or "-5". Write only.
static const char KEY_GPS_ALTITUDE[];
// GPS timestamp (UTC in seconds since January 1, 1970). This should be
// stored in JPEG EXIF header.
// Example value: "1251192757". Write only.
static const char KEY_GPS_TIMESTAMP[];
// GPS Processing Method
// Example value: "GPS" or "NETWORK". Write only.
static const char KEY_GPS_PROCESSING_METHOD[];
// Current white balance setting.
// Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write.
static const char KEY_WHITE_BALANCE[];
// Supported white balance settings.
// Example value: "auto,incandescent,daylight". Read only.
static const char KEY_SUPPORTED_WHITE_BALANCE[];
// Current color effect setting.
// Example value: "none" or EFFECT_XXX constants. Read/write.
static const char KEY_EFFECT[];
// Supported color effect settings.
// Example value: "none,mono,sepia". Read only.
static const char KEY_SUPPORTED_EFFECTS[];
// Current antibanding setting.
// Example value: "auto" or ANTIBANDING_XXX constants. Read/write.
static const char KEY_ANTIBANDING[];
// Supported antibanding settings.
// Example value: "auto,50hz,60hz,off". Read only.
static const char KEY_SUPPORTED_ANTIBANDING[];
// Current scene mode.
// Example value: "auto" or SCENE_MODE_XXX constants. Read/write.
static const char KEY_SCENE_MODE[];
// Supported scene mode settings.
// Example value: "auto,night,fireworks". Read only.
static const char KEY_SUPPORTED_SCENE_MODES[];
// Current flash mode.
// Example value: "auto" or FLASH_MODE_XXX constants. Read/write.
static const char KEY_FLASH_MODE[];
// Supported flash modes.
// Example value: "auto,on,off". Read only.
static const char KEY_SUPPORTED_FLASH_MODES[];
// Current focus mode. This will not be empty. Applications should call
// CameraHardwareInterface.autoFocus to start the focus if focus mode is
// FOCUS_MODE_AUTO or FOCUS_MODE_MACRO.
// Example value: "auto" or FOCUS_MODE_XXX constants. Read/write.
static const char KEY_FOCUS_MODE[];
// Supported focus modes.
// Example value: "auto,macro,fixed". Read only.
static const char KEY_SUPPORTED_FOCUS_MODES[];
// Focal length in millimeter.
// Example value: "4.31". Read only.
static const char KEY_FOCAL_LENGTH[];
// Horizontal angle of view in degrees.
// Example value: "54.8". Read only.
static const char KEY_HORIZONTAL_VIEW_ANGLE[];
// Vertical angle of view in degrees.
// Example value: "42.5". Read only.
static const char KEY_VERTICAL_VIEW_ANGLE[];
// Exposure compensation index. 0 means exposure is not adjusted.
// Example value: "0" or "5". Read/write.
static const char KEY_EXPOSURE_COMPENSATION[];
// The maximum exposure compensation index (>=0).
// Example value: "6". Read only.
static const char KEY_MAX_EXPOSURE_COMPENSATION[];
// The minimum exposure compensation index (<=0).
// Example value: "-6". Read only.
static const char KEY_MIN_EXPOSURE_COMPENSATION[];
// The exposure compensation step. Exposure compensation index multiply by
// step eqals to EV. Ex: if exposure compensation index is 6 and step is
// 0.3333, EV is -2.
// Example value: "0.333333333" or "0.5". Read only.
static const char KEY_EXPOSURE_COMPENSATION_STEP[];
// Current zoom value.
// Example value: "0" or "6". Read/write.
static const char KEY_ZOOM[];
// Maximum zoom value.
// Example value: "6". Read only.
static const char KEY_MAX_ZOOM[];
// The zoom ratios of all zoom values. The zoom ratio is in 1/100
// increments. Ex: a zoom of 3.2x is returned as 320. The number of list
// elements is KEY_MAX_ZOOM + 1. The first element is always 100. The last
// element is the zoom ratio of zoom value KEY_MAX_ZOOM.
// Example value: "100,150,200,250,300,350,400". Read only.
static const char KEY_ZOOM_RATIOS[];
// Whether zoom is supported. Zoom is supported if the value is "true". Zoom
// is not supported if the value is not "true" or the key does not exist.
// Example value: "true". Read only.
static const char KEY_ZOOM_SUPPORTED[];
// Whether if smooth zoom is supported. Smooth zoom is supported if the
// value is "true". It is not supported if the value is not "true" or the
// key does not exist.
// See CAMERA_CMD_START_SMOOTH_ZOOM, CAMERA_CMD_STOP_SMOOTH_ZOOM, and
// CAMERA_MSG_ZOOM in frameworks/base/include/camera/Camera.h.
// Example value: "true". Read only.
static const char KEY_SMOOTH_ZOOM_SUPPORTED[];
// The distances (in meters) from the camera to where an object appears to
// be in focus. The object is sharpest at the optimal focus distance. The
// depth of field is the far focus distance minus near focus distance.
//
// Focus distances may change after starting auto focus, canceling auto
// focus, or starting the preview. Applications can read this anytime to get
// the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS,
// focus distances may change from time to time.
//
// This is intended to estimate the distance between the camera and the
// subject. After autofocus, the subject distance may be within near and far
// focus distance. However, the precision depends on the camera hardware,
// autofocus algorithm, the focus area, and the scene. The error can be
// large and it should be only used as a reference.
//
// Far focus distance > optimal focus distance > near focus distance. If
// the far focus distance is infinity, the value should be "Infinity" (case
// sensitive). The format is three float values separated by commas. The
// first is near focus distance. The second is optimal focus distance. The
// third is far focus distance.
// Example value: "0.95,1.9,Infinity" or "0.049,0.05,0.051". Read only.
static const char KEY_FOCUS_DISTANCES[];
// The image format for video frames. See CAMERA_MSG_VIDEO_FRAME in
// frameworks/base/include/camera/Camera.h.
// Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read only.
static const char KEY_VIDEO_FRAME_FORMAT[];
// Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED.
static const char TRUE[];
// Value for KEY_FOCUS_DISTANCES.
static const char FOCUS_DISTANCE_INFINITY[];
// Values for white balance settings.
static const char WHITE_BALANCE_AUTO[];
static const char WHITE_BALANCE_INCANDESCENT[];
static const char WHITE_BALANCE_FLUORESCENT[];
static const char WHITE_BALANCE_WARM_FLUORESCENT[];
static const char WHITE_BALANCE_DAYLIGHT[];
static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[];
static const char WHITE_BALANCE_TWILIGHT[];
static const char WHITE_BALANCE_SHADE[];
// Values for effect settings.
static const char EFFECT_NONE[];
static const char EFFECT_MONO[];
static const char EFFECT_NEGATIVE[];
static const char EFFECT_SOLARIZE[];
static const char EFFECT_SEPIA[];
static const char EFFECT_POSTERIZE[];
static const char EFFECT_WHITEBOARD[];
static const char EFFECT_BLACKBOARD[];
static const char EFFECT_AQUA[];
// Values for antibanding settings.
static const char ANTIBANDING_AUTO[];
static const char ANTIBANDING_50HZ[];
static const char ANTIBANDING_60HZ[];
static const char ANTIBANDING_OFF[];
// Values for flash mode settings.
// Flash will not be fired.
static const char FLASH_MODE_OFF[];
// Flash will be fired automatically when required. The flash may be fired
// during preview, auto-focus, or snapshot depending on the driver.
static const char FLASH_MODE_AUTO[];
// Flash will always be fired during snapshot. The flash may also be
// fired during preview or auto-focus depending on the driver.
static const char FLASH_MODE_ON[];
// Flash will be fired in red-eye reduction mode.
static const char FLASH_MODE_RED_EYE[];
// Constant emission of light during preview, auto-focus and snapshot.
// This can also be used for video recording.
static const char FLASH_MODE_TORCH[];
// Values for scene mode settings.
static const char SCENE_MODE_AUTO[];
static const char SCENE_MODE_ACTION[];
static const char SCENE_MODE_PORTRAIT[];
static const char SCENE_MODE_LANDSCAPE[];
static const char SCENE_MODE_NIGHT[];
static const char SCENE_MODE_NIGHT_PORTRAIT[];
static const char SCENE_MODE_THEATRE[];
static const char SCENE_MODE_BEACH[];
static const char SCENE_MODE_SNOW[];
static const char SCENE_MODE_SUNSET[];
static const char SCENE_MODE_STEADYPHOTO[];
static const char SCENE_MODE_FIREWORKS[];
static const char SCENE_MODE_SPORTS[];
static const char SCENE_MODE_PARTY[];
static const char SCENE_MODE_CANDLELIGHT[];
// Applications are looking for a barcode. Camera driver will be optimized
// for barcode reading.
static const char SCENE_MODE_BARCODE[];
// Formats for setPreviewFormat and setPictureFormat.
static const char PIXEL_FORMAT_YUV422SP[];
static const char PIXEL_FORMAT_YUV420SP[]; // NV21
static const char PIXEL_FORMAT_YUV422I[]; // YUY2
static const char PIXEL_FORMAT_RGB565[];
static const char PIXEL_FORMAT_JPEG[];
// Values for focus mode settings.
// Auto-focus mode. Applications should call
// CameraHardwareInterface.autoFocus to start the focus in this mode.
static const char FOCUS_MODE_AUTO[];
// Focus is set at infinity. Applications should not call
// CameraHardwareInterface.autoFocus in this mode.
static const char FOCUS_MODE_INFINITY[];
// Macro (close-up) focus mode. Applications should call
// CameraHardwareInterface.autoFocus to start the focus in this mode.
static const char FOCUS_MODE_MACRO[];
// Focus is fixed. The camera is always in this mode if the focus is not
// adjustable. If the camera has auto-focus, this mode can fix the
// focus, which is usually at hyperfocal distance. Applications should
// not call CameraHardwareInterface.autoFocus in this mode.
static const char FOCUS_MODE_FIXED[];
// Extended depth of field (EDOF). Focusing is done digitally and
// continuously. Applications should not call
// CameraHardwareInterface.autoFocus in this mode.
static const char FOCUS_MODE_EDOF[];
// Continuous auto focus mode intended for video recording. The camera
// continuously tries to focus. This is ideal for shooting video.
// Applications still can call CameraHardwareInterface.takePicture in this
// mode but the subject may not be in focus. Auto focus starts when the
// parameter is set. Applications should not call
// CameraHardwareInterface.autoFocus in this mode. To stop continuous focus,
// applications should change the focus mode to other modes.
static const char FOCUS_MODE_CONTINUOUS_VIDEO[];
private:
DefaultKeyedVector<String8,String8> mMap;
};
}; // namespace android
#endif

View File

@ -0,0 +1,51 @@
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_ICAMERA_APP_H
#define ANDROID_HARDWARE_ICAMERA_APP_H
#include <utils/RefBase.h>
#include <binder/IInterface.h>
#include <binder/Parcel.h>
#include <binder/IMemory.h>
#include <utils/Timers.h>
namespace android {
class ICameraClient: public IInterface
{
public:
DECLARE_META_INTERFACE(CameraClient);
virtual void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) = 0;
virtual void dataCallback(int32_t msgType, const sp<IMemory>& data) = 0;
virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& data) = 0;
};
// ----------------------------------------------------------------------------
class BnCameraClient: public BnInterface<ICameraClient>
{
public:
virtual status_t onTransact( uint32_t code,
const Parcel& data,
Parcel* reply,
uint32_t flags = 0);
};
}; // namespace android
#endif