Niels Möller | be682d4 | 2018-03-27 08:31:45 +0200 | [diff] [blame] | 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 | |
| 11 | #include "api/video_codecs/sdp_video_format.h" |
philipel | e8ed830 | 2019-07-03 11:53:48 +0200 | [diff] [blame^] | 12 | #include "rtc_base/strings/string_builder.h" |
Niels Möller | be682d4 | 2018-03-27 08:31:45 +0200 | [diff] [blame] | 13 | |
| 14 | namespace webrtc { |
| 15 | |
| 16 | SdpVideoFormat::SdpVideoFormat(const std::string& name) : name(name) {} |
| 17 | |
| 18 | SdpVideoFormat::SdpVideoFormat(const std::string& name, |
| 19 | const Parameters& parameters) |
| 20 | : name(name), parameters(parameters) {} |
| 21 | |
| 22 | SdpVideoFormat::SdpVideoFormat(const SdpVideoFormat&) = default; |
| 23 | SdpVideoFormat::SdpVideoFormat(SdpVideoFormat&&) = default; |
Niels Möller | c5d4461 | 2018-03-28 09:02:09 +0200 | [diff] [blame] | 24 | SdpVideoFormat& SdpVideoFormat::operator=(const SdpVideoFormat&) = default; |
| 25 | SdpVideoFormat& SdpVideoFormat::operator=(SdpVideoFormat&&) = default; |
Niels Möller | be682d4 | 2018-03-27 08:31:45 +0200 | [diff] [blame] | 26 | |
| 27 | SdpVideoFormat::~SdpVideoFormat() = default; |
| 28 | |
philipel | e8ed830 | 2019-07-03 11:53:48 +0200 | [diff] [blame^] | 29 | std::string SdpVideoFormat::ToString() const { |
| 30 | rtc::StringBuilder builder; |
| 31 | builder << "Codec name: " << name << ", parameters: {"; |
| 32 | for (const auto& kv : parameters) |
| 33 | builder << " " << kv.first << "=" << kv.second; |
| 34 | builder << " }"; |
| 35 | |
| 36 | return builder.str(); |
| 37 | } |
| 38 | |
Niels Möller | be682d4 | 2018-03-27 08:31:45 +0200 | [diff] [blame] | 39 | bool operator==(const SdpVideoFormat& a, const SdpVideoFormat& b) { |
| 40 | return a.name == b.name && a.parameters == b.parameters; |
| 41 | } |
| 42 | |
| 43 | } // namespace webrtc |