1*d9f75844SAndroid Build Coastguard Worker /* 2*d9f75844SAndroid Build Coastguard Worker * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved. 3*d9f75844SAndroid Build Coastguard Worker * 4*d9f75844SAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license 5*d9f75844SAndroid Build Coastguard Worker * that can be found in the LICENSE file in the root of the source 6*d9f75844SAndroid Build Coastguard Worker * tree. An additional intellectual property rights grant can be found 7*d9f75844SAndroid Build Coastguard Worker * in the file PATENTS. All contributing project authors may 8*d9f75844SAndroid Build Coastguard Worker * be found in the AUTHORS file in the root of the source tree. 9*d9f75844SAndroid Build Coastguard Worker */ 10*d9f75844SAndroid Build Coastguard Worker 11*d9f75844SAndroid Build Coastguard Worker #ifndef API_VIDEO_CODECS_VP9_PROFILE_H_ 12*d9f75844SAndroid Build Coastguard Worker #define API_VIDEO_CODECS_VP9_PROFILE_H_ 13*d9f75844SAndroid Build Coastguard Worker 14*d9f75844SAndroid Build Coastguard Worker #include <string> 15*d9f75844SAndroid Build Coastguard Worker 16*d9f75844SAndroid Build Coastguard Worker #include "absl/types/optional.h" 17*d9f75844SAndroid Build Coastguard Worker #include "api/video_codecs/sdp_video_format.h" 18*d9f75844SAndroid Build Coastguard Worker #include "rtc_base/system/rtc_export.h" 19*d9f75844SAndroid Build Coastguard Worker 20*d9f75844SAndroid Build Coastguard Worker namespace webrtc { 21*d9f75844SAndroid Build Coastguard Worker 22*d9f75844SAndroid Build Coastguard Worker // Profile information for VP9 video. 23*d9f75844SAndroid Build Coastguard Worker extern RTC_EXPORT const char kVP9FmtpProfileId[]; 24*d9f75844SAndroid Build Coastguard Worker 25*d9f75844SAndroid Build Coastguard Worker enum class VP9Profile { 26*d9f75844SAndroid Build Coastguard Worker kProfile0, 27*d9f75844SAndroid Build Coastguard Worker kProfile1, 28*d9f75844SAndroid Build Coastguard Worker kProfile2, 29*d9f75844SAndroid Build Coastguard Worker kProfile3, 30*d9f75844SAndroid Build Coastguard Worker }; 31*d9f75844SAndroid Build Coastguard Worker 32*d9f75844SAndroid Build Coastguard Worker // Helper functions to convert VP9Profile to std::string. Returns "0" by 33*d9f75844SAndroid Build Coastguard Worker // default. 34*d9f75844SAndroid Build Coastguard Worker RTC_EXPORT std::string VP9ProfileToString(VP9Profile profile); 35*d9f75844SAndroid Build Coastguard Worker 36*d9f75844SAndroid Build Coastguard Worker // Helper functions to convert std::string to VP9Profile. Returns null if given 37*d9f75844SAndroid Build Coastguard Worker // an invalid profile string. 38*d9f75844SAndroid Build Coastguard Worker absl::optional<VP9Profile> StringToVP9Profile(const std::string& str); 39*d9f75844SAndroid Build Coastguard Worker 40*d9f75844SAndroid Build Coastguard Worker // Parse profile that is represented as a string of single digit contained in an 41*d9f75844SAndroid Build Coastguard Worker // SDP key-value map. A default profile(kProfile0) will be returned if the 42*d9f75844SAndroid Build Coastguard Worker // profile key is missing. Nothing will be returned if the key is present but 43*d9f75844SAndroid Build Coastguard Worker // the string is invalid. 44*d9f75844SAndroid Build Coastguard Worker RTC_EXPORT absl::optional<VP9Profile> ParseSdpForVP9Profile( 45*d9f75844SAndroid Build Coastguard Worker const SdpVideoFormat::Parameters& params); 46*d9f75844SAndroid Build Coastguard Worker 47*d9f75844SAndroid Build Coastguard Worker // Returns true if the parameters have the same VP9 profile, or neither contains 48*d9f75844SAndroid Build Coastguard Worker // VP9 profile. 49*d9f75844SAndroid Build Coastguard Worker bool VP9IsSameProfile(const SdpVideoFormat::Parameters& params1, 50*d9f75844SAndroid Build Coastguard Worker const SdpVideoFormat::Parameters& params2); 51*d9f75844SAndroid Build Coastguard Worker 52*d9f75844SAndroid Build Coastguard Worker } // namespace webrtc 53*d9f75844SAndroid Build Coastguard Worker 54*d9f75844SAndroid Build Coastguard Worker #endif // API_VIDEO_CODECS_VP9_PROFILE_H_ 55