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

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /*
     2  * Copyright (C) 2008 The Android Open Source Project
     3  *
     4  * Licensed under the Apache License, Version 2.0 (the "License");
     5  * you may not use this file except in compliance with the License.
     6  * You may obtain a copy of the License at
     7  *
     8  *      http://www.apache.org/licenses/LICENSE-2.0
     9  *
    10  * Unless required by applicable law or agreed to in writing, software
    11  * distributed under the License is distributed on an "AS IS" BASIS,
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  * See the License for the specific language governing permissions and
    14  * limitations under the License.
    15  */
    17 #ifndef ANDROID_INCLUDE_HARDWARE_HARDWARE_H
    18 #define ANDROID_INCLUDE_HARDWARE_HARDWARE_H
    20 #include <stdint.h>
    21 #include <sys/cdefs.h>
    23 #include <cutils/native_handle.h>
    25 __BEGIN_DECLS
    27 /*
    28  * Value for the hw_module_t.tag field
    29  */
    31 #define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
    33 #define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
    34 #define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
    36 struct hw_module_t;
    37 struct hw_module_methods_t;
    38 struct hw_device_t;
    40 /**
    41  * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
    42  * and the fields of this data structure must begin with hw_module_t
    43  * followed by module specific information.
    44  */
    45 typedef struct hw_module_t {
    46     /** tag must be initialized to HARDWARE_MODULE_TAG */
    47     uint32_t tag;
    49     /** major version number for the module */
    50     uint16_t version_major;
    52     /** minor version number of the module */
    53     uint16_t version_minor;
    55     /** Identifier of module */
    56     const char *id;
    58     /** Name of this module */
    59     const char *name;
    61     /** Author/owner/implementor of the module */
    62     const char *author;
    64     /** Modules methods */
    65     struct hw_module_methods_t* methods;
    67     /** module's dso */
    68     void* dso;
    70     /** padding to 128 bytes, reserved for future use */
    71     uint32_t reserved[32-7];
    73 } hw_module_t;
    75 typedef struct hw_module_methods_t {
    76     /** Open a specific device */
    77     int (*open)(const struct hw_module_t* module, const char* id,
    78             struct hw_device_t** device);
    80 } hw_module_methods_t;
    82 /**
    83  * Every device data structure must begin with hw_device_t
    84  * followed by module specific public methods and attributes.
    85  */
    86 typedef struct hw_device_t {
    87     /** tag must be initialized to HARDWARE_DEVICE_TAG */
    88     uint32_t tag;
    90     /** version number for hw_device_t */
    91     uint32_t version;
    93     /** reference to the module this device belongs to */
    94     struct hw_module_t* module;
    96     /** padding reserved for future use */
    97     uint32_t reserved[12];
    99     /** Close this device */
   100     int (*close)(struct hw_device_t* device);
   102 } hw_device_t;
   104 /**
   105  * Name of the hal_module_info
   106  */
   107 #define HAL_MODULE_INFO_SYM         HMI
   109 /**
   110  * Name of the hal_module_info as a string
   111  */
   112 #define HAL_MODULE_INFO_SYM_AS_STR  "HMI"
   114 /**
   115  * Get the module info associated with a module by id.
   116  * @return: 0 == success, <0 == error and *pHmi == NULL
   117  */
   118 int hw_get_module(const char *id, const struct hw_module_t **module);
   121 /**
   122  * pixel format definitions
   123  */
   125 enum {
   126     HAL_PIXEL_FORMAT_RGBA_8888          = 1,
   127     HAL_PIXEL_FORMAT_RGBX_8888          = 2,
   128     HAL_PIXEL_FORMAT_RGB_888            = 3,
   129     HAL_PIXEL_FORMAT_RGB_565            = 4,
   130     HAL_PIXEL_FORMAT_BGRA_8888          = 5,
   131     HAL_PIXEL_FORMAT_RGBA_5551          = 6,
   132     HAL_PIXEL_FORMAT_RGBA_4444          = 7,
   134     /* 0x8 - 0xFF range unavailable */
   136     /*
   137      * 0x100 - 0x1FF
   138      *
   139      * This range is reserved for pixel formats that are specific to the HAL
   140      * implementation.  Implementations can use any value in this range to
   141      * communicate video pixel formats between their HAL modules.  These formats
   142      * must not have an alpha channel.  Additionally, an EGLimage created from a
   143      * gralloc buffer of one of these formats must be supported for use with the
   144      * GL_OES_EGL_image_external OpenGL ES extension.
   145      */
   147     /*
   148      * Android YUV format:
   149      *
   150      * This format is exposed outside of the HAL to software
   151      * decoders and applications.
   152      * EGLImageKHR must support it in conjunction with the
   153      * OES_EGL_image_external extension.
   154      *
   155      * YV12 is 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
   156      * by (W/2) x (H/2) Cr and Cb planes.
   157      *
   158      * This format assumes
   159      * - an even width
   160      * - an even height
   161      * - a horizontal stride multiple of 16 pixels
   162      * - a vertical stride equal to the height
   163      *
   164      *   y_size = stride * height
   165      *   c_size = ALIGN(stride/2, 16) * height/2
   166      *   size = y_size + c_size * 2
   167      *   cr_offset = y_size
   168      *   cb_offset = y_size + c_size
   169      *
   170      */
   171     HAL_PIXEL_FORMAT_YV12   = 0x32315659, // YCrCb 4:2:0 Planar
   175     /* Legacy formats (deprecated), used by ImageFormat.java */
   176     HAL_PIXEL_FORMAT_YCbCr_422_SP       = 0x10, // NV16
   177     HAL_PIXEL_FORMAT_YCrCb_420_SP       = 0x11, // NV21
   178     HAL_PIXEL_FORMAT_YCbCr_422_I        = 0x14, // YUY2
   179 };
   182 /**
   183  * Transformation definitions
   184  *
   185  * IMPORTANT NOTE:
   186  * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.
   187  *
   188  */
   190 enum {
   191     /* flip source image horizontally (around the vertical axis) */
   192     HAL_TRANSFORM_FLIP_H    = 0x01,
   193     /* flip source image vertically (around the horizontal axis)*/
   194     HAL_TRANSFORM_FLIP_V    = 0x02,
   195     /* rotate source image 90 degrees clockwise */
   196     HAL_TRANSFORM_ROT_90    = 0x04,
   197     /* rotate source image 180 degrees */
   198     HAL_TRANSFORM_ROT_180   = 0x03,
   199     /* rotate source image 270 degrees clockwise */
   200     HAL_TRANSFORM_ROT_270   = 0x07,
   201 };
   203 __END_DECLS
   205 #endif  /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */

mercurial