OLD | NEW |
---|---|
(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 | |
perkj_chrome
2016/03/04 15:34:02
Want to update this text with the new names.
mcasas
2016/03/04 19:59:45
Done.
| |
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 struct VideoCaptureDeviceInfo { | |
16 string device_id; | |
17 string label; | |
perkj_chrome
2016/03/04 15:34:02
If this is from VideoCaptureDevice::Name - can we
mcasas
2016/03/04 19:59:45
Corresponds to device_name.GetNameAndModel().
Don
| |
18 // TODO(mcasas): add VideoFacingMode facing_mode; | |
19 }; | |
20 | |
21 struct StreamOptions { | |
perkj_chrome
2016/03/04 15:34:02
VideoCaptureDeviceOptions? There are no Steams an
mcasas
2016/03/04 19:59:45
These are not the VideoCaptureDevice
options, but
| |
22 string device_id; | |
23 | |
24 // Replicate the used fields of VideoCaptureParams. | |
25 mojo.Size capture_size; | |
26 double frame_rate; | |
27 // TODO(mcasas): add and wire PowerLineFrequency and ResolutionChangePolicy. | |
28 }; | |
29 | |
30 // Information provided to a VideoStreamClient about an available video frame. | |
31 struct FrameInfo { | |
32 // Shared memory handle to allocated storage for the frame. This handle may | |
33 // be mapped by the client for read-only access. | |
34 // TODO(mcasas): investigate if sharing this buffer per frame has any impact | |
35 // in performance. If so, reinstaurate a sharing-buffer-preamble. | |
36 handle<shared_buffer> storage_handle; | |
magjed_chromium
2016/03/04 15:41:42
|storage_handle| contains all the data, right? Don
mcasas
2016/03/04 19:59:45
Not yet. Offsets are not used in capture and
the
magjed_chromium
2016/03/07 15:36:24
With plane offsets I mean: how do you calculate th
mcasas
2016/03/07 20:57:49
Yes.
magjed_chromium
2016/03/09 14:11:18
Acknowledged.
| |
37 // Size in bytes of the allocated storage. | |
38 int32 storage_size; | |
39 | |
40 // Pixel format of the frame data in storage. | |
41 media.interfaces.VideoFormat pixel_format; | |
42 | |
43 // Size of the frame in pixels. This includes pixel data for the whole image; | |
44 // i.e. for YUV formats with subsampled chroma planes where the visible | |
45 // portion does not line up on a sample boundary, |coded_size| will be rounded | |
46 // up appropriately and pixel data will be provided for the odd pixels. | |
47 mojo.Size coded_size; | |
48 | |
49 // Visible rectangle of pixels in the frame. This must be a subrect of | |
50 // |coded_rect|. May be odd with respect to the sample boundaries, e.g. for | |
51 // formats with subsampled chroma. This is used e.g. for letterboxing. | |
52 mojo.Rect visible_rect; | |
perkj_chrome
2016/03/04 15:34:02
Do we use this now? Can't we add this if we ever n
mcasas
2016/03/04 19:59:45
(Some) ChromeOS devices actually use this field
(I
| |
53 | |
54 // A coded version of base::TimeTicks::Now() at the time the frame data was | |
55 // generated by its source. For the sake of consistency this must always be | |
56 // interpreted using base::TimeTicks::FromInternalValue or some equivalent. | |
57 int64 timestamp; | |
perkj_chrome
2016/03/04 15:34:02
Why can't this be TimeTicks then instead of int64?
mcasas
2016/03/04 19:59:45
There are no marshalling primitives for TimeTicks
perkj_chrome
2016/03/07 23:58:27
Acknowledged.
| |
58 }; | |
59 | |
60 // The client interface for a VideoCaptureStream. | |
61 interface VideoCaptureStreamClient { | |
62 // Informs the client that new frame data is available. |info| provides | |
63 // details about this individual frame. | |
64 FrameAvailable(FrameInfo info) => (); | |
perkj_chrome
2016/03/04 15:34:02
Should this be OnFrameAvailable to be consistent w
mcasas
2016/03/04 19:59:45
Done.
| |
65 | |
66 // Some Error has happened; the capture will in all likelihood be interrupted. | |
perkj_chrome
2016/03/04 15:34:02
Please decide what will happen when an error occur
perkj_chrome
2016/03/04 15:34:02
nit: Suggest - An error has occurred.....
mcasas
2016/03/04 19:59:45
The client doesn't need to know, because is
down t
mcasas
2016/03/04 19:59:45
Done.
| |
67 Error(string error); | |
68 }; | |
69 | |
70 // The VideoCaptureStream interface abstracts a distinct local source of video | |
71 // frame data such as a WebCam. | |
72 // TODO(mcasas): Consider extending to desktop capture and web view capture. | |
73 interface VideoCaptureStream { | |
74 // Starts sending frames to |client|. Must only be called once and must be the | |
75 // first call on the Stream. | |
76 Start(VideoCaptureStreamClient client); | |
77 | |
78 // Stops the capture, releasing all associated resources. | |
79 Stop(); | |
80 }; | |
81 | |
82 // The primary top-level service interface exposed by the video_capture | |
83 // component. This can used by a UserMediaClient implementation to get hold of a | |
perkj_chrome
2016/03/04 15:34:02
If this is browser side only this will not be used
mcasas
2016/03/04 19:59:45
Done.
| |
84 // VideoCaptureStream that can be Start()ed to produce video frames. In a way, | |
85 // it is a video-only flavour of WebUserMediaClient. | |
86 // TODO(mcasas): Add a method to retrieve the capture capabilities of a given | |
87 // |device_id|. | |
88 interface VideoCaptureHandler { | |
89 EnumerateDevices() | |
90 => (array<VideoCaptureDeviceInfo> devices); | |
91 | |
92 RequestVideoCaptureStream(StreamOptions options, string security_origin) | |
perkj_chrome
2016/03/04 15:34:02
why security_origin if this is browser side only?
mcasas
2016/03/04 19:59:45
Reminder of where this all started, months and
mon
| |
93 => (VideoCaptureStream? stream); | |
94 }; | |
95 | |
OLD | NEW |