1 /*Copyright (c) 2012-2015, 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 #ifndef __QOMX_EXTENSIONS_H__ 29 #define __QOMX_EXTENSIONS_H__ 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 #include <OMX_Image.h> 36 #include <qexif.h> 37 38 /** qomx_image_eventd 39 * Qcom specific events extended from OMX_EVENT 40 * @ OMX_EVENT_THUMBNAIL_DROPPED - Indicates that the thumbnail 41 * size id too big to be included 42 * in the exif and will be 43 * dropped 44 **/ 45 typedef enum { 46 OMX_EVENT_THUMBNAIL_DROPPED = OMX_EventVendorStartUnused+1 47 } QOMX_IMAGE_EXT_EVENTS; 48 49 /** 50 * The following macros defines the string to be used for 51 * getting the extension indices. 52 **/ 53 #define QOMX_IMAGE_EXT_EXIF_NAME "OMX.QCOM.image.exttype.exif" 54 #define QOMX_IMAGE_EXT_THUMBNAIL_NAME "OMX.QCOM.image.exttype.thumbnail" 55 #define QOMX_IMAGE_EXT_BUFFER_OFFSET_NAME "OMX.QCOM.image.exttype.bufferOffset" 56 #define QOMX_IMAGE_EXT_MOBICAT_NAME "OMX.QCOM.image.exttype.mobicat" 57 #define QOMX_IMAGE_EXT_ENCODING_MODE_NAME "OMX.QCOM.image.encoding.mode" 58 #define QOMX_IMAGE_EXT_WORK_BUFFER_NAME "OMX.QCOM.image.exttype.workbuffer" 59 #define QOMX_IMAGE_EXT_METADATA_NAME "OMX.QCOM.image.exttype.metadata" 60 #define QOMX_IMAGE_EXT_META_ENC_KEY_NAME "OMX.QCOM.image.exttype.metaEncKey" 61 #define QOMX_IMAGE_EXT_MEM_OPS_NAME "OMX.QCOM.image.exttype.mem_ops" 62 #define QOMX_IMAGE_EXT_JPEG_SPEED_NAME "OMX.QCOM.image.exttype.jpeg.speed" 63 #define QOMX_IMAGE_EXT_MULTI_IMAGE_NAME "OMX.QCOM.image.exttype.multi.image" 64 65 /** QOMX_IMAGE_EXT_INDEXTYPE 66 * This enum is an extension of the OMX_INDEXTYPE enum and 67 * specifies Qcom supported extention indexes. These indexes are 68 * associated with the extension names and can be used as 69 * Indexes in the SetParameter and Getparameter functins to set 70 * or get values from qcom specific data structures 71 **/ 72 typedef enum { 73 //Name: OMX.QCOM.image.exttype.exif 74 QOMX_IMAGE_EXT_EXIF = 0x07F00000, 75 76 //Name: OMX.QCOM.image.exttype.thumbnail 77 QOMX_IMAGE_EXT_THUMBNAIL = 0x07F00001, 78 79 //Name: OMX.QCOM.image.exttype.bufferOffset 80 QOMX_IMAGE_EXT_BUFFER_OFFSET = 0x07F00002, 81 82 //Name: OMX.QCOM.image.exttype.mobicat 83 QOMX_IMAGE_EXT_MOBICAT = 0x07F00003, 84 85 //Name: OMX.QCOM.image.encoding.approach 86 QOMX_IMAGE_EXT_ENCODING_MODE = 0x07F00004, 87 88 //Name: OMX.QCOM.image.exttype.workbuffer 89 QOMX_IMAGE_EXT_WORK_BUFFER = 0x07F00005, 90 91 //Name: OMX.QCOM.image.exttype.metadata 92 QOMX_IMAGE_EXT_METADATA = 0x07F00008, 93 94 //Name: OMX.QCOM.image.exttype.metaEncKey 95 QOMX_IMAGE_EXT_META_ENC_KEY = 0x07F00009, 96 97 //Name: OMX.QCOM.image.exttype.memOps 98 QOMX_IMAGE_EXT_MEM_OPS = 0x07F0000A, 99 100 //Name: OMX.QCOM.image.exttype.jpeg.speed 101 QOMX_IMAGE_EXT_JPEG_SPEED = 0x07F000B, 102 103 //Name: OMX.QCOM.image.exttype.multi.image 104 QOMX_IMAGE_EXT_MULTI_IMAGE = 0x07F000C, 105 106 } QOMX_IMAGE_EXT_INDEXTYPE; 107 108 /** QOMX_BUFFER_INFO 109 * The structure specifies informaton 110 * associated with the buffers and should be passed as appData 111 * in UseBuffer calls to the OMX component with buffer specific 112 * data. @ fd - FD of the buffer allocated. If the buffer is 113 * allocated on the heap, it can be zero. 114 * @offset - Buffer offset 115 **/ 116 117 typedef struct { 118 OMX_U32 fd; 119 OMX_U32 offset; 120 } QOMX_BUFFER_INFO; 121 122 /** QEXIF_INFO_DATA 123 * The basic exif structure used to construct 124 * information for a single exif tag. 125 * @tag_entry 126 * @tag_id 127 **/ 128 typedef struct{ 129 exif_tag_entry_t tag_entry; 130 exif_tag_id_t tag_id; 131 } QEXIF_INFO_DATA; 132 133 /** QEXTN_DATA 134 * The structure used to carry addtional payload 135 * meant to be in EXIF Appx marker fields. 136 * @sw_3a_version 137 **/ 138 typedef struct { 139 uint16_t sw_3a_version[4]; 140 } QEXTN_DATA; 141 142 /**QOMX_EXIF_INFO 143 * The structure contains an array of exif tag 144 * structures(qexif_info_data) and should be passed to the OMX 145 * layer by the OMX client using the extension index. 146 * @exif_data - Array of exif tags 147 * @numOfEntries - Number of exif tags entries being passed in 148 * the array 149 * @debug_data - specific debug information for internal use 150 **/ 151 typedef struct { 152 QEXIF_INFO_DATA *exif_data; 153 OMX_U32 numOfEntries; 154 QEXTN_DATA debug_data; 155 } QOMX_EXIF_INFO; 156 157 /**QOMX_YUV_FRAME_INFO 158 * The structre contains all the offsets 159 * associated with the Y and cbcr buffers. 160 * @yOffset - Offset within the Y buffer 161 * @cbcrOffset - Offset within the cb/cr buffer. The array 162 * should be populated in order depending on cb 163 * first or cr first in case of planar data. For 164 * pseusoplanar, only the first array element 165 * needs to be filled and the secnd element should 166 * be set to zero. 167 * @cbcrStartOffset - Start offset of the cb/cr buffer starting 168 * starting from the Y buffer. The array 169 * should be populated in order depending on 170 * cb first or cr first in case of planar 171 * data. For pseusoplanar, only the first 172 * array element needs to be filled and the 173 * secnd element should be set to zero. 174 **/ 175 typedef struct { 176 OMX_U32 yOffset; 177 OMX_U32 cbcrOffset[2]; 178 OMX_U32 cbcrStartOffset[2]; 179 } QOMX_YUV_FRAME_INFO; 180 181 /** qomx_thumbnail_info 182 * Includes all information associated with the thumbnail 183 * @input_width - Width of the input thumbnail buffer 184 * @input_height - Heighr of the input thumbnail buffer 185 * @scaling_enabled - Flag indicating if thumbnail scaling is 186 * enabled. 187 * @quality - JPEG Q factor value in the range of 1-100. A factor of 1 188 * produces the smallest, worst quality images, and a factor 189 * of 100 produces the largest, best quality images. A 190 * typical default is 75 for small good quality images. 191 * @crop_info - Includes the crop width, crop height, 192 * horizontal and vertical offsets. 193 * @output_width - Output Width of the the thumbnail. This is 194 * the width after scaling if scaling is enabled 195 * or width after cropping if only cropping is 196 * enabled or same same input width otherwise 197 * @output_height - Output height of the thumbnail. This is 198 * the height after scaling if scaling is enabled 199 * or height after cropping if only cropping is 200 * enabled or same same input height otherwise 201 **/ 202 typedef struct { 203 OMX_U32 input_width; 204 OMX_U32 input_height; 205 OMX_U8 scaling_enabled; 206 OMX_U32 quality; 207 OMX_CONFIG_RECTTYPE crop_info; 208 OMX_U32 output_width; 209 OMX_U32 output_height; 210 QOMX_YUV_FRAME_INFO tmbOffset; 211 OMX_U32 rotation; 212 } QOMX_THUMBNAIL_INFO; 213 214 /**qomx_mobicat 215 * Mobicat data to padded tot he OMX layer 216 * @mobicatData - Mobicate data 217 * @mobicatDataLength - length of the mobicat data 218 **/ 219 typedef struct { 220 OMX_U8 *mobicatData; 221 OMX_U32 mobicatDataLength; 222 } QOMX_MOBICAT; 223 224 /**qomx_workbuffer 225 * Ion buffer to be used for the H/W encoder 226 * @fd - FD of the buffer allocated 227 * @vaddr - Buffer address 228 **/ 229 typedef struct { 230 int fd; 231 uint8_t *vaddr; 232 uint32_t length; 233 } QOMX_WORK_BUFFER; 234 235 /**QOMX_METADATA 236 * 237 * meta data to be set in EXIF 238 * @metadata: Dynamic metadata associated with each image 239 * @metaPayloadSize : Size of dynamic metadata 240 * @mobicat_mask : Mobicat MASk 241 * @static_metadata: Static metadata associated with each image 242 */ 243 typedef struct { 244 OMX_U8 *metadata; 245 OMX_U32 metaPayloadSize; 246 OMX_U8 mobicat_mask; 247 OMX_U8 *static_metadata; 248 } QOMX_METADATA; 249 250 /**QOMX_META_ENC_KEY 251 * 252 * meta data encryption key 253 */ 254 typedef struct { 255 OMX_U8 *metaKey; 256 OMX_U32 keyLen; 257 } QOMX_META_ENC_KEY; 258 259 /** QOMX_IMG_COLOR_FORMATTYPE 260 * This enum is an extension of the OMX_COLOR_FORMATTYPE enum. 261 * It specifies Qcom supported color formats. 262 **/ 263 typedef enum QOMX_IMG_COLOR_FORMATTYPE { 264 OMX_QCOM_IMG_COLOR_FormatYVU420SemiPlanar = OMX_COLOR_FormatVendorStartUnused + 0x300, 265 OMX_QCOM_IMG_COLOR_FormatYVU422SemiPlanar, 266 OMX_QCOM_IMG_COLOR_FormatYVU422SemiPlanar_h1v2, 267 OMX_QCOM_IMG_COLOR_FormatYUV422SemiPlanar_h1v2, 268 OMX_QCOM_IMG_COLOR_FormatYVU444SemiPlanar, 269 OMX_QCOM_IMG_COLOR_FormatYUV444SemiPlanar, 270 OMX_QCOM_IMG_COLOR_FormatYVU420Planar, 271 OMX_QCOM_IMG_COLOR_FormatYVU422Planar, 272 OMX_QCOM_IMG_COLOR_FormatYVU422Planar_h1v2, 273 OMX_QCOM_IMG_COLOR_FormatYUV422Planar_h1v2, 274 OMX_QCOM_IMG_COLOR_FormatYVU444Planar, 275 OMX_QCOM_IMG_COLOR_FormatYUV444Planar 276 } QOMX_IMG_COLOR_FORMATTYPE; 277 278 /** QOMX_ENCODING_MODE 279 * This enum is used to select parallel encoding 280 * or sequential encoding for the thumbnail and 281 * main image 282 **/ 283 typedef enum { 284 OMX_Serial_Encoding, 285 OMX_Parallel_Encoding 286 } QOMX_ENCODING_MODE; 287 288 289 /**omx_jpeg_ouput_buf_t 290 * Structure describing jpeg output buffer 291 * @handle - Handle to the containing class 292 * @mem_hdl - Handle to camera memory struct 293 * @vaddr - Buffer address 294 * @size - Buffer size 295 * @fd - file descriptor 296 **/ 297 typedef struct { 298 void *handle; 299 void *mem_hdl; 300 int8_t isheap; 301 size_t size; /*input*/ 302 void *vaddr; 303 int fd; 304 } omx_jpeg_ouput_buf_t; 305 306 /** QOMX_MEM_OPS 307 * Structure holding the function pointers to 308 * buffer memory operations 309 * @get_memory - function to allocate buffer memory 310 * @psession - reference to jpeg session ptr 311 **/ 312 typedef struct { 313 int (*get_memory)( omx_jpeg_ouput_buf_t *p_out_buf, void *p_jpeg_session); 314 void *psession; 315 } QOMX_MEM_OPS; 316 317 /** QOMX_JPEG_SPEED_MODE 318 * Enum specifying the values for the jpeg 319 * speed mode setting 320 **/ 321 typedef enum { 322 QOMX_JPEG_SPEED_MODE_NORMAL, 323 QOMX_JPEG_SPEED_MODE_HIGH 324 } QOMX_JPEG_SPEED_MODE; 325 326 /** QOMX_JPEG_SPEED 327 * Structure used to set the jpeg speed mode 328 * parameter 329 * @speedMode - jpeg speed mode 330 **/ 331 typedef struct { 332 QOMX_JPEG_SPEED_MODE speedMode; 333 } QOMX_JPEG_SPEED; 334 335 /** OMX_IMAGE_TYPE 336 * Enum specifying the values for the jpeg 337 * image type setting 338 **/ 339 typedef enum { 340 QOMX_JPEG_IMAGE_TYPE_JPEG, 341 QOMX_JPEG_IMAGE_TYPE_MPO 342 } OMX_IMAGE_TYPE; 343 344 /** QOMX_JPEG_IMAGE_SEQUENCE_INFO 345 * Struct specifying the parameters for 346 * sequence of jpeg images 347 * @image_type : jpeg image type 348 * @is_primary_image: Flag indicating if the image is a 349 primary image in the sequence 350 * @num_of_images: Number of images in the sequence 351 **/ 352 typedef struct { 353 OMX_IMAGE_TYPE image_type; 354 OMX_U8 is_primary_image; 355 OMX_U32 num_of_images; 356 } QOMX_JPEG_MULTI_IMAGE_INFO; 357 358 #ifdef __cplusplus 359 } 360 #endif 361 362 #endif 363