OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 std::vector<FeedbackParam> params_; | 60 std::vector<FeedbackParam> params_; |
61 }; | 61 }; |
62 | 62 |
63 struct Codec { | 63 struct Codec { |
64 int id; | 64 int id; |
65 std::string name; | 65 std::string name; |
66 int clockrate; | 66 int clockrate; |
67 CodecParameterMap params; | 67 CodecParameterMap params; |
68 FeedbackParams feedback_params; | 68 FeedbackParams feedback_params; |
69 | 69 |
70 // Creates a codec with the given parameters. | |
71 Codec(int id, const std::string& name, int clockrate); | |
72 // Creates an empty codec. | |
73 Codec(); | |
74 Codec(const Codec& c); | |
75 Codec(Codec&& c); | |
76 virtual ~Codec(); | 70 virtual ~Codec(); |
77 | 71 |
78 // Indicates if this codec is compatible with the specified codec. | 72 // Indicates if this codec is compatible with the specified codec. |
79 bool Matches(const Codec& codec) const; | 73 bool Matches(const Codec& codec) const; |
80 | 74 |
81 // Find the parameter for |name| and write the value to |out|. | 75 // Find the parameter for |name| and write the value to |out|. |
82 bool GetParam(const std::string& name, std::string* out) const; | 76 bool GetParam(const std::string& name, std::string* out) const; |
83 bool GetParam(const std::string& name, int* out) const; | 77 bool GetParam(const std::string& name, int* out) const; |
84 | 78 |
85 void SetParam(const std::string& name, const std::string& value); | 79 void SetParam(const std::string& name, const std::string& value); |
(...skipping 13 matching lines...) Expand all Loading... |
99 virtual webrtc::RtpCodecParameters ToCodecParameters() const; | 93 virtual webrtc::RtpCodecParameters ToCodecParameters() const; |
100 | 94 |
101 Codec& operator=(const Codec& c); | 95 Codec& operator=(const Codec& c); |
102 Codec& operator=(Codec&& c); | 96 Codec& operator=(Codec&& c); |
103 | 97 |
104 bool operator==(const Codec& c) const; | 98 bool operator==(const Codec& c) const; |
105 | 99 |
106 bool operator!=(const Codec& c) const { | 100 bool operator!=(const Codec& c) const { |
107 return !(*this == c); | 101 return !(*this == c); |
108 } | 102 } |
| 103 |
| 104 protected: |
| 105 // A Codec can't be created without a subclass. |
| 106 // Creates a codec with the given parameters. |
| 107 Codec(int id, const std::string& name, int clockrate); |
| 108 // Creates an empty codec. |
| 109 Codec(); |
| 110 Codec(const Codec& c); |
| 111 Codec(Codec&& c); |
109 }; | 112 }; |
110 | 113 |
111 struct AudioCodec : public Codec { | 114 struct AudioCodec : public Codec { |
112 int bitrate; | 115 int bitrate; |
113 size_t channels; | 116 size_t channels; |
114 | 117 |
115 // Creates a codec with the given parameters. | 118 // Creates a codec with the given parameters. |
116 AudioCodec(int id, | 119 AudioCodec(int id, |
117 const std::string& name, | 120 const std::string& name, |
118 int clockrate, | 121 int clockrate, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 bool HasTransportCc(const Codec& codec); | 220 bool HasTransportCc(const Codec& codec); |
218 // Returns the first codec in |supported_codecs| that matches |codec|, or | 221 // Returns the first codec in |supported_codecs| that matches |codec|, or |
219 // nullptr if no codec matches. | 222 // nullptr if no codec matches. |
220 const VideoCodec* FindMatchingCodec( | 223 const VideoCodec* FindMatchingCodec( |
221 const std::vector<VideoCodec>& supported_codecs, | 224 const std::vector<VideoCodec>& supported_codecs, |
222 const VideoCodec& codec); | 225 const VideoCodec& codec); |
223 | 226 |
224 } // namespace cricket | 227 } // namespace cricket |
225 | 228 |
226 #endif // WEBRTC_MEDIA_BASE_CODEC_H_ | 229 #endif // WEBRTC_MEDIA_BASE_CODEC_H_ |
OLD | NEW |