summaryrefslogtreecommitdiffstats
path: root/dom/media/ipc/PMFCDM.ipdl
blob: 793cfa3808c79ed48dfb5b0d015a337d060a836f (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

include "MFCDMSerializers.h";

include protocol PRemoteDecoderManager;

using mozilla::KeySystemConfig::Requirement from "mozilla/KeySystemConfig.h";
using mozilla::KeySystemConfig::SessionType from "mozilla/KeySystemConfig.h";
using mozilla::CryptoScheme from "MediaData.h";
using mozilla::dom::MediaKeyMessageType from "mozilla/dom/MediaKeyMessageEventBinding.h";
using mozilla::dom::MediaKeyStatus from "mozilla/dom/MediaKeyStatusMapBinding.h";
using mozilla::dom::HDCPVersion from "mozilla/dom/MediaKeysBinding.h";
using mozilla::KeySystemConfigRequest from "mozilla/KeySystemConfig.h";

namespace mozilla {

// For EME spec 'message' event
// https://w3c.github.io/encrypted-media/#queue-message
struct MFCDMKeyMessage {
  nsString sessionId;
  MediaKeyMessageType type;
  uint8_t[] message;
};

// For EME spec 'keystatuseschange' event
// https://w3c.github.io/encrypted-media/#dom-evt-keystatuseschange
struct MFCDMKeyInformation {
  uint8_t[] keyId;
  MediaKeyStatus status;
};

struct MFCDMKeyStatusChange {
  nsString sessionId;
  MFCDMKeyInformation[] keyInfo;
};

// For EME spec Update Expiration algorithm
// https://w3c.github.io/encrypted-media/#update-expiration
struct MFCDMKeyExpiration {
  nsString sessionId;
  double expiredTimeMilliSecondsSinceEpoch;
};

// For GetCapabilities()
struct MFCDMMediaCapability {
  nsString contentType;
  nsString robustness;
};

struct MFCDMCapabilitiesIPDL {
  nsString keySystem;
  nsString[] initDataTypes;
  MFCDMMediaCapability[] audioCapabilities;
  MFCDMMediaCapability[] videoCapabilities;
  SessionType[] sessionTypes;
  CryptoScheme[] encryptionSchemes;
  Requirement distinctiveID;
  Requirement persistentState;
  bool? isHDCP22Compatible;
  bool isHardwareDecryption;
};

union MFCDMCapabilitiesResult {
  nsresult;
  MFCDMCapabilitiesIPDL;
};

// For Init()
struct MFCDMInitParamsIPDL {
  nsString origin;
  nsString[] initDataTypes;
  Requirement distinctiveID;
  Requirement persistentState;
  MFCDMMediaCapability[] audioCapabilities;
  MFCDMMediaCapability[] videoCapabilities;
};

struct MFCDMInitIPDL {
  uint64_t id;
};

union MFCDMInitResult {
  nsresult;
  MFCDMInitIPDL;
};

struct MFCDMCreateSessionParamsIPDL {
  SessionType sessionType;
  nsString initDataType;
  uint8_t[] initData;
};

union MFCDMSessionResult {
  nsString;
  nsresult;
};

struct MFCDMCapabilitiesRequest {
  nsString keySystem;
  bool isHardwareDecryption;
};

[ManualDealloc]
async protocol PMFCDM
{
  manager PRemoteDecoderManager;
parent:
  async GetCapabilities(MFCDMCapabilitiesRequest request) returns (MFCDMCapabilitiesResult result);
  async Init(MFCDMInitParamsIPDL params) returns (MFCDMInitResult result);
  async CreateSessionAndGenerateRequest(MFCDMCreateSessionParamsIPDL type)
      returns (MFCDMSessionResult result);
  async LoadSession(SessionType sessionType, nsString sessionId) returns (nsresult result);
  async UpdateSession(nsString sessionId, uint8_t[] response) returns (nsresult result);
  async CloseSession(nsString sessionId) returns (nsresult result);
  async RemoveSession(nsString sessionId) returns (nsresult result);
  async SetServerCertificate(uint8_t[] certificate) returns (nsresult result);
  async GetStatusForPolicy(HDCPVersion minHdcpVersion) returns (nsresult result);
  async __delete__();

child:
  async OnSessionKeyMessage(MFCDMKeyMessage message);
  async OnSessionKeyStatusesChanged(MFCDMKeyStatusChange keystatuses);
  async OnSessionKeyExpiration(MFCDMKeyExpiration expiration);
};

} // namespace mozilla