blob: 09f564e8e64d00ac0a536852d30296cfefefb247 [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 Persson6d051642022-08-29 09:05:00 +020051 kS2T2,
Niels Möller3c24c092022-06-30 15:42:51 +020052 kS2T3,
Åsa Persson6d051642022-08-29 09:05:00 +020053 kS3T1,
54 kS3T2,
Niels Möller79d566b2022-04-29 11:03:13 +020055 kS3T3,
56};
57
Byoungchan Leea1a7c632022-07-05 21:06:28 +090058inline constexpr ScalabilityMode kAllScalabilityModes[] = {
59 // clang-format off
60 ScalabilityMode::kL1T1,
61 ScalabilityMode::kL1T2,
Byoungchan Leea1a7c632022-07-05 21:06:28 +090062 ScalabilityMode::kL1T3,
Byoungchan Leea1a7c632022-07-05 21:06:28 +090063 ScalabilityMode::kL2T1,
64 ScalabilityMode::kL2T1h,
65 ScalabilityMode::kL2T1_KEY,
66 ScalabilityMode::kL2T2,
67 ScalabilityMode::kL2T2h,
68 ScalabilityMode::kL2T2_KEY,
69 ScalabilityMode::kL2T2_KEY_SHIFT,
70 ScalabilityMode::kL2T3,
71 ScalabilityMode::kL2T3h,
72 ScalabilityMode::kL2T3_KEY,
73 ScalabilityMode::kL3T1,
74 ScalabilityMode::kL3T1h,
75 ScalabilityMode::kL3T1_KEY,
76 ScalabilityMode::kL3T2,
77 ScalabilityMode::kL3T2h,
78 ScalabilityMode::kL3T2_KEY,
79 ScalabilityMode::kL3T3,
80 ScalabilityMode::kL3T3h,
81 ScalabilityMode::kL3T3_KEY,
82 ScalabilityMode::kS2T1,
Åsa Persson6d051642022-08-29 09:05:00 +020083 ScalabilityMode::kS2T2,
Byoungchan Leea1a7c632022-07-05 21:06:28 +090084 ScalabilityMode::kS2T3,
Åsa Persson6d051642022-08-29 09:05:00 +020085 ScalabilityMode::kS3T1,
86 ScalabilityMode::kS3T2,
Byoungchan Leea1a7c632022-07-05 21:06:28 +090087 ScalabilityMode::kS3T3,
88 // clang-format on
89};
90
91inline constexpr size_t kScalabilityModeCount =
92 sizeof(kAllScalabilityModes) / sizeof(ScalabilityMode);
93
94RTC_EXPORT
95absl::string_view ScalabilityModeToString(ScalabilityMode scalability_mode);
96
Niels Möller79d566b2022-04-29 11:03:13 +020097} // namespace webrtc
Byoungchan Leea1a7c632022-07-05 21:06:28 +090098
Niels Möller79d566b2022-04-29 11:03:13 +020099#endif // API_VIDEO_CODECS_SCALABILITY_MODE_H_