summaryrefslogtreecommitdiffstats
path: root/include/camera
diff options
context:
space:
mode:
Diffstat (limited to 'include/camera')
-rw-r--r--include/camera/Camera.h43
-rw-r--r--include/camera/CameraHardwareInterface.h12
-rw-r--r--include/camera/CameraParameters.h107
-rw-r--r--include/camera/ICameraService.h10
4 files changed, 153 insertions, 19 deletions
diff --git a/include/camera/Camera.h b/include/camera/Camera.h
index 57968e3..e6d84ba 100644
--- a/include/camera/Camera.h
+++ b/include/camera/Camera.h
@@ -83,6 +83,18 @@ enum {
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,
};
@@ -92,6 +104,32 @@ enum {
CAMERA_ERROR_SERVER_DIED = 100
};
+enum {
+ CAMERA_FACING_BACK = 0,
+ CAMERA_FACING_FRONT = 1 /* The camera faces to the user */
+};
+
+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, but the camera
+ * sensor is mounted in landscape. If the top side of the camera sensor is
+ * aligned with the right edge of the display in natural orientation, the
+ * value should be 90.
+ */
+ int orientation;
+};
+
class ICameraService;
class ICamera;
class Surface;
@@ -112,7 +150,10 @@ 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();
+ static int32_t getNumberOfCameras();
+ static status_t getCameraInfo(int cameraId,
+ struct CameraInfo* cameraInfo);
+ static sp<Camera> connect(int cameraId);
~Camera();
void init();
diff --git a/include/camera/CameraHardwareInterface.h b/include/camera/CameraHardwareInterface.h
index d877c74..6a66e3c 100644
--- a/include/camera/CameraHardwareInterface.h
+++ b/include/camera/CameraHardwareInterface.h
@@ -213,8 +213,16 @@ public:
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();
+/**
+ * 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);
+/* HAL should return NULL if it fails to open camera hardware. */
+extern "C" sp<CameraHardwareInterface> HAL_openCameraHardware(int cameraId);
}; // namespace android
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h
index 5ea83a5..53039a0 100644
--- a/include/camera/CameraParameters.h
+++ b/include/camera/CameraParameters.h
@@ -22,6 +22,21 @@
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:
@@ -43,12 +58,15 @@ public:
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;
@@ -65,13 +83,29 @@ public:
// 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.
+ // 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.
+ // 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.
@@ -83,7 +117,8 @@ public:
// 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.
+ // 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.
@@ -119,14 +154,17 @@ public:
// 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.
+ // 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. This will be stored in JPEG EXIF header.
- // Example value: "121.564448". Write only.
+ // 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. This will be stored in JPEG EXIF header.
- // Example value: "21.0". Write only.
+ // 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.
@@ -165,10 +203,9 @@ public:
// 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.
+ // 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.
@@ -221,9 +258,40 @@ public:
// 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[];
@@ -294,11 +362,14 @@ public:
static const char PIXEL_FORMAT_JPEG[];
// Values for focus mode settings.
- // Auto-focus mode.
+ // 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
@@ -309,6 +380,14 @@ public:
// 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;
diff --git a/include/camera/ICameraService.h b/include/camera/ICameraService.h
index 82b1283..7d70c1e 100644
--- a/include/camera/ICameraService.h
+++ b/include/camera/ICameraService.h
@@ -30,13 +30,19 @@ class ICameraService : public IInterface
{
public:
enum {
- CONNECT = IBinder::FIRST_CALL_TRANSACTION,
+ GET_NUMBER_OF_CAMERAS = IBinder::FIRST_CALL_TRANSACTION,
+ GET_CAMERA_INFO,
+ CONNECT
};
public:
DECLARE_META_INTERFACE(CameraService);
- virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient) = 0;
+ virtual int32_t getNumberOfCameras() = 0;
+ virtual status_t getCameraInfo(int cameraId,
+ struct CameraInfo* cameraInfo) = 0;
+ virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient,
+ int cameraId) = 0;
};
// ----------------------------------------------------------------------------