18bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala/* 28bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Copyright (C) 2012 The Android Open Source Project 38bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 48bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Licensed under the Apache License, Version 2.0 (the "License"); 58bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * you may not use this file except in compliance with the License. 68bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * You may obtain a copy of the License at 78bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 88bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * http://www.apache.org/licenses/LICENSE-2.0 98bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 108bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Unless required by applicable law or agreed to in writing, software 118bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * distributed under the License is distributed on an "AS IS" BASIS, 128bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 138bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * See the License for the specific language governing permissions and 148bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * limitations under the License. 158bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala */ 168bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 178bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala// FIXME: add well-defined names for cameras 188bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 198bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#ifndef ANDROID_INCLUDE_CAMERA_COMMON_H 208bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#define ANDROID_INCLUDE_CAMERA_COMMON_H 218bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 228bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#include <stdint.h> 238bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#include <sys/cdefs.h> 248bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#include <sys/types.h> 258bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#include <cutils/native_handle.h> 268bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#include <system/camera.h> 278bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#include <hardware/hardware.h> 288bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#include <hardware/gralloc.h> 298bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 308bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala__BEGIN_DECLS 318bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 328bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala/** 338bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * The id of this module 348bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala */ 358bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#define CAMERA_HARDWARE_MODULE_ID "camera" 368bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 378bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala/** 388bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Module versioning information for the Camera hardware module, based on 398bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * camera_module_t.common.module_api_version. The two most significant hex 408bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * digits represent the major version, and the two least significant represent 418bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * the minor version. 428bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 438bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala ******************************************************************************* 44ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * Versions: 0.X - 1.X [CAMERA_MODULE_API_VERSION_1_0] 458bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 468bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Camera modules that report these version numbers implement the initial 478bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * camera module HAL interface. All camera devices openable through this 488bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * module support only version 1 of the camera device HAL. The device_version 498bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * and static_camera_characteristics fields of camera_info are not valid. Only 508bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * the android.hardware.Camera API can be supported by this module and its 518bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * devices. 528bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 538bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala ******************************************************************************* 54ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * Version: 2.0 [CAMERA_MODULE_API_VERSION_2_0] 558bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 568bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Camera modules that report this version number implement the second version 578bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * of the camera module HAL interface. Camera devices openable through this 588bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * module may support either version 1.0 or version 2.0 of the camera device 598bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * HAL interface. The device_version field of camera_info is always valid; the 608bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * static_camera_characteristics field of camera_info is valid if the 618bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * device_version field is 2.0 or higher. 62d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 63d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala ******************************************************************************* 64d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * Version: 2.1 [CAMERA_MODULE_API_VERSION_2_1] 65d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 66d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * This camera module version adds support for asynchronous callbacks to the 67d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * framework from the camera HAL module, which is used to notify the framework 68d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * about changes to the camera module state. Modules that provide a valid 69d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * set_callbacks() method must report at least this version number. 7019b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 7119b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray ******************************************************************************* 7219b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Version: 2.2 [CAMERA_MODULE_API_VERSION_2_2] 7319b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 7419b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * This camera module version adds vendor tag support from the module, and 7519b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * deprecates the old vendor_tag_query_ops that were previously only 7619b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * accessible with a device open. 778bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala */ 788bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 79ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala/** 80ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * Predefined macros for currently-defined version numbers 81ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala */ 82ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala 83ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala/** 84ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * All module versions <= HARDWARE_MODULE_API_VERSION(1, 0xFF) must be treated 85ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * as CAMERA_MODULE_API_VERSION_1_0 86ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala */ 87ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala#define CAMERA_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0) 88ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala#define CAMERA_MODULE_API_VERSION_2_0 HARDWARE_MODULE_API_VERSION(2, 0) 89d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala#define CAMERA_MODULE_API_VERSION_2_1 HARDWARE_MODULE_API_VERSION(2, 1) 9019b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray#define CAMERA_MODULE_API_VERSION_2_2 HARDWARE_MODULE_API_VERSION(2, 2) 91ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala 9219b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray#define CAMERA_MODULE_API_VERSION_CURRENT CAMERA_MODULE_API_VERSION_2_2 93ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala 94ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala/** 95ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * All device versions <= HARDWARE_DEVICE_API_VERSION(1, 0xFF) must be treated 96ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * as CAMERA_DEVICE_API_VERSION_1_0 97ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala */ 98ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) 99ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) 100d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1) 101d2a877536a1fe22101cf40def1b6d07e35c3868aEino-Ville Talvala#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0) 1029d51856d71b4aa25ca925b1ee7d9950878847f63Eino-Ville Talvala#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1) 1038bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 104d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala// Device version 2.x is outdated; device version 3.0 is experimental 105ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala#define CAMERA_DEVICE_API_VERSION_CURRENT CAMERA_DEVICE_API_VERSION_1_0 1068bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 1078bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala/** 108d0ca70d834f4c69bf798b5ac6a47a20f0ba908d1James Dong * Defined in /system/media/camera/include/system/camera_metadata.h 1098bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala */ 1108bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvalatypedef struct camera_metadata camera_metadata_t; 1118bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 1129acc74043b4fd236fbfea492ba8ef3764d9dc079Alex Raytypedef struct camera_info { 1138bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala /** 1148bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * The direction that the camera faces to. It should be CAMERA_FACING_BACK 1158bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * or CAMERA_FACING_FRONT. 1168bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 1178bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Version information: 1188bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Valid in all camera_module versions 1198bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala */ 1208bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala int facing; 1218bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 1228bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala /** 1238bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * The orientation of the camera image. The value is the angle that the 1248bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * camera image needs to be rotated clockwise so it shows correctly on the 1258bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * display in its natural orientation. It should be 0, 90, 180, or 270. 1268bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 1278bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * For example, suppose a device has a naturally tall screen. The 128d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * back-facing camera sensor is mounted in landscape. You are looking at the 129d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * screen. If the top side of the camera sensor is aligned with the right 130d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * edge of the screen in natural orientation, the value should be 90. If the 131d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * top side of a front-facing camera sensor is aligned with the right of the 132d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * screen, the value should be 270. 1338bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 1348bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Version information: 1358bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Valid in all camera_module versions 1368bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala */ 1378bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala int orientation; 1388bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 1398bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala /** 1408bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * The value of camera_device_t.common.version. 1418bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 1428bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Version information (based on camera_module_t.common.module_api_version): 1438bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 144ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * CAMERA_MODULE_API_VERSION_1_0: 1458bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 146ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * Not valid. Can be assumed to be CAMERA_DEVICE_API_VERSION_1_0. Do 1478bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * not read this field. 1488bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 149d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * CAMERA_MODULE_API_VERSION_2_0 or higher: 1508bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 1518bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Always valid 1528bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 1538bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala */ 1548bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala uint32_t device_version; 1558bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 1568bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala /** 1578bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * The camera's fixed characteristics, which include all camera metadata in 158b8b6439598ecc5faecfce8d43f3418b057714b4cEino-Ville Talvala * the android.*.info.* sections. This should be a sorted metadata buffer, 159b8b6439598ecc5faecfce8d43f3418b057714b4cEino-Ville Talvala * and may not be modified or freed by the caller. The pointer should remain 160d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * valid for the lifetime of the camera module, and values in it may not 161d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * change after it is returned by get_camera_info(). 1628bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 1638bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Version information (based on camera_module_t.common.module_api_version): 1648bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 165ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * CAMERA_MODULE_API_VERSION_1_0: 1668bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 1678bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * Not valid. Extra characteristics are not available. Do not read this 1688bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * field. 1698bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 170d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * CAMERA_MODULE_API_VERSION_2_0 or higher: 1718bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 172ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * Valid if device_version >= CAMERA_DEVICE_API_VERSION_2_0. Do not read 173ddc026e39344169f64f4696174a4d1269d069557Eino-Ville Talvala * otherwise. 1748bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala * 1758bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala */ 176b8b6439598ecc5faecfce8d43f3418b057714b4cEino-Ville Talvala const camera_metadata_t *static_camera_characteristics; 1779acc74043b4fd236fbfea492ba8ef3764d9dc079Alex Ray} camera_info_t; 1788bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 179d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala/** 180d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * camera_device_status_t: 181d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 182d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * The current status of the camera device, as provided by the HAL through the 183d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * camera_module_callbacks.camera_device_status_change() call. 184152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * 185152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * At module load time, the framework will assume all camera devices are in the 186152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * CAMERA_DEVICE_STATUS_PRESENT state. The HAL should invoke 187152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * camera_module_callbacks::camera_device_status_change to inform the framework 188152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * of any initially NOT_PRESENT devices. 189152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * 190152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * Allowed transitions: 191152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * PRESENT -> NOT_PRESENT 192152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * NOT_PRESENT -> ENUMERATING 193152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * NOT_PRESENT -> PRESENT 194152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * ENUMERATING -> PRESENT 195152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * ENUMERATING -> NOT_PRESENT 196d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala */ 197d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvalatypedef enum camera_device_status { 198d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala /** 199d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * The camera device is not currently connected, and opening it will return 200d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * failure. Calls to get_camera_info must still succeed, and provide the 201d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * same information it would if the camera were connected 202d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala */ 203d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala CAMERA_DEVICE_STATUS_NOT_PRESENT = 0, 204d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala 205d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala /** 206d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * The camera device is connected, and opening it will succeed. The 207d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * information returned by get_camera_info cannot change due to this status 208d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * change. By default, the framework will assume all devices are in this 209d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * state. 210d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala */ 211152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin CAMERA_DEVICE_STATUS_PRESENT = 1, 212152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin 213152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin /** 214152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * The camera device is connected, but it is undergoing an enumeration and 215152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * so opening the device will return -EBUSY. Calls to get_camera_info 216152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin * must still succeed, as if the camera was in the PRESENT status. 217152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin */ 218152b50fda66a1fe2b4ed96ec54da96d10f8ac37cIgor Murashkin CAMERA_DEVICE_STATUS_ENUMERATING = 2, 219d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala 220d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala} camera_device_status_t; 221d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala 222d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala/** 223d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * Callback functions for the camera HAL module to use to inform the framework 224d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * of changes to the camera subsystem. These are called only by HAL modules 225d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * implementing version CAMERA_MODULE_API_VERSION_2_1 or higher of the HAL 226d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * module API interface. 227d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala */ 228d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvalatypedef struct camera_module_callbacks { 229d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala 230d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala /** 231d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * camera_device_status_change: 232d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 233d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * Callback to the framework to indicate that the state of a specific camera 234d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * device has changed. At module load time, the framework will assume all 235d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * camera devices are in the CAMERA_DEVICE_STATUS_PRESENT state. The HAL 236d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * must call this method to inform the framework of any initially 237d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * NOT_PRESENT devices. 238d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 239d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * camera_module_callbacks: The instance of camera_module_callbacks_t passed 240d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * to the module with set_callbacks. 241d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 242d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * camera_id: The ID of the camera device that has a new status. 243d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 244d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * new_status: The new status code, one of the camera_device_status_t enums, 245d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * or a platform-specific status. 246d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 247d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala */ 248d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala void (*camera_device_status_change)(const struct camera_module_callbacks*, 249d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala int camera_id, 250d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala int new_status); 251d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala 252d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala} camera_module_callbacks_t; 253d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala 25419b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray/** 25519b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Set up vendor-specific tag query methods. These are needed to properly query 25619b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * entries with vendor-specified tags, potentially returned by get_camera_info. 25719b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 25819b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * This should be used in place of vendor_tag_query_ops, which are deprecated. 25919b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray */ 26019b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Raytypedef struct vendor_tag_ops vendor_tag_ops_t; 26119b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Raystruct vendor_tag_ops { 26219b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray /** 26319b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Get the number of vendor tags supported on this platform. Used to 26419b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * calculate the size of buffer needed for holding the array of all tags 26519b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * returned by get_all_tags(). 26619b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray */ 26719b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray int (*get_tag_count)(const vendor_tag_ops_t *v); 26819b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray 26919b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray /** 27019b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Fill an array with all the supported vendor tags on this platform. 27119b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * get_tag_count() returns the number of tags supported, and 27219b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * tag_array will be allocated with enough space to hold all of the tags. 27319b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray */ 27419b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray void (*get_all_tags)(const vendor_tag_ops_t *v, uint32_t *tag_array); 27519b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray 27619b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray /** 27719b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Get vendor section name for a vendor-specified entry tag. Only called for 27819b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * vendor-defined tags. The section name must start with the name of the 27919b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * vendor in the Java package style. For example, CameraZoom Inc. must 28019b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * prefix their sections with "com.camerazoom." Must return NULL if the tag 28119b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * is outside the bounds of vendor-defined sections. 28219b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 28319b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * There may be different vendor-defined tag sections, for example the 28419b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * phone maker, the chipset maker, and the camera module maker may each 28519b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * have their own "com.vendor."-prefixed section. 28619b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 28719b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * The memory pointed to by the return value must remain valid for the 28819b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * lifetime that the module is loaded, and is owned by the module. 28919b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray */ 29019b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray const char *(*get_section_name)(const vendor_tag_ops_t *v, uint32_t tag); 29119b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray 29219b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray /** 29319b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Get tag name for a vendor-specified entry tag. Only called for 29419b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * vendor-defined tags. Must return NULL if the it is not a vendor-defined 29519b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * tag. 29619b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 29719b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * The memory pointed to by the return value must remain valid for the 29819b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * lifetime that the module is loaded, and is owned by the module. 29919b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray */ 30019b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray const char *(*get_tag_name)(const vendor_tag_ops_t *v, uint32_t tag); 30119b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray 30219b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray /** 30319b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Get tag type for a vendor-specified entry tag. Only called for tags >= 30419b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 0x80000000. Must return -1 if the tag is outside the bounds of 30519b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * vendor-defined sections. 30619b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray */ 30719b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray int (*get_tag_type)(const vendor_tag_ops_t *v, uint32_t tag); 30819b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray 30919b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray /* reserved for future use */ 31019b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray void* reserved[8]; 31119b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray}; 31219b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray 3138bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvalatypedef struct camera_module { 3148bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala hw_module_t common; 315d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala 316d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala /** 317d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * get_number_of_cameras: 318d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 319d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * Returns the number of camera devices accessible through the camera 320d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * module. The camera devices are numbered 0 through N-1, where N is the 321d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * value returned by this call. The name of the camera device for open() is 322d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * simply the number converted to a string. That is, "0" for camera ID 0, 323d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * "1" for camera ID 1. 324d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 325d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * The value here must be static, and cannot change after the first call to 326d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * this method 327d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala */ 3288bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala int (*get_number_of_cameras)(void); 329d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala 330d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala /** 331d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * get_camera_info: 332d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 333d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * Return the static camera information for a given camera device. This 334d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * information may not change for a camera device. 335d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 336d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala */ 3378bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala int (*get_camera_info)(int camera_id, struct camera_info *info); 338d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala 339d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala /** 340d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * set_callbacks: 341d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 342d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * Provide callback function pointers to the HAL module to inform framework 343d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * of asynchronous camera module events. The framework will call this 344d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * function once after initial camera HAL module load, after the 345d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * get_number_of_cameras() method is called for the first time, and before 346d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * any other calls to the module. 347d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 348d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * Version information (based on camera_module_t.common.module_api_version): 349d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 350d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * CAMERA_MODULE_API_VERSION_1_0, CAMERA_MODULE_API_VERSION_2_0: 351d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 352d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * Not provided by HAL module. Framework may not call this function. 353d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 354d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * CAMERA_MODULE_API_VERSION_2_1: 355d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 356d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * Valid to be called by the framework. 357d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala * 358d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala */ 359d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala int (*set_callbacks)(const camera_module_callbacks_t *callbacks); 360d76f8af6d4d79e22d9a924710e5d8444c8e4ed8fEino-Ville Talvala 36119b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray /** 36219b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * get_vendor_tag_ops: 36319b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 36419b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Get methods to query for vendor extension metadata tag information. The 36519b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * HAL should fill in all the vendor tag operation methods, or leave ops 36619b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * unchanged if no vendor tags are defined. 36719b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 36819b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Version information (based on camera_module_t.common.module_api_version): 36919b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 37019b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * CAMERA_MODULE_API_VERSION_1_x/2_0/2_1: 37119b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Not provided by HAL module. Framework may not call this function. 37219b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * 37319b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * CAMERA_MODULE_API_VERSION_2_2: 37419b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray * Valid to be called by the framework. 37519b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray */ 37619b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray void (*get_vendor_tag_ops)(vendor_tag_ops_t* ops); 37719b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray 37819b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray /* reserved for future use */ 37919b2ceafe41e318ebe68f4b0dfeca73822d553e4Alex Ray void* reserved[8]; 3808bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala} camera_module_t; 3818bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 3828bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala__END_DECLS 3838bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala 3848bf364ef20331ebcc23b1f72121434a98bc5c567Eino-Ville Talvala#endif /* ANDROID_INCLUDE_CAMERA_COMMON_H */ 385