166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev/* 266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * Copyright (C) 2011 The Android Open Source Project 366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * Licensed under the Apache License, Version 2.0 (the "License"); 566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * you may not use this file except in compliance with the License. 666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * You may obtain a copy of the License at 766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * http://www.apache.org/licenses/LICENSE-2.0 966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 1066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * Unless required by applicable law or agreed to in writing, software 1166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * distributed under the License is distributed on an "AS IS" BASIS, 1266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * See the License for the specific language governing permissions and 1466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * limitations under the License. 1566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev */ 1666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 1766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#ifndef SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H 1866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#define SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H 1966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 2066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#include <stdint.h> 2166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#include <sys/cdefs.h> 2266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#include <sys/types.h> 2366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#include <cutils/native_handle.h> 2466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#include <hardware/hardware.h> 2566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#include <hardware/gralloc.h> 2666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 2766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev__BEGIN_DECLS 2866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 2966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev/** 3066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * A set of bit masks for specifying how the received preview frames are 3166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * handled before the previewCallback() call. 3266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 3366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * The least significant 3 bits of an "int" value are used for this purpose: 3466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 3566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * ..... 0 0 0 3666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * ^ ^ ^ 3766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * | | |---------> determine whether the callback is enabled or not 3866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * | |-----------> determine whether the callback is one-shot or not 3966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * |-------------> determine whether the frame is copied out or not 4066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 4166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * WARNING: When a frame is sent directly without copying, it is the frame 4266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * receiver's responsiblity to make sure that the frame data won't get 4366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * corrupted by subsequent preview frames filled by the camera. This flag is 4466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * recommended only when copying out data brings significant performance price 4566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * and the handling/processing of the received frame data is always faster than 4666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * the preview frame rate so that data corruption won't occur. 4766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 4866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * For instance, 4966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 1. 0x00 disables the callback. In this case, copy out and one shot bits 5066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * are ignored. 5166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 2. 0x01 enables a callback without copying out the received frames. A 5266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * typical use case is the Camcorder application to avoid making costly 5366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * frame copies. 5466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 3. 0x05 is enabling a callback with frame copied out repeatedly. A typical 5566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * use case is the Camera application. 5666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 4. 0x07 is enabling a callback with frame copied out only once. A typical 5766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * use case is the Barcode scanner application. 5866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev */ 5966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 6066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchevenum { 6166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_FRAME_CALLBACK_FLAG_ENABLE_MASK = 0x01, 6266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_FRAME_CALLBACK_FLAG_ONE_SHOT_MASK = 0x02, 6366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_FRAME_CALLBACK_FLAG_COPY_OUT_MASK = 0x04, 6466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev /** Typical use cases */ 6566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_FRAME_CALLBACK_FLAG_NOOP = 0x00, 6666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_FRAME_CALLBACK_FLAG_CAMCORDER = 0x01, 6766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_FRAME_CALLBACK_FLAG_CAMERA = 0x05, 6866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_FRAME_CALLBACK_FLAG_BARCODE_SCANNER = 0x07 6966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev}; 7066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 7166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev/** msgType in notifyCallback and dataCallback functions */ 7266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchevenum { 739d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li CAMERA_MSG_ERROR = 0x0001, // notifyCallback 749d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li CAMERA_MSG_SHUTTER = 0x0002, // notifyCallback 759d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li CAMERA_MSG_FOCUS = 0x0004, // notifyCallback 769d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li CAMERA_MSG_ZOOM = 0x0008, // notifyCallback 779d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li CAMERA_MSG_PREVIEW_FRAME = 0x0010, // dataCallback 789d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li CAMERA_MSG_VIDEO_FRAME = 0x0020, // data_timestamp_callback 799d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li CAMERA_MSG_POSTVIEW_FRAME = 0x0040, // dataCallback 809d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li CAMERA_MSG_RAW_IMAGE = 0x0080, // dataCallback 819d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li CAMERA_MSG_COMPRESSED_IMAGE = 0x0100, // dataCallback 829d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li CAMERA_MSG_RAW_IMAGE_NOTIFY = 0x0200, // dataCallback 83a43546a874890064606489f2125181a5f65adacdWu-cheng Li // Preview frame metadata. This can be combined with 84a43546a874890064606489f2125181a5f65adacdWu-cheng Li // CAMERA_MSG_PREVIEW_FRAME in dataCallback. For example, the apps can 85a43546a874890064606489f2125181a5f65adacdWu-cheng Li // request FRAME and METADATA. Or the apps can request only FRAME or only 86a43546a874890064606489f2125181a5f65adacdWu-cheng Li // METADATA. 87a43546a874890064606489f2125181a5f65adacdWu-cheng Li CAMERA_MSG_PREVIEW_METADATA = 0x0400, // dataCallback 883dc54060c139f5ebbcf3494b346785ea85d4afa8Wu-cheng Li // Notify on autofocus start and stop. This is useful in continuous 893dc54060c139f5ebbcf3494b346785ea85d4afa8Wu-cheng Li // autofocus - FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE. 903dc54060c139f5ebbcf3494b346785ea85d4afa8Wu-cheng Li CAMERA_MSG_FOCUS_MOVE = 0x0800, // notifyCallback 9166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_MSG_ALL_MSGS = 0xFFFF 9266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev}; 9366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 9466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev/** cmdType in sendCommand functions */ 9566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchevenum { 9666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_CMD_START_SMOOTH_ZOOM = 1, 9766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_CMD_STOP_SMOOTH_ZOOM = 2, 98de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li 99de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li /** 100de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * Set the clockwise rotation of preview display (setPreviewDisplay) in 10166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * degrees. This affects the preview frames and the picture displayed after 10266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * snapshot. This method is useful for portrait mode applications. Note 10366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * that preview display of front-facing cameras is flipped horizontally 10466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * before the rotation, that is, the image is reflected along the central 10566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * vertical axis of the camera sensor. So the users can see themselves as 10666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * looking into a mirror. 10766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 10866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * This does not affect the order of byte array of 10966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * CAMERA_MSG_PREVIEW_FRAME, CAMERA_MSG_VIDEO_FRAME, 11066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * CAMERA_MSG_POSTVIEW_FRAME, CAMERA_MSG_RAW_IMAGE, or 1118d43cb6edb5c0d9ebb1fa0586b738d7832a288b4Wu-cheng Li * CAMERA_MSG_COMPRESSED_IMAGE. This is allowed to be set during preview 1128d43cb6edb5c0d9ebb1fa0586b738d7832a288b4Wu-cheng Li * since API level 14. 11366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev */ 11466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_CMD_SET_DISPLAY_ORIENTATION = 3, 11566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 116de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li /** 117de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * cmdType to disable/enable shutter sound. In sendCommand passing arg1 = 11866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * 0 will disable, while passing arg1 = 1 will enable the shutter sound. 11966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev */ 12066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_CMD_ENABLE_SHUTTER_SOUND = 4, 12166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 12266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev /* cmdType to play recording sound */ 12366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_CMD_PLAY_RECORDING_SOUND = 5, 124de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li 125de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li /** 126de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * Start the face detection. This should be called after preview is started. 127de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * The camera will notify the listener of CAMERA_MSG_FACE and the detected 128de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * faces in the preview frame. The detected faces may be the same as the 129de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * previous ones. Apps should call CAMERA_CMD_STOP_FACE_DETECTION to stop 130de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * the face detection. This method is supported if CameraParameters 131de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * KEY_MAX_NUM_HW_DETECTED_FACES or KEY_MAX_NUM_SW_DETECTED_FACES is 132de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * bigger than 0. Hardware and software face detection should not be running 133de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * at the same time. If the face detection has started, apps should not send 134de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * this again. 135de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * 136de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * In hardware face detection mode, CameraParameters KEY_WHITE_BALANCE, 137de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * KEY_FOCUS_AREAS and KEY_METERING_AREAS have no effect. 138de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * 139de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * arg1 is the face detection type. It can be CAMERA_FACE_DETECTION_HW or 14058cfa8af0ef6ff541a638756866427aced483943Eino-Ville Talvala * CAMERA_FACE_DETECTION_SW. If the type of face detection requested is not 14158cfa8af0ef6ff541a638756866427aced483943Eino-Ville Talvala * supported, the HAL must return BAD_VALUE. 142de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li */ 143de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li CAMERA_CMD_START_FACE_DETECTION = 6, 144de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li 145de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li /** 146de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * Stop the face detection. 147de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li */ 148de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li CAMERA_CMD_STOP_FACE_DETECTION = 7, 1493dc54060c139f5ebbcf3494b346785ea85d4afa8Wu-cheng Li 1503dc54060c139f5ebbcf3494b346785ea85d4afa8Wu-cheng Li /** 1513dc54060c139f5ebbcf3494b346785ea85d4afa8Wu-cheng Li * Enable/disable focus move callback (CAMERA_MSG_FOCUS_MOVE). Passing 1523dc54060c139f5ebbcf3494b346785ea85d4afa8Wu-cheng Li * arg1 = 0 will disable, while passing arg1 = 1 will enable the callback. 1533dc54060c139f5ebbcf3494b346785ea85d4afa8Wu-cheng Li */ 1543dc54060c139f5ebbcf3494b346785ea85d4afa8Wu-cheng Li CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG = 8, 1552923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li 1562923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li /** 1572923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * Ping camera service to see if camera hardware is released. 1582923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * 1592923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * When any camera method returns error, the client can use ping command 1602923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * to see if the camera has been taken away by other clients. If the result 1612923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * is NO_ERROR, it means the camera hardware is not released. If the result 1622923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * is not NO_ERROR, the camera has been released and the existing client 1632923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * can silently finish itself or show a dialog. 1642923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li */ 1652923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li CAMERA_CMD_PING = 9, 1666c4c66a7670e3a20867866384666380ae7b706c6James Dong 1676c4c66a7670e3a20867866384666380ae7b706c6James Dong /** 1686c4c66a7670e3a20867866384666380ae7b706c6James Dong * Configure the number of video buffers used for recording. The intended 1696c4c66a7670e3a20867866384666380ae7b706c6James Dong * video buffer count for recording is passed as arg1, which must be 1706c4c66a7670e3a20867866384666380ae7b706c6James Dong * greater than 0. This command must be sent before recording is started. 1716c4c66a7670e3a20867866384666380ae7b706c6James Dong * This command returns INVALID_OPERATION error if it is sent after video 1726c4c66a7670e3a20867866384666380ae7b706c6James Dong * recording is started, or the command is not supported at all. This 1736c4c66a7670e3a20867866384666380ae7b706c6James Dong * command also returns a BAD_VALUE error if the intended video buffer 1746c4c66a7670e3a20867866384666380ae7b706c6James Dong * count is non-positive or too big to be realized. 1756c4c66a7670e3a20867866384666380ae7b706c6James Dong */ 1766c4c66a7670e3a20867866384666380ae7b706c6James Dong CAMERA_CMD_SET_VIDEO_BUFFER_COUNT = 10, 17766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev}; 17866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 17966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev/** camera fatal errors */ 18066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchevenum { 18166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_ERROR_UNKNOWN = 1, 1822923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li /** 1832923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * Camera was released because another client has connected to the camera. 1842923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * The original client should call Camera::disconnect immediately after 1852923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * getting this notification. Otherwise, the camera will be released by 1862923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * camera service in a short time. The client should not call any method 1872923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li * (except disconnect and sending CAMERA_CMD_PING) after getting this. 1882923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li */ 1892923c0ba526902604ee53e94e07a16bef55742afWu-cheng Li CAMERA_ERROR_RELEASED = 2, 19066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev CAMERA_ERROR_SERVER_DIED = 100 19166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev}; 19266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 19366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchevenum { 194de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li /** The facing of the camera is opposite to that of the screen. */ 195de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li CAMERA_FACING_BACK = 0, 196de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li /** The facing of the camera is the same as that of the screen. */ 197de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li CAMERA_FACING_FRONT = 1 198de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li}; 199de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li 200de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Lienum { 201de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li /** Hardware face detection. It does not use much CPU. */ 202de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li CAMERA_FACE_DETECTION_HW = 0, 203de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li /** 204de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * Software face detection. It uses some CPU. Applications must use 205de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li * Camera.setPreviewTexture for preview in this mode. 206de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li */ 207de19ea26025927fe95ec96818a13dd58bec91cf6Wu-cheng Li CAMERA_FACE_DETECTION_SW = 1 20866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev}; 20966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 2109d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li/** 2119d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * The information of a face from camera face detection. 2129d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li */ 2139d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Litypedef struct camera_face { 2149d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li /** 2159d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * Bounds of the face [left, top, right, bottom]. (-1000, -1000) represents 2169d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * the top-left of the camera field of view, and (1000, 1000) represents the 2179d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * bottom-right of the field of view. The width and height cannot be 0 or 2189d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * negative. This is supported by both hardware and software face detection. 2199d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * 2209d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * The direction is relative to the sensor orientation, that is, what the 2219d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * sensor sees. The direction is not affected by the rotation or mirroring 2229d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * of CAMERA_CMD_SET_DISPLAY_ORIENTATION. 2239d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li */ 2243ac91d178bfbc38fbeb4743f9fbe5619e8e744d0Wu-cheng Li int32_t rect[4]; 2259d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li 2269d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li /** 2279d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * The confidence level of the face. The range is 1 to 100. 100 is the 2289d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * highest confidence. This is supported by both hardware and software 2299d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * face detection. 2309d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li */ 2313ac91d178bfbc38fbeb4743f9fbe5619e8e744d0Wu-cheng Li int32_t score; 2329d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li 2339d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li /** 2349d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * An unique id per face while the face is visible to the tracker. If 2359d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * the face leaves the field-of-view and comes back, it will get a new 2369d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * id. If the value is 0, id is not supported. 2379d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li */ 2383ac91d178bfbc38fbeb4743f9fbe5619e8e744d0Wu-cheng Li int32_t id; 2399d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li 2409d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li /** 2419d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * The coordinates of the center of the left eye. The range is -1000 to 2429d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * 1000. -2000, -2000 if this is not supported. 2439d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li */ 2443ac91d178bfbc38fbeb4743f9fbe5619e8e744d0Wu-cheng Li int32_t left_eye[2]; 2459d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li 2469d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li /** 2479d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * The coordinates of the center of the right eye. The range is -1000 to 2489d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * 1000. -2000, -2000 if this is not supported. 2499d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li */ 2503ac91d178bfbc38fbeb4743f9fbe5619e8e744d0Wu-cheng Li int32_t right_eye[2]; 2519d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li 2529d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li /** 2539d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * The coordinates of the center of the mouth. The range is -1000 to 1000. 2549d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * -2000, -2000 if this is not supported. 2559d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li */ 2563ac91d178bfbc38fbeb4743f9fbe5619e8e744d0Wu-cheng Li int32_t mouth[2]; 2579d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li 2589d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li} camera_face_t; 2599d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li 2609d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li/** 2619d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * The metadata of the frame data. 2629d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li */ 2639d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Litypedef struct camera_frame_metadata { 2649d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li /** 2659d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li * The number of detected faces in the frame. 2669d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li */ 2673ac91d178bfbc38fbeb4743f9fbe5619e8e744d0Wu-cheng Li int32_t number_of_faces; 2689d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li 2699d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li /** 270baad2843a1af443aa251be510c4476159d064d20Wu-cheng Li * An array of the detected faces. The length is number_of_faces. 2719d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li */ 2729d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li camera_face_t *faces; 2739d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li} camera_frame_metadata_t; 2749d5bfd35414f2be2f1ea8a2cabee8f407d3e38c0Wu-cheng Li 27566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev__END_DECLS 27666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev 27766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#endif /* SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H */ 278