naiveproxy/services/video_capture/public/interfaces/virtual_device.mojom
2018-02-02 05:49:39 -05:00

47 lines
2.1 KiB
Plaintext

// Copyright 2017 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/capture/mojo/video_capture_types.mojom";
import "media/mojo/interfaces/media_types.mojom";
import "services/video_capture/public/interfaces/producer.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
// Interface for a producer to feed video frames into a virtual
// device. These frames will appear to the consumer of the device
// as if they were produced by a real device.
//
// The buffers used for transporting video frames are managed by
// this interface, and are obtained from a finite size buffer pool.
// When the producer wants to push a frame, it will first request a buffer
// via |RequestFrameBuffer|, and a buffer ID will be provided in the
// response. In the process of assigning a buffer to the producer, a new
// buffer might be created and/or an old buffer might be retired.
//
// To avoid the remapping of buffers in producer after each buffer
// request, a separate interface |Producer| is used for notifying the
// producer with the buffer information changes. It is producer's
// responsibility for caching the buffer information.
interface VirtualDevice {
// This is used by the producer for requesting a buffer to store frame
// data. The frame can subsequently be pushed via |OnFrameReadyInBuffer|.
// An invalid buffer ID |Constants.kInvalidBufferId| will be returned
// if no buffer is available.
//
// Note: A new buffer might be created and/or an old buffer might be
// retired as a side-effect of the request. In that case,
// |Producer.OnNewBufferHandle| and/or |Producer.OnBufferRetired|
// will be invoked.
RequestFrameBuffer(gfx.mojom.Size dimension,
media.mojom.VideoPixelFormat pixel_format,
media.mojom.VideoPixelStorage pixel_storage)
=> (int32 buffer_id);
// Called to indicate that a video frame is ready in the given buffer
// |buffer_id|.
OnFrameReadyInBuffer(int32 buffer_id,
media.mojom.VideoFrameInfo frame_info);
};