| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ | 6 #define CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "media/base/audio_parameters.h" | 17 #include "media/base/audio_parameters.h" |
| 18 #include "media/base/video_facing.h" | 18 #include "media/base/video_facing.h" |
| 19 #include "media/capture/video/video_capture_device_descriptor.h" |
| 19 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
| 20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 | 24 |
| 24 // Types of media streams. | 25 // Types of media streams. |
| 25 enum MediaStreamType { | 26 enum MediaStreamType { |
| 26 MEDIA_NO_SERVICE = 0, | 27 MEDIA_NO_SERVICE = 0, |
| 27 | 28 |
| 28 // A device provided by the operating system (e.g., webcam input). | 29 // A device provided by the operating system (e.g., webcam input). |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 MEDIA_DEVICE_SCREEN_CAPTURE_FAILURE = 7, | 63 MEDIA_DEVICE_SCREEN_CAPTURE_FAILURE = 7, |
| 63 MEDIA_DEVICE_CAPTURE_FAILURE = 8, | 64 MEDIA_DEVICE_CAPTURE_FAILURE = 8, |
| 64 MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED = 9, | 65 MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED = 9, |
| 65 MEDIA_DEVICE_TRACK_START_FAILURE = 10, | 66 MEDIA_DEVICE_TRACK_START_FAILURE = 10, |
| 66 MEDIA_DEVICE_NOT_SUPPORTED = 11, | 67 MEDIA_DEVICE_NOT_SUPPORTED = 11, |
| 67 MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN = 12, | 68 MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN = 12, |
| 68 MEDIA_DEVICE_KILL_SWITCH_ON = 13, | 69 MEDIA_DEVICE_KILL_SWITCH_ON = 13, |
| 69 NUM_MEDIA_REQUEST_RESULTS | 70 NUM_MEDIA_REQUEST_RESULTS |
| 70 }; | 71 }; |
| 71 | 72 |
| 73 using CameraCalibration = |
| 74 media::VideoCaptureDeviceDescriptor::CameraCalibration; |
| 75 |
| 72 // Convenience predicates to determine whether the given type represents some | 76 // Convenience predicates to determine whether the given type represents some |
| 73 // audio or some video device. | 77 // audio or some video device. |
| 74 CONTENT_EXPORT bool IsAudioInputMediaType(MediaStreamType type); | 78 CONTENT_EXPORT bool IsAudioInputMediaType(MediaStreamType type); |
| 75 CONTENT_EXPORT bool IsVideoMediaType(MediaStreamType type); | 79 CONTENT_EXPORT bool IsVideoMediaType(MediaStreamType type); |
| 76 CONTENT_EXPORT bool IsScreenCaptureMediaType(MediaStreamType type); | 80 CONTENT_EXPORT bool IsScreenCaptureMediaType(MediaStreamType type); |
| 77 | 81 |
| 78 // TODO(xians): Change the structs to classes. | 82 // TODO(xians): Change the structs to classes. |
| 79 // Represents one device in a request for media stream(s). | 83 // Represents one device in a request for media stream(s). |
| 80 struct CONTENT_EXPORT MediaStreamDevice { | 84 struct CONTENT_EXPORT MediaStreamDevice { |
| 81 MediaStreamDevice(); | 85 MediaStreamDevice(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // audio (i.e. IsAudioInputMediaType returns true). | 158 // audio (i.e. IsAudioInputMediaType returns true). |
| 155 | 159 |
| 156 // Contains the device properties of the capture device. | 160 // Contains the device properties of the capture device. |
| 157 AudioDeviceParameters input; | 161 AudioDeviceParameters input; |
| 158 | 162 |
| 159 // If the capture device has an associated output device (e.g. headphones), | 163 // If the capture device has an associated output device (e.g. headphones), |
| 160 // this will contain the properties for the output device. If no such device | 164 // this will contain the properties for the output device. If no such device |
| 161 // exists (e.g. webcam w/mic), then the value of this member will be all | 165 // exists (e.g. webcam w/mic), then the value of this member will be all |
| 162 // zeros. | 166 // zeros. |
| 163 AudioDeviceParameters matched_output; | 167 AudioDeviceParameters matched_output; |
| 168 |
| 169 // This field is optional and available only for some camera models. |
| 170 base::Optional<CameraCalibration> camera_calibration; |
| 164 }; | 171 }; |
| 165 | 172 |
| 166 class CONTENT_EXPORT MediaStreamDevices | 173 class CONTENT_EXPORT MediaStreamDevices |
| 167 : public std::vector<MediaStreamDevice> { | 174 : public std::vector<MediaStreamDevice> { |
| 168 public: | 175 public: |
| 169 MediaStreamDevices(); | 176 MediaStreamDevices(); |
| 170 MediaStreamDevices(size_t count, const MediaStreamDevice& value); | 177 MediaStreamDevices(size_t count, const MediaStreamDevice& value); |
| 171 | 178 |
| 172 // Looks for a MediaStreamDevice based on its ID. | 179 // Looks for a MediaStreamDevice based on its ID. |
| 173 // Returns NULL if not found. | 180 // Returns NULL if not found. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 266 |
| 260 // Callback used return results of media access requests. | 267 // Callback used return results of media access requests. |
| 261 typedef base::Callback<void(const MediaStreamDevices& devices, | 268 typedef base::Callback<void(const MediaStreamDevices& devices, |
| 262 content::MediaStreamRequestResult result, | 269 content::MediaStreamRequestResult result, |
| 263 std::unique_ptr<MediaStreamUI> ui)> | 270 std::unique_ptr<MediaStreamUI> ui)> |
| 264 MediaResponseCallback; | 271 MediaResponseCallback; |
| 265 | 272 |
| 266 } // namespace content | 273 } // namespace content |
| 267 | 274 |
| 268 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ | 275 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ |
| OLD | NEW |