Johannes Kron | c3fcee7 | 2021-04-19 07:09:26 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021 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_VP9_PROFILE_H_ |
| 12 | #define API_VIDEO_CODECS_VP9_PROFILE_H_ |
| 13 | |
| 14 | #include <string> |
| 15 | |
| 16 | #include "absl/types/optional.h" |
| 17 | #include "api/video_codecs/sdp_video_format.h" |
| 18 | #include "rtc_base/system/rtc_export.h" |
| 19 | |
| 20 | namespace webrtc { |
| 21 | |
| 22 | // Profile information for VP9 video. |
| 23 | extern RTC_EXPORT const char kVP9FmtpProfileId[]; |
| 24 | |
| 25 | enum class VP9Profile { |
| 26 | kProfile0, |
| 27 | kProfile1, |
| 28 | kProfile2, |
Sergio Garcia Murillo | 179f40e | 2022-06-22 12:42:48 | [diff] [blame] | 29 | kProfile3, |
Johannes Kron | c3fcee7 | 2021-04-19 07:09:26 | [diff] [blame] | 30 | }; |
| 31 | |
| 32 | // Helper functions to convert VP9Profile to std::string. Returns "0" by |
| 33 | // default. |
| 34 | RTC_EXPORT std::string VP9ProfileToString(VP9Profile profile); |
| 35 | |
| 36 | // Helper functions to convert std::string to VP9Profile. Returns null if given |
| 37 | // an invalid profile string. |
| 38 | absl::optional<VP9Profile> StringToVP9Profile(const std::string& str); |
| 39 | |
| 40 | // Parse profile that is represented as a string of single digit contained in an |
| 41 | // SDP key-value map. A default profile(kProfile0) will be returned if the |
| 42 | // profile key is missing. Nothing will be returned if the key is present but |
| 43 | // the string is invalid. |
| 44 | RTC_EXPORT absl::optional<VP9Profile> ParseSdpForVP9Profile( |
Philipp Hancke | de17252 | 2023-12-14 08:45:39 | [diff] [blame] | 45 | const CodecParameterMap& params); |
Johannes Kron | c3fcee7 | 2021-04-19 07:09:26 | [diff] [blame] | 46 | |
| 47 | // Returns true if the parameters have the same VP9 profile, or neither contains |
| 48 | // VP9 profile. |
Philipp Hancke | de17252 | 2023-12-14 08:45:39 | [diff] [blame] | 49 | bool VP9IsSameProfile(const CodecParameterMap& params1, |
| 50 | const CodecParameterMap& params2); |
Johannes Kron | c3fcee7 | 2021-04-19 07:09:26 | [diff] [blame] | 51 | |
| 52 | } // namespace webrtc |
| 53 | |
| 54 | #endif // API_VIDEO_CODECS_VP9_PROFILE_H_ |