| Index: components/video_capture/public/interfaces/video_capture.mojom
|
| diff --git a/components/video_capture/public/interfaces/video_capture.mojom b/components/video_capture/public/interfaces/video_capture.mojom
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0fec2afc0a5670d504734d6fcb42c618c82bb18d
|
| --- /dev/null
|
| +++ b/components/video_capture/public/interfaces/video_capture.mojom
|
| @@ -0,0 +1,80 @@
|
| +// 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.
|
| +
|
| +module video_capture.mojom;
|
| +
|
| +import "media/mojo/interfaces/media_types.mojom";
|
| +import "ui/mojo/geometry/geometry.mojom";
|
| +
|
| +// Information provided to a subscription client about a newly created frame
|
| +// buffer.
|
| +struct FrameBufferInfo {
|
| + // A unique (per-stream) identifier for this buffer.
|
| + int32 id;
|
| +
|
| + // Shared memory handle to allocated storage for the frame. This handle may
|
| + // be mapped by the client for read-only access.
|
| + handle<shared_buffer> storage;
|
| +
|
| + // Size in bytes of the allocated storage.
|
| + int32 size;
|
| +};
|
| +
|
| +// Information provided to a VideoStreamClient about an available video frame.
|
| +struct FrameInfo {
|
| + // The frame buffer in which this frame's pixel data can be found.
|
| + int32 buffer_id;
|
| +
|
| + // 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 VideoStream.
|
| +interface StreamClient {
|
| + // Informs the client of a new frame buffer which may be used to provide
|
| + // frame data. The client should keep track of this buffer until
|
| + // BufferDestroyed is called with |info.id|.
|
| + BufferCreated(FrameBufferInfo info);
|
| +
|
| + // Informs the client that buffer |buffer_id| will no longer be used to
|
| + // provide frame data. The client should release any resources it has tied
|
| + // to this buffer.
|
| + BufferDestroyed(int32 buffer_id);
|
| +
|
| + // Informs the client that new frame data is available. |info| provides
|
| + // details about this individual frame. The client should respond as soon as
|
| + // it's finished reading the frame data.
|
| + FrameAvailable(FrameInfo info) => ();
|
| +};
|
| +
|
| +// The Stream interface abstracts a distinct source of video frame data such
|
| +// as a camera device, desktop capture, web view capture, or a remote stream.
|
| +interface Stream {
|
| + // Starts sending frames to |client|. Must only be called once and must be the
|
| + // first call on the VideoStream.
|
| + Start(StreamClient client);
|
| +
|
| + // Temporarily stops sending frames to the client. The client will not begin
|
| + // receiving frame data again until Resume is called.
|
| + Pause();
|
| +
|
| + // Resumes sending frames to the client.
|
| + Resume();
|
| +};
|
|
|