vp9_profile.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef MEDIA_BASE_VP9_PROFILE_H_
  11. #define MEDIA_BASE_VP9_PROFILE_H_
  12. #include <string>
  13. #include "absl/types/optional.h"
  14. #include "api/video_codecs/sdp_video_format.h"
  15. #include "rtc_base/system/rtc_export.h"
  16. namespace webrtc {
  17. // Profile information for VP9 video.
  18. extern RTC_EXPORT const char kVP9FmtpProfileId[];
  19. enum class VP9Profile {
  20. kProfile0,
  21. kProfile1,
  22. kProfile2,
  23. };
  24. // Helper functions to convert VP9Profile to std::string. Returns "0" by
  25. // default.
  26. RTC_EXPORT std::string VP9ProfileToString(VP9Profile profile);
  27. // Helper functions to convert std::string to VP9Profile. Returns null if given
  28. // an invalid profile string.
  29. absl::optional<VP9Profile> StringToVP9Profile(const std::string& str);
  30. // Parse profile that is represented as a string of single digit contained in an
  31. // SDP key-value map. A default profile(kProfile0) will be returned if the
  32. // profile key is missing. Nothing will be returned if the key is present but
  33. // the string is invalid.
  34. RTC_EXPORT absl::optional<VP9Profile> ParseSdpForVP9Profile(
  35. const SdpVideoFormat::Parameters& params);
  36. // Returns true if the parameters have the same VP9 profile, or neither contains
  37. // VP9 profile.
  38. bool IsSameVP9Profile(const SdpVideoFormat::Parameters& params1,
  39. const SdpVideoFormat::Parameters& params2);
  40. } // namespace webrtc
  41. #endif // MEDIA_BASE_VP9_PROFILE_H_