1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79

media / mojo / mojom / key_system_support.mojom [blame]

// 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;
};

// See media::CdmCapabilityQueryStatus
enum CdmCapabilityQueryStatus {
  kSuccess = 0,
  kUnknown = 1,
  kHardwareSecureCodecNotSupported = 2,
  kNoSupportedVideoCodec = 3,
  kNoSupportedEncryptionScheme = 4,
  kUnsupportedKeySystem = 5,
  kMediaFoundationCdmNotSupported = 6,
  kDisconnectionError = 7,
  kMediaFoundationGetCdmFactoryFailed = 8,
  kCreateDummyMediaFoundationCdmFailed = 9,
  kUnexpectedEmptyCapability = 10,
};

// TODO(crbug.com/40841428): Ideally, this should be replaced by a
// base::expected<T, E> where T is CdmCapability and E is a
// CdmCapabilityQueryStatus.
struct KeySystemCapability {
  CdmCapability? sw_secure_capability;
  CdmCapability? hw_secure_capability;
  CdmCapabilityQueryStatus? sw_secure_capability_query_status;
  CdmCapabilityQueryStatus? hw_secure_capability_query_status;
};

// 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);
};