• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /*---------------------------------------------------------------------------------------------*/
138 
139 /**
140  * Definitions of the standard compression strategies. It is recommended that everyone uses
141  * these definitions directly for standard compression strategies.
142  */
143 static const aidl::android::hardware::graphics::common::ExtendableType Compression_None =
144         {GRALLOC4_STANDARD_COMPRESSION,
145          static_cast<int64_t>(aidl::android::hardware::graphics::common::Compression::NONE)};
146 
147 static const aidl::android::hardware::graphics::common::ExtendableType
148         Compression_DisplayStreamCompression =
149                 {GRALLOC4_STANDARD_COMPRESSION,
150                  static_cast<int64_t>(aidl::android::hardware::graphics::common::Compression::
151                                               DISPLAY_STREAM_COMPRESSION)};
152 
153 /*---------------------------------------------------------------------------------------------*/
154 
155 /**
156  * Definitions of the standard interlaced strategies. It is recommended that everyone uses
157  * these definitions directly for standard interlaced strategies.
158  */
159 static const aidl::android::hardware::graphics::common::ExtendableType Interlaced_None =
160         {GRALLOC4_STANDARD_INTERLACED,
161          static_cast<int64_t>(aidl::android::hardware::graphics::common::Interlaced::NONE)};
162 
163 static const aidl::android::hardware::graphics::common::ExtendableType Interlaced_TopBottom =
164         {GRALLOC4_STANDARD_INTERLACED,
165          static_cast<int64_t>(aidl::android::hardware::graphics::common::Interlaced::TOP_BOTTOM)};
166 
167 static const aidl::android::hardware::graphics::common::ExtendableType Interlaced_RightLeft =
168         {GRALLOC4_STANDARD_INTERLACED,
169          static_cast<int64_t>(aidl::android::hardware::graphics::common::Interlaced::RIGHT_LEFT)};
170 
171 /*---------------------------------------------------------------------------------------------*/
172 
173 /**
174  * Definitions of the standard chroma siting. It is recommended that everyone uses
175  * these definitions directly for standard chroma siting.
176  */
177 static const aidl::android::hardware::graphics::common::ExtendableType ChromaSiting_None =
178         {GRALLOC4_STANDARD_CHROMA_SITING,
179          static_cast<int64_t>(aidl::android::hardware::graphics::common::ChromaSiting::NONE)};
180 
181 static const aidl::android::hardware::graphics::common::ExtendableType ChromaSiting_Unknown =
182         {GRALLOC4_STANDARD_CHROMA_SITING,
183          static_cast<int64_t>(aidl::android::hardware::graphics::common::ChromaSiting::UNKNOWN)};
184 
185 static const aidl::android::hardware::graphics::common::ExtendableType
186         ChromaSiting_SitedInterstitial = {GRALLOC4_STANDARD_CHROMA_SITING,
187                                           static_cast<int64_t>(
188                                                   aidl::android::hardware::graphics::common::
189                                                           ChromaSiting::SITED_INTERSTITIAL)};
190 
191 static const aidl::android::hardware::graphics::common::ExtendableType
192         ChromaSiting_CositedHorizontal = {GRALLOC4_STANDARD_CHROMA_SITING,
193                                           static_cast<int64_t>(
194                                                   aidl::android::hardware::graphics::common::
195                                                           ChromaSiting::COSITED_HORIZONTAL)};
196 
197 /*---------------------------------------------------------------------------------------------*/
198 
199 /**
200  * Definitions of the standard plane layout component types. It is recommended that everyone uses
201  * these definitions directly for standard plane layout component types
202  */
203 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_Y =
204         {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
205          static_cast<int64_t>(
206                  aidl::android::hardware::graphics::common::PlaneLayoutComponentType::Y)};
207 
208 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_CB =
209         {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
210          static_cast<int64_t>(
211                  aidl::android::hardware::graphics::common::PlaneLayoutComponentType::CB)};
212 
213 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_CR =
214         {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
215          static_cast<int64_t>(
216                  aidl::android::hardware::graphics::common::PlaneLayoutComponentType::CR)};
217 
218 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_R =
219         {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
220          static_cast<int64_t>(
221                  aidl::android::hardware::graphics::common::PlaneLayoutComponentType::R)};
222 
223 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_G =
224         {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
225          static_cast<int64_t>(
226                  aidl::android::hardware::graphics::common::PlaneLayoutComponentType::G)};
227 
228 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_B =
229         {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
230          static_cast<int64_t>(
231                  aidl::android::hardware::graphics::common::PlaneLayoutComponentType::B)};
232 
233 static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_A =
234         {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
235          static_cast<int64_t>(
236                  aidl::android::hardware::graphics::common::PlaneLayoutComponentType::A)};
237 
238 static const aidl::android::hardware::graphics::common::ExtendableType
239         PlaneLayoutComponentType_RAW =
240                 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
241                  static_cast<int64_t>(
242                          aidl::android::hardware::graphics::common::PlaneLayoutComponentType::RAW)};
243 
244 /*---------------------------------------------------------------------------------------------*/
245 
246 /**
247  * The functions below encode and decode BufferDescriptorInfo into a byte stream.
248  */
249 status_t encodeBufferDescriptorInfo(const android::hardware::graphics::mapper::V4_0::IMapper::BufferDescriptorInfo& bufferDescriptorInfo, android::hardware::hidl_vec<uint8_t>* outBufferDescriptorInfo);
250 status_t decodeBufferDescriptorInfo(const android::hardware::hidl_vec<uint8_t>& bufferDescriptorInfo, android::hardware::graphics::mapper::V4_0::IMapper::BufferDescriptorInfo* outBufferDescriptorInfo);
251 
252 /**
253  * The functions below encode and decode standard metadata into a byte stream. It is STRONGLY
254  * recommended that both the vendor and system partitions use these functions when getting
255  * and setting metadata through gralloc 4 (IMapper 4.0).
256  */
257 status_t encodeBufferId(uint64_t bufferId, android::hardware::hidl_vec<uint8_t>* outBufferId);
258 status_t decodeBufferId(const android::hardware::hidl_vec<uint8_t>& bufferId, uint64_t* outBufferId);
259 
260 status_t encodeName(const std::string& name, android::hardware::hidl_vec<uint8_t>* outName);
261 status_t decodeName(const android::hardware::hidl_vec<uint8_t>& name, std::string* outName);
262 
263 status_t encodeWidth(uint64_t width, android::hardware::hidl_vec<uint8_t>* outWidth);
264 status_t decodeWidth(const android::hardware::hidl_vec<uint8_t>& width, uint64_t* outWidth);
265 
266 status_t encodeHeight(uint64_t height, android::hardware::hidl_vec<uint8_t>* outHeight);
267 status_t decodeHeight(const android::hardware::hidl_vec<uint8_t>& height, uint64_t* outHeight);
268 
269 status_t encodeLayerCount(uint64_t layerCount, android::hardware::hidl_vec<uint8_t>* outLayerCount);
270 status_t decodeLayerCount(const android::hardware::hidl_vec<uint8_t>& layerCount, uint64_t* outLayerCount);
271 
272 status_t encodePixelFormatRequested(const hardware::graphics::common::V1_2::PixelFormat& pixelFormatRequested, android::hardware::hidl_vec<uint8_t>* outPixelFormatRequested);
273 status_t decodePixelFormatRequested(const android::hardware::hidl_vec<uint8_t>& pixelFormatRequested, hardware::graphics::common::V1_2::PixelFormat* outPixelFormatRequested);
274 
275 status_t encodePixelFormatFourCC(uint32_t pixelFormatFourCC, android::hardware::hidl_vec<uint8_t>* outPixelFormatFourCC);
276 status_t decodePixelFormatFourCC(const android::hardware::hidl_vec<uint8_t>& pixelFormatFourCC, uint32_t* outPixelFormatFourCC);
277 
278 status_t encodePixelFormatModifier(uint64_t pixelFormatModifier, android::hardware::hidl_vec<uint8_t>* outPixelFormatModifier);
279 status_t decodePixelFormatModifier(const android::hardware::hidl_vec<uint8_t>& pixelFormatModifier, uint64_t* outPixelFormatModifier);
280 
281 status_t encodeUsage(uint64_t usage, android::hardware::hidl_vec<uint8_t>* outUsage);
282 status_t decodeUsage(const android::hardware::hidl_vec<uint8_t>& usage, uint64_t* outUsage);
283 
284 status_t encodeAllocationSize(uint64_t allocationSize, android::hardware::hidl_vec<uint8_t>* outAllocationSize);
285 status_t decodeAllocationSize(const android::hardware::hidl_vec<uint8_t>& allocationSize, uint64_t* outAllocationSize);
286 
287 status_t encodeProtectedContent(uint64_t protectedContent, android::hardware::hidl_vec<uint8_t>* outProtectedContent);
288 status_t decodeProtectedContent(const android::hardware::hidl_vec<uint8_t>& protectedContent, uint64_t* outProtectedContent);
289 
290 status_t encodeCompression(const aidl::android::hardware::graphics::common::ExtendableType& compression, android::hardware::hidl_vec<uint8_t>* outCompression);
291 status_t decodeCompression(const android::hardware::hidl_vec<uint8_t>& compression, aidl::android::hardware::graphics::common::ExtendableType* outCompression);
292 
293 status_t encodeInterlaced(const aidl::android::hardware::graphics::common::ExtendableType& interlaced, android::hardware::hidl_vec<uint8_t>* outInterlaced);
294 status_t decodeInterlaced(const android::hardware::hidl_vec<uint8_t>& interlaced, aidl::android::hardware::graphics::common::ExtendableType* outInterlaced);
295 
296 status_t encodeChromaSiting(const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting, android::hardware::hidl_vec<uint8_t>* outChromaSiting);
297 status_t decodeChromaSiting(const android::hardware::hidl_vec<uint8_t>& chromaSiting, aidl::android::hardware::graphics::common::ExtendableType* outChromaSiting);
298 
299 status_t encodePlaneLayouts(const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& planeLayouts, android::hardware::hidl_vec<uint8_t>* outPlaneLayouts);
300 status_t decodePlaneLayouts(const android::hardware::hidl_vec<uint8_t>& planeLayouts, std::vector<aidl::android::hardware::graphics::common::PlaneLayout>* outPlaneLayouts);
301 
302 status_t encodeCrop(const std::vector<aidl::android::hardware::graphics::common::Rect>& crop, android::hardware::hidl_vec<uint8_t>* outCrop);
303 status_t decodeCrop(const android::hardware::hidl_vec<uint8_t>& crop, std::vector<aidl::android::hardware::graphics::common::Rect>* outCrop);
304 
305 status_t encodeDataspace(const aidl::android::hardware::graphics::common::Dataspace& dataspace, android::hardware::hidl_vec<uint8_t>* outDataspace);
306 status_t decodeDataspace(const android::hardware::hidl_vec<uint8_t>& dataspace, aidl::android::hardware::graphics::common::Dataspace* outDataspace);
307 
308 status_t encodeBlendMode(const aidl::android::hardware::graphics::common::BlendMode& blendMode, android::hardware::hidl_vec<uint8_t>* outBlendMode);
309 status_t decodeBlendMode(const android::hardware::hidl_vec<uint8_t>& blendMode, aidl::android::hardware::graphics::common::BlendMode* outBlendMode);
310 
311 status_t encodeSmpte2086(
312         const std::optional<aidl::android::hardware::graphics::common::Smpte2086>& smpte2086,
313         android::hardware::hidl_vec<uint8_t>* outSmpte2086);
314 status_t decodeSmpte2086(
315         const android::hardware::hidl_vec<uint8_t>& smpte2086,
316         std::optional<aidl::android::hardware::graphics::common::Smpte2086>* outSmpte2086);
317 
318 status_t encodeCta861_3(
319         const std::optional<aidl::android::hardware::graphics::common::Cta861_3>& cta861_3,
320         android::hardware::hidl_vec<uint8_t>* outCta861_3);
321 status_t decodeCta861_3(
322         const android::hardware::hidl_vec<uint8_t>& cta861_3,
323         std::optional<aidl::android::hardware::graphics::common::Cta861_3>* outCta861_3);
324 
325 status_t encodeSmpte2094_40(const std::optional<std::vector<uint8_t>>& smpte2094_40,
326                             android::hardware::hidl_vec<uint8_t>* outSmpte2094_40);
327 status_t decodeSmpte2094_40(const android::hardware::hidl_vec<uint8_t>& smpte2094_40,
328                             std::optional<std::vector<uint8_t>>* outSmpte2094_40);
329 
330 /**
331  * The functions below can be used to encode and decode vendor metadata types.
332  */
333 status_t encodeUint32(
334         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
335         uint32_t input, android::hardware::hidl_vec<uint8_t>* output);
336 status_t decodeUint32(
337         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
338         const android::hardware::hidl_vec<uint8_t>& input, uint32_t* output);
339 
340 status_t encodeInt32(
341         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
342         int32_t input, android::hardware::hidl_vec<uint8_t>* output);
343 status_t decodeInt32(
344         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
345         const android::hardware::hidl_vec<uint8_t>& input, int32_t* output);
346 
347 status_t encodeUint64(
348         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
349         uint64_t input, android::hardware::hidl_vec<uint8_t>* output);
350 status_t decodeUint64(
351         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
352         const android::hardware::hidl_vec<uint8_t>& input, uint64_t* output);
353 
354 status_t encodeInt64(
355         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
356         int64_t input, android::hardware::hidl_vec<uint8_t>* output);
357 status_t decodeInt64(
358         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
359         const android::hardware::hidl_vec<uint8_t>& input, int64_t* output);
360 
361 status_t encodeFloat(
362         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
363         float input, android::hardware::hidl_vec<uint8_t>* output);
364 status_t decodeFloat(
365         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
366         const android::hardware::hidl_vec<uint8_t>& input, float* output);
367 
368 status_t encodeDouble(
369         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
370         double input, android::hardware::hidl_vec<uint8_t>* output);
371 status_t decodeDouble(
372         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
373         const android::hardware::hidl_vec<uint8_t>& input, double* output);
374 
375 status_t encodeString(
376         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
377         const std::string& input, android::hardware::hidl_vec<uint8_t>* output);
378 status_t decodeString(
379         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType,
380         const android::hardware::hidl_vec<uint8_t>& input, std::string* output);
381 
382 /**
383  * The functions below can be used to parse extendable types.
384  */
385 bool isStandardMetadataType(
386         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType);
387 bool isStandardCompression(
388         const aidl::android::hardware::graphics::common::ExtendableType& compression);
389 bool isStandardInterlaced(
390         const aidl::android::hardware::graphics::common::ExtendableType& interlaced);
391 bool isStandardChromaSiting(
392         const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting);
393 bool isStandardPlaneLayoutComponentType(
394         const aidl::android::hardware::graphics::common::ExtendableType& planeLayoutComponentType);
395 
396 aidl::android::hardware::graphics::common::StandardMetadataType getStandardMetadataTypeValue(
397         const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType);
398 aidl::android::hardware::graphics::common::Compression getStandardCompressionValue(
399         const aidl::android::hardware::graphics::common::ExtendableType& compression);
400 aidl::android::hardware::graphics::common::Interlaced getStandardInterlacedValue(
401         const aidl::android::hardware::graphics::common::ExtendableType& interlaced);
402 aidl::android::hardware::graphics::common::ChromaSiting getStandardChromaSitingValue(
403         const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting);
404 aidl::android::hardware::graphics::common::PlaneLayoutComponentType
405 getStandardPlaneLayoutComponentTypeValue(
406         const aidl::android::hardware::graphics::common::ExtendableType& planeLayoutComponentType);
407 
408 /**
409  * The functions below return string representations of ExtendableTypes
410  */
411 std::string getCompressionName(
412         const aidl::android::hardware::graphics::common::ExtendableType& compression);
413 std::string getInterlacedName(
414         const aidl::android::hardware::graphics::common::ExtendableType& interlaced);
415 std::string getChromaSitingName(
416         const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting);
417 std::string getPlaneLayoutComponentTypeName(
418         const aidl::android::hardware::graphics::common::ExtendableType& planeLayoutComponentType);
419 
420 } // namespace gralloc4
421 
422 } // namespace android
423