scalability_mode_helper.h (1485B)
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_HELPER_H_ 12 #define API_VIDEO_CODECS_SCALABILITY_MODE_HELPER_H_ 13 14 #include <optional> 15 16 #include "absl/strings/string_view.h" 17 #include "api/video_codecs/scalability_mode.h" 18 #include "rtc_base/system/rtc_export.h" 19 20 namespace webrtc { 21 22 // Returns the number of spatial layers from the `scalability_mode_string` 23 // or nullopt if the given mode is unknown. 24 RTC_EXPORT std::optional<int> ScalabilityModeStringToNumSpatialLayers( 25 absl::string_view scalability_mode_string); 26 27 // Returns the number of temporal layers from the `scalability_mode_string` 28 // or nullopt if the given mode is unknown. 29 RTC_EXPORT std::optional<int> ScalabilityModeStringToNumTemporalLayers( 30 absl::string_view scalability_mode_string); 31 32 // Convert the `scalability_mode_string` to the scalability mode enum value 33 // or nullopt if the given mode is unknown. 34 RTC_EXPORT std::optional<ScalabilityMode> ScalabilityModeStringToEnum( 35 absl::string_view scalability_mode_string); 36 37 } // namespace webrtc 38 39 #endif // API_VIDEO_CODECS_SCALABILITY_MODE_HELPER_H_