chromium/media/mojo/mojom/fuchsia_media.mojom

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

module media.mojom;

import "media/mojo/mojom/media_types.mojom";
import "media/mojo/mojom/video_decoder.mojom";

// Mojo struct for
// `fidl::InterfaceRequest<fuchsia::media::drm::ContentDecryptionModule>`.
struct CdmRequest {
  handle<platform> request;
};

// Mojo struct for `fidl::InterfaceRequest<fuchsia::media::StreamProcessor>`.
struct StreamProcessorRequest {
  handle<platform> request;
};

enum VideoDecoderSecureMemoryMode {
  // Input and output buffers are not protected.
  CLEAR,

  // Input and output buffers must be allocated in protected memory.
  SECURE,

  // Input buffers are not protected. Output buffers are protected.
  SECURE_OUTPUT,
};

// Interface used by the renderer to connect to CDM and mediacodec resources.
// Instances are document-scoped.
interface FuchsiaMediaCdmProvider {
  // Create connection to fuchsia::media::drm::ContentDecryptionModule for
  // `key_system`. Implementation should make sure the persistent storage is
  // isolated per web origin.
  CreateCdm(string key_system, CdmRequest cdm_request);
};

// Interface implemented in the browser process and bound once per set of
// GpuVideoAcceleratorFactories in the renderer to get hardware codec resources.
interface FuchsiaMediaCodecProvider {
  // Create connection to fuchsia::media::StreamProcessor for the specified
  // `codec`.
  CreateVideoDecoder(VideoCodec codec, VideoDecoderSecureMemoryMode secure_mode,
                     StreamProcessorRequest stream_processor_request);

  // Returns video decoder configs that are supported by the driver-based local
  // codec factory.
  GetSupportedVideoDecoderConfigs() =>
     (array<SupportedVideoDecoderConfig> supported_configs);
};