1/*
2 * Copyright (C) 2017 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
17package android.hardware.media@1.0;
18
19import android.hardware.graphics.common@1.0::PixelFormat;
20
21/**
22 * Aliases
23 */
24typedef handle FileDescriptor; // This must have no more than one fd.
25typedef FileDescriptor Fence;
26typedef vec<uint8_t> Bytes;
27
28/**
29 * Ref: frameworks/native/include/ui/GraphicBuffer.h
30 * Ref: system/core/include/system/window.h: ANativeWindowBuffer
31 */
32
33/**
34 * This struct contains attributes for a gralloc buffer that can be put into a
35 * union.
36 */
37struct AnwBufferAttributes {
38    uint32_t width;
39    uint32_t height;
40    uint32_t stride;
41    PixelFormat format;
42    uint32_t usage; // TODO: convert to an enum
43    uint32_t generationNumber;
44    uint64_t layerCount;
45    uint64_t id;
46};
47
48/**
49 * An AnwBuffer is simply AnwBufferAttributes plus a native handle.
50 */
51struct AnwBuffer {
52    handle nativeHandle;
53    AnwBufferAttributes attr;
54};
55
56/**
57 * Ref: frameworks/native/include/android/rect.h
58 * Ref: frameworks/native/include/ui/Rect.h
59 */
60struct Rect {
61    int32_t left;
62    int32_t top;
63    int32_t right;
64    int32_t bottom;
65};
66
67/**
68 * Ref: frameworks/native/include/ui/Region.h
69 */
70typedef vec<Rect> Region;
71
72