andersc | 063f0c0 | 2017-09-11 11:50:51 -0700 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef API_VIDEO_CODECS_SDP_VIDEO_FORMAT_H_ |
| 12 | #define API_VIDEO_CODECS_SDP_VIDEO_FORMAT_H_ |
andersc | 063f0c0 | 2017-09-11 11:50:51 -0700 | [diff] [blame] | 13 | |
| 14 | #include <map> |
| 15 | #include <string> |
| 16 | |
Byoungchan Lee | a1a7c63 | 2022-07-05 21:06:28 +0900 | [diff] [blame] | 17 | #include "absl/container/inlined_vector.h" |
Johannes Kron | 20ee02c | 2021-04-20 15:53:52 +0200 | [diff] [blame] | 18 | #include "api/array_view.h" |
Byoungchan Lee | a1a7c63 | 2022-07-05 21:06:28 +0900 | [diff] [blame] | 19 | #include "api/video_codecs/scalability_mode.h" |
Mirko Bonadei | ac19414 | 2018-10-22 17:08:37 +0200 | [diff] [blame] | 20 | #include "rtc_base/system/rtc_export.h" |
| 21 | |
andersc | 063f0c0 | 2017-09-11 11:50:51 -0700 | [diff] [blame] | 22 | namespace webrtc { |
| 23 | |
| 24 | // SDP specification for a single video codec. |
| 25 | // NOTE: This class is still under development and may change without notice. |
Mirko Bonadei | ac19414 | 2018-10-22 17:08:37 +0200 | [diff] [blame] | 26 | struct RTC_EXPORT SdpVideoFormat { |
andersc | 063f0c0 | 2017-09-11 11:50:51 -0700 | [diff] [blame] | 27 | using Parameters = std::map<std::string, std::string>; |
| 28 | |
Niels Möller | be682d4 | 2018-03-27 08:31:45 +0200 | [diff] [blame] | 29 | explicit SdpVideoFormat(const std::string& name); |
| 30 | SdpVideoFormat(const std::string& name, const Parameters& parameters); |
Byoungchan Lee | a1a7c63 | 2022-07-05 21:06:28 +0900 | [diff] [blame] | 31 | SdpVideoFormat( |
| 32 | const std::string& name, |
| 33 | const Parameters& parameters, |
| 34 | const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>& |
| 35 | scalability_modes); |
Niels Möller | be682d4 | 2018-03-27 08:31:45 +0200 | [diff] [blame] | 36 | SdpVideoFormat(const SdpVideoFormat&); |
| 37 | SdpVideoFormat(SdpVideoFormat&&); |
Niels Möller | c5d4461 | 2018-03-28 09:02:09 +0200 | [diff] [blame] | 38 | SdpVideoFormat& operator=(const SdpVideoFormat&); |
| 39 | SdpVideoFormat& operator=(SdpVideoFormat&&); |
andersc | 063f0c0 | 2017-09-11 11:50:51 -0700 | [diff] [blame] | 40 | |
Niels Möller | be682d4 | 2018-03-27 08:31:45 +0200 | [diff] [blame] | 41 | ~SdpVideoFormat(); |
andersc | 063f0c0 | 2017-09-11 11:50:51 -0700 | [diff] [blame] | 42 | |
Johannes Kron | 20ee02c | 2021-04-20 15:53:52 +0200 | [diff] [blame] | 43 | // Returns true if the SdpVideoFormats have the same names as well as codec |
| 44 | // specific parameters. Please note that two SdpVideoFormats can represent the |
| 45 | // same codec even though not all parameters are the same. |
| 46 | bool IsSameCodec(const SdpVideoFormat& other) const; |
| 47 | bool IsCodecInList( |
| 48 | rtc::ArrayView<const webrtc::SdpVideoFormat> formats) const; |
| 49 | |
philipel | e8ed830 | 2019-07-03 11:53:48 +0200 | [diff] [blame] | 50 | std::string ToString() const; |
| 51 | |
Mirko Bonadei | 66e7679 | 2019-04-02 11:33:59 +0200 | [diff] [blame] | 52 | friend RTC_EXPORT bool operator==(const SdpVideoFormat& a, |
| 53 | const SdpVideoFormat& b); |
| 54 | friend RTC_EXPORT bool operator!=(const SdpVideoFormat& a, |
| 55 | const SdpVideoFormat& b) { |
andersc | 063f0c0 | 2017-09-11 11:50:51 -0700 | [diff] [blame] | 56 | return !(a == b); |
| 57 | } |
| 58 | |
| 59 | std::string name; |
| 60 | Parameters parameters; |
Byoungchan Lee | a1a7c63 | 2022-07-05 21:06:28 +0900 | [diff] [blame] | 61 | absl::InlinedVector<ScalabilityMode, kScalabilityModeCount> scalability_modes; |
andersc | 063f0c0 | 2017-09-11 11:50:51 -0700 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | } // namespace webrtc |
| 65 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 66 | #endif // API_VIDEO_CODECS_SDP_VIDEO_FORMAT_H_ |