blob: 151a315972ecfd8d5e7934826cec799f8e1b6568 [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,
Niels Möller3b048132022-05-05 14:37:05 +020030 kL1T2h,
Niels Möller79d566b2022-04-29 11:03:13 +020031 kL1T3,
Niels Möller3b048132022-05-05 14:37:05 +020032 kL1T3h,
Niels Möller79d566b2022-04-29 11:03:13 +020033 kL2T1,
34 kL2T1h,
35 kL2T1_KEY,
36 kL2T2,
Niels Möller3b048132022-05-05 14:37:05 +020037 kL2T2h,
Niels Möller79d566b2022-04-29 11:03:13 +020038 kL2T2_KEY,
39 kL2T2_KEY_SHIFT,
Niels Möller3b048132022-05-05 14:37:05 +020040 kL2T3,
41 kL2T3h,
Niels Möller79d566b2022-04-29 11:03:13 +020042 kL2T3_KEY,
43 kL3T1,
Niels Möller3b048132022-05-05 14:37:05 +020044 kL3T1h,
45 kL3T1_KEY,
46 kL3T2,
47 kL3T2h,
48 kL3T2_KEY,
Niels Möller79d566b2022-04-29 11:03:13 +020049 kL3T3,
Niels Möller3b048132022-05-05 14:37:05 +020050 kL3T3h,
Niels Möller79d566b2022-04-29 11:03:13 +020051 kL3T3_KEY,
52 kS2T1,
Åsa Persson6d051642022-08-29 09:05:00 +020053 kS2T2,
Niels Möller3c24c092022-06-30 15:42:51 +020054 kS2T3,
Åsa Persson6d051642022-08-29 09:05:00 +020055 kS3T1,
56 kS3T2,
Niels Möller79d566b2022-04-29 11:03:13 +020057 kS3T3,
58};
59
Byoungchan Leea1a7c632022-07-05 21:06:28 +090060inline constexpr ScalabilityMode kAllScalabilityModes[] = {
61 // clang-format off
62 ScalabilityMode::kL1T1,
63 ScalabilityMode::kL1T2,
64 ScalabilityMode::kL1T2h,
65 ScalabilityMode::kL1T3,
66 ScalabilityMode::kL1T3h,
67 ScalabilityMode::kL2T1,
68 ScalabilityMode::kL2T1h,
69 ScalabilityMode::kL2T1_KEY,
70 ScalabilityMode::kL2T2,
71 ScalabilityMode::kL2T2h,
72 ScalabilityMode::kL2T2_KEY,
73 ScalabilityMode::kL2T2_KEY_SHIFT,
74 ScalabilityMode::kL2T3,
75 ScalabilityMode::kL2T3h,
76 ScalabilityMode::kL2T3_KEY,
77 ScalabilityMode::kL3T1,
78 ScalabilityMode::kL3T1h,
79 ScalabilityMode::kL3T1_KEY,
80 ScalabilityMode::kL3T2,
81 ScalabilityMode::kL3T2h,
82 ScalabilityMode::kL3T2_KEY,
83 ScalabilityMode::kL3T3,
84 ScalabilityMode::kL3T3h,
85 ScalabilityMode::kL3T3_KEY,
86 ScalabilityMode::kS2T1,
Åsa Persson6d051642022-08-29 09:05:00 +020087 ScalabilityMode::kS2T2,
Byoungchan Leea1a7c632022-07-05 21:06:28 +090088 ScalabilityMode::kS2T3,
Åsa Persson6d051642022-08-29 09:05:00 +020089 ScalabilityMode::kS3T1,
90 ScalabilityMode::kS3T2,
Byoungchan Leea1a7c632022-07-05 21:06:28 +090091 ScalabilityMode::kS3T3,
92 // clang-format on
93};
94
95inline constexpr size_t kScalabilityModeCount =
96 sizeof(kAllScalabilityModes) / sizeof(ScalabilityMode);
97
98RTC_EXPORT
99absl::string_view ScalabilityModeToString(ScalabilityMode scalability_mode);
100
Niels Möller79d566b2022-04-29 11:03:13 +0200101} // namespace webrtc
Byoungchan Leea1a7c632022-07-05 21:06:28 +0900102
Niels Möller79d566b2022-04-29 11:03:13 +0200103#endif // API_VIDEO_CODECS_SCALABILITY_MODE_H_