1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/omx-plugin/include/froyo/hardware/hardware.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,167 @@ 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 + HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, 1.137 + HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, 1.138 + HAL_PIXEL_FORMAT_YCbCr_422_P = 0x12, 1.139 + HAL_PIXEL_FORMAT_YCbCr_420_P = 0x13, 1.140 + HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, 1.141 + HAL_PIXEL_FORMAT_YCbCr_420_I = 0x15, 1.142 + HAL_PIXEL_FORMAT_CbYCrY_422_I = 0x16, 1.143 + HAL_PIXEL_FORMAT_CbYCrY_420_I = 0x17, 1.144 + HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED = 0x20, 1.145 + HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x21, 1.146 + HAL_PIXEL_FORMAT_YCrCb_420_SP_TILED = 0x22, 1.147 + HAL_PIXEL_FORMAT_YCrCb_422_SP = 0x23, 1.148 +}; 1.149 + 1.150 + 1.151 +/** 1.152 + * Transformation definitions 1.153 + */ 1.154 + 1.155 +enum { 1.156 + /* flip source image horizontally */ 1.157 + HAL_TRANSFORM_FLIP_H = 0x01, 1.158 + /* flip source image vertically */ 1.159 + HAL_TRANSFORM_FLIP_V = 0x02, 1.160 + /* rotate source image 90 degrees */ 1.161 + HAL_TRANSFORM_ROT_90 = 0x04, 1.162 + /* rotate source image 180 degrees */ 1.163 + HAL_TRANSFORM_ROT_180 = 0x03, 1.164 + /* rotate source image 270 degrees */ 1.165 + HAL_TRANSFORM_ROT_270 = 0x07, 1.166 +}; 1.167 + 1.168 +__END_DECLS 1.169 + 1.170 +#endif /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */