Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_ | |
| 7 | |
| 8 #include "base/memory/ptr_util.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "content/public/common/media_stream_request.h" | |
| 11 #include "media/capture/video/video_capture_device.h" | |
| 12 #include "media/capture/video_capture_types.h" | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 class VideoCaptureController; | |
| 17 | |
| 18 class CONTENT_EXPORT BuildableDeviceCallbacks { | |
|
mcasas
2017/03/22 00:33:42
Why not make this class
class BuildableVideoCaptur
chfremer
2017/03/22 17:26:51
The reason why I generally avoid nesting interface
| |
| 19 public: | |
| 20 virtual ~BuildableDeviceCallbacks() {} | |
| 21 // Returns false if no descriptor was found. | |
|
mcasas
2017/03/22 00:33:42
s/false/nullptr/?
chfremer
2017/03/22 17:26:51
Done.
| |
| 22 virtual const media::VideoCaptureDeviceDescriptor* LookupDeviceDescriptor( | |
| 23 const std::string& id) = 0; | |
| 24 virtual void WillStartDevice(media::VideoFacingMode facing_mode) = 0; | |
| 25 virtual void DidStartDevice(VideoCaptureController* controller) = 0; | |
| 26 virtual void OnDeviceStartFailed(VideoCaptureController* controller) = 0; | |
|
mcasas
2017/03/22 00:33:42
These two methods are used similarly, so what abou
chfremer
2017/03/22 17:26:51
We currently have names WillStartDevice() and DidS
| |
| 27 }; | |
| 28 | |
| 29 // Abstraction for a video capture device that must be "built" before it can be | |
| 30 // operated and must be "stopped", before it can be released. Typical operation | |
| 31 // is that a newly created instance initially reports IsDeviceAlive() == false. | |
| 32 // Clients call CreateAndStartDeviceAsync(), which kicks off the asynchronous | |
| 33 // building of the device. The outcome of the device building is typically | |
| 34 // reported to an instance of BuildableDeviceCallbacks (see above). Once the | |
| 35 // device has been built successfully, the "Device operation methods", are | |
| 36 // allowed to be called. ReleaseDeviceAsync() must be called in order to | |
| 37 // release the device if it has before been built successfully. After calling | |
| 38 // ReleaseDeviceAsync(), it is legal to call CreateAndStartDeviceAsync() to | |
| 39 // rebuild and start the device again. | |
| 40 class BuildableVideoCaptureDevice { | |
| 41 public: | |
| 42 virtual ~BuildableVideoCaptureDevice() {} | |
| 43 | |
| 44 // Device management methods. | |
| 45 virtual void CreateAndStartDeviceAsync( | |
| 46 VideoCaptureController* controller, | |
| 47 const media::VideoCaptureParams& params, | |
| 48 BuildableDeviceCallbacks* callbacks, | |
| 49 base::OnceClosure done_cb) = 0; | |
| 50 virtual void ReleaseDeviceAsync(VideoCaptureController* controller, | |
| 51 base::OnceClosure done_cb) = 0; | |
| 52 virtual bool IsDeviceAlive() const = 0; | |
| 53 | |
| 54 // Device operation methods. | |
| 55 virtual void GetPhotoCapabilities( | |
| 56 media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback) | |
| 57 const = 0; | |
| 58 virtual void SetPhotoOptions( | |
| 59 media::mojom::PhotoSettingsPtr settings, | |
| 60 media::VideoCaptureDevice::SetPhotoOptionsCallback callback) = 0; | |
| 61 virtual void TakePhoto( | |
| 62 media::VideoCaptureDevice::TakePhotoCallback callback) = 0; | |
| 63 virtual void MaybeSuspendDevice() = 0; | |
| 64 virtual void ResumeDevice() = 0; | |
| 65 virtual void RequestRefreshFrame() = 0; | |
| 66 | |
| 67 // Methods for specific types of devices. | |
| 68 virtual void SetDesktopCaptureWindowIdAsync(gfx::NativeViewId window_id, | |
| 69 base::OnceClosure done_cb) = 0; | |
| 70 }; | |
| 71 | |
| 72 } // namespace content | |
| 73 | |
| 74 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_ | |
| OLD | NEW |