• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "absl/strings/string_view.h"
18 #include "rtc_base/system/rtc_export.h"
19 
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.
27 enum class ScalabilityMode : uint8_t {
28   kL1T1,
29   kL1T2,
30   kL1T3,
31   kL2T1,
32   kL2T1h,
33   kL2T1_KEY,
34   kL2T2,
35   kL2T2h,
36   kL2T2_KEY,
37   kL2T2_KEY_SHIFT,
38   kL2T3,
39   kL2T3h,
40   kL2T3_KEY,
41   kL3T1,
42   kL3T1h,
43   kL3T1_KEY,
44   kL3T2,
45   kL3T2h,
46   kL3T2_KEY,
47   kL3T3,
48   kL3T3h,
49   kL3T3_KEY,
50   kS2T1,
51   kS2T1h,
52   kS2T2,
53   kS2T2h,
54   kS2T3,
55   kS2T3h,
56   kS3T1,
57   kS3T1h,
58   kS3T2,
59   kS3T2h,
60   kS3T3,
61   kS3T3h,
62 };
63 
64 inline constexpr ScalabilityMode kAllScalabilityModes[] = {
65     // clang-format off
66     ScalabilityMode::kL1T1,
67     ScalabilityMode::kL1T2,
68     ScalabilityMode::kL1T3,
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,
89     ScalabilityMode::kS2T1h,
90     ScalabilityMode::kS2T2,
91     ScalabilityMode::kS2T2h,
92     ScalabilityMode::kS2T3,
93     ScalabilityMode::kS2T3h,
94     ScalabilityMode::kS3T1,
95     ScalabilityMode::kS3T1h,
96     ScalabilityMode::kS3T2,
97     ScalabilityMode::kS3T2h,
98     ScalabilityMode::kS3T3,
99     ScalabilityMode::kS3T3h,
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 
109 }  // namespace webrtc
110 
111 #endif  // API_VIDEO_CODECS_SCALABILITY_MODE_H_
112