tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

av1_profile.h (1904B)


      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_AV1_PROFILE_H_
     12 #define API_VIDEO_CODECS_AV1_PROFILE_H_
     13 
     14 #include <optional>
     15 
     16 #include "absl/strings/string_view.h"
     17 #include "api/rtp_parameters.h"
     18 #include "rtc_base/system/rtc_export.h"
     19 
     20 namespace webrtc {
     21 
     22 // Profiles can be found at:
     23 // https://aomedia.org/av1/specification/annex-a/#profiles
     24 // The enum values match the number specified in the SDP.
     25 enum class AV1Profile {
     26  kProfile0 = 0,
     27  kProfile1 = 1,
     28  kProfile2 = 2,
     29 };
     30 
     31 // Helper function which converts an AV1Profile to std::string. Returns "0" if
     32 // an unknown value is passed in.
     33 RTC_EXPORT absl::string_view AV1ProfileToString(AV1Profile profile);
     34 
     35 // Helper function which converts a std::string to AV1Profile. Returns null if
     36 // |profile| is not a valid profile string.
     37 std::optional<AV1Profile> StringToAV1Profile(absl::string_view profile);
     38 
     39 // Parses an SDP key-value map of format parameters to retrive an AV1 profile.
     40 // Returns an AV1Profile if one has been specified, `kProfile0` if no profile is
     41 // specified and an empty value if the profile key is present but contains an
     42 // invalid value.
     43 RTC_EXPORT std::optional<AV1Profile> ParseSdpForAV1Profile(
     44    const CodecParameterMap& params);
     45 
     46 // Returns true if the parameters have the same AV1 profile or neither contains
     47 // an AV1 profile, otherwise false.
     48 bool AV1IsSameProfile(const CodecParameterMap& params1,
     49                      const CodecParameterMap& params2);
     50 
     51 }  // namespace webrtc
     52 
     53 #endif  // API_VIDEO_CODECS_AV1_PROFILE_H_