CameraProperties.h revision c322989ae6ff6769490828de1b5eda12b749cce9
1/* 2 * Copyright (C) Texas Instruments - http://www.ti.com/ 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 18 19 20#ifndef CAMERA_PROPERTIES_H 21#define CAMERA_PROPERTIES_H 22 23#include <utils/KeyedVector.h> 24#include <utils/String8.h> 25#include <stdio.h> 26#include <dirent.h> 27#include <errno.h> 28#include <stdio.h> 29#include <string.h> 30 31namespace android { 32 33#define MAX_CAMERAS_SUPPORTED 2 34#define MAX_PROP_NAME_LENGTH 50 35#define MAX_PROP_VALUE_LENGTH 2048 36 37#define EXIF_MAKE_DEFAULT "default_make" 38#define EXIF_MODEL_DEFAULT "default_model" 39 40// Class that handles the Camera Properties 41class CameraProperties 42{ 43public: 44 static const char INVALID[]; 45 static const char CAMERA_NAME[]; 46 static const char CAMERA_SENSOR_INDEX[]; 47 static const char ORIENTATION_INDEX[]; 48 static const char FACING_INDEX[]; 49 static const char S3D_SUPPORTED[]; 50 static const char SUPPORTED_PREVIEW_SIZES[]; 51 static const char SUPPORTED_PREVIEW_FORMATS[]; 52 static const char SUPPORTED_PREVIEW_FRAME_RATES[]; 53 static const char SUPPORTED_PICTURE_SIZES[]; 54 static const char SUPPORTED_PICTURE_FORMATS[]; 55 static const char SUPPORTED_THUMBNAIL_SIZES[]; 56 static const char SUPPORTED_WHITE_BALANCE[]; 57 static const char SUPPORTED_EFFECTS[]; 58 static const char SUPPORTED_ANTIBANDING[]; 59 static const char SUPPORTED_EXPOSURE_MODES[]; 60 static const char SUPPORTED_EV_MIN[]; 61 static const char SUPPORTED_EV_MAX[]; 62 static const char SUPPORTED_EV_STEP[]; 63 static const char SUPPORTED_ISO_VALUES[]; 64 static const char SUPPORTED_SCENE_MODES[]; 65 static const char SUPPORTED_FLASH_MODES[]; 66 static const char SUPPORTED_FOCUS_MODES[]; 67 static const char REQUIRED_PREVIEW_BUFS[]; 68 static const char REQUIRED_IMAGE_BUFS[]; 69 static const char SUPPORTED_ZOOM_RATIOS[]; 70 static const char SUPPORTED_ZOOM_STAGES[]; 71 static const char SUPPORTED_IPP_MODES[]; 72 static const char SMOOTH_ZOOM_SUPPORTED[]; 73 static const char ZOOM_SUPPORTED[]; 74 static const char PREVIEW_SIZE[]; 75 static const char PREVIEW_FORMAT[]; 76 static const char PREVIEW_FRAME_RATE[]; 77 static const char ZOOM[]; 78 static const char PICTURE_SIZE[]; 79 static const char PICTURE_FORMAT[]; 80 static const char JPEG_THUMBNAIL_SIZE[]; 81 static const char WHITEBALANCE[]; 82 static const char EFFECT[]; 83 static const char ANTIBANDING[]; 84 static const char EXPOSURE_MODE[]; 85 static const char EV_COMPENSATION[]; 86 static const char ISO_MODE[]; 87 static const char FOCUS_MODE[]; 88 static const char SCENE_MODE[]; 89 static const char FLASH_MODE[]; 90 static const char JPEG_QUALITY[]; 91 static const char BRIGHTNESS[]; 92 static const char SATURATION[]; 93 static const char SHARPNESS[]; 94 static const char CONTRAST[]; 95 static const char IPP[]; 96 static const char AUTOCONVERGENCE[]; 97 static const char AUTOCONVERGENCE_MODE[]; 98 static const char MANUALCONVERGENCE_VALUES[]; 99 static const char SENSOR_ORIENTATION[]; 100 static const char SENSOR_ORIENTATION_VALUES[]; 101 static const char REVISION[]; 102 static const char FOCAL_LENGTH[]; 103 static const char HOR_ANGLE[]; 104 static const char VER_ANGLE[]; 105 static const char EXIF_MAKE[]; 106 static const char EXIF_MODEL[]; 107 static const char JPEG_THUMBNAIL_QUALITY[]; 108 static const char MAX_FOCUS_AREAS[]; 109 static const char MAX_FD_HW_FACES[]; 110 static const char MAX_FD_SW_FACES[]; 111 112 static const char PARAMS_DELIMITER []; 113 114 static const char S3D2D_PREVIEW[]; 115 static const char S3D2D_PREVIEW_MODES[]; 116 static const char VSTAB[]; 117 static const char VSTAB_VALUES[]; 118 static const char FRAMERATE_RANGE[]; 119 static const char FRAMERATE_RANGE_SUPPORTED[]; 120 121 static const char DEFAULT_VALUE[]; 122 123 static const char AUTO_EXPOSURE_LOCK[]; 124 static const char AUTO_EXPOSURE_LOCK_SUPPORTED[]; 125 static const char AUTO_WHITEBALANCE_LOCK[]; 126 static const char AUTO_WHITEBALANCE_LOCK_SUPPORTED[]; 127 static const char MAX_NUM_METERING_AREAS[]; 128 static const char METERING_AREAS[]; 129 130 CameraProperties(); 131 ~CameraProperties(); 132 133 // container class passed around for accessing properties 134 class Properties 135 { 136 public: 137 Properties() 138 { 139 mProperties = new DefaultKeyedVector<String8, String8>(String8(DEFAULT_VALUE)); 140 // set properties that are same for all cameras 141 set(EXIF_MAKE, EXIF_MAKE_DEFAULT); 142 set(EXIF_MODEL, EXIF_MODEL_DEFAULT); 143 } 144 ~Properties() 145 { 146 delete mProperties; 147 } 148 ssize_t set(const char *prop, const char *value); 149 ssize_t set(const char *prop, int value); 150 const char* get(const char * prop); 151 void dump(); 152 153 protected: 154 const char* keyAt(unsigned int); 155 const char* valueAt(unsigned int); 156 157 private: 158 DefaultKeyedVector<String8, String8>* mProperties; 159 160 }; 161 162 ///Initializes the CameraProperties class 163 status_t initialize(); 164 status_t loadProperties(); 165 int camerasSupported(); 166 int getProperties(int cameraIndex, Properties** properties); 167 168private: 169 170 uint32_t mCamerasSupported; 171 int mInitialized; 172 173 Properties mCameraProps[MAX_CAMERAS_SUPPORTED]; 174 175}; 176 177}; 178 179#endif //CAMERA_PROPERTIES_H 180 181