Chromium Code Reviews| 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. |
| 11 | 11 |
| 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
| 13 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 13 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
| 14 | 14 |
| 15 #include <map> | 15 #include <map> |
| 16 #include <set> | 16 #include <set> |
| 17 #include <string> | 17 #include <string> |
| 18 | 18 |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 21 #include "base/process/process_handle.h" | 21 #include "base/process/process_handle.h" |
| 22 #include "content/browser/renderer_host/media/media_stream_provider.h" | 22 #include "content/browser/renderer_host/media/media_stream_provider.h" |
| 23 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h" | 23 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h" |
| 24 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
| 25 #include "content/common/media/media_stream_options.h" | 25 #include "content/common/media/media_stream_options.h" |
| 26 #include "media/video/capture/video_capture_device.h" | 26 #include "media/video/capture/video_capture_device.h" |
| 27 #include "media/video/capture/video_capture_device_factory.h" | 27 #include "media/video/capture/video_capture_device_factory.h" |
| 28 #include "media/video/capture/video_capture_types.h" | 28 #include "media/video/capture/video_capture_types.h" |
| 29 #include "ui/gfx/display.h" | |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 class VideoCaptureController; | 32 class VideoCaptureController; |
| 32 class VideoCaptureControllerEventHandler; | 33 class VideoCaptureControllerEventHandler; |
| 33 | 34 |
| 34 // VideoCaptureManager opens/closes and start/stops video capture devices. | 35 // VideoCaptureManager opens/closes and start/stops video capture devices. |
| 35 class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { | 36 class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| 36 public: | 37 public: |
| 37 // Callback used to signal the completion of a controller lookup. | 38 // Callback used to signal the completion of a controller lookup. |
| 38 typedef base::Callback< | 39 typedef base::Callback< |
| 39 void(const base::WeakPtr<VideoCaptureController>&)> DoneCB; | 40 void(const base::WeakPtr<VideoCaptureController>&)> DoneCB; |
| 40 | 41 |
| 41 explicit VideoCaptureManager( | 42 explicit VideoCaptureManager( |
| 42 scoped_ptr<media::VideoCaptureDeviceFactory> factory); | 43 scoped_ptr<media::VideoCaptureDeviceFactory> factory); |
| 43 | 44 |
| 45 // Set the Display rotation. | |
| 46 void SetDisplayRotation(gfx::Display::Rotation rotation); | |
|
vrk (LEFT CHROMIUM)
2014/05/09 01:11:31
nit: Comment that this must be called on the IO th
Zachary Kuznia
2014/05/09 07:42:22
Done.
| |
| 47 | |
| 44 // Implements MediaStreamProvider. | 48 // Implements MediaStreamProvider. |
| 45 virtual void Register(MediaStreamProviderListener* listener, | 49 virtual void Register(MediaStreamProviderListener* listener, |
| 46 const scoped_refptr<base::SingleThreadTaskRunner>& | 50 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 47 device_task_runner) OVERRIDE; | 51 device_task_runner) OVERRIDE; |
| 48 | 52 |
| 49 virtual void Unregister() OVERRIDE; | 53 virtual void Unregister() OVERRIDE; |
| 50 | 54 |
| 51 virtual void EnumerateDevices(MediaStreamType stream_type) OVERRIDE; | 55 virtual void EnumerateDevices(MediaStreamType stream_type) OVERRIDE; |
| 52 | 56 |
| 53 virtual int Open(const StreamDeviceInfo& device) OVERRIDE; | 57 virtual int Open(const StreamDeviceInfo& device) OVERRIDE; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 // from EnumerateDevices()--, and this snapshot is used to update this list in | 238 // from EnumerateDevices()--, and this snapshot is used to update this list in |
| 235 // OnDevicesInfoEnumerated(). GetDeviceSupportedFormats() will | 239 // OnDevicesInfoEnumerated(). GetDeviceSupportedFormats() will |
| 236 // use this list if the device is not started, otherwise it will retrieve the | 240 // use this list if the device is not started, otherwise it will retrieve the |
| 237 // active device capture format from the VideoCaptureController associated. | 241 // active device capture format from the VideoCaptureController associated. |
| 238 DeviceInfos devices_info_cache_; | 242 DeviceInfos devices_info_cache_; |
| 239 | 243 |
| 240 // Accessed on the device thread only. | 244 // Accessed on the device thread only. |
| 241 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> | 245 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> |
| 242 notification_window_ids_; | 246 notification_window_ids_; |
| 243 | 247 |
| 248 // Accessed on the device thread only. | |
| 249 gfx::Display::Rotation display_rotation_; | |
| 250 | |
| 244 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 251 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
| 245 }; | 252 }; |
| 246 | 253 |
| 247 } // namespace content | 254 } // namespace content |
| 248 | 255 |
| 249 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 256 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
| OLD | NEW |