OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 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 |
11 // This file contains the interface for MediaConstraints, corresponding to | 11 // This file contains the interface for MediaConstraints, corresponding to |
12 // the definition at | 12 // the definition at |
13 // http://www.w3.org/TR/mediacapture-streams/#mediastreamconstraints and also | 13 // http://www.w3.org/TR/mediacapture-streams/#mediastreamconstraints and also |
14 // used in WebRTC: http://dev.w3.org/2011/webrtc/editor/webrtc.html#constraints. | 14 // used in WebRTC: http://dev.w3.org/2011/webrtc/editor/webrtc.html#constraints. |
15 | 15 |
16 #ifndef WEBRTC_API_MEDIACONSTRAINTSINTERFACE_H_ | 16 #ifndef WEBRTC_API_MEDIACONSTRAINTSINTERFACE_H_ |
17 #define WEBRTC_API_MEDIACONSTRAINTSINTERFACE_H_ | 17 #define WEBRTC_API_MEDIACONSTRAINTSINTERFACE_H_ |
18 | 18 |
19 #include <string> | 19 #include <string> |
20 #include <vector> | 20 #include <vector> |
21 | 21 |
| 22 #include "webrtc/base/optional.h" |
| 23 |
22 namespace webrtc { | 24 namespace webrtc { |
23 | 25 |
24 // MediaConstraintsInterface | 26 // MediaConstraintsInterface |
25 // Interface used for passing arguments about media constraints | 27 // Interface used for passing arguments about media constraints |
26 // to the MediaStream and PeerConnection implementation. | 28 // to the MediaStream and PeerConnection implementation. |
27 class MediaConstraintsInterface { | 29 class MediaConstraintsInterface { |
28 public: | 30 public: |
29 struct Constraint { | 31 struct Constraint { |
30 Constraint() {} | 32 Constraint() {} |
31 Constraint(const std::string& key, const std::string value) | 33 Constraint(const std::string& key, const std::string value) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 113 |
112 protected: | 114 protected: |
113 // Dtor protected as objects shouldn't be deleted via this interface | 115 // Dtor protected as objects shouldn't be deleted via this interface |
114 virtual ~MediaConstraintsInterface() {} | 116 virtual ~MediaConstraintsInterface() {} |
115 }; | 117 }; |
116 | 118 |
117 bool FindConstraint(const MediaConstraintsInterface* constraints, | 119 bool FindConstraint(const MediaConstraintsInterface* constraints, |
118 const std::string& key, bool* value, | 120 const std::string& key, bool* value, |
119 size_t* mandatory_constraints); | 121 size_t* mandatory_constraints); |
120 | 122 |
| 123 bool FindConstraint(const MediaConstraintsInterface* constraints, |
| 124 const std::string& key, |
| 125 int* value, |
| 126 size_t* mandatory_constraints); |
| 127 |
| 128 rtc::Optional<bool> ConstraintToOptionalBool( |
| 129 const MediaConstraintsInterface* constraints, |
| 130 const std::string& key); |
| 131 rtc::Optional<int> ConstraintToOptionalInt( |
| 132 const MediaConstraintsInterface* constraints, |
| 133 const std::string& key); |
| 134 |
121 } // namespace webrtc | 135 } // namespace webrtc |
122 | 136 |
123 #endif // WEBRTC_API_MEDIACONSTRAINTSINTERFACE_H_ | 137 #endif // WEBRTC_API_MEDIACONSTRAINTSINTERFACE_H_ |
OLD | NEW |