| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 gfx::NativeViewId window_id); | 126 gfx::NativeViewId window_id); |
| 127 | 127 |
| 128 // Gets a weak reference to the device factory, used for tests. | 128 // Gets a weak reference to the device factory, used for tests. |
| 129 media::VideoCaptureDeviceFactory* video_capture_device_factory() const { | 129 media::VideoCaptureDeviceFactory* video_capture_device_factory() const { |
| 130 return video_capture_device_factory_.get(); | 130 return video_capture_device_factory_.get(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 virtual ~VideoCaptureManager(); | 134 virtual ~VideoCaptureManager(); |
| 135 struct DeviceEntry; | 135 struct DeviceEntry; |
| 136 | 136 typedef media::VideoCaptureDevice::DeviceInfo DeviceInfo; |
| 137 // This data structure is a convenient wrap of a devices' name and associated | 137 typedef media::VideoCaptureDevice::DeviceInfos DeviceInfos; |
| 138 // video capture supported formats. | |
| 139 struct DeviceInfo { | |
| 140 DeviceInfo(); | |
| 141 DeviceInfo(const media::VideoCaptureDevice::Name& name, | |
| 142 const media::VideoCaptureFormats& supported_formats); | |
| 143 ~DeviceInfo(); | |
| 144 | |
| 145 media::VideoCaptureDevice::Name name; | |
| 146 media::VideoCaptureFormats supported_formats; | |
| 147 }; | |
| 148 typedef std::vector<DeviceInfo> DeviceInfos; | |
| 149 | 138 |
| 150 // Checks to see if |entry| has no clients left on its controller. If so, | 139 // Checks to see if |entry| has no clients left on its controller. If so, |
| 151 // remove it from the list of devices, and delete it asynchronously. |entry| | 140 // remove it from the list of devices, and delete it asynchronously. |entry| |
| 152 // may be freed by this function. | 141 // may be freed by this function. |
| 153 void DestroyDeviceEntryIfNoClients(DeviceEntry* entry); | 142 void DestroyDeviceEntryIfNoClients(DeviceEntry* entry); |
| 154 | 143 |
| 155 // Helpers to report an event to our Listener. | 144 // Helpers to report an event to our Listener. |
| 156 void OnOpened(MediaStreamType type, | 145 void OnOpened(MediaStreamType type, |
| 157 media::VideoCaptureSessionId capture_session_id); | 146 media::VideoCaptureSessionId capture_session_id); |
| 158 void OnClosed(MediaStreamType type, | 147 void OnClosed(MediaStreamType type, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // Accessed on the device thread only. | 254 // Accessed on the device thread only. |
| 266 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> | 255 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> |
| 267 notification_window_ids_; | 256 notification_window_ids_; |
| 268 | 257 |
| 269 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 258 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
| 270 }; | 259 }; |
| 271 | 260 |
| 272 } // namespace content | 261 } // namespace content |
| 273 | 262 |
| 274 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 263 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
| OLD | NEW |