1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 import "gpu/ipc/common/mailbox_holder.mojom";
8 import "media/capture/mojom/video_capture_types.mojom";
9 import "media/mojo/mojom/media_types.mojom";
10 import "mojo/public/mojom/base/shared_memory.mojom";
11 import "mojo/public/mojom/base/time.mojom";
12 import "ui/gfx/geometry/mojom/geometry.mojom";
13 import "ui/gfx/mojom/buffer_types.mojom";
14 import "ui/gfx/mojom/color_space.mojom";
16 struct VideoFrameInfo {
17 mojo_base.mojom.TimeDelta timestamp;
18 VideoFrameMetadata metadata;
19 VideoCapturePixelFormat pixel_format;
20 gfx.mojom.Size coded_size;
21 gfx.mojom.Rect visible_rect;
22 // Some buffer types may be preemtively mapped in the capturer.
23 // In that case a shared memory region is passed to the consumer together
24 // with a GMB handle, and this flag here is passed to notify the consumer
25 // that the region has valid data.
27 // Describes the color space in use for this video frame.
28 gfx.mojom.ColorSpace color_space;
29 // Optionally, stride information can be provided.
30 // If not provided, it is assumed that frame data is tightly packed.
31 PlaneStrides? strides;
34 // Represents a buffer that is ready for consumption. |buffer_id| has video
35 // capture data and |info| contains the associated VideoFrame constituent parts.
41 struct MailboxBufferHandleSet {
42 // Size must be kept in sync with media::VideoFrame::kMaxPlanes.
43 array<gpu.mojom.MailboxHolder, 4> mailbox_holder;
46 union VideoBufferHandle {
47 // TODO(https://crbug.com/1316808): It is extremely confusing that this union
48 // has both an unsafe and a read-only shmem region subtype. This is probably
49 // a sign that this union needs better documentation or to be split apart
50 // into more distinct types.
51 mojo_base.mojom.UnsafeSharedMemoryRegion unsafe_shmem_region;
52 mojo_base.mojom.ReadOnlySharedMemoryRegion read_only_shmem_region;
53 MailboxBufferHandleSet mailbox_handles;
54 gfx.mojom.GpuMemoryBufferHandle gpu_memory_buffer_handle;