Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 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 | |
Byoungchan Lee | a1a7c63 | 2022-07-05 12:06:28 | [diff] [blame] | 14 | #include <stddef.h> |
| 15 | #include <stdint.h> |
| 16 | |
| 17 | #include "absl/strings/string_view.h" |
| 18 | #include "rtc_base/system/rtc_export.h" |
| 19 | |
Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 20 | namespace webrtc { |
| 21 | |
| 22 | // Supported scalability modes. Most applications should use the |
| 23 | // PeerConnection-level apis where scalability mode is represented as a string. |
| 24 | // This list of currently recognized modes is intended for the api boundary |
| 25 | // between webrtc and injected encoders. Any application usage outside of |
| 26 | // injected encoders is strongly discouraged. |
Byoungchan Lee | a1a7c63 | 2022-07-05 12:06:28 | [diff] [blame] | 27 | enum class ScalabilityMode : uint8_t { |
Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 28 | kL1T1, |
| 29 | kL1T2, |
| 30 | kL1T3, |
| 31 | kL2T1, |
| 32 | kL2T1h, |
| 33 | kL2T1_KEY, |
| 34 | kL2T2, |
Niels Möller | 3b04813 | 2022-05-05 12:37:05 | [diff] [blame] | 35 | kL2T2h, |
Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 36 | kL2T2_KEY, |
| 37 | kL2T2_KEY_SHIFT, |
Niels Möller | 3b04813 | 2022-05-05 12:37:05 | [diff] [blame] | 38 | kL2T3, |
| 39 | kL2T3h, |
Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 40 | kL2T3_KEY, |
| 41 | kL3T1, |
Niels Möller | 3b04813 | 2022-05-05 12:37:05 | [diff] [blame] | 42 | kL3T1h, |
| 43 | kL3T1_KEY, |
| 44 | kL3T2, |
| 45 | kL3T2h, |
| 46 | kL3T2_KEY, |
Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 47 | kL3T3, |
Niels Möller | 3b04813 | 2022-05-05 12:37:05 | [diff] [blame] | 48 | kL3T3h, |
Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 49 | kL3T3_KEY, |
| 50 | kS2T1, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 51 | kS2T1h, |
Åsa Persson | 6d05164 | 2022-08-29 07:05:00 | [diff] [blame] | 52 | kS2T2, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 53 | kS2T2h, |
Niels Möller | 3c24c09 | 2022-06-30 13:42:51 | [diff] [blame] | 54 | kS2T3, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 55 | kS2T3h, |
Åsa Persson | 6d05164 | 2022-08-29 07:05:00 | [diff] [blame] | 56 | kS3T1, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 57 | kS3T1h, |
Åsa Persson | 6d05164 | 2022-08-29 07:05:00 | [diff] [blame] | 58 | kS3T2, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 59 | kS3T2h, |
Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 60 | kS3T3, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 61 | kS3T3h, |
Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 62 | }; |
| 63 | |
Byoungchan Lee | a1a7c63 | 2022-07-05 12:06:28 | [diff] [blame] | 64 | inline constexpr ScalabilityMode kAllScalabilityModes[] = { |
| 65 | // clang-format off |
| 66 | ScalabilityMode::kL1T1, |
| 67 | ScalabilityMode::kL1T2, |
Byoungchan Lee | a1a7c63 | 2022-07-05 12:06:28 | [diff] [blame] | 68 | ScalabilityMode::kL1T3, |
Byoungchan Lee | a1a7c63 | 2022-07-05 12:06:28 | [diff] [blame] | 69 | ScalabilityMode::kL2T1, |
| 70 | ScalabilityMode::kL2T1h, |
| 71 | ScalabilityMode::kL2T1_KEY, |
| 72 | ScalabilityMode::kL2T2, |
| 73 | ScalabilityMode::kL2T2h, |
| 74 | ScalabilityMode::kL2T2_KEY, |
| 75 | ScalabilityMode::kL2T2_KEY_SHIFT, |
| 76 | ScalabilityMode::kL2T3, |
| 77 | ScalabilityMode::kL2T3h, |
| 78 | ScalabilityMode::kL2T3_KEY, |
| 79 | ScalabilityMode::kL3T1, |
| 80 | ScalabilityMode::kL3T1h, |
| 81 | ScalabilityMode::kL3T1_KEY, |
| 82 | ScalabilityMode::kL3T2, |
| 83 | ScalabilityMode::kL3T2h, |
| 84 | ScalabilityMode::kL3T2_KEY, |
| 85 | ScalabilityMode::kL3T3, |
| 86 | ScalabilityMode::kL3T3h, |
| 87 | ScalabilityMode::kL3T3_KEY, |
| 88 | ScalabilityMode::kS2T1, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 89 | ScalabilityMode::kS2T1h, |
Åsa Persson | 6d05164 | 2022-08-29 07:05:00 | [diff] [blame] | 90 | ScalabilityMode::kS2T2, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 91 | ScalabilityMode::kS2T2h, |
Byoungchan Lee | a1a7c63 | 2022-07-05 12:06:28 | [diff] [blame] | 92 | ScalabilityMode::kS2T3, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 93 | ScalabilityMode::kS2T3h, |
Åsa Persson | 6d05164 | 2022-08-29 07:05:00 | [diff] [blame] | 94 | ScalabilityMode::kS3T1, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 95 | ScalabilityMode::kS3T1h, |
Åsa Persson | 6d05164 | 2022-08-29 07:05:00 | [diff] [blame] | 96 | ScalabilityMode::kS3T2, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 97 | ScalabilityMode::kS3T2h, |
Byoungchan Lee | a1a7c63 | 2022-07-05 12:06:28 | [diff] [blame] | 98 | ScalabilityMode::kS3T3, |
Åsa Persson | ecfe8da | 2022-08-31 07:46:41 | [diff] [blame] | 99 | ScalabilityMode::kS3T3h, |
Byoungchan Lee | a1a7c63 | 2022-07-05 12:06:28 | [diff] [blame] | 100 | // clang-format on |
| 101 | }; |
| 102 | |
| 103 | inline constexpr size_t kScalabilityModeCount = |
| 104 | sizeof(kAllScalabilityModes) / sizeof(ScalabilityMode); |
| 105 | |
| 106 | RTC_EXPORT |
| 107 | absl::string_view ScalabilityModeToString(ScalabilityMode scalability_mode); |
| 108 | |
Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 109 | } // namespace webrtc |
Byoungchan Lee | a1a7c63 | 2022-07-05 12:06:28 | [diff] [blame] | 110 | |
Niels Möller | 79d566b | 2022-04-29 09:03:13 | [diff] [blame] | 111 | #endif // API_VIDEO_CODECS_SCALABILITY_MODE_H_ |