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 // VideoCaptureManager is used to open/close, start/stop, enumerate available | 5 // VideoCaptureManager is used to open/close, start/stop, enumerate available |
6 // video capture devices, and manage VideoCaptureController's. | 6 // video capture devices, and manage VideoCaptureController's. |
7 // All functions are expected to be called from Browser::IO thread. Some helper | 7 // All functions are expected to be called from Browser::IO thread. Some helper |
8 // functions (*OnDeviceThread) will dispatch operations to the device thread. | 8 // functions (*OnDeviceThread) will dispatch operations to the device thread. |
9 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice. | 9 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice. |
10 // A device can only be opened once. | 10 // A device can only be opened once. |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/threading/thread_checker.h" | 26 #include "base/threading/thread_checker.h" |
27 #include "base/timer/elapsed_timer.h" | 27 #include "base/timer/elapsed_timer.h" |
28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
29 #include "content/browser/renderer_host/media/buildable_video_capture_device.h" | 29 #include "content/browser/renderer_host/media/buildable_video_capture_device.h" |
30 #include "content/browser/renderer_host/media/media_stream_provider.h" | 30 #include "content/browser/renderer_host/media/media_stream_provider.h" |
31 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" | 31 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" |
32 #include "content/common/content_export.h" | 32 #include "content/common/content_export.h" |
33 #include "content/common/media/media_stream_options.h" | 33 #include "content/common/media/media_stream_options.h" |
34 #include "media/base/video_facing.h" | 34 #include "media/base/video_facing.h" |
35 #include "media/capture/video/video_capture_device.h" | 35 #include "media/capture/video/video_capture_device.h" |
36 #include "media/capture/video/video_capture_device_factory.h" | |
37 #include "media/capture/video/video_capture_device_info.h" | 36 #include "media/capture/video/video_capture_device_info.h" |
38 #include "media/capture/video/video_capture_system.h" | 37 #include "media/capture/video/video_capture_system.h" |
39 #include "media/capture/video_capture_types.h" | 38 #include "media/capture/video_capture_types.h" |
40 | 39 |
41 #if defined(OS_ANDROID) | 40 #if defined(OS_ANDROID) |
42 #include "base/android/application_status_listener.h" | 41 #include "base/android/application_status_listener.h" |
43 #endif | 42 #endif |
44 | 43 |
45 namespace content { | 44 namespace content { |
46 class VideoCaptureController; | 45 class VideoCaptureController; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // in use. | 155 // in use. |
157 bool GetDeviceFormatsInUse(MediaStreamType stream_type, | 156 bool GetDeviceFormatsInUse(MediaStreamType stream_type, |
158 const std::string& device_id, | 157 const std::string& device_id, |
159 media::VideoCaptureFormats* supported_formats); | 158 media::VideoCaptureFormats* supported_formats); |
160 | 159 |
161 // Sets the platform-dependent window ID for the desktop capture notification | 160 // Sets the platform-dependent window ID for the desktop capture notification |
162 // UI for the given session. | 161 // UI for the given session. |
163 void SetDesktopCaptureWindowId(media::VideoCaptureSessionId session_id, | 162 void SetDesktopCaptureWindowId(media::VideoCaptureSessionId session_id, |
164 gfx::NativeViewId window_id); | 163 gfx::NativeViewId window_id); |
165 | 164 |
166 // Gets a weak reference to the device factory, used for tests. | |
167 media::VideoCaptureDeviceFactory* video_capture_device_factory() const { | |
168 return video_capture_system_->video_capture_device_factory(); | |
169 } | |
170 | |
171 #if defined(OS_WIN) | |
172 void set_device_task_runner( | |
173 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner) { | |
174 device_task_runner_ = device_task_runner; | |
175 } | |
176 #endif | |
177 | |
178 // Returns the SingleThreadTaskRunner where devices are enumerated on and | |
179 // started. | |
180 scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner() { | |
181 return device_task_runner_; | |
182 } | |
183 | |
184 void GetPhotoCapabilities( | 165 void GetPhotoCapabilities( |
185 int session_id, | 166 int session_id, |
186 VideoCaptureDevice::GetPhotoCapabilitiesCallback callback); | 167 VideoCaptureDevice::GetPhotoCapabilitiesCallback callback); |
187 void SetPhotoOptions(int session_id, | 168 void SetPhotoOptions(int session_id, |
188 media::mojom::PhotoSettingsPtr settings, | 169 media::mojom::PhotoSettingsPtr settings, |
189 VideoCaptureDevice::SetPhotoOptionsCallback callback); | 170 VideoCaptureDevice::SetPhotoOptionsCallback callback); |
190 void TakePhoto(int session_id, | 171 void TakePhoto(int session_id, |
191 VideoCaptureDevice::TakePhotoCallback callback); | 172 VideoCaptureDevice::TakePhotoCallback callback); |
192 | 173 |
193 #if defined(OS_ANDROID) | 174 #if defined(OS_ANDROID) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // Map used by DesktopCapture. | 306 // Map used by DesktopCapture. |
326 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> | 307 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> |
327 notification_window_ids_; | 308 notification_window_ids_; |
328 | 309 |
329 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 310 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
330 }; | 311 }; |
331 | 312 |
332 } // namespace content | 313 } // namespace content |
333 | 314 |
334 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 315 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
OLD | NEW |