Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: content/browser/renderer_host/media/buildable_video_capture_device.h

Issue 2738763002: [Mojo Video Capture] Introduce abstraction BuildableVideoCaptureDevice (Closed)
Patch Set: Incorporated suggestions from Patch Set 8 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // Returns nullptr if no descriptor was found.
34 virtual const media::VideoCaptureDeviceDescriptor* LookupDeviceDescriptor(
35 const std::string& id) = 0;
36 virtual void WillStartDevice(media::VideoFacingMode facing_mode) = 0;
37 virtual void DidStartDevice(VideoCaptureController* controller) = 0;
38 virtual void OnDeviceStartFailed(VideoCaptureController* controller) = 0;
39 };
40
41 virtual ~BuildableVideoCaptureDevice() {}
42
43 // Device management methods.
44 virtual void CreateAndStartDeviceAsync(
45 VideoCaptureController* controller,
46 const media::VideoCaptureParams& params,
47 Callbacks* callbacks,
48 base::OnceClosure done_cb) = 0;
49 virtual void ReleaseDeviceAsync(VideoCaptureController* controller,
50 base::OnceClosure done_cb) = 0;
51 virtual bool IsDeviceAlive() const = 0;
52
53 // Device operation methods.
54 virtual void GetPhotoCapabilities(
55 media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback)
56 const = 0;
57 virtual void SetPhotoOptions(
58 media::mojom::PhotoSettingsPtr settings,
59 media::VideoCaptureDevice::SetPhotoOptionsCallback callback) = 0;
60 virtual void TakePhoto(
61 media::VideoCaptureDevice::TakePhotoCallback callback) = 0;
62 virtual void MaybeSuspendDevice() = 0;
63 virtual void ResumeDevice() = 0;
64 virtual void RequestRefreshFrame() = 0;
65
66 // Methods for specific types of devices.
67 virtual void SetDesktopCaptureWindowIdAsync(gfx::NativeViewId window_id,
68 base::OnceClosure done_cb) = 0;
69 };
70
71 } // namespace content
72
73 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/renderer_host/media/in_process_buildable_video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698