media/omx-plugin/include/gb/hardware/hardware.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/omx-plugin/include/gb/hardware/hardware.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,205 @@
     1.4 +/*
     1.5 + * Copyright (C) 2008 The Android Open Source Project
     1.6 + *
     1.7 + * Licensed under the Apache License, Version 2.0 (the "License");
     1.8 + * you may not use this file except in compliance with the License.
     1.9 + * You may obtain a copy of the License at
    1.10 + *
    1.11 + *      http://www.apache.org/licenses/LICENSE-2.0
    1.12 + *
    1.13 + * Unless required by applicable law or agreed to in writing, software
    1.14 + * distributed under the License is distributed on an "AS IS" BASIS,
    1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.16 + * See the License for the specific language governing permissions and
    1.17 + * limitations under the License.
    1.18 + */
    1.19 +
    1.20 +#ifndef ANDROID_INCLUDE_HARDWARE_HARDWARE_H
    1.21 +#define ANDROID_INCLUDE_HARDWARE_HARDWARE_H
    1.22 +
    1.23 +#include <stdint.h>
    1.24 +#include <sys/cdefs.h>
    1.25 +
    1.26 +#include <cutils/native_handle.h>
    1.27 +
    1.28 +__BEGIN_DECLS
    1.29 +
    1.30 +/*
    1.31 + * Value for the hw_module_t.tag field
    1.32 + */
    1.33 +
    1.34 +#define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
    1.35 +
    1.36 +#define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
    1.37 +#define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
    1.38 +
    1.39 +struct hw_module_t;
    1.40 +struct hw_module_methods_t;
    1.41 +struct hw_device_t;
    1.42 +
    1.43 +/**
    1.44 + * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
    1.45 + * and the fields of this data structure must begin with hw_module_t
    1.46 + * followed by module specific information.
    1.47 + */
    1.48 +typedef struct hw_module_t {
    1.49 +    /** tag must be initialized to HARDWARE_MODULE_TAG */
    1.50 +    uint32_t tag;
    1.51 +
    1.52 +    /** major version number for the module */
    1.53 +    uint16_t version_major;
    1.54 +
    1.55 +    /** minor version number of the module */
    1.56 +    uint16_t version_minor;
    1.57 +
    1.58 +    /** Identifier of module */
    1.59 +    const char *id;
    1.60 +
    1.61 +    /** Name of this module */
    1.62 +    const char *name;
    1.63 +
    1.64 +    /** Author/owner/implementor of the module */
    1.65 +    const char *author;
    1.66 +
    1.67 +    /** Modules methods */
    1.68 +    struct hw_module_methods_t* methods;
    1.69 +
    1.70 +    /** module's dso */
    1.71 +    void* dso;
    1.72 +
    1.73 +    /** padding to 128 bytes, reserved for future use */
    1.74 +    uint32_t reserved[32-7];
    1.75 +
    1.76 +} hw_module_t;
    1.77 +
    1.78 +typedef struct hw_module_methods_t {
    1.79 +    /** Open a specific device */
    1.80 +    int (*open)(const struct hw_module_t* module, const char* id,
    1.81 +            struct hw_device_t** device);
    1.82 +
    1.83 +} hw_module_methods_t;
    1.84 +
    1.85 +/**
    1.86 + * Every device data structure must begin with hw_device_t
    1.87 + * followed by module specific public methods and attributes.
    1.88 + */
    1.89 +typedef struct hw_device_t {
    1.90 +    /** tag must be initialized to HARDWARE_DEVICE_TAG */
    1.91 +    uint32_t tag;
    1.92 +
    1.93 +    /** version number for hw_device_t */
    1.94 +    uint32_t version;
    1.95 +
    1.96 +    /** reference to the module this device belongs to */
    1.97 +    struct hw_module_t* module;
    1.98 +
    1.99 +    /** padding reserved for future use */
   1.100 +    uint32_t reserved[12];
   1.101 +
   1.102 +    /** Close this device */
   1.103 +    int (*close)(struct hw_device_t* device);
   1.104 +
   1.105 +} hw_device_t;
   1.106 +
   1.107 +/**
   1.108 + * Name of the hal_module_info
   1.109 + */
   1.110 +#define HAL_MODULE_INFO_SYM         HMI
   1.111 +
   1.112 +/**
   1.113 + * Name of the hal_module_info as a string
   1.114 + */
   1.115 +#define HAL_MODULE_INFO_SYM_AS_STR  "HMI"
   1.116 +
   1.117 +/**
   1.118 + * Get the module info associated with a module by id.
   1.119 + * @return: 0 == success, <0 == error and *pHmi == NULL
   1.120 + */
   1.121 +int hw_get_module(const char *id, const struct hw_module_t **module);
   1.122 +
   1.123 +
   1.124 +/**
   1.125 + * pixel format definitions
   1.126 + */
   1.127 +
   1.128 +enum {
   1.129 +    HAL_PIXEL_FORMAT_RGBA_8888          = 1,
   1.130 +    HAL_PIXEL_FORMAT_RGBX_8888          = 2,
   1.131 +    HAL_PIXEL_FORMAT_RGB_888            = 3,
   1.132 +    HAL_PIXEL_FORMAT_RGB_565            = 4,
   1.133 +    HAL_PIXEL_FORMAT_BGRA_8888          = 5,
   1.134 +    HAL_PIXEL_FORMAT_RGBA_5551          = 6,
   1.135 +    HAL_PIXEL_FORMAT_RGBA_4444          = 7,
   1.136 +
   1.137 +    /* 0x8 - 0xFF range unavailable */
   1.138 +
   1.139 +    /*
   1.140 +     * 0x100 - 0x1FF
   1.141 +     *
   1.142 +     * This range is reserved for pixel formats that are specific to the HAL
   1.143 +     * implementation.  Implementations can use any value in this range to
   1.144 +     * communicate video pixel formats between their HAL modules.  These formats
   1.145 +     * must not have an alpha channel.  Additionally, an EGLimage created from a
   1.146 +     * gralloc buffer of one of these formats must be supported for use with the
   1.147 +     * GL_OES_EGL_image_external OpenGL ES extension.
   1.148 +     */
   1.149 +
   1.150 +    /*
   1.151 +     * Android YUV format:
   1.152 +     *
   1.153 +     * This format is exposed outside of the HAL to software
   1.154 +     * decoders and applications.
   1.155 +     * EGLImageKHR must support it in conjunction with the
   1.156 +     * OES_EGL_image_external extension.
   1.157 +     *
   1.158 +     * YV12 is 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
   1.159 +     * by (W/2) x (H/2) Cr and Cb planes.
   1.160 +     *
   1.161 +     * This format assumes
   1.162 +     * - an even width
   1.163 +     * - an even height
   1.164 +     * - a horizontal stride multiple of 16 pixels
   1.165 +     * - a vertical stride equal to the height
   1.166 +     *
   1.167 +     *   y_size = stride * height
   1.168 +     *   c_size = ALIGN(stride/2, 16) * height/2
   1.169 +     *   size = y_size + c_size * 2
   1.170 +     *   cr_offset = y_size
   1.171 +     *   cb_offset = y_size + c_size
   1.172 +     *
   1.173 +     */
   1.174 +    HAL_PIXEL_FORMAT_YV12   = 0x32315659, // YCrCb 4:2:0 Planar
   1.175 +
   1.176 +
   1.177 +
   1.178 +    /* Legacy formats (deprecated), used by ImageFormat.java */
   1.179 +    HAL_PIXEL_FORMAT_YCbCr_422_SP       = 0x10, // NV16
   1.180 +    HAL_PIXEL_FORMAT_YCrCb_420_SP       = 0x11, // NV21
   1.181 +    HAL_PIXEL_FORMAT_YCbCr_422_I        = 0x14, // YUY2
   1.182 +};
   1.183 +
   1.184 +
   1.185 +/**
   1.186 + * Transformation definitions
   1.187 + *
   1.188 + * IMPORTANT NOTE:
   1.189 + * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.
   1.190 + *
   1.191 + */
   1.192 +
   1.193 +enum {
   1.194 +    /* flip source image horizontally (around the vertical axis) */
   1.195 +    HAL_TRANSFORM_FLIP_H    = 0x01,
   1.196 +    /* flip source image vertically (around the horizontal axis)*/
   1.197 +    HAL_TRANSFORM_FLIP_V    = 0x02,
   1.198 +    /* rotate source image 90 degrees clockwise */
   1.199 +    HAL_TRANSFORM_ROT_90    = 0x04,
   1.200 +    /* rotate source image 180 degrees */
   1.201 +    HAL_TRANSFORM_ROT_180   = 0x03,
   1.202 +    /* rotate source image 270 degrees clockwise */
   1.203 +    HAL_TRANSFORM_ROT_270   = 0x07,
   1.204 +};
   1.205 +
   1.206 +__END_DECLS
   1.207 +
   1.208 +#endif  /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */

mercurial