| Index: media/capture/interfaces/video_capture.mojom
|
| diff --git a/media/capture/interfaces/video_capture.mojom b/media/capture/interfaces/video_capture.mojom
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..741ee3705b0019a777903737dc201cf49b812449
|
| --- /dev/null
|
| +++ b/media/capture/interfaces/video_capture.mojom
|
| @@ -0,0 +1,93 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// This mojom defines the interface for enumerating Video Capture Devices and
|
| +// selecting one for capturing. Such a VCD is manipulated via creation of a
|
| +// VideoCaptureStream, which is then Start()ed to produce FrameInfos to a
|
| +// VideoCaptureStreamClient. In this sense, this API mimics a UserMediaClient.
|
| +
|
| +module media.mojom;
|
| +
|
| +import "media/mojo/interfaces/media_types.mojom";
|
| +import "ui/mojo/geometry/geometry.mojom";
|
| +
|
| +struct VideoCaptureDeviceInfo {
|
| + string device_id;
|
| + string name;
|
| + // TODO(mcasas): add VideoFacingMode facing_mode;
|
| +};
|
| +
|
| +struct VideoCaptureOptions {
|
| + string device_id;
|
| +
|
| + // Replicate the used fields of VideoCaptureParams.
|
| + mojo.Size capture_size;
|
| + double frame_rate;
|
| + // TODO(mcasas): add and wire PowerLineFrequency and ResolutionChangePolicy.
|
| +};
|
| +
|
| +// Information provided to a VideoStreamClient about an available video frame.
|
| +struct FrameInfo {
|
| + // Shared memory handle to allocated storage for the frame. This handle may
|
| + // be mapped by the client for read-only access.
|
| + // TODO(mcasas): investigate if sharing this buffer per frame has any impact
|
| + // in performance. If so, reinstaurate a sharing-buffer-preamble.
|
| + handle<shared_buffer> storage_handle;
|
| + // Size in bytes of the allocated storage.
|
| + int32 storage_size;
|
| +
|
| + // Pixel format of the frame data in storage.
|
| + media.interfaces.VideoFormat pixel_format;
|
| +
|
| + // Size of the frame in pixels. This includes pixel data for the whole image;
|
| + // i.e. for YUV formats with subsampled chroma planes where the visible
|
| + // portion does not line up on a sample boundary, |coded_size| will be rounded
|
| + // up appropriately and pixel data will be provided for the odd pixels.
|
| + mojo.Size coded_size;
|
| +
|
| + // Visible rectangle of pixels in the frame. This must be a subrect of
|
| + // |coded_rect|. May be odd with respect to the sample boundaries, e.g. for
|
| + // formats with subsampled chroma. This is used e.g. for letterboxing.
|
| + mojo.Rect visible_rect;
|
| +
|
| + // A coded version of base::TimeTicks::Now() at the time the frame data was
|
| + // generated by its source. For the sake of consistency this must always be
|
| + // interpreted using base::TimeTicks::FromInternalValue or some equivalent.
|
| + int64 timestamp;
|
| +};
|
| +
|
| +// The client interface for a VideoCaptureStream.
|
| +interface VideoCaptureStreamClient {
|
| + // Informs the client that new frame data is available. |info| provides
|
| + // details about this individual frame.
|
| + OnFrameAvailable(FrameInfo info) => ();
|
| +
|
| + // An error has ocurred; the capture will be stopped.
|
| + OnError(string error);
|
| +};
|
| +
|
| +// The VideoCaptureStream interface abstracts a distinct local source of video
|
| +// frame data such as a WebCam.
|
| +// TODO(mcasas): Consider extending to desktop capture and web view capture.
|
| +interface VideoCaptureStream {
|
| + // Starts sending frames to |client|. Must only be called once and must be the
|
| + // first call on the Stream.
|
| + Start(VideoCaptureStreamClient client);
|
| +
|
| + // Stops the capture, releasing all associated resources.
|
| + Stop();
|
| +};
|
| +
|
| +// Primary top-level service interface exposed by the video_capture component.
|
| +interface VideoCaptureHandler {
|
| + EnumerateDevices()
|
| + => (array<VideoCaptureDeviceInfo> devices);
|
| +
|
| + // TODO(mcasas): Add a method to retrieve the capture capabilities of a given
|
| + // |device_id|.
|
| +
|
| + RequestVideoCaptureStream(VideoCaptureOptions options)
|
| + => (VideoCaptureStream? stream);
|
| +};
|
| +
|
|
|