chromium/media/mojo/mojom/key_system_support.mojom

// Copyright 2017 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/content_decryption_module.mojom";
import "media/mojo/mojom/media_types.mojom";

struct VideoCodecInfo {
  // Array of VideoCodecProfiles supported. If no profiles for a
  // particular codec are specified, then it is assumed that all
  // profiles are supported by the CDM.
  array<VideoCodecProfile> supported_profiles;

  // A boolean that contains info about whether the video codec
  // supports clear lead. This defaults to true except for specific
  // cases involving Windows codecs.
  bool supports_clear_lead = true;
};

// TODO(xhwang): Use "set" instead of "array" if supported by mojom.
struct CdmCapability {
  // List of audio codecs supported by the CDM (e.g. opus). This does not
  // include codec profiles, as in general Chromium doesn't handle audio
  // codec profiles separately. The list of supported codecs should be unique.
  array<AudioCodec> audio_codecs;

  // Map of video codecs and a struct containing the associated profiles
  // supported by the CDM (e.g. vp8) and whether clear lead is supported.
  map<VideoCodec, VideoCodecInfo> video_codecs;

  array<EncryptionScheme> encryption_schemes;
  array<CdmSessionType> session_types;
};

struct KeySystemCapability {
  CdmCapability? sw_secure_capability;
  CdmCapability? hw_secure_capability;
};

// Process-wide observer used by the renderer to observe key system support
// changes. `key_systems` is a map from the key system string to the
// KeySystemCapability for that key system.
interface KeySystemSupportObserver {
  // Called when there's a key system support update.
  OnKeySystemSupportUpdated(map<string, KeySystemCapability> key_systems);
};

// Browser process singleton that a renderer process can use to subscribe to
// key system updates.
interface KeySystemSupport {
  // Adds an observer to observe key system support updates. KeySystemSupport
  // implementation is in the browser process, as it maintains the list of
  // registered CDMs, and hardware secure support check also needs to run in the
  // browser process because the render process is sandboxed. KeySystemSupport
  // clients run in the renderer process.
  AddObserver(pending_remote<KeySystemSupportObserver> observer);
};