1 /* 2 * Copyright (c) 2018 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 MEDIA_BASE_VP9_PROFILE_H_ 12 #define MEDIA_BASE_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, 29 }; 30 31 // Helper functions to convert VP9Profile to std::string. Returns "0" by 32 // default. 33 RTC_EXPORT std::string VP9ProfileToString(VP9Profile profile); 34 35 // Helper functions to convert std::string to VP9Profile. Returns null if given 36 // an invalid profile string. 37 absl::optional<VP9Profile> StringToVP9Profile(const std::string& str); 38 39 // Parse profile that is represented as a string of single digit contained in an 40 // SDP key-value map. A default profile(kProfile0) will be returned if the 41 // profile key is missing. Nothing will be returned if the key is present but 42 // the string is invalid. 43 RTC_EXPORT absl::optional<VP9Profile> ParseSdpForVP9Profile( 44 const SdpVideoFormat::Parameters& params); 45 46 // Returns true if the parameters have the same VP9 profile, or neither contains 47 // VP9 profile. 48 bool IsSameVP9Profile(const SdpVideoFormat::Parameters& params1, 49 const SdpVideoFormat::Parameters& params2); 50 51 } // namespace webrtc 52 53 #endif // MEDIA_BASE_VP9_PROFILE_H_ 54