blob: a1e23f4f9c92c394a337a9f7c7c0c2cffabc7cc3 [file] [log] [blame]
andersc063f0c02017-09-11 11:50:51 -07001/*
2 * Copyright (c) 2017 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef API_VIDEO_CODECS_SDP_VIDEO_FORMAT_H_
12#define API_VIDEO_CODECS_SDP_VIDEO_FORMAT_H_
andersc063f0c02017-09-11 11:50:51 -070013
14#include <map>
15#include <string>
16
Johannes Kron20ee02c2021-04-20 15:53:52 +020017#include "api/array_view.h"
Mirko Bonadeiac194142018-10-22 17:08:37 +020018#include "rtc_base/system/rtc_export.h"
19
andersc063f0c02017-09-11 11:50:51 -070020namespace webrtc {
21
22// SDP specification for a single video codec.
23// NOTE: This class is still under development and may change without notice.
Mirko Bonadeiac194142018-10-22 17:08:37 +020024struct RTC_EXPORT SdpVideoFormat {
andersc063f0c02017-09-11 11:50:51 -070025 using Parameters = std::map<std::string, std::string>;
26
Niels Möllerbe682d42018-03-27 08:31:45 +020027 explicit SdpVideoFormat(const std::string& name);
28 SdpVideoFormat(const std::string& name, const Parameters& parameters);
29 SdpVideoFormat(const SdpVideoFormat&);
30 SdpVideoFormat(SdpVideoFormat&&);
Niels Möllerc5d44612018-03-28 09:02:09 +020031 SdpVideoFormat& operator=(const SdpVideoFormat&);
32 SdpVideoFormat& operator=(SdpVideoFormat&&);
andersc063f0c02017-09-11 11:50:51 -070033
Niels Möllerbe682d42018-03-27 08:31:45 +020034 ~SdpVideoFormat();
andersc063f0c02017-09-11 11:50:51 -070035
Johannes Kron20ee02c2021-04-20 15:53:52 +020036 // Returns true if the SdpVideoFormats have the same names as well as codec
37 // specific parameters. Please note that two SdpVideoFormats can represent the
38 // same codec even though not all parameters are the same.
39 bool IsSameCodec(const SdpVideoFormat& other) const;
40 bool IsCodecInList(
41 rtc::ArrayView<const webrtc::SdpVideoFormat> formats) const;
42
philipele8ed8302019-07-03 11:53:48 +020043 std::string ToString() const;
44
Mirko Bonadei66e76792019-04-02 11:33:59 +020045 friend RTC_EXPORT bool operator==(const SdpVideoFormat& a,
46 const SdpVideoFormat& b);
47 friend RTC_EXPORT bool operator!=(const SdpVideoFormat& a,
48 const SdpVideoFormat& b) {
andersc063f0c02017-09-11 11:50:51 -070049 return !(a == b);
50 }
51
52 std::string name;
53 Parameters parameters;
54};
55
56} // namespace webrtc
57
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020058#endif // API_VIDEO_CODECS_SDP_VIDEO_FORMAT_H_