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 // Abstraction for a video capture device that must be "built" before it can be | |
19 // operated and must be "stopped", before it can be released. Typical operation | |
20 // is that a newly created instance initially reports IsDeviceAlive() == false. | |
21 // Clients call CreateAndStartDeviceAsync(), which kicks off the asynchronous | |
22 // building of the device. The outcome of the device building is reported to an | |
23 // instance of Callbacks. Once the device has been built successfully, the | |
24 // "Device operation methods", are allowed to be called. ReleaseDeviceAsync() | |
25 // must be called in order to release the device if it has before been built | |
26 // successfully. After calling ReleaseDeviceAsync(), it is legal to call | |
27 // CreateAndStartDeviceAsync() to rebuild and start the device again. | |
28 class CONTENT_EXPORT BuildableVideoCaptureDevice { | |
29 public: | |
30 class CONTENT_EXPORT Callbacks { | |
31 public: | |
32 virtual ~Callbacks() {} | |
33 virtual void OnDeviceStarted(VideoCaptureController* controller) = 0; | |
34 virtual void OnDeviceStartFailed(VideoCaptureController* controller) = 0; | |
35 virtual void OnDeviceStartAborted() = 0; | |
36 }; | |
37 | |
38 virtual ~BuildableVideoCaptureDevice() {} | |
39 | |
40 // Device management methods. | |
41 virtual void CreateAndStartDeviceAsync( | |
42 VideoCaptureController* controller, | |
43 const media::VideoCaptureParams& params, | |
44 Callbacks* callbacks, | |
45 base::OnceClosure done_cb) = 0; | |
46 virtual void ReleaseDeviceAsync(VideoCaptureController* controller, | |
47 base::OnceClosure done_cb) = 0; | |
48 virtual bool IsDeviceAlive() const = 0; | |
49 | |
50 // Device operation methods. | |
51 virtual void GetPhotoCapabilities( | |
52 media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback) | |
53 const = 0; | |
54 virtual void SetPhotoOptions( | |
55 media::mojom::PhotoSettingsPtr settings, | |
56 media::VideoCaptureDevice::SetPhotoOptionsCallback callback) = 0; | |
57 virtual void TakePhoto( | |
58 media::VideoCaptureDevice::TakePhotoCallback callback) = 0; | |
59 virtual void MaybeSuspendDevice() = 0; | |
60 virtual void ResumeDevice() = 0; | |
61 virtual void RequestRefreshFrame() = 0; | |
62 | |
63 // Methods for specific types of devices. | |
64 virtual void SetDesktopCaptureWindowIdAsync(gfx::NativeViewId window_id, | |
65 base::OnceClosure done_cb) = 0; | |
66 }; | |
67 | |
68 } // namespace content | |
69 | |
70 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_ | |
OLD | NEW |