blob: 27f84cbeccd3d0276f678f34264213d0d66c5d22 [file] [log] [blame]
Johannes Kronc3fcee72021-04-19 07:09:261/*
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
20namespace webrtc {
21
22// Profile information for VP9 video.
23extern RTC_EXPORT const char kVP9FmtpProfileId[];
24
25enum class VP9Profile {
26 kProfile0,
27 kProfile1,
28 kProfile2,
Sergio Garcia Murillo179f40e2022-06-22 12:42:4829 kProfile3,
Johannes Kronc3fcee72021-04-19 07:09:2630};
31
32// Helper functions to convert VP9Profile to std::string. Returns "0" by
33// default.
34RTC_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.
38absl::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.
44RTC_EXPORT absl::optional<VP9Profile> ParseSdpForVP9Profile(
Philipp Hanckede172522023-12-14 08:45:3945 const CodecParameterMap& params);
Johannes Kronc3fcee72021-04-19 07:09:2646
47// Returns true if the parameters have the same VP9 profile, or neither contains
48// VP9 profile.
Philipp Hanckede172522023-12-14 08:45:3949bool VP9IsSameProfile(const CodecParameterMap& params1,
50 const CodecParameterMap& params2);
Johannes Kronc3fcee72021-04-19 07:09:2651
52} // namespace webrtc
53
54#endif // API_VIDEO_CODECS_VP9_PROFILE_H_