scalability_mode.h (2889B)
1 /* 2 * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef API_VIDEO_CODECS_SCALABILITY_MODE_H_ 12 #define API_VIDEO_CODECS_SCALABILITY_MODE_H_ 13 14 #include <stddef.h> 15 #include <stdint.h> 16 17 #include <optional> 18 19 #include "absl/strings/string_view.h" 20 #include "rtc_base/system/rtc_export.h" 21 22 namespace webrtc { 23 24 // Supported scalability modes. Most applications should use the 25 // PeerConnection-level apis where scalability mode is represented as a string. 26 // This list of currently recognized modes is intended for the api boundary 27 // between webrtc and injected encoders. Any application usage outside of 28 // injected encoders is strongly discouraged. 29 enum class ScalabilityMode : uint8_t { 30 kL1T1, 31 kL1T2, 32 kL1T3, 33 kL2T1, 34 kL2T1h, 35 kL2T1_KEY, 36 kL2T2, 37 kL2T2h, 38 kL2T2_KEY, 39 kL2T2_KEY_SHIFT, 40 kL2T3, 41 kL2T3h, 42 kL2T3_KEY, 43 kL3T1, 44 kL3T1h, 45 kL3T1_KEY, 46 kL3T2, 47 kL3T2h, 48 kL3T2_KEY, 49 kL3T3, 50 kL3T3h, 51 kL3T3_KEY, 52 kS2T1, 53 kS2T1h, 54 kS2T2, 55 kS2T2h, 56 kS2T3, 57 kS2T3h, 58 kS3T1, 59 kS3T1h, 60 kS3T2, 61 kS3T2h, 62 kS3T3, 63 kS3T3h, 64 }; 65 66 inline constexpr ScalabilityMode kAllScalabilityModes[] = { 67 // clang-format off 68 ScalabilityMode::kL1T1, 69 ScalabilityMode::kL1T2, 70 ScalabilityMode::kL1T3, 71 ScalabilityMode::kL2T1, 72 ScalabilityMode::kL2T1h, 73 ScalabilityMode::kL2T1_KEY, 74 ScalabilityMode::kL2T2, 75 ScalabilityMode::kL2T2h, 76 ScalabilityMode::kL2T2_KEY, 77 ScalabilityMode::kL2T2_KEY_SHIFT, 78 ScalabilityMode::kL2T3, 79 ScalabilityMode::kL2T3h, 80 ScalabilityMode::kL2T3_KEY, 81 ScalabilityMode::kL3T1, 82 ScalabilityMode::kL3T1h, 83 ScalabilityMode::kL3T1_KEY, 84 ScalabilityMode::kL3T2, 85 ScalabilityMode::kL3T2h, 86 ScalabilityMode::kL3T2_KEY, 87 ScalabilityMode::kL3T3, 88 ScalabilityMode::kL3T3h, 89 ScalabilityMode::kL3T3_KEY, 90 ScalabilityMode::kS2T1, 91 ScalabilityMode::kS2T1h, 92 ScalabilityMode::kS2T2, 93 ScalabilityMode::kS2T2h, 94 ScalabilityMode::kS2T3, 95 ScalabilityMode::kS2T3h, 96 ScalabilityMode::kS3T1, 97 ScalabilityMode::kS3T1h, 98 ScalabilityMode::kS3T2, 99 ScalabilityMode::kS3T2h, 100 ScalabilityMode::kS3T3, 101 ScalabilityMode::kS3T3h, 102 // clang-format on 103 }; 104 105 inline constexpr size_t kScalabilityModeCount = 106 sizeof(kAllScalabilityModes) / sizeof(ScalabilityMode); 107 108 RTC_EXPORT 109 absl::string_view ScalabilityModeToString(ScalabilityMode scalability_mode); 110 RTC_EXPORT 111 absl::string_view ScalabilityModeToString( 112 std::optional<ScalabilityMode> scalability_mode); 113 114 } // namespace webrtc 115 116 #endif // API_VIDEO_CODECS_SCALABILITY_MODE_H_