OSDN Git Service

Add specific version number constants to Camera HAL.
authorEino-Ville Talvala <etalvala@google.com>
Tue, 27 Mar 2012 23:15:25 +0000 (16:15 -0700)
committerEino-Ville Talvala <etalvala@google.com>
Tue, 27 Mar 2012 23:15:25 +0000 (16:15 -0700)
These constants should be used by HAL implementations to indicate
which versions of the module and device APIs they support.

Change-Id: I4b6eae278481545694e6a1827833b5958c26720c

include/hardware/camera.h
include/hardware/camera2.h
include/hardware/camera_common.h

index 3530f8d..b7182f8 100644 (file)
 #include "camera_common.h"
 
 /**
- * Camera device HAL, initial version [ HARDWARE_DEVICE_API_VERSION(1,0) ]
+ * Camera device HAL, initial version [ CAMERA_DEVICE_API_VERSION_1_0 ]
  *
  * Supports the android.hardware.Camera API.
  *
  * Camera devices that support this version of the HAL must return a value in
  * the range HARDWARE_DEVICE_API_VERSION(0,0)-(1,FF) in
- * camera_device_t.common.version.
+ * camera_device_t.common.version. CAMERA_DEVICE_API_VERSION_1_0 is the
+ * recommended value.
  *
  * Camera modules that implement version 2.0 or higher of camera_module_t must
  * also return the value of camera_device_t.common.version in
@@ -281,7 +282,8 @@ typedef struct camera_device_ops {
 typedef struct camera_device {
     /**
      * camera_device.common.version must be in the range
-     * HARDWARE_DEVICE_API_VERSION(0,0)-(1,FF). (1,0) is recommended.
+     * HARDWARE_DEVICE_API_VERSION(0,0)-(1,FF). CAMERA_DEVICE_API_VERSION_1_0 is
+     * recommended.
      */
     hw_device_t common;
     camera_device_ops_t *ops;
index f94c56c..48f5c35 100644 (file)
@@ -20,7 +20,7 @@
 #include "camera_common.h"
 
 /**
- * Camera device HAL 2.0 [ HARDWARE_DEVICE_API_VERSION(2,0) ]
+ * Camera device HAL 2.0 [ CAMERA_DEVICE_API_VERSION_2_0 ]
  *
  * EXPERIMENTAL.
  *
@@ -28,7 +28,7 @@
  * android.hardware.Camera APIs.
  *
  * Camera devices that support this version of the HAL must return
- * CAMERA_DEVICE_API_VERSION(2, 0) in camera_device_t.common.version and in
+ * CAMERA_DEVICE_API_VERSION_2_0 in camera_device_t.common.version and in
  * camera_info_t.device_version (from camera_module_t.get_camera_info).
  *
  * Camera modules that may contain version 2.0 devices must implement at least
@@ -265,7 +265,7 @@ typedef struct camera2_device_ops {
 
 typedef struct camera2_device {
     /**
-     * common.version must equal HARDWARE_DEVICE_API_VERSION(2, 0) to identify
+     * common.version must equal CAMERA_DEVICE_API_VERSION_2_0 to identify
      * this device as implementing version 2.0 of the camera device HAL.
      */
     hw_device_t common;
index 0a13d5c..593cd5f 100644 (file)
@@ -41,7 +41,7 @@ __BEGIN_DECLS
  * the minor version.
  *
  *******************************************************************************
- * Versions: 0.X-1.X
+ * Versions: 0.X - 1.X [CAMERA_MODULE_API_VERSION_1_0]
  *
  *   Camera modules that report these version numbers implement the initial
  *   camera module HAL interface. All camera devices openable through this
@@ -51,7 +51,7 @@ __BEGIN_DECLS
  *   devices.
  *
  *******************************************************************************
- * Version: 2.0
+ * Version: 2.0 [CAMERA_MODULE_API_VERSION_2_0]
  *
  *   Camera modules that report this version number implement the second version
  *   of the camera module HAL interface. Camera devices openable through this
@@ -61,10 +61,28 @@ __BEGIN_DECLS
  *   device_version field is 2.0 or higher.
  */
 
+/**
+ * Predefined macros for currently-defined version numbers
+ */
+
+/**
+ * All module versions <= HARDWARE_MODULE_API_VERSION(1, 0xFF) must be treated
+ * as CAMERA_MODULE_API_VERSION_1_0
+ */
+#define CAMERA_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
+#define CAMERA_MODULE_API_VERSION_2_0 HARDWARE_MODULE_API_VERSION(2, 0)
+
+#define CAMERA_MODULE_API_VERSION_CURRENT CAMERA_MODULE_API_VERSION_2_0
+
+/**
+ * All device versions <= HARDWARE_DEVICE_API_VERSION(1, 0xFF) must be treated
+ * as CAMERA_DEVICE_API_VERSION_1_0
+ */
+#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
+#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0)
 
-#define CAMERA_MODULE_API_VERSION HARDWARE_MODULE_API_VERSION(2, 0)
-// Stable version for device, version 2.0 is experimental
-#define CAMERA_DEVICE_API_VERSION HARDWARE_DEVICE_API_VERSION(1, 0)
+// Device version 2.0 is experimental
+#define CAMERA_DEVICE_API_VERSION_CURRENT CAMERA_DEVICE_API_VERSION_1_0
 
 /**
  * Defined in /system/media/camera/include/camera_metadata.h
@@ -103,12 +121,12 @@ struct camera_info {
      *
      * Version information (based on camera_module_t.common.module_api_version):
      *
-     *  HARDWARE_MODULE_API_VERSION(0, 0)-(1, FF):
+     *  CAMERA_MODULE_API_VERSION_1_0:
      *
-     *    Not valid. Can be assumed to be HARDWARE_DEVICE_API_VERSION(1,0). Do
+     *    Not valid. Can be assumed to be CAMERA_DEVICE_API_VERSION_1_0. Do
      *    not read this field.
      *
-     *  HARDWARE_MODULE_API_VERSION(2, 0):
+     *  CAMERA_MODULE_API_VERSION_2_0:
      *
      *    Always valid
      *
@@ -121,15 +139,15 @@ struct camera_info {
      *
      * Version information (based on camera_module_t.common.module_api_version):
      *
-     *  HARDWARE_MODULE_API_VERSION(0, 0)-(1, FF):
+     *  CAMERA_MODULE_API_VERSION_1_0:
      *
      *    Not valid. Extra characteristics are not available. Do not read this
      *    field.
      *
-     *  HARDWARE_MODULE_API_VERSION(2, 0):
+     *  CAMERA_MODULE_API_VERSION_2_0:
      *
-     *    Valid if device_version >= HARDWARE_DEVICE_API_VERSION(2,0). Do not
-     *    read otherwise.
+     *    Valid if device_version >= CAMERA_DEVICE_API_VERSION_2_0. Do not read
+     *    otherwise.
      *
      */
     camera_metadata_t *static_camera_characteristics;