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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 // Called by VideoCaptureHost to remove |client_handler|. If this is the last | 78 // Called by VideoCaptureHost to remove |client_handler|. If this is the last |
79 // client of the device, the |controller| and its VideoCaptureDevice may be | 79 // client of the device, the |controller| and its VideoCaptureDevice may be |
80 // destroyed. The client must not access |controller| after calling this | 80 // destroyed. The client must not access |controller| after calling this |
81 // function. | 81 // function. |
82 void StopCaptureForClient(VideoCaptureController* controller, | 82 void StopCaptureForClient(VideoCaptureController* controller, |
83 VideoCaptureControllerID client_id, | 83 VideoCaptureControllerID client_id, |
84 VideoCaptureControllerEventHandler* client_handler, | 84 VideoCaptureControllerEventHandler* client_handler, |
85 bool aborted_due_to_error); | 85 bool aborted_due_to_error); |
86 | 86 |
| 87 // Called by VideoCaptureHost to pause to update video buffer specified by |
| 88 // |client_id| and |client_handler|. If all clients of |controller| are |
| 89 // paused, the corresponding device will be closed. |
| 90 void PauseCaptureForClient( |
| 91 VideoCaptureController* controller, |
| 92 VideoCaptureControllerID client_id, |
| 93 VideoCaptureControllerEventHandler* client_handler); |
| 94 |
| 95 // Called by VideoCaptureHost to resume to update video buffer specified by |
| 96 // |client_id| and |client_handler|. The |session_id| and |params| should be |
| 97 // same as those used in StartCaptureForClient(). |
| 98 // If this is first active client of |controller|, device will be allocated |
| 99 // and it will take a little time to resume. |
| 100 // Allocating device could failed if other app holds the camera, the error |
| 101 // will be notified through VideoCaptureControllerEventHandler::OnError(). |
| 102 void ResumeCaptureForClient( |
| 103 media::VideoCaptureSessionId session_id, |
| 104 const media::VideoCaptureParams& params, |
| 105 VideoCaptureController* controller, |
| 106 VideoCaptureControllerID client_id, |
| 107 VideoCaptureControllerEventHandler* client_handler); |
| 108 |
87 // Retrieves all capture supported formats for a particular device. Returns | 109 // Retrieves all capture supported formats for a particular device. Returns |
88 // false if the |capture_session_id| is not found. The supported formats are | 110 // false if the |capture_session_id| is not found. The supported formats are |
89 // cached during device(s) enumeration, and depending on the underlying | 111 // cached during device(s) enumeration, and depending on the underlying |
90 // implementation, could be an empty list. | 112 // implementation, could be an empty list. |
91 bool GetDeviceSupportedFormats( | 113 bool GetDeviceSupportedFormats( |
92 media::VideoCaptureSessionId capture_session_id, | 114 media::VideoCaptureSessionId capture_session_id, |
93 media::VideoCaptureFormats* supported_formats); | 115 media::VideoCaptureFormats* supported_formats); |
94 | 116 |
95 // Retrieves the format(s) currently in use. Returns false if the | 117 // Retrieves the format(s) currently in use. Returns false if the |
96 // |capture_session_id| is not found. Returns true and |formats_in_use| | 118 // |capture_session_id| is not found. Returns true and |formats_in_use| |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // Accessed on the device thread only. | 265 // Accessed on the device thread only. |
244 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> | 266 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> |
245 notification_window_ids_; | 267 notification_window_ids_; |
246 | 268 |
247 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 269 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
248 }; | 270 }; |
249 | 271 |
250 } // namespace content | 272 } // namespace content |
251 | 273 |
252 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 274 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
OLD | NEW |