1 /* 2 * Copyright 2019 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 */ 16 17 #pragma once 18 19 #include <aidl/android/hardware/graphics/common/BlendMode.h> 20 #include <aidl/android/hardware/graphics/common/ChromaSiting.h> 21 #include <aidl/android/hardware/graphics/common/Compression.h> 22 #include <aidl/android/hardware/graphics/common/Cta861_3.h> 23 #include <aidl/android/hardware/graphics/common/Dataspace.h> 24 #include <aidl/android/hardware/graphics/common/ExtendableType.h> 25 #include <aidl/android/hardware/graphics/common/Interlaced.h> 26 #include <aidl/android/hardware/graphics/common/PlaneLayout.h> 27 #include <aidl/android/hardware/graphics/common/PlaneLayoutComponentType.h> 28 #include <aidl/android/hardware/graphics/common/Rect.h> 29 #include <aidl/android/hardware/graphics/common/Smpte2086.h> 30 #include <aidl/android/hardware/graphics/common/StandardMetadataType.h> 31 #include <aidl/android/hardware/graphics/common/XyColor.h> 32 #include <android/hardware/graphics/mapper/4.0/IMapper.h> 33 34 namespace android { 35 namespace gralloc4 { 36 37 #define GRALLOC4_STANDARD_METADATA_TYPE "android.hardware.graphics.common.StandardMetadataType" 38 #define GRALLOC4_STANDARD_CHROMA_SITING "android.hardware.graphics.common.ChromaSiting" 39 #define GRALLOC4_STANDARD_COMPRESSION "android.hardware.graphics.common.Compression" 40 #define GRALLOC4_STANDARD_INTERLACED "android.hardware.graphics.common.Interlaced" 41 #define GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE \ 42 "android.hardware.graphics.common.PlaneLayoutComponentType" 43 44 /*---------------------------------------------------------------------------------------------*/ 45 /** 46 * Definitions of the standard buffer metadata types. It is recommended that everyone uses 47 * these definitions directly for standard buffer metadata types. 48 */ 49 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_BufferId = { 50 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::BUFFER_ID) 51 }; 52 53 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Name = { 54 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::NAME) 55 }; 56 57 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Width = { 58 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::WIDTH) 59 }; 60 61 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Height = { 62 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::HEIGHT) 63 }; 64 65 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_LayerCount = { 66 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::LAYER_COUNT) 67 }; 68 69 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_PixelFormatRequested = { 70 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::PIXEL_FORMAT_REQUESTED) 71 }; 72 73 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_PixelFormatFourCC = { 74 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::PIXEL_FORMAT_FOURCC) 75 }; 76 77 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_PixelFormatModifier = { 78 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::PIXEL_FORMAT_MODIFIER) 79 }; 80 81 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Usage = { 82 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::USAGE) 83 }; 84 85 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_AllocationSize = { 86 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::ALLOCATION_SIZE) 87 }; 88 89 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_ProtectedContent = { 90 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::PROTECTED_CONTENT) 91 }; 92 93 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Compression = { 94 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::COMPRESSION) 95 }; 96 97 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Interlaced = { 98 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::INTERLACED) 99 }; 100 101 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_ChromaSiting = { 102 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::CHROMA_SITING) 103 }; 104 105 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_PlaneLayouts = { 106 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::PLANE_LAYOUTS) 107 }; 108 109 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Crop = { 110 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::CROP) 111 }; 112 113 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Dataspace = { 114 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::DATASPACE) 115 }; 116 117 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_BlendMode = { 118 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::BLEND_MODE) 119 }; 120 121 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType 122 MetadataType_Smpte2086 = {GRALLOC4_STANDARD_METADATA_TYPE, 123 static_cast<int64_t>(aidl::android::hardware::graphics::common:: 124 StandardMetadataType::SMPTE2086)}; 125 126 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType 127 MetadataType_Cta861_3 = {GRALLOC4_STANDARD_METADATA_TYPE, 128 static_cast<int64_t>(aidl::android::hardware::graphics::common:: 129 StandardMetadataType::CTA861_3)}; 130 131 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType 132 MetadataType_Smpte2094_40 = {GRALLOC4_STANDARD_METADATA_TYPE, 133 static_cast<int64_t>( 134 aidl::android::hardware::graphics::common:: 135 StandardMetadataType::SMPTE2094_40)}; 136 137 static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType 138 MetadataType_Smpte2094_10 = {GRALLOC4_STANDARD_METADATA_TYPE, 139 static_cast<int64_t>( 140 aidl::android::hardware::graphics::common:: 141 StandardMetadataType::SMPTE2094_10)}; 142 143 /*---------------------------------------------------------------------------------------------*/ 144 145 /** 146 * Definitions of the standard compression strategies. It is recommended that everyone uses 147 * these definitions directly for standard compression strategies. 148 */ 149 static const aidl::android::hardware::graphics::common::ExtendableType Compression_None = 150 {GRALLOC4_STANDARD_COMPRESSION, 151 static_cast<int64_t>(aidl::android::hardware::graphics::common::Compression::NONE)}; 152 153 static const aidl::android::hardware::graphics::common::ExtendableType 154 Compression_DisplayStreamCompression = 155 {GRALLOC4_STANDARD_COMPRESSION, 156 static_cast<int64_t>(aidl::android::hardware::graphics::common::Compression:: 157 DISPLAY_STREAM_COMPRESSION)}; 158 159 /*---------------------------------------------------------------------------------------------*/ 160 161 /** 162 * Definitions of the standard interlaced strategies. It is recommended that everyone uses 163 * these definitions directly for standard interlaced strategies. 164 */ 165 static const aidl::android::hardware::graphics::common::ExtendableType Interlaced_None = 166 {GRALLOC4_STANDARD_INTERLACED, 167 static_cast<int64_t>(aidl::android::hardware::graphics::common::Interlaced::NONE)}; 168 169 static const aidl::android::hardware::graphics::common::ExtendableType Interlaced_TopBottom = 170 {GRALLOC4_STANDARD_INTERLACED, 171 static_cast<int64_t>(aidl::android::hardware::graphics::common::Interlaced::TOP_BOTTOM)}; 172 173 static const aidl::android::hardware::graphics::common::ExtendableType Interlaced_RightLeft = 174 {GRALLOC4_STANDARD_INTERLACED, 175 static_cast<int64_t>(aidl::android::hardware::graphics::common::Interlaced::RIGHT_LEFT)}; 176 177 /*---------------------------------------------------------------------------------------------*/ 178 179 /** 180 * Definitions of the standard chroma siting. It is recommended that everyone uses 181 * these definitions directly for standard chroma siting. 182 */ 183 static const aidl::android::hardware::graphics::common::ExtendableType ChromaSiting_None = 184 {GRALLOC4_STANDARD_CHROMA_SITING, 185 static_cast<int64_t>(aidl::android::hardware::graphics::common::ChromaSiting::NONE)}; 186 187 static const aidl::android::hardware::graphics::common::ExtendableType ChromaSiting_Unknown = 188 {GRALLOC4_STANDARD_CHROMA_SITING, 189 static_cast<int64_t>(aidl::android::hardware::graphics::common::ChromaSiting::UNKNOWN)}; 190 191 static const aidl::android::hardware::graphics::common::ExtendableType 192 ChromaSiting_SitedInterstitial = {GRALLOC4_STANDARD_CHROMA_SITING, 193 static_cast<int64_t>( 194 aidl::android::hardware::graphics::common:: 195 ChromaSiting::SITED_INTERSTITIAL)}; 196 197 static const aidl::android::hardware::graphics::common::ExtendableType 198 ChromaSiting_CositedHorizontal = {GRALLOC4_STANDARD_CHROMA_SITING, 199 static_cast<int64_t>( 200 aidl::android::hardware::graphics::common:: 201 ChromaSiting::COSITED_HORIZONTAL)}; 202 203 /*---------------------------------------------------------------------------------------------*/ 204 205 /** 206 * Definitions of the standard plane layout component types. It is recommended that everyone uses 207 * these definitions directly for standard plane layout component types 208 */ 209 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_Y = 210 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE, 211 static_cast<int64_t>( 212 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::Y)}; 213 214 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_CB = 215 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE, 216 static_cast<int64_t>( 217 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::CB)}; 218 219 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_CR = 220 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE, 221 static_cast<int64_t>( 222 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::CR)}; 223 224 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_R = 225 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE, 226 static_cast<int64_t>( 227 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::R)}; 228 229 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_G = 230 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE, 231 static_cast<int64_t>( 232 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::G)}; 233 234 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_B = 235 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE, 236 static_cast<int64_t>( 237 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::B)}; 238 239 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_A = 240 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE, 241 static_cast<int64_t>( 242 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::A)}; 243 244 static const aidl::android::hardware::graphics::common::ExtendableType 245 PlaneLayoutComponentType_RAW = 246 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE, 247 static_cast<int64_t>( 248 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::RAW)}; 249 250 /*---------------------------------------------------------------------------------------------*/ 251 252 /** 253 * The functions below encode and decode BufferDescriptorInfo into a byte stream. 254 */ 255 status_t encodeBufferDescriptorInfo(const android::hardware::graphics::mapper::V4_0::IMapper::BufferDescriptorInfo& bufferDescriptorInfo, android::hardware::hidl_vec<uint8_t>* outBufferDescriptorInfo); 256 status_t decodeBufferDescriptorInfo(const android::hardware::hidl_vec<uint8_t>& bufferDescriptorInfo, android::hardware::graphics::mapper::V4_0::IMapper::BufferDescriptorInfo* outBufferDescriptorInfo); 257 258 /** 259 * The functions below encode and decode standard metadata into a byte stream. It is STRONGLY 260 * recommended that both the vendor and system partitions use these functions when getting 261 * and setting metadata through gralloc 4 (IMapper 4.0). 262 */ 263 status_t encodeBufferId(uint64_t bufferId, android::hardware::hidl_vec<uint8_t>* outBufferId); 264 status_t decodeBufferId(const android::hardware::hidl_vec<uint8_t>& bufferId, uint64_t* outBufferId); 265 266 status_t encodeName(const std::string& name, android::hardware::hidl_vec<uint8_t>* outName); 267 status_t decodeName(const android::hardware::hidl_vec<uint8_t>& name, std::string* outName); 268 269 status_t encodeWidth(uint64_t width, android::hardware::hidl_vec<uint8_t>* outWidth); 270 status_t decodeWidth(const android::hardware::hidl_vec<uint8_t>& width, uint64_t* outWidth); 271 272 status_t encodeHeight(uint64_t height, android::hardware::hidl_vec<uint8_t>* outHeight); 273 status_t decodeHeight(const android::hardware::hidl_vec<uint8_t>& height, uint64_t* outHeight); 274 275 status_t encodeLayerCount(uint64_t layerCount, android::hardware::hidl_vec<uint8_t>* outLayerCount); 276 status_t decodeLayerCount(const android::hardware::hidl_vec<uint8_t>& layerCount, uint64_t* outLayerCount); 277 278 status_t encodePixelFormatRequested(const hardware::graphics::common::V1_2::PixelFormat& pixelFormatRequested, android::hardware::hidl_vec<uint8_t>* outPixelFormatRequested); 279 status_t decodePixelFormatRequested(const android::hardware::hidl_vec<uint8_t>& pixelFormatRequested, hardware::graphics::common::V1_2::PixelFormat* outPixelFormatRequested); 280 281 status_t encodePixelFormatFourCC(uint32_t pixelFormatFourCC, android::hardware::hidl_vec<uint8_t>* outPixelFormatFourCC); 282 status_t decodePixelFormatFourCC(const android::hardware::hidl_vec<uint8_t>& pixelFormatFourCC, uint32_t* outPixelFormatFourCC); 283 284 status_t encodePixelFormatModifier(uint64_t pixelFormatModifier, android::hardware::hidl_vec<uint8_t>* outPixelFormatModifier); 285 status_t decodePixelFormatModifier(const android::hardware::hidl_vec<uint8_t>& pixelFormatModifier, uint64_t* outPixelFormatModifier); 286 287 status_t encodeUsage(uint64_t usage, android::hardware::hidl_vec<uint8_t>* outUsage); 288 status_t decodeUsage(const android::hardware::hidl_vec<uint8_t>& usage, uint64_t* outUsage); 289 290 status_t encodeAllocationSize(uint64_t allocationSize, android::hardware::hidl_vec<uint8_t>* outAllocationSize); 291 status_t decodeAllocationSize(const android::hardware::hidl_vec<uint8_t>& allocationSize, uint64_t* outAllocationSize); 292 293 status_t encodeProtectedContent(uint64_t protectedContent, android::hardware::hidl_vec<uint8_t>* outProtectedContent); 294 status_t decodeProtectedContent(const android::hardware::hidl_vec<uint8_t>& protectedContent, uint64_t* outProtectedContent); 295 296 status_t encodeCompression(const aidl::android::hardware::graphics::common::ExtendableType& compression, android::hardware::hidl_vec<uint8_t>* outCompression); 297 status_t decodeCompression(const android::hardware::hidl_vec<uint8_t>& compression, aidl::android::hardware::graphics::common::ExtendableType* outCompression); 298 299 status_t encodeInterlaced(const aidl::android::hardware::graphics::common::ExtendableType& interlaced, android::hardware::hidl_vec<uint8_t>* outInterlaced); 300 status_t decodeInterlaced(const android::hardware::hidl_vec<uint8_t>& interlaced, aidl::android::hardware::graphics::common::ExtendableType* outInterlaced); 301 302 status_t encodeChromaSiting(const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting, android::hardware::hidl_vec<uint8_t>* outChromaSiting); 303 status_t decodeChromaSiting(const android::hardware::hidl_vec<uint8_t>& chromaSiting, aidl::android::hardware::graphics::common::ExtendableType* outChromaSiting); 304 305 status_t encodePlaneLayouts(const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& planeLayouts, android::hardware::hidl_vec<uint8_t>* outPlaneLayouts); 306 status_t decodePlaneLayouts(const android::hardware::hidl_vec<uint8_t>& planeLayouts, std::vector<aidl::android::hardware::graphics::common::PlaneLayout>* outPlaneLayouts); 307 308 status_t encodeCrop(const std::vector<aidl::android::hardware::graphics::common::Rect>& crop, android::hardware::hidl_vec<uint8_t>* outCrop); 309 status_t decodeCrop(const android::hardware::hidl_vec<uint8_t>& crop, std::vector<aidl::android::hardware::graphics::common::Rect>* outCrop); 310 311 status_t encodeDataspace(const aidl::android::hardware::graphics::common::Dataspace& dataspace, android::hardware::hidl_vec<uint8_t>* outDataspace); 312 status_t decodeDataspace(const android::hardware::hidl_vec<uint8_t>& dataspace, aidl::android::hardware::graphics::common::Dataspace* outDataspace); 313 314 status_t encodeBlendMode(const aidl::android::hardware::graphics::common::BlendMode& blendMode, android::hardware::hidl_vec<uint8_t>* outBlendMode); 315 status_t decodeBlendMode(const android::hardware::hidl_vec<uint8_t>& blendMode, aidl::android::hardware::graphics::common::BlendMode* outBlendMode); 316 317 status_t encodeSmpte2086( 318 const std::optional<aidl::android::hardware::graphics::common::Smpte2086>& smpte2086, 319 android::hardware::hidl_vec<uint8_t>* outSmpte2086); 320 status_t decodeSmpte2086( 321 const android::hardware::hidl_vec<uint8_t>& smpte2086, 322 std::optional<aidl::android::hardware::graphics::common::Smpte2086>* outSmpte2086); 323 324 status_t encodeCta861_3( 325 const std::optional<aidl::android::hardware::graphics::common::Cta861_3>& cta861_3, 326 android::hardware::hidl_vec<uint8_t>* outCta861_3); 327 status_t decodeCta861_3( 328 const android::hardware::hidl_vec<uint8_t>& cta861_3, 329 std::optional<aidl::android::hardware::graphics::common::Cta861_3>* outCta861_3); 330 331 status_t encodeSmpte2094_40(const std::optional<std::vector<uint8_t>>& smpte2094_40, 332 android::hardware::hidl_vec<uint8_t>* outSmpte2094_40); 333 status_t decodeSmpte2094_40(const android::hardware::hidl_vec<uint8_t>& smpte2094_40, 334 std::optional<std::vector<uint8_t>>* outSmpte2094_40); 335 336 status_t encodeSmpte2094_10(const std::optional<std::vector<uint8_t>>& smpte2094_10, 337 android::hardware::hidl_vec<uint8_t>* outSmpte2094_10); 338 status_t decodeSmpte2094_10(const android::hardware::hidl_vec<uint8_t>& smpte2094_10, 339 std::optional<std::vector<uint8_t>>* outSmpte2094_10); 340 341 /** 342 * The functions below can be used to encode and decode vendor metadata types. 343 */ 344 status_t encodeUint32( 345 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 346 uint32_t input, android::hardware::hidl_vec<uint8_t>* output); 347 status_t decodeUint32( 348 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 349 const android::hardware::hidl_vec<uint8_t>& input, uint32_t* output); 350 351 status_t encodeInt32( 352 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 353 int32_t input, android::hardware::hidl_vec<uint8_t>* output); 354 status_t decodeInt32( 355 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 356 const android::hardware::hidl_vec<uint8_t>& input, int32_t* output); 357 358 status_t encodeUint64( 359 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 360 uint64_t input, android::hardware::hidl_vec<uint8_t>* output); 361 status_t decodeUint64( 362 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 363 const android::hardware::hidl_vec<uint8_t>& input, uint64_t* output); 364 365 status_t encodeInt64( 366 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 367 int64_t input, android::hardware::hidl_vec<uint8_t>* output); 368 status_t decodeInt64( 369 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 370 const android::hardware::hidl_vec<uint8_t>& input, int64_t* output); 371 372 status_t encodeFloat( 373 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 374 float input, android::hardware::hidl_vec<uint8_t>* output); 375 status_t decodeFloat( 376 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 377 const android::hardware::hidl_vec<uint8_t>& input, float* output); 378 379 status_t encodeDouble( 380 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 381 double input, android::hardware::hidl_vec<uint8_t>* output); 382 status_t decodeDouble( 383 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 384 const android::hardware::hidl_vec<uint8_t>& input, double* output); 385 386 status_t encodeString( 387 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 388 const std::string& input, android::hardware::hidl_vec<uint8_t>* output); 389 status_t decodeString( 390 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType, 391 const android::hardware::hidl_vec<uint8_t>& input, std::string* output); 392 393 /** 394 * The functions below can be used to parse extendable types. 395 */ 396 bool isStandardMetadataType( 397 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType); 398 bool isStandardCompression( 399 const aidl::android::hardware::graphics::common::ExtendableType& compression); 400 bool isStandardInterlaced( 401 const aidl::android::hardware::graphics::common::ExtendableType& interlaced); 402 bool isStandardChromaSiting( 403 const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting); 404 bool isStandardPlaneLayoutComponentType( 405 const aidl::android::hardware::graphics::common::ExtendableType& planeLayoutComponentType); 406 407 aidl::android::hardware::graphics::common::StandardMetadataType getStandardMetadataTypeValue( 408 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType); 409 aidl::android::hardware::graphics::common::Compression getStandardCompressionValue( 410 const aidl::android::hardware::graphics::common::ExtendableType& compression); 411 aidl::android::hardware::graphics::common::Interlaced getStandardInterlacedValue( 412 const aidl::android::hardware::graphics::common::ExtendableType& interlaced); 413 aidl::android::hardware::graphics::common::ChromaSiting getStandardChromaSitingValue( 414 const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting); 415 aidl::android::hardware::graphics::common::PlaneLayoutComponentType 416 getStandardPlaneLayoutComponentTypeValue( 417 const aidl::android::hardware::graphics::common::ExtendableType& planeLayoutComponentType); 418 419 /** 420 * The functions below return string representations of ExtendableTypes 421 */ 422 std::string getCompressionName( 423 const aidl::android::hardware::graphics::common::ExtendableType& compression); 424 std::string getInterlacedName( 425 const aidl::android::hardware::graphics::common::ExtendableType& interlaced); 426 std::string getChromaSitingName( 427 const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting); 428 std::string getPlaneLayoutComponentTypeName( 429 const aidl::android::hardware::graphics::common::ExtendableType& planeLayoutComponentType); 430 431 } // namespace gralloc4 432 433 } // namespace android 434