OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "content/common/content_export.h" |
| 11 #include "media/capture/video_capture_types.h" |
| 12 #include "third_party/webrtc/base/optional.h" |
| 13 |
| 14 namespace blink { |
| 15 class WebMediaConstraints; |
| 16 } |
| 17 |
| 18 namespace content { |
| 19 |
| 20 class CONTENT_EXPORT VideoContentCaptureSourceSelectionResult { |
| 21 public: |
| 22 // Creates a result without value and with the given |failed_constraint_name|. |
| 23 // Does not take ownership of |failed_constraint_name|, so it must be null or |
| 24 // point to a string that remains accessible. |
| 25 explicit VideoContentCaptureSourceSelectionResult( |
| 26 const char* failed_constraint_name); |
| 27 |
| 28 // Creates a result with the given values. |device_id| is moved to an internal |
| 29 // field. |
| 30 VideoContentCaptureSourceSelectionResult( |
| 31 std::string device_id, |
| 32 const rtc::Optional<bool>& noise_reduction, |
| 33 media::VideoCaptureParams capture_params); |
| 34 |
| 35 VideoContentCaptureSourceSelectionResult( |
| 36 const VideoContentCaptureSourceSelectionResult& other); |
| 37 VideoContentCaptureSourceSelectionResult& operator=( |
| 38 const VideoContentCaptureSourceSelectionResult& other); |
| 39 VideoContentCaptureSourceSelectionResult( |
| 40 VideoContentCaptureSourceSelectionResult&& other); |
| 41 VideoContentCaptureSourceSelectionResult& operator=( |
| 42 VideoContentCaptureSourceSelectionResult&& other); |
| 43 ~VideoContentCaptureSourceSelectionResult(); |
| 44 |
| 45 bool HasValue() const { return failed_constraint_name_ == nullptr; } |
| 46 |
| 47 // Accessors. |
| 48 const char* failed_constraint_name() const { return failed_constraint_name_; } |
| 49 const std::string& device_id() const { return device_id_; } |
| 50 const rtc::Optional<bool>& noise_reduction() const { |
| 51 return noise_reduction_; |
| 52 } |
| 53 media::VideoCaptureParams capture_params() const { return capture_params_; } |
| 54 |
| 55 // Convenience accessors for fields embedded in the |capture_params_| field. |
| 56 int Height() const; |
| 57 int Width() const; |
| 58 float FrameRate() const; |
| 59 media::ResolutionChangePolicy ResolutionChangePolicy() const; |
| 60 |
| 61 private: |
| 62 const char* failed_constraint_name_; |
| 63 std::string device_id_; |
| 64 rtc::Optional<bool> noise_reduction_; |
| 65 media::VideoCaptureParams capture_params_; |
| 66 }; |
| 67 |
| 68 // This function performs source and source-settings selection for content |
| 69 // video capture based on the given |constraints|. |
| 70 VideoContentCaptureSourceSelectionResult CONTENT_EXPORT |
| 71 SelectVideoContentCaptureSourceSettings( |
| 72 const blink::WebMediaConstraints& constraints); |
| 73 |
| 74 } // namespace content |
| 75 |
| 76 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_CONTENT_H_ |
OLD | NEW |