1/* Copyright (c) 2012, The Linux Foundation. All rights reserved. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are 5 * met: 6 * * Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions in binary form must reproduce the above 9 * copyright notice, this list of conditions and the following 10 * disclaimer in the documentation and/or other materials provided 11 * with the distribution. 12 * * Neither the name of The Linux Foundation nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#ifndef ANDROID_HARDWARE_QCAMERA_USB_PARM_H 30#define ANDROID_HARDWARE_QCAMERA_USB_PARM_H 31 32 33#include <utils/threads.h> 34#include <hardware/camera.h> 35#include <binder/MemoryBase.h> 36#include <binder/MemoryHeapBase.h> 37#include <utils/threads.h> 38#include <cutils/properties.h> 39#include <camera/Camera.h> 40#include <camera/QCameraParameters.h> 41#include <system/window.h> 42#include <system/camera.h> 43#include <hardware/camera.h> 44#include <gralloc_priv.h> 45#include <hardware/power.h> 46 47extern "C" { 48#include <linux/android_pmem.h> 49#include <linux/msm_ion.h> 50#include <camera.h> 51#include <camera_defs_i.h> 52} //extern C 53 54//Error codes 55#define NOT_FOUND -1 56 57/****************************************************************************** 58* Macro definitions 59******************************************************************************/ 60/* enum definitions for picture formats */ 61static const int PICTURE_FORMAT_JPEG = 1; 62static const int PICTURE_FORMAT_RAW = 2; 63 64/* Default preview width in pixels */ 65#define DEFAULT_USBCAM_PRVW_WD 1280//640 66 67/* Default preview height in pixels */ 68#define DEFAULT_USBCAM_PRVW_HT 720//480 69 70/* Default picture format */ 71#define DEFAULT_USBCAM_PICT_FMT PICTURE_FORMAT_JPEG 72 73/* Default picture width in pixels */ 74#define DEFAULT_USBCAM_PICT_WD 640 75 76/* Default picture height in pixels */ 77#define DEFAULT_USBCAM_PICT_HT 480 78 79/* Default picture JPEG quality 0-100 */ 80#define DEFAULT_USBCAM_PICT_QLTY 85 81 82/* Default thumbnail width in pixels */ 83#define DEFAULT_USBCAM_THUMBNAIL_WD 432 84 85/* Default thumbnail height in pixels */ 86#define DEFAULT_USBCAM_THUMBNAIL_HT 288 87 88/* Default thumbnail JPEG quality 0-100 */ 89#define DEFAULT_USBCAM_THUMBNAIL_QLTY 85 90 91/* Default preview format */ 92#define DEFAULT_USBCAM_PRVW_FMT HAL_PIXEL_FORMAT_YCrCb_420_SP 93 94/* minimum of the default preview fps range in milli-Hz */ 95#define MIN_PREV_FPS 5000 96 97/* maximum of the default preview fps range in milli-Hz */ 98#define MAX_PREV_FPS 121000 99 100//for histogram stats 101#define HISTOGRAM_STATS_SIZE 257 102#define NUM_HISTOGRAM_BUFFERS 3 103 104namespace android { 105 106/****************************************************************************** 107* Structure definitions 108******************************************************************************/ 109typedef struct { 110 uint32_t aspect_ratio; 111 uint32_t width; 112 uint32_t height; 113} thumbnail_size_type; 114 115/****************************************************************************** 116 * Function: usbCamInitDefaultParameters 117 * Description: This function sets default parameters to camera HAL context 118 * 119 * Input parameters: 120 * camHal - camera HAL handle 121 * 122 * Return values: 123 * 0 No error 124 * -1 Error 125 * 126 * Notes: none 127 *****************************************************************************/ 128int usbCamInitDefaultParameters(camera_hardware_t *camHal); 129 130/****************************************************************************** 131 * Function: usbCamSetParameters 132 * Description: This function parses the parameter string and stores the 133 * parameters in the camera HAL handle 134 * 135 * Input parameters: 136 * camHal - camera HAL handle 137 * params - pointer to parameter string 138 * 139 * Return values: 140 * 0 Success 141 * -1 Error 142 * Notes: none 143 *****************************************************************************/ 144int usbCamSetParameters(camera_hardware_t *camHal, const char *params); 145 146/****************************************************************************** 147 * Function: usbCamGetParameters 148 * Description: This function allocates memory for parameter string, 149 * composes and returns the parameter string 150 * 151 * Input parameters: 152 * camHal - camera HAL handle 153 * 154 * Return values: 155 * Address to the parameter string 156 * 157 * Notes: none 158 *****************************************************************************/ 159char* usbCamGetParameters(camera_hardware_t *camHal); 160 161/****************************************************************************** 162 * Function: usbCamPutParameters 163 * Description: This function frees the memory allocated for parameter string 164 * 165 * Input parameters: 166 * camHal - camera HAL handle 167 * parms - Parameter string 168 * 169 * Return values: 170 * 0 Success 171 * -1 Error 172 * Notes: none 173 *****************************************************************************/ 174void usbCamPutParameters(camera_hardware_t *camHal, char *parms); 175 176}; // namespace android 177 178#endif /* ANDROID_HARDWARE_QCAMERA_USB_PARM_H */ 179