1 /* 2 * Copyright (C) 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 #ifndef ANDROID_MEDIA_ECO_SERVICE_CONSTANTS_H_ 17 #define ANDROID_MEDIA_ECO_SERVICE_CONSTANTS_H_ 18 19 #include <stdint.h> 20 #include <sys/mman.h> 21 22 namespace android { 23 namespace media { 24 namespace eco { 25 26 // Codec type. 27 constexpr int32_t CodecTypeUnknown = 0x00; 28 constexpr int32_t CodecTypeAVC = 0x01; 29 constexpr int32_t CodecTypeHEVC = 0x02; 30 31 // Encoded frame type. 32 constexpr int32_t FrameTypeUnknown = 0x0; 33 constexpr int32_t FrameTypeI = 0x01; 34 constexpr int32_t FrameTypeP = 0x02; 35 constexpr int32_t FrameTypeB = 0x04; 36 37 // Below constants are borrowed from 38 // frameworks/av/media/libstagefright/include/media/stagefright/MediaCodecConstants.h 39 40 // from MediaCodecInfo.java 41 42 // Profile types: 43 constexpr int32_t AVCProfileBaseline = 0x01; 44 constexpr int32_t AVCProfileMain = 0x02; 45 constexpr int32_t AVCProfileExtended = 0x04; 46 constexpr int32_t AVCProfileHigh = 0x08; 47 constexpr int32_t AVCProfileHigh10 = 0x10; 48 constexpr int32_t AVCProfileHigh422 = 0x20; 49 constexpr int32_t AVCProfileHigh444 = 0x40; 50 constexpr int32_t AVCProfileConstrainedBaseline = 0x10000; 51 constexpr int32_t AVCProfileConstrainedHigh = 0x80000; 52 53 constexpr int32_t HEVCProfileMain = 0x01; 54 constexpr int32_t HEVCProfileMain10 = 0x02; 55 constexpr int32_t HEVCProfileMainStill = 0x04; 56 constexpr int32_t HEVCProfileMain10HDR10 = 0x1000; 57 constexpr int32_t HEVCProfileMain10HDR10Plus = 0x2000; 58 59 // Level types: 60 constexpr int32_t AVCLevel1 = 0x01; 61 constexpr int32_t AVCLevel1b = 0x02; 62 constexpr int32_t AVCLevel11 = 0x04; 63 constexpr int32_t AVCLevel12 = 0x08; 64 constexpr int32_t AVCLevel13 = 0x10; 65 constexpr int32_t AVCLevel2 = 0x20; 66 constexpr int32_t AVCLevel21 = 0x40; 67 constexpr int32_t AVCLevel22 = 0x80; 68 constexpr int32_t AVCLevel3 = 0x100; 69 constexpr int32_t AVCLevel31 = 0x200; 70 constexpr int32_t AVCLevel32 = 0x400; 71 constexpr int32_t AVCLevel4 = 0x800; 72 constexpr int32_t AVCLevel41 = 0x1000; 73 constexpr int32_t AVCLevel42 = 0x2000; 74 constexpr int32_t AVCLevel5 = 0x4000; 75 constexpr int32_t AVCLevel51 = 0x8000; 76 constexpr int32_t AVCLevel52 = 0x10000; 77 constexpr int32_t AVCLevel6 = 0x20000; 78 constexpr int32_t AVCLevel61 = 0x40000; 79 constexpr int32_t AVCLevel62 = 0x80000; 80 81 constexpr int32_t HEVCMainTierLevel1 = 0x1; 82 constexpr int32_t HEVCHighTierLevel1 = 0x2; 83 constexpr int32_t HEVCMainTierLevel2 = 0x4; 84 constexpr int32_t HEVCHighTierLevel2 = 0x8; 85 constexpr int32_t HEVCMainTierLevel21 = 0x10; 86 constexpr int32_t HEVCHighTierLevel21 = 0x20; 87 constexpr int32_t HEVCMainTierLevel3 = 0x40; 88 constexpr int32_t HEVCHighTierLevel3 = 0x80; 89 constexpr int32_t HEVCMainTierLevel31 = 0x100; 90 constexpr int32_t HEVCHighTierLevel31 = 0x200; 91 constexpr int32_t HEVCMainTierLevel4 = 0x400; 92 constexpr int32_t HEVCHighTierLevel4 = 0x800; 93 constexpr int32_t HEVCMainTierLevel41 = 0x1000; 94 constexpr int32_t HEVCHighTierLevel41 = 0x2000; 95 constexpr int32_t HEVCMainTierLevel5 = 0x4000; 96 constexpr int32_t HEVCHighTierLevel5 = 0x8000; 97 constexpr int32_t HEVCMainTierLevel51 = 0x10000; 98 constexpr int32_t HEVCHighTierLevel51 = 0x20000; 99 constexpr int32_t HEVCMainTierLevel52 = 0x40000; 100 constexpr int32_t HEVCHighTierLevel52 = 0x80000; 101 constexpr int32_t HEVCMainTierLevel6 = 0x100000; 102 constexpr int32_t HEVCHighTierLevel6 = 0x200000; 103 constexpr int32_t HEVCMainTierLevel61 = 0x400000; 104 constexpr int32_t HEVCHighTierLevel61 = 0x800000; 105 constexpr int32_t HEVCMainTierLevel62 = 0x1000000; 106 constexpr int32_t HEVCHighTierLevel62 = 0x2000000; 107 108 inline static const char* asString_AVCProfile(int32_t i, const char* def = "??") { 109 switch (i) { 110 case AVCProfileBaseline: 111 return "Baseline"; 112 case AVCProfileMain: 113 return "Main"; 114 case AVCProfileExtended: 115 return "Extended"; 116 case AVCProfileHigh: 117 return "High"; 118 case AVCProfileHigh10: 119 return "High10"; 120 case AVCProfileHigh422: 121 return "High422"; 122 case AVCProfileHigh444: 123 return "High444"; 124 case AVCProfileConstrainedBaseline: 125 return "ConstrainedBaseline"; 126 case AVCProfileConstrainedHigh: 127 return "ConstrainedHigh"; 128 default: 129 return def; 130 } 131 } 132 133 inline static const char* asString_AVCLevel(int32_t i, const char* def = "??") { 134 switch (i) { 135 case AVCLevel1: 136 return "1"; 137 case AVCLevel1b: 138 return "1b"; 139 case AVCLevel11: 140 return "1.1"; 141 case AVCLevel12: 142 return "1.2"; 143 case AVCLevel13: 144 return "1.3"; 145 case AVCLevel2: 146 return "2"; 147 case AVCLevel21: 148 return "2.1"; 149 case AVCLevel22: 150 return "2.2"; 151 case AVCLevel3: 152 return "3"; 153 case AVCLevel31: 154 return "3.1"; 155 case AVCLevel32: 156 return "3.2"; 157 case AVCLevel4: 158 return "4"; 159 case AVCLevel41: 160 return "4.1"; 161 case AVCLevel42: 162 return "4.2"; 163 case AVCLevel5: 164 return "5"; 165 case AVCLevel51: 166 return "5.1"; 167 case AVCLevel52: 168 return "5.2"; 169 case AVCLevel6: 170 return "6"; 171 case AVCLevel61: 172 return "6.1"; 173 case AVCLevel62: 174 return "6.2"; 175 default: 176 return def; 177 } 178 } 179 180 inline static const char* asString_HEVCProfile(int32_t i, const char* def = "??") { 181 switch (i) { 182 case HEVCProfileMain: 183 return "Main"; 184 case HEVCProfileMain10: 185 return "Main10"; 186 case HEVCProfileMainStill: 187 return "MainStill"; 188 case HEVCProfileMain10HDR10: 189 return "Main10HDR10"; 190 case HEVCProfileMain10HDR10Plus: 191 return "Main10HDR10Plus"; 192 default: 193 return def; 194 } 195 } 196 197 inline static const char* asString_HEVCTierLevel(int32_t i, const char* def = "??") { 198 switch (i) { 199 case HEVCMainTierLevel1: 200 return "Main 1"; 201 case HEVCHighTierLevel1: 202 return "High 1"; 203 case HEVCMainTierLevel2: 204 return "Main 2"; 205 case HEVCHighTierLevel2: 206 return "High 2"; 207 case HEVCMainTierLevel21: 208 return "Main 2.1"; 209 case HEVCHighTierLevel21: 210 return "High 2.1"; 211 case HEVCMainTierLevel3: 212 return "Main 3"; 213 case HEVCHighTierLevel3: 214 return "High 3"; 215 case HEVCMainTierLevel31: 216 return "Main 3.1"; 217 case HEVCHighTierLevel31: 218 return "High 3.1"; 219 case HEVCMainTierLevel4: 220 return "Main 4"; 221 case HEVCHighTierLevel4: 222 return "High 4"; 223 case HEVCMainTierLevel41: 224 return "Main 4.1"; 225 case HEVCHighTierLevel41: 226 return "High 4.1"; 227 case HEVCMainTierLevel5: 228 return "Main 5"; 229 case HEVCHighTierLevel5: 230 return "High 5"; 231 case HEVCMainTierLevel51: 232 return "Main 5.1"; 233 case HEVCHighTierLevel51: 234 return "High 5.1"; 235 case HEVCMainTierLevel52: 236 return "Main 5.2"; 237 case HEVCHighTierLevel52: 238 return "High 5.2"; 239 case HEVCMainTierLevel6: 240 return "Main 6"; 241 case HEVCHighTierLevel6: 242 return "High 6"; 243 case HEVCMainTierLevel61: 244 return "Main 6.1"; 245 case HEVCHighTierLevel61: 246 return "High 6.1"; 247 case HEVCMainTierLevel62: 248 return "Main 6.2"; 249 case HEVCHighTierLevel62: 250 return "High 6.2"; 251 default: 252 return def; 253 } 254 } 255 256 } // namespace eco 257 } // namespace media 258 } // namespace android 259 260 #endif // ANDROID_MEDIA_ECO_SERVICE_CONSTANTS_H_ 261