| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 | 11 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 12 namespace blink { | 12 #include "third_party/webrtc/base/optional.h" |
| 13 class WebMediaConstraints; | |
| 14 class WebString; | |
| 15 } | |
| 16 | 13 |
| 17 namespace content { | 14 namespace content { |
| 18 | 15 |
| 19 // Method to get boolean value of constraint with |name| from constraints. | 16 // Method to get boolean value of constraint with |name| from constraints. |
| 20 // Returns true if the constraint is specified in either mandatory or optional | 17 // Returns true if the constraint is specified in either mandatory or optional |
| 21 // constraints. | 18 // constraints. |
| 22 bool CONTENT_EXPORT GetConstraintValueAsBoolean( | 19 bool CONTENT_EXPORT GetConstraintValueAsBoolean( |
| 23 const blink::WebMediaConstraints& constraints, | 20 const blink::WebMediaConstraints& constraints, |
| 24 const std::string& name, | 21 const blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*picker, |
| 25 bool* value); | 22 bool* value); |
| 26 | 23 |
| 27 // Method to get int value of constraint with |name| from constraints. | 24 // Method to get int value of constraint with |name| from constraints. |
| 28 // Returns true if the constraint is specified in either mandatory or Optional | 25 // Returns true if the constraint is specified in either mandatory or Optional |
| 29 // constraints. | 26 // constraints. |
| 30 bool CONTENT_EXPORT GetConstraintValueAsInteger( | 27 bool CONTENT_EXPORT GetConstraintValueAsInteger( |
| 31 const blink::WebMediaConstraints& constraints, | 28 const blink::WebMediaConstraints& constraints, |
| 32 const std::string& name, | 29 const blink::LongConstraint blink::WebMediaTrackConstraintSet::*picker, |
| 30 int* value); |
| 31 |
| 32 bool CONTENT_EXPORT GetConstraintMinAsInteger( |
| 33 const blink::WebMediaConstraints& constraints, |
| 34 const blink::LongConstraint blink::WebMediaTrackConstraintSet::*picker, |
| 35 int* value); |
| 36 |
| 37 bool CONTENT_EXPORT GetConstraintMaxAsInteger( |
| 38 const blink::WebMediaConstraints& constraints, |
| 39 const blink::LongConstraint blink::WebMediaTrackConstraintSet::*picker, |
| 33 int* value); | 40 int* value); |
| 34 | 41 |
| 35 // Method to get double precision value of constraint with |name| from | 42 // Method to get double precision value of constraint with |name| from |
| 36 // constraints. Returns true if the constraint is specified in either mandatory | 43 // constraints. Returns true if the constraint is specified in either mandatory |
| 37 // or Optional constraints. | 44 // or Optional constraints. |
| 38 bool CONTENT_EXPORT GetConstraintValueAsDouble( | 45 bool CONTENT_EXPORT GetConstraintValueAsDouble( |
| 39 const blink::WebMediaConstraints& constraints, | 46 const blink::WebMediaConstraints& constraints, |
| 40 const std::string& name, | 47 const blink::DoubleConstraint blink::WebMediaTrackConstraintSet::*picker, |
| 48 double* value); |
| 49 |
| 50 bool CONTENT_EXPORT GetConstraintMaxAsDouble( |
| 51 const blink::WebMediaConstraints& constraints, |
| 52 const blink::DoubleConstraint blink::WebMediaTrackConstraintSet::*picker, |
| 41 double* value); | 53 double* value); |
| 42 | 54 |
| 43 // Method to get std::string value of constraint with |name| from constraints. | 55 // Method to get std::string value of constraint with |name| from constraints. |
| 44 // Returns true if the constraint is specified in either mandatory or Optional | 56 // Returns true if the constraint is specified in either mandatory or Optional |
| 45 // constraints. | 57 // constraints. |
| 46 bool CONTENT_EXPORT GetConstraintValueAsString( | 58 bool CONTENT_EXPORT GetConstraintValueAsString( |
| 47 const blink::WebMediaConstraints& constraints, | 59 const blink::WebMediaConstraints& constraints, |
| 48 const std::string& name, | 60 const blink::StringConstraint blink::WebMediaTrackConstraintSet::*picker, |
| 49 std::string* value); | 61 std::string* value); |
| 50 | 62 |
| 51 // Method to get boolean value of constraint with |name| from the | 63 rtc::Optional<bool> ConstraintToOptional( |
| 52 // mandatory constraints. | |
| 53 bool CONTENT_EXPORT GetMandatoryConstraintValueAsBoolean( | |
| 54 const blink::WebMediaConstraints& constraints, | 64 const blink::WebMediaConstraints& constraints, |
| 55 const std::string& name, | 65 const blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*picker); |
| 56 bool* value); | |
| 57 | |
| 58 // Method to get int value of constraint with |name| from the | |
| 59 // mandatory constraints. | |
| 60 bool CONTENT_EXPORT GetMandatoryConstraintValueAsInteger( | |
| 61 const blink::WebMediaConstraints& constraints, | |
| 62 const std::string& name, | |
| 63 int* value); | |
| 64 | |
| 65 // Method to get double value of constraint with |name| from the | |
| 66 // mandatory constraints. | |
| 67 bool CONTENT_EXPORT GetMandatoryConstraintValueAsDouble( | |
| 68 const blink::WebMediaConstraints& constraints, | |
| 69 const std::string& name, | |
| 70 double* value); | |
| 71 | |
| 72 // Method to get bool value of constraint with |name| from the | |
| 73 // optional constraints. | |
| 74 bool CONTENT_EXPORT GetOptionalConstraintValueAsBoolean( | |
| 75 const blink::WebMediaConstraints& constraints, | |
| 76 const std::string& name, | |
| 77 bool* value); | |
| 78 | |
| 79 // Method to get int value of constraint with |name| from the | |
| 80 // optional constraints. | |
| 81 bool CONTENT_EXPORT GetOptionalConstraintValueAsInteger( | |
| 82 const blink::WebMediaConstraints& constraints, | |
| 83 const std::string& name, | |
| 84 int* value); | |
| 85 | |
| 86 // Method to get double value of constraint with |name| from the | |
| 87 // optional constraints. | |
| 88 bool CONTENT_EXPORT GetOptionalConstraintValueAsDouble( | |
| 89 const blink::WebMediaConstraints& constraints, | |
| 90 const std::string& name, | |
| 91 double* value); | |
| 92 | 66 |
| 93 } // namespace content | 67 } // namespace content |
| 94 | 68 |
| 95 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ | 69 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ |
| OLD | NEW |