blob: b26f32eb2224536b3294ebb4cb181ca0e0202c75 [file] [log] [blame]
Niels Möller79d566b2022-04-29 11:03:13 +02001/*
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 Leea1a7c632022-07-05 21:06:28 +090014#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öller79d566b2022-04-29 11:03:13 +020020namespace 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 Leea1a7c632022-07-05 21:06:28 +090027enum class ScalabilityMode : uint8_t {
Niels Möller79d566b2022-04-29 11:03:13 +020028 kL1T1,
29 kL1T2,
30 kL1T3,
31 kL2T1,
32 kL2T1h,
33 kL2T1_KEY,
34 kL2T2,
Niels Möller3b048132022-05-05 14:37:05 +020035 kL2T2h,
Niels Möller79d566b2022-04-29 11:03:13 +020036 kL2T2_KEY,
37 kL2T2_KEY_SHIFT,
Niels Möller3b048132022-05-05 14:37:05 +020038 kL2T3,
39 kL2T3h,
Niels Möller79d566b2022-04-29 11:03:13 +020040 kL2T3_KEY,
41 kL3T1,
Niels Möller3b048132022-05-05 14:37:05 +020042 kL3T1h,
43 kL3T1_KEY,
44 kL3T2,
45 kL3T2h,
46 kL3T2_KEY,
Niels Möller79d566b2022-04-29 11:03:13 +020047 kL3T3,
Niels Möller3b048132022-05-05 14:37:05 +020048 kL3T3h,
Niels Möller79d566b2022-04-29 11:03:13 +020049 kL3T3_KEY,
50 kS2T1,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020051 kS2T1h,
Åsa Persson6d051642022-08-29 09:05:00 +020052 kS2T2,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020053 kS2T2h,
Niels Möller3c24c092022-06-30 15:42:51 +020054 kS2T3,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020055 kS2T3h,
Åsa Persson6d051642022-08-29 09:05:00 +020056 kS3T1,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020057 kS3T1h,
Åsa Persson6d051642022-08-29 09:05:00 +020058 kS3T2,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020059 kS3T2h,
Niels Möller79d566b2022-04-29 11:03:13 +020060 kS3T3,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020061 kS3T3h,
Niels Möller79d566b2022-04-29 11:03:13 +020062};
63
Byoungchan Leea1a7c632022-07-05 21:06:28 +090064inline constexpr ScalabilityMode kAllScalabilityModes[] = {
65 // clang-format off
66 ScalabilityMode::kL1T1,
67 ScalabilityMode::kL1T2,
Byoungchan Leea1a7c632022-07-05 21:06:28 +090068 ScalabilityMode::kL1T3,
Byoungchan Leea1a7c632022-07-05 21:06:28 +090069 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 Perssonecfe8da2022-08-31 09:46:41 +020089 ScalabilityMode::kS2T1h,
Åsa Persson6d051642022-08-29 09:05:00 +020090 ScalabilityMode::kS2T2,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020091 ScalabilityMode::kS2T2h,
Byoungchan Leea1a7c632022-07-05 21:06:28 +090092 ScalabilityMode::kS2T3,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020093 ScalabilityMode::kS2T3h,
Åsa Persson6d051642022-08-29 09:05:00 +020094 ScalabilityMode::kS3T1,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020095 ScalabilityMode::kS3T1h,
Åsa Persson6d051642022-08-29 09:05:00 +020096 ScalabilityMode::kS3T2,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020097 ScalabilityMode::kS3T2h,
Byoungchan Leea1a7c632022-07-05 21:06:28 +090098 ScalabilityMode::kS3T3,
Åsa Perssonecfe8da2022-08-31 09:46:41 +020099 ScalabilityMode::kS3T3h,
Byoungchan Leea1a7c632022-07-05 21:06:28 +0900100 // clang-format on
101};
102
103inline constexpr size_t kScalabilityModeCount =
104 sizeof(kAllScalabilityModes) / sizeof(ScalabilityMode);
105
106RTC_EXPORT
107absl::string_view ScalabilityModeToString(ScalabilityMode scalability_mode);
108
Niels Möller79d566b2022-04-29 11:03:13 +0200109} // namespace webrtc
Byoungchan Leea1a7c632022-07-05 21:06:28 +0900110
Niels Möller79d566b2022-04-29 11:03:13 +0200111#endif // API_VIDEO_CODECS_SCALABILITY_MODE_H_