chromium/ash/components/arc/mojom/video_frame_pool.mojom

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Next MinVersion: 2

module arc.mojom;

import "ash/components/arc/mojom/gfx.mojom";
import "ash/components/arc/mojom/video_common.mojom";

// Mojo structure representing a single video frame.
// Next ordinal: 6
struct VideoFrame {
  int32 id@0;
  handle<platform> handle_fd@1;
  Size coded_size@2;
  HalPixelFormat format@3;
  array<VideoFramePlane> planes@4;
  // These modifier flags are platform-specific and are assigned upon buffer
  // allocation. They are passed through unmodified to the hardware.
  uint64 modifier@5;
};

// Video frame pool service, managing a set of video frames for the remote mojo
// client. The client is responsible for creating and adding video frames to the
// pool, so they can be used by the associated video decoder.
// Next Method ID: 2
interface VideoFramePool {
  // Initialize the video frame pool, connecting it to the specified |client|.
  Initialize@0(pending_associated_remote<VideoFramePoolClient> client);

  // Add the specified |video_frame| to the pool.
  AddVideoFrame@1(VideoFrame video_frame) => (bool result);
};

// Video frame pool client, needs to provide video frames to the pool.
// Deprecated method IDs: 0
// Next method ID: 2
interface VideoFramePoolClient {
  // Request a set of video frames from the client with specified properties.
  // The pool client needs to add frames to the pool using AddVideoFrame().
  // The pool client should call the response callback before making any
  // AddVideoFrame() calls in order to acknowledge the receipt of the request.
  // After the pool receives the acknowledgement, it will assume that all
  // subsequent AddVideoFrame() calls correspond to the acknowledged
  // RequestVideoFrames() request. Any AddVideoFrame() calls received by the
  // pool prior to the receipt of an acknowledgment response are immediately
  // replied with |result| = true and without using the corresponding
  // |video_frame|.
  [MinVersion=1] RequestVideoFrames@1(VideoPixelFormat format, Size coded_size,
                       Rect visible_rect, uint32 num_frames) => ();
};