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

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 miu@'s suggestions from PatchSet 3 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 2016 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/browser/renderer_host/media/ownership.h"
11 #include "content/public/common/media_stream_request.h"
12 #include "media/capture/video/video_capture_device.h"
13 #include "media/capture/video_capture_types.h"
14
15 namespace content {
16
17 class VideoCaptureController;
18
19 class CONTENT_EXPORT BuildableDeviceCallbacks {
20 public:
21 virtual ~BuildableDeviceCallbacks() {}
22 // Returns false if no descriptor was found.
23 virtual const media::VideoCaptureDeviceDescriptor* LookupDeviceDescriptor(
24 const std::string& id) = 0;
25 virtual void WillStartDevice(media::VideoFacingMode facing_mode) = 0;
26 virtual void DidStartDevice(VideoCaptureController* entry) = 0;
27 virtual void OnDeviceStartFailed(VideoCaptureController* entry) = 0;
28 };
29
30 // Abstraction for a video capture device that must be "built" before it can be
31 // operated and must be "stopped", before it can be released. Typical operation
32 // is that a newly created instance initially reports IsDeviceAlive() == false.
33 // Clients call CreateAndStartDeviceAsync(), which kicks off the asynchronous
34 // building of the device. The outcome of the device building is typically
35 // reported to an instance of BuildableDeviceCallbacks (see above). Once the
36 // device has been built successfully, the "Device operation methods", are
37 // allowed to be called. ReleaseDeviceAsync() must be called in order to
38 // release the device if it has before been built successfully. After calling
39 // ReleaseDeviceAsync(), it is legal to call CreateAndStartDeviceAsync() to
40 // rebuild and start the device again.
41 class BuildableVideoCaptureDevice {
42 public:
43 virtual ~BuildableVideoCaptureDevice() {}
44
45 // Device management methods.
46 // The passed-in |context_reference| must guarantee that the context relevant
47 // during the asynchronous processing stays alive.
48 virtual void CreateAndStartDeviceAsync(
49 VideoCaptureController* entry,
50 VideoCaptureController* controller,
51 const media::VideoCaptureParams& params,
52 BuildableDeviceCallbacks* callbacks,
53 std::unique_ptr<Ownership> context_reference) = 0;
54 // The passed-in |context_reference| must guarantee that the context relevant
55 // during the asynchronous processing stays alive.
56 virtual void ReleaseDeviceAsync(
57 VideoCaptureController* controller,
58 std::unique_ptr<Ownership> context_reference) = 0;
59 virtual bool IsDeviceAlive() const = 0;
60
61 // Device operation methods.
62 virtual void GetPhotoCapabilities(
63 media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback)
64 const = 0;
65 virtual void SetPhotoOptions(
66 media::mojom::PhotoSettingsPtr settings,
67 media::VideoCaptureDevice::SetPhotoOptionsCallback callback) = 0;
68 virtual void TakePhoto(
69 media::VideoCaptureDevice::TakePhotoCallback callback) = 0;
70 virtual void MaybeSuspendDevice() = 0;
71 virtual void ResumeDevice() = 0;
72 virtual void RequestRefreshFrame() = 0;
73
74 // Methods for specific types of devices.
75 // The passed-in |context_reference| must guarantee that the context relevant
76 // during the asynchronous processing stays alive.
77 virtual void SetDesktopCaptureWindowIdAsync(
78 gfx::NativeViewId window_id,
79 std::unique_ptr<Ownership> context_reference) = 0;
80 };
81
82 } // namespace content
83
84 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698