| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 51 | 51 | 
| 52   virtual void Close(int capture_session_id) OVERRIDE; | 52   virtual void Close(int capture_session_id) OVERRIDE; | 
| 53 | 53 | 
| 54   // Used by unit test to make sure a fake device is used instead of a real | 54   // Used by unit test to make sure a fake device is used instead of a real | 
| 55   // video capture device. Due to timing requirements, the function must be | 55   // video capture device. Due to timing requirements, the function must be | 
| 56   // called before EnumerateDevices and Open. | 56   // called before EnumerateDevices and Open. | 
| 57   void UseFakeDevice(); | 57   void UseFakeDevice(); | 
| 58 | 58 | 
| 59   // Called by VideoCaptureHost to locate a capture device for |capture_params|, | 59   // Called by VideoCaptureHost to locate a capture device for |capture_params|, | 
| 60   // adding the Host as a client of the device's controller if successful. The | 60   // adding the Host as a client of the device's controller if successful. The | 
| 61   // value of |capture_params.session_id| controls which device is selected; | 61   // value of |session_id| controls which device is selected; | 
| 62   // this value should be a session id previously returned by Open(). | 62   // this value should be a session id previously returned by Open(). | 
| 63   // | 63   // | 
| 64   // If the device is not already started (i.e., no other client is currently | 64   // If the device is not already started (i.e., no other client is currently | 
| 65   // capturing from this device), this call will cause a VideoCaptureController | 65   // capturing from this device), this call will cause a VideoCaptureController | 
| 66   // and VideoCaptureDevice to be created, possibly asynchronously. | 66   // and VideoCaptureDevice to be created, possibly asynchronously. | 
| 67   // | 67   // | 
| 68   // On success, the controller is returned via calling |done_cb|, indicating | 68   // On success, the controller is returned via calling |done_cb|, indicating | 
| 69   // that the client was successfully added. A NULL controller is passed to | 69   // that the client was successfully added. A NULL controller is passed to | 
| 70   // the callback on failure. | 70   // the callback on failure. | 
| 71   void StartCaptureForClient(const media::VideoCaptureParams& capture_params, | 71   void StartCaptureForClient(media::VideoCaptureSessionId session_id, | 
|  | 72                              const media::VideoCaptureParams& capture_params, | 
| 72                              base::ProcessHandle client_render_process, | 73                              base::ProcessHandle client_render_process, | 
| 73                              VideoCaptureControllerID client_id, | 74                              VideoCaptureControllerID client_id, | 
| 74                              VideoCaptureControllerEventHandler* client_handler, | 75                              VideoCaptureControllerEventHandler* client_handler, | 
| 75                              const DoneCB& done_cb); | 76                              const DoneCB& done_cb); | 
| 76 | 77 | 
| 77   // 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 | 
| 78   // client of the device, the |controller| and its VideoCaptureDevice may be | 79   // client of the device, the |controller| and its VideoCaptureDevice may be | 
| 79   // destroyed. The client must not access |controller| after calling this | 80   // destroyed. The client must not access |controller| after calling this | 
| 80   // function. | 81   // function. | 
| 81   void StopCaptureForClient(VideoCaptureController* controller, | 82   void StopCaptureForClient(VideoCaptureController* controller, | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 113 | 114 | 
| 114   // Queries and returns the available device IDs. | 115   // Queries and returns the available device IDs. | 
| 115   media::VideoCaptureDevice::Names GetAvailableDevicesOnDeviceThread( | 116   media::VideoCaptureDevice::Names GetAvailableDevicesOnDeviceThread( | 
| 116       MediaStreamType stream_type); | 117       MediaStreamType stream_type); | 
| 117 | 118 | 
| 118   // Create and Start a new VideoCaptureDevice, storing the result in | 119   // Create and Start a new VideoCaptureDevice, storing the result in | 
| 119   // |entry->video_capture_device|. Ownership of |client| passes to | 120   // |entry->video_capture_device|. Ownership of |client| passes to | 
| 120   // the device. | 121   // the device. | 
| 121   void DoStartDeviceOnDeviceThread( | 122   void DoStartDeviceOnDeviceThread( | 
| 122       DeviceEntry* entry, | 123       DeviceEntry* entry, | 
| 123       const media::VideoCaptureCapability& capture_params, | 124       const media::VideoCaptureParams& params, | 
| 124       scoped_ptr<media::VideoCaptureDevice::Client> client); | 125       scoped_ptr<media::VideoCaptureDevice::Client> client); | 
| 125 | 126 | 
| 126   // Stop and destroy the VideoCaptureDevice held in | 127   // Stop and destroy the VideoCaptureDevice held in | 
| 127   // |entry->video_capture_device|. | 128   // |entry->video_capture_device|. | 
| 128   void DoStopDeviceOnDeviceThread(DeviceEntry* entry); | 129   void DoStopDeviceOnDeviceThread(DeviceEntry* entry); | 
| 129 | 130 | 
| 130   // The message loop of media stream device thread, where VCD's live. | 131   // The message loop of media stream device thread, where VCD's live. | 
| 131   scoped_refptr<base::MessageLoopProxy> device_loop_; | 132   scoped_refptr<base::MessageLoopProxy> device_loop_; | 
| 132 | 133 | 
| 133   // Only accessed on Browser::IO thread. | 134   // Only accessed on Browser::IO thread. | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 176   // when a device is created in DoStartDeviceOnDeviceThread(). Used only on the | 177   // when a device is created in DoStartDeviceOnDeviceThread(). Used only on the | 
| 177   // device thread. | 178   // device thread. | 
| 178   media::VideoCaptureDevice::Names video_capture_devices_; | 179   media::VideoCaptureDevice::Names video_capture_devices_; | 
| 179 | 180 | 
| 180   DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 181   DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 
| 181 }; | 182 }; | 
| 182 | 183 | 
| 183 }  // namespace content | 184 }  // namespace content | 
| 184 | 185 | 
| 185 #endif  // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 186 #endif  // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 
| OLD | NEW | 
|---|