| 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 module video_capture.mojom; |
| 6 |
| 7 import "media/mojo/interfaces/media_types.mojom"; |
| 8 import "ui/mojo/geometry/geometry.mojom"; |
| 9 |
| 10 // Information provided to a subscription client about a newly created frame |
| 11 // buffer. |
| 12 struct FrameBufferInfo { |
| 13 // A unique (per-stream) identifier for this buffer. |
| 14 int32 id; |
| 15 |
| 16 // Shared memory handle to allocated storage for the frame. This handle may |
| 17 // be mapped by the client for read-only access. |
| 18 handle<shared_buffer> storage; |
| 19 |
| 20 // Size in bytes of the allocated storage. |
| 21 int32 size; |
| 22 }; |
| 23 |
| 24 // Information provided to a VideoStreamClient about an available video frame. |
| 25 struct FrameInfo { |
| 26 // The frame buffer in which this frame's pixel data can be found. |
| 27 int32 buffer_id; |
| 28 |
| 29 // Pixel format of the frame data in storage. |
| 30 media.interfaces.VideoFormat pixel_format; |
| 31 |
| 32 // Size of the frame in pixels. This includes pixel data for the whole image; |
| 33 // i.e. for YUV formats with subsampled chroma planes where the visible |
| 34 // portion does not line up on a sample boundary, |coded_size| will be rounded |
| 35 // up appropriately and pixel data will be provided for the odd pixels. |
| 36 mojo.Size coded_size; |
| 37 |
| 38 // Visible rectangle of pixels in the frame. This must be a subrect of |
| 39 // |coded_rect|. May be odd with respect to the sample boundaries, e.g. for |
| 40 // formats with subsampled chroma. This is used e.g. for letterboxing. |
| 41 mojo.Rect visible_rect; |
| 42 |
| 43 // A coded version of base::TimeTicks::Now() at the time the frame data was |
| 44 // generated by its source. For the sake of consistency this must always be |
| 45 // interpreted using base::TimeTicks::FromInternalValue or some equivalent. |
| 46 int64 timestamp; |
| 47 }; |
| 48 |
| 49 // The client interface for a VideoStream. |
| 50 interface StreamClient { |
| 51 // Informs the client of a new frame buffer which may be used to provide |
| 52 // frame data. The client should keep track of this buffer until |
| 53 // BufferDestroyed is called with |info.id|. |
| 54 BufferCreated(FrameBufferInfo info); |
| 55 |
| 56 // Informs the client that buffer |buffer_id| will no longer be used to |
| 57 // provide frame data. The client should release any resources it has tied |
| 58 // to this buffer. |
| 59 BufferDestroyed(int32 buffer_id); |
| 60 |
| 61 // Informs the client that new frame data is available. |info| provides |
| 62 // details about this individual frame. The client should respond as soon as |
| 63 // it's finished reading the frame data. |
| 64 FrameAvailable(FrameInfo info) => (); |
| 65 }; |
| 66 |
| 67 // The Stream interface abstracts a distinct source of video frame data such |
| 68 // as a camera device, desktop capture, web view capture, or a remote stream. |
| 69 interface Stream { |
| 70 // Starts sending frames to |client|. Must only be called once and must be the |
| 71 // first call on the VideoStream. |
| 72 Start(StreamClient client); |
| 73 |
| 74 // Temporarily stops sending frames to the client. The client will not begin |
| 75 // receiving frame data again until Resume is called. |
| 76 Pause(); |
| 77 |
| 78 // Resumes sending frames to the client. |
| 79 Resume(); |
| 80 }; |
| OLD | NEW |