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