aboutsummaryrefslogtreecommitdiff
path: root/camera/usbcamcore/inc/QCameraUsbParm.h
blob: 595bf42c9d2ce0042d5ceca9d2e3fa9cffc114b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer in the documentation and/or other materials provided
 *       with the distribution.
 *     * Neither the name of The Linux Foundation nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef ANDROID_HARDWARE_QCAMERA_USB_PARM_H
#define ANDROID_HARDWARE_QCAMERA_USB_PARM_H


#include <utils/threads.h>
#include <hardware/camera.h>
#include <binder/MemoryBase.h>
#include <binder/MemoryHeapBase.h>
#include <utils/threads.h>
#include <cutils/properties.h>
#include <camera/Camera.h>
#include <camera/QCameraParameters.h>
#include <system/window.h>
#include <system/camera.h>
#include <hardware/camera.h>
#include <gralloc_priv.h>
#include <hardware/power.h>

extern "C" {
#include <linux/android_pmem.h>
#include <linux/msm_ion.h>
#include <camera.h>
#include <camera_defs_i.h>
} //extern C

//Error codes
#define NOT_FOUND       -1

/******************************************************************************
* Macro definitions
******************************************************************************/
/* enum definitions for picture formats */
static const int PICTURE_FORMAT_JPEG = 1;
static const int PICTURE_FORMAT_RAW = 2;

/* Default preview width in pixels */
#define DEFAULT_USBCAM_PRVW_WD  1280//640

/* Default preview height in pixels */
#define DEFAULT_USBCAM_PRVW_HT  720//480

/* Default picture format */
#define DEFAULT_USBCAM_PICT_FMT     PICTURE_FORMAT_JPEG

/* Default picture width in pixels */
#define DEFAULT_USBCAM_PICT_WD  640

/* Default picture height in pixels */
#define DEFAULT_USBCAM_PICT_HT  480

/* Default picture JPEG quality 0-100 */
#define DEFAULT_USBCAM_PICT_QLTY  85

/* Default thumbnail width in pixels */
#define DEFAULT_USBCAM_THUMBNAIL_WD    432

/* Default thumbnail height in pixels */
#define DEFAULT_USBCAM_THUMBNAIL_HT    288

/* Default thumbnail JPEG quality 0-100 */
#define DEFAULT_USBCAM_THUMBNAIL_QLTY  85

/* Default preview format */
#define DEFAULT_USBCAM_PRVW_FMT HAL_PIXEL_FORMAT_YCrCb_420_SP

/* minimum of the default preview fps range in milli-Hz */
#define MIN_PREV_FPS            5000

/* maximum of the default preview fps range in milli-Hz */
#define MAX_PREV_FPS            121000

//for histogram stats
#define HISTOGRAM_STATS_SIZE 257
#define NUM_HISTOGRAM_BUFFERS 3

namespace android {

/******************************************************************************
* Structure definitions
******************************************************************************/
typedef struct {
    uint32_t aspect_ratio;
    uint32_t width;
    uint32_t height;
} thumbnail_size_type;

/******************************************************************************
 * Function: usbCamInitDefaultParameters
 * Description: This function sets default parameters to camera HAL context
 *
 * Input parameters:
 *   camHal              - camera HAL handle
 *
 * Return values:
 *      0   No error
 *      -1  Error
 *
 * Notes: none
 *****************************************************************************/
int usbCamInitDefaultParameters(camera_hardware_t *camHal);

/******************************************************************************
 * Function: usbCamSetParameters
 * Description: This function parses the parameter string and stores the
 *              parameters in the camera HAL handle
 *
 * Input parameters:
 *  camHal              - camera HAL handle
 *  params              - pointer to parameter string
 *
 * Return values:
 *      0   Success
 *      -1  Error
 * Notes: none
 *****************************************************************************/
int usbCamSetParameters(camera_hardware_t *camHal, const char *params);

/******************************************************************************
 * Function: usbCamGetParameters
 * Description: This function allocates memory for parameter string,
 *              composes and returns the parameter string
 *
 * Input parameters:
 *   camHal             - camera HAL handle
 *
 * Return values:
 *      Address to the parameter string
 *
 * Notes: none
 *****************************************************************************/
char* usbCamGetParameters(camera_hardware_t *camHal);

/******************************************************************************
 * Function: usbCamPutParameters
 * Description: This function frees the memory allocated for parameter string
 *
 * Input parameters:
 *  camHal              - camera HAL handle
 *  parms               - Parameter string
 *
 * Return values:
 *      0   Success
 *      -1  Error
 * Notes: none
 *****************************************************************************/
void usbCamPutParameters(camera_hardware_t *camHal, char *parms);

}; // namespace android

#endif /* ANDROID_HARDWARE_QCAMERA_USB_PARM_H */