summaryrefslogtreecommitdiffstats
path: root/include/camera
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-02-09 17:46:37 -0800
committerMathias Agopian <mathias@google.com>2010-02-11 13:16:22 -0800
commit3cf613507f1e2f7bd932d921a6e222e426fd3be4 (patch)
tree20c9dd57e2227046ab1d6fc1185f4136c6dac12e /include/camera
parent988e3f0b2c74095deae580157c57935a98573052 (diff)
downloadframeworks_av-3cf613507f1e2f7bd932d921a6e222e426fd3be4.zip
frameworks_av-3cf613507f1e2f7bd932d921a6e222e426fd3be4.tar.gz
frameworks_av-3cf613507f1e2f7bd932d921a6e222e426fd3be4.tar.bz2
split libsurfaceflinger_client and libcamera_client out of libui
Diffstat (limited to 'include/camera')
-rw-r--r--include/camera/Camera.h214
-rw-r--r--include/camera/CameraHardwareInterface.h221
-rw-r--r--include/camera/CameraParameters.h284
-rw-r--r--include/camera/ICamera.h108
-rw-r--r--include/camera/ICameraClient.h51
-rw-r--r--include/camera/ICameraService.h55
6 files changed, 933 insertions, 0 deletions
diff --git a/include/camera/Camera.h b/include/camera/Camera.h
new file mode 100644
index 0000000..ee2b30c
--- /dev/null
+++ b/include/camera/Camera.h
@@ -0,0 +1,214 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2008 HTC Inc.
+ *
+ * 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 <camera/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,
+ CAMERA_CMD_SET_DISPLAY_ORIENTATION = 3,
+};
+
+// camera fatal errors
+enum {
+ CAMERA_ERROR_UKNOWN = 1,
+ CAMERA_ERROR_SERVER_DIED = 100
+};
+
+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 sp<Camera> connect();
+ ~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
diff --git a/include/camera/CameraHardwareInterface.h b/include/camera/CameraHardwareInterface.h
new file mode 100644
index 0000000..d877c74
--- /dev/null
+++ b/include/camera/CameraHardwareInterface.h
@@ -0,0 +1,221 @@
+/*
+ * 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/Camera.h>
+#include <camera/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;
+
+ /**
+ * 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;}
+
+ /**
+ * 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. */
+ 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;
+};
+
+/** factory function to instantiate a camera hardware object */
+extern "C" sp<CameraHardwareInterface> openCameraHardware();
+
+}; // namespace android
+
+#endif
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h
new file mode 100644
index 0000000..e328f33
--- /dev/null
+++ b/include/camera/CameraParameters.h
@@ -0,0 +1,284 @@
+/*
+ * 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 {
+
+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;
+
+ /* preview-size=176x144 */
+ void setPreviewSize(int width, int height);
+ void getPreviewSize(int *width, int *height) const;
+
+ /* preview-fps=15 */
+ void setPreviewFrameRate(int fps);
+ int getPreviewFrameRate() const;
+
+ /* preview-format=rgb565|yuv422 */
+ void setPreviewFormat(const char *format);
+ const char *getPreviewFormat() const;
+
+ /* picture-size=1024x768 */
+ void setPictureSize(int width, int height);
+ void getPictureSize(int *width, int *height) const;
+
+ /* picture-format=yuv422|jpeg */
+ 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 image format for preview frames.
+ // 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.
+ // 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.
+ // 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 orientation of the device in degrees. For example, suppose the
+ // natural position of the device is landscape. If the user takes a picture
+ // in landscape mode in 2048x1536 resolution, the rotation will be set to
+ // "0". If the user rotates the phone 90 degrees clockwise, the rotation
+ // should be set to "90".
+ // The camera driver can set orientation in the EXIF header without rotating
+ // the picture. Or the driver can rotate the picture and the EXIF thumbnail.
+ // If the Jpeg picture is rotated, the orientation in the EXIF header should
+ // be missing or 1 (row #0 is top and column #0 is left side). The driver
+ // should not set default value for this parameter.
+ // Example value: "0" or "90" or "180" or "270". Write only.
+ static const char KEY_ROTATION[];
+ // GPS latitude coordinate. This will be stored in JPEG EXIF header.
+ // Example value: "25.032146". Write only.
+ static const char KEY_GPS_LATITUDE[];
+ // GPS longitude coordinate. This will be stored in JPEG EXIF header.
+ // Example value: "121.564448". Write only.
+ static const char KEY_GPS_LONGITUDE[];
+ // GPS altitude. This will be stored in JPEG EXIF header.
+ // Example value: "21.0". 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[];
+ // 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. If the camera does not support auto-focus, the value
+ // should be FOCUS_MODE_FIXED. If the focus mode is not FOCUS_MODE_FIXED or
+ // or FOCUS_MODE_INFINITY, applications should call
+ // CameraHardwareInterface.autoFocus to start the focus.
+ // 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. The value is multiplied by 100. -100 means -1 EV.
+ // 130 means +1.3 EV.
+ // Example value: "0" or "133". Read/write.
+ static const char KEY_EXPOSURE_COMPENSATION[];
+ // Supported exposure compensation.
+ // Example value: "-100,-66,-33,0,33,66,100". Read only.
+ static const char KEY_SUPPORTED_EXPOSURE_COMPENSATION[];
+
+
+ // 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[];
+
+ // 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.
+ 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[];
+ 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[];
+
+private:
+ DefaultKeyedVector<String8,String8> mMap;
+};
+
+}; // namespace android
+
+#endif
diff --git a/include/camera/ICamera.h b/include/camera/ICamera.h
new file mode 100644
index 0000000..6fcf9e5
--- /dev/null
+++ b/include/camera/ICamera.h
@@ -0,0 +1,108 @@
+/*
+ * 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_H
+#define ANDROID_HARDWARE_ICAMERA_H
+
+#include <utils/RefBase.h>
+#include <binder/IInterface.h>
+#include <binder/Parcel.h>
+#include <surfaceflinger/ISurface.h>
+#include <binder/IMemory.h>
+#include <utils/String8.h>
+#include <camera/Camera.h>
+
+namespace android {
+
+class ICameraClient;
+
+class ICamera: public IInterface
+{
+public:
+ DECLARE_META_INTERFACE(Camera);
+
+ virtual void disconnect() = 0;
+
+ // connect new client with existing camera remote
+ virtual status_t connect(const sp<ICameraClient>& client) = 0;
+
+ // prevent other processes from using this ICamera interface
+ virtual status_t lock() = 0;
+
+ // allow other processes to use this ICamera interface
+ virtual status_t unlock() = 0;
+
+ // pass the buffered ISurface to the camera service
+ virtual status_t setPreviewDisplay(const sp<ISurface>& surface) = 0;
+
+ // set the preview callback flag to affect how the received frames from
+ // preview are handled.
+ virtual void setPreviewCallbackFlag(int flag) = 0;
+
+ // start preview mode, must call setPreviewDisplay first
+ virtual status_t startPreview() = 0;
+
+ // stop preview mode
+ virtual void stopPreview() = 0;
+
+ // get preview state
+ virtual bool previewEnabled() = 0;
+
+ // start recording mode
+ virtual status_t startRecording() = 0;
+
+ // stop recording mode
+ virtual void stopRecording() = 0;
+
+ // get recording state
+ virtual bool recordingEnabled() = 0;
+
+ // release a recording frame
+ virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0;
+
+ // auto focus
+ virtual status_t autoFocus() = 0;
+
+ // cancel auto focus
+ virtual status_t cancelAutoFocus() = 0;
+
+ // take a picture
+ virtual status_t takePicture() = 0;
+
+ // set preview/capture parameters - key/value pairs
+ virtual status_t setParameters(const String8& params) = 0;
+
+ // get preview/capture parameters - key/value pairs
+ virtual String8 getParameters() const = 0;
+
+ // send command to camera driver
+ virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
+};
+
+// ----------------------------------------------------------------------------
+
+class BnCamera: public BnInterface<ICamera>
+{
+public:
+ virtual status_t onTransact( uint32_t code,
+ const Parcel& data,
+ Parcel* reply,
+ uint32_t flags = 0);
+};
+
+}; // namespace android
+
+#endif
diff --git a/include/camera/ICameraClient.h b/include/camera/ICameraClient.h
new file mode 100644
index 0000000..236d0f6
--- /dev/null
+++ b/include/camera/ICameraClient.h
@@ -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
diff --git a/include/camera/ICameraService.h b/include/camera/ICameraService.h
new file mode 100644
index 0000000..82b1283
--- /dev/null
+++ b/include/camera/ICameraService.h
@@ -0,0 +1,55 @@
+/*
+ * 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_ICAMERASERVICE_H
+#define ANDROID_HARDWARE_ICAMERASERVICE_H
+
+#include <utils/RefBase.h>
+#include <binder/IInterface.h>
+#include <binder/Parcel.h>
+
+#include <camera/ICameraClient.h>
+#include <camera/ICamera.h>
+
+namespace android {
+
+class ICameraService : public IInterface
+{
+public:
+ enum {
+ CONNECT = IBinder::FIRST_CALL_TRANSACTION,
+ };
+
+public:
+ DECLARE_META_INTERFACE(CameraService);
+
+ virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient) = 0;
+};
+
+// ----------------------------------------------------------------------------
+
+class BnCameraService: public BnInterface<ICameraService>
+{
+public:
+ virtual status_t onTransact( uint32_t code,
+ const Parcel& data,
+ Parcel* reply,
+ uint32_t flags = 0);
+};
+
+}; // namespace android
+
+#endif