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

Side by Side Diff: media/capture/interfaces/video_capture.mojom

Issue 1699553002: Mojo Video Capture service in media/capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rockot@s comments Created 4 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 // This mojom defines the interface for enumerating Video Capture Devices and
6 // selecting one for capturing. Such a VCD is manipulated via creation of a
7 // Stream, which is then Start()ed to produce FrameInfos to a StreamCient. In
8 // this sense, this API mimics a UserMediaClient.
9
10 module media.mojom;
11
12 import "media/mojo/interfaces/media_types.mojom";
13 import "ui/mojo/geometry/geometry.mojom";
14
15 // Copies of third_party/WebKit/public/platform/WebSourceInfo.h.
16 enum SourceKind { None, Audio, Video };
17 enum VideoFacingMode { None, User, Environment };
18 struct WebSourceInfo {
19 string device_id;
20 string label;
21
22 SourceKind kind; // Should always be blink::WebSourceInfo::SourceKindVideo
23
24 VideoFacingMode facing_mode;
25 };
26
27 struct StreamOptions {
28 string device_id;
29
30 // Replicate the used fields of VideoCaptureParams.
31 mojo.Size capture_size;
32 double frame_rate;
33 // TODO(mcasas): add and wire PowerLineFrequency and ResolutionChangePolicy.
34 };
35
36 // Information provided to a VideoStreamClient about an available video frame.
37 struct FrameInfo {
38 // Shared memory handle to allocated storage for the frame. This handle may
39 // be mapped by the client for read-only access.
40 // TODO(mcasas): investigate if sharing this buffer per frame has ny impact in
perkj_chrome 2016/03/02 13:14:10 s ny/any
mcasas 2016/03/02 19:53:51 Done.
41 // performance. If so, reinstaurate a sharing-buffer-preamble.
42 handle<shared_buffer> storage_handle;
43 // Size in bytes of the allocated storage.
44 int32 storage_size;
45
46 // Pixel format of the frame data in storage.
47 media.interfaces.VideoFormat pixel_format;
48
49 // Size of the frame in pixels. This includes pixel data for the whole image;
50 // i.e. for YUV formats with subsampled chroma planes where the visible
51 // portion does not line up on a sample boundary, |coded_size| will be rounded
52 // up appropriately and pixel data will be provided for the odd pixels.
53 mojo.Size coded_size;
54
55 // Visible rectangle of pixels in the frame. This must be a subrect of
56 // |coded_rect|. May be odd with respect to the sample boundaries, e.g. for
57 // formats with subsampled chroma. This is used e.g. for letterboxing.
58 mojo.Rect visible_rect;
59
60 // A coded version of base::TimeTicks::Now() at the time the frame data was
61 // generated by its source. For the sake of consistency this must always be
62 // interpreted using base::TimeTicks::FromInternalValue or some equivalent.
63 int64 timestamp;
64 };
65
66 // The client interface for a Stream.
67 interface StreamClient {
68 // Informs the client that new frame data is available. |info| provides
69 // details about this individual frame.
70 FrameAvailable(FrameInfo info) => ();
71
72 // Some Error has happened; the capture will in all likelihood be interrupted.
73 Error(string error);
74 };
75
76 // The Stream interface abstracts a distinct local source of video frame data
77 // such as a camera device, desktop capture, web view capture.
78 interface Stream {
79 // Starts sending frames to |client|. Must only be called once and must be the
80 // first call on the Stream.
81 Start(StreamClient client);
82
83 // Temporarily stops sending frames to the client. The client will not begin
84 // receiving frame data again until Resume is called.
85 Pause();
perkj_chrome 2016/03/02 13:14:10 Is Pause used? Can we skip this for now and use S
mcasas 2016/03/02 19:53:51 Done.
86
87 // Resumes sending frames to the client.
88 Resume();
89
90 // Stops the capture, releasing all associated resources.
91 Stop();
92 };
93
94 // The primary top-level service interface exposed by the video_capture
95 // component. This is used by a UserMediaClient implementation to get hold of a
96 // Stream that can be Start()ed to produce video frames, so in a way, it is a
97 // video-only flavour of WebUserMediaClient.
98 // TODO(mcasas): Add a method to retrieve the capture capabilities of a given
99 // |device_id|.
100 interface VideoCaptureHandler {
101 // requestMediaDevices(const WebMediaDevicesRequest&)
102 RequestMediaDevices()
103 => (array<WebSourceInfo> devices);
perkj_chrome 2016/03/02 13:14:10 should only be possible to get one video device at
mcasas 2016/03/02 19:53:51 ? This RPC enumerates the devices, it follows th
104
105 // requestUserMedia(const WebUserMediaRequest&)
106 RequestStream(StreamOptions options, string security_origin)
perkj_chrome 2016/03/02 13:14:10 Can we stick with only one method to start with.
mcasas 2016/03/02 19:53:51 Negative, we need at least: - enumerate all device
107 => (Stream? stream);
108 };
109
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698