1/*
2 * Copyright (C) 2023 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
17syntax = "proto2";
18
19package android.media.codec;
20
21//
22// MediaResource reclaim status code.
23enum ReclaimStatus {
24    // Unspecified Reclaim error.
25    RECLAIM_STATUS_UNSPECIFIED = 0;
26    // Reclaimed successfully.
27    RECLAIM_SUCCESS = 1;
28    // Reclaim failed as none of the clients have the requested resources.
29    RECLAIM_FAILED_NO_CLIENTS = 2;
30    // Reclaim failed as client(s) failed to reclaim the resources.
31    RECLAIM_FAILED_RECLAIM_RESOURCES = 3;
32}
33
34//
35// MediaCodec type.
36//
37// From
38//  frameworks/av/services/mediaresourcemanager/aidl/android/media/MediaResourceSubType.aidl
39enum CodecType {
40    // Unspecified codec type.
41    CODEC_TYPE_UNSPECIFIED = 0;
42    // Audio codec
43    CODEC_TYPE_AUDIO = 1;
44    // Video codec.
45    CODEC_TYPE_VIDEO = 2;
46    // Image codec.
47    CODEC_TYPE_IMAGE = 3;
48}
49
50// The codec technology.
51enum Codec {
52    CODEC_UNKNOWN = 0;
53    CODEC_AVC = 1;
54    CODEC_HEVC = 2;
55    CODEC_VP8 = 3;
56    CODEC_VP9 = 4;
57    CODEC_AV1 = 5;
58}
59
60// The video resolution, as computed by multiplying the width by the height and finding the enum
61// that is just below the limit.
62enum Resolution {
63   RESOLUTION_UNKNOWN = 0;
64   RESOLUTION_ZERO = -1;
65   RESOLUTION_INVALID = -2;
66
67   RESOLUTION_SMALLEST = 11;
68   RESOLUTION_VERY_LOW = 41;
69   RESOLUTION_352X640 = 228;
70   RESOLUTION_360X640 = 233;
71   RESOLUTION_480X640 = 311;
72   RESOLUTION_480X854 = 414;
73   RESOLUTION_540X960 = 524;
74   RESOLUTION_576X1024 = 621;
75
76   RESOLUTION_720P_HD_ALMOST = 912; // -1%
77   RESOLUTION_720P_HD = 931; // +1%
78
79   RESOLUTION_1080P_FHD_ALMOST = 2053; // -1%
80   RESOLUTION_1080P_FHD = 2095; // +1%
81
82   RESOLUTION_1080X2340 = 2553;
83   RESOLUTION_1080X2400 = 2618;
84   RESOLUTION_1440X2560 = 3724;
85
86   RESOLUTION_4K_UHD_ALMOST = 8211; // -1%
87   RESOLUTION_4K_UHD = 8378; // +1%
88   RESOLUTION_8K_UHD_ALMOST = 32846; // -1%
89   RESOLUTION_8K_UHD = 33510; // +1%
90   RESOLUTION_16K = 134038;
91   RESOLUTION_32K = 536151;
92   RESOLUTION_MAX_SIZE = 2147483647;
93}
94
95// The video framerate as detected by looking at timestamps.
96enum Framerate {
97    FRAMERATE_UNKNOWN = 0;
98    FRAMERATE_UNDETERMINED = 1;
99    FRAMERATE_24_3_2_PULLDOWN = 2;
100    FRAMERATE_24 = 2400;
101    FRAMERATE_25 = 2500;
102    FRAMERATE_30 = 3000;
103    FRAMERATE_50 = 5000;
104    FRAMERATE_60 = 6000;
105    FRAMERATE_120 = 12000;
106    FRAMERATE_240 = 24000;
107    FRAMERATE_480 = 48000;
108    FRAMERATE_960 = 96000;
109}
110
111// Bitrate is relative to the codec, resolution and framerate using a lookup table.
112enum Bitrate {
113    BITRATE_UNKNOWN = 0;
114    BITRATE_LOW = 1;
115    BITRATE_MEDIUM = 2;
116    BITRATE_HIGH = 3;
117}
118
119// The HDR format produced by the decoder.
120enum HdrFormat {
121    HDR_FORMAT_UNKNOWN = 0;
122    HDR_FORMAT_NONE = 1;
123    HDR_FORMAT_HLG = 2;
124    HDR_FORMAT_HDR10 = 3;
125    HDR_FORMAT_HDR10_PLUS = 4;
126    HDR_FORMAT_DOLBY_VISION = 5;
127}
128