Home | History | Annotate | Download | only in qomx_core
      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 #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 
     64 /** QOMX_IMAGE_EXT_INDEXTYPE
     65 *  This enum is an extension of the OMX_INDEXTYPE enum and
     66 *  specifies Qcom supported extention indexes. These indexes are
     67 *  associated with the extension names and can be used as
     68 *  Indexes in the SetParameter and Getparameter functins to set
     69 *  or get values from qcom specific data structures
     70 **/
     71 typedef enum {
     72   //Name: OMX.QCOM.image.exttype.exif
     73   QOMX_IMAGE_EXT_EXIF = 0x07F00000,
     74 
     75   //Name: OMX.QCOM.image.exttype.thumbnail
     76   QOMX_IMAGE_EXT_THUMBNAIL = 0x07F00001,
     77 
     78   //Name: OMX.QCOM.image.exttype.bufferOffset
     79   QOMX_IMAGE_EXT_BUFFER_OFFSET = 0x07F00002,
     80 
     81   //Name: OMX.QCOM.image.exttype.mobicat
     82   QOMX_IMAGE_EXT_MOBICAT = 0x07F00003,
     83 
     84   //Name: OMX.QCOM.image.encoding.approach
     85   QOMX_IMAGE_EXT_ENCODING_MODE = 0x07F00004,
     86 
     87   //Name: OMX.QCOM.image.exttype.workbuffer
     88   QOMX_IMAGE_EXT_WORK_BUFFER = 0x07F00005,
     89 
     90   //Name: OMX.QCOM.image.exttype.metadata
     91   QOMX_IMAGE_EXT_METADATA = 0x07F00008,
     92 
     93   //Name: OMX.QCOM.image.exttype.metaEncKey
     94   QOMX_IMAGE_EXT_META_ENC_KEY = 0x07F00009,
     95 
     96   //Name: OMX.QCOM.image.exttype.memOps
     97   QOMX_IMAGE_EXT_MEM_OPS = 0x07F0000A,
     98 
     99   //Name: OMX.QCOM.image.exttype.jpeg.speed
    100   QOMX_IMAGE_EXT_JPEG_SPEED = 0x07F000B,
    101 
    102 } QOMX_IMAGE_EXT_INDEXTYPE;
    103 
    104 /** QOMX_BUFFER_INFO
    105 *  The structure specifies informaton
    106 *   associated with the buffers and should be passed as appData
    107 *   in UseBuffer calls to the OMX component with buffer specific
    108 *   data. @ fd - FD of the buffer allocated. If the buffer is
    109 *          allocated on the heap, it can be zero.
    110 *   @offset - Buffer offset
    111 **/
    112 
    113 typedef struct {
    114   OMX_U32 fd;
    115   OMX_U32 offset;
    116 } QOMX_BUFFER_INFO;
    117 
    118 /** QEXIF_INFO_DATA
    119 *   The basic exif structure used to construct
    120 *   information for a single exif tag.
    121 *   @tag_entry
    122 *   @tag_id
    123 **/
    124 typedef struct{
    125   exif_tag_entry_t tag_entry;
    126   exif_tag_id_t tag_id;
    127 } QEXIF_INFO_DATA;
    128 
    129 /**QOMX_EXIF_INFO
    130 *  The structure contains an array of exif tag
    131 *  structures(qexif_info_data) and should be passed to the OMX
    132 *  layer by the OMX client using the extension index.
    133 *  @exif_data - Array of exif tags
    134 *  @numOfEntries - Number of exif tags entries being passed in
    135 *                 the array
    136 **/
    137 typedef struct {
    138   QEXIF_INFO_DATA *exif_data;
    139   OMX_U32 numOfEntries;
    140 } QOMX_EXIF_INFO;
    141 
    142 /**QOMX_YUV_FRAME_INFO
    143 *  The structre contains all the offsets
    144 *  associated with the Y and cbcr buffers.
    145 *  @yOffset - Offset within the Y buffer
    146 *  @cbcrOffset - Offset within the cb/cr buffer. The array
    147 *                should be populated in order depending on cb
    148 *                first or cr first in case of planar data. For
    149 *                pseusoplanar, only the first array element
    150 *                needs to be filled and the secnd element should
    151 *                be set to zero.
    152 *  @cbcrStartOffset - Start offset of the cb/cr buffer starting
    153 *                     starting from the Y buffer. The array
    154 *                     should be populated in order depending on
    155 *                     cb first or cr first in case of planar
    156 *                     data. For pseusoplanar, only the first
    157 *                     array element needs to be filled and the
    158 *                     secnd element should be set to zero.
    159 **/
    160 typedef struct {
    161   OMX_U32 yOffset;
    162   OMX_U32 cbcrOffset[2];
    163   OMX_U32 cbcrStartOffset[2];
    164 } QOMX_YUV_FRAME_INFO;
    165 
    166 /** qomx_thumbnail_info
    167 *  Includes all information associated with the thumbnail
    168 *  @input_width - Width of the input thumbnail buffer
    169 *  @input_height - Heighr of the input thumbnail buffer
    170 *  @scaling_enabled - Flag indicating if thumbnail scaling is
    171 *  enabled.
    172 *  @quality - JPEG Q factor value in the range of 1-100. A factor of 1
    173  *               produces the smallest, worst quality images, and a factor
    174  *               of 100 produces the largest, best quality images.  A
    175  *               typical default is 75 for small good quality images.
    176 *  @crop_info - Includes the crop width, crop height,
    177 *               horizontal and vertical offsets.
    178 *  @output_width - Output Width of the the thumbnail. This is
    179 *                the width after scaling if scaling is enabled
    180 *                or width after cropping if only cropping is
    181 *                enabled or same same input width otherwise
    182 *  @output_height - Output height of the thumbnail. This is
    183 *                the height after scaling if scaling is enabled
    184 *                or height after cropping if only cropping is
    185 *                enabled or same same input height otherwise
    186 **/
    187 typedef struct {
    188   OMX_U32 input_width;
    189   OMX_U32 input_height;
    190   OMX_U8 scaling_enabled;
    191   OMX_U32 quality;
    192   OMX_CONFIG_RECTTYPE crop_info;
    193   OMX_U32 output_width;
    194   OMX_U32 output_height;
    195   QOMX_YUV_FRAME_INFO tmbOffset;
    196   OMX_U32 rotation;
    197 } QOMX_THUMBNAIL_INFO;
    198 
    199 /**qomx_mobicat
    200 *  Mobicat data to padded tot he OMX layer
    201 *  @mobicatData - Mobicate data
    202 *  @mobicatDataLength - length of the mobicat data
    203 **/
    204 typedef struct {
    205   OMX_U8 *mobicatData;
    206   OMX_U32 mobicatDataLength;
    207 } QOMX_MOBICAT;
    208 
    209 /**qomx_workbuffer
    210 *  Ion buffer to be used for the H/W encoder
    211 *  @fd - FD of the buffer allocated
    212 *  @vaddr - Buffer address
    213 **/
    214 typedef struct {
    215   int fd;
    216   uint8_t *vaddr;
    217   uint32_t length;
    218 } QOMX_WORK_BUFFER;
    219 
    220 /**QOMX_METADATA
    221  *
    222  * meta data to be set in EXIF
    223  */
    224 typedef struct {
    225   OMX_U8  *metadata;
    226   OMX_U32 metaPayloadSize;
    227 } QOMX_METADATA;
    228 
    229 /**QOMX_META_ENC_KEY
    230  *
    231  * meta data encryption key
    232  */
    233 typedef struct {
    234   OMX_U8  *metaKey;
    235   OMX_U32 keyLen;
    236 } QOMX_META_ENC_KEY;
    237 
    238 /** QOMX_IMG_COLOR_FORMATTYPE
    239 *  This enum is an extension of the OMX_COLOR_FORMATTYPE enum.
    240 *  It specifies Qcom supported color formats.
    241 **/
    242 typedef enum QOMX_IMG_COLOR_FORMATTYPE {
    243   OMX_QCOM_IMG_COLOR_FormatYVU420SemiPlanar = OMX_COLOR_FormatVendorStartUnused + 0x300,
    244   OMX_QCOM_IMG_COLOR_FormatYVU422SemiPlanar,
    245   OMX_QCOM_IMG_COLOR_FormatYVU422SemiPlanar_h1v2,
    246   OMX_QCOM_IMG_COLOR_FormatYUV422SemiPlanar_h1v2,
    247   OMX_QCOM_IMG_COLOR_FormatYVU444SemiPlanar,
    248   OMX_QCOM_IMG_COLOR_FormatYUV444SemiPlanar,
    249   OMX_QCOM_IMG_COLOR_FormatYVU420Planar,
    250   OMX_QCOM_IMG_COLOR_FormatYVU422Planar,
    251   OMX_QCOM_IMG_COLOR_FormatYVU422Planar_h1v2,
    252   OMX_QCOM_IMG_COLOR_FormatYUV422Planar_h1v2,
    253   OMX_QCOM_IMG_COLOR_FormatYVU444Planar,
    254   OMX_QCOM_IMG_COLOR_FormatYUV444Planar
    255 } QOMX_IMG_COLOR_FORMATTYPE;
    256 
    257 /** QOMX_ENCODING_MODE
    258 *  This enum is used to select parallel encoding
    259 *  or sequential encoding for the thumbnail and
    260 *  main image
    261 **/
    262 typedef enum {
    263   OMX_Serial_Encoding,
    264   OMX_Parallel_Encoding
    265 } QOMX_ENCODING_MODE;
    266 
    267 
    268 /**omx_jpeg_ouput_buf_t
    269 *  Structure describing jpeg output buffer
    270 *  @handle - Handle to the containing class
    271 *  @mem_hdl - Handle to camera memory struct
    272 *  @vaddr - Buffer address
    273 *  @size - Buffer size
    274 *  @fd - file descriptor
    275 **/
    276 typedef struct {
    277   void *handle;
    278   void *mem_hdl;
    279   int8_t isheap;
    280   int size; /*input*/
    281   void *vaddr;
    282   int fd;
    283 } omx_jpeg_ouput_buf_t;
    284 
    285 /** QOMX_MEM_OPS
    286 * Structure holding the function pointers to
    287 * buffer memory operations
    288 * @get_memory - function to allocate buffer memory
    289 **/
    290 typedef struct {
    291   int (*get_memory)( omx_jpeg_ouput_buf_t *p_out_buf);
    292 } QOMX_MEM_OPS;
    293 
    294 /** QOMX_JPEG_SPEED_MODE
    295 * Enum specifying the values for the jpeg
    296 * speed mode setting
    297 **/
    298 typedef enum {
    299   QOMX_JPEG_SPEED_MODE_NORMAL,
    300   QOMX_JPEG_SPEED_MODE_HIGH
    301 } QOMX_JPEG_SPEED_MODE;
    302 
    303 /** QOMX_JPEG_SPEED
    304 * Structure used to set the jpeg speed mode
    305 * parameter
    306 * @speedMode - jpeg speed mode
    307 **/
    308 typedef struct {
    309   QOMX_JPEG_SPEED_MODE speedMode;
    310 } QOMX_JPEG_SPEED;
    311 
    312 #ifdef __cplusplus
    313  }
    314 #endif
    315 
    316 #endif
    317