Chromium Code Reviews| Index: media/mojo/interfaces/content_decryption_module.mojom |
| diff --git a/media/mojo/interfaces/content_decryption_module.mojom b/media/mojo/interfaces/content_decryption_module.mojom |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2635f8d892725c60d0655c743db3af23c1bc0c77 |
| --- /dev/null |
| +++ b/media/mojo/interfaces/content_decryption_module.mojom |
| @@ -0,0 +1,115 @@ |
| +// Copyright 2014 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 mojo; |
| + |
| +import "media/mojo/interfaces/decryptor.mojom"; |
| + |
| +// Transport layer of media::MediaKeys::Exception (see media/base/media_keys.h). |
| +// This is used for ContentDecryptionModule (CDM) promise rejections or session |
|
ddorwin
2014/12/08 23:46:48
note: session errors only exist in prefixed.
xhwang
2014/12/10 04:59:15
Done.
|
| +// errors. |
| +enum CdmException { |
| + NOT_SUPPORTED_ERROR, |
| + INVALID_STATE_ERROR, |
| + INVALID_ACCESS_ERROR, |
| + QUOTA_EXCEEDED_ERROR, |
| + UNKNOWN_ERROR, |
| + CLIENT_ERROR, |
| + OUTPUT_ERROR |
| +}; |
| + |
| +// Transport layer of media::CdmContext (see media/base/cdm_context.h), which |
| +// represents the context that a media pipeline needs from a CDM to decrypt |
| +// (and decode) encrypted buffers. |
| +// A CDM implementation must choose to support either an explicit or an implicit |
|
ddorwin
2014/12/08 23:46:48
nit: drop second "an"
xhwang
2014/12/10 04:59:15
Done.
|
| +// decryptor: |
| +// - Explicit decryptor: non-null |decryptor| and invalid |cdm_id|. The client |
|
ddorwin
2014/12/08 23:46:48
I wonder if this interface should have getters tha
xhwang
2014/12/10 04:59:15
The current approach seems clean to me. I'll see h
|
| +// (e.g. media pipeline) will use the |decryptor| directly |
| +// to decrypt (and decode) encrypted buffers. |
| +// - Implicit decryptor: null |decryptor| and valid |cdm_id|. The client (e.g. |
| +// media pipeline) will use the |cdm_id| to locate a |
| +// decryptor and associate it with the client. |
| +const int32 kInvalidCdmId = 0; |
| +struct CdmContext { |
| + Decryptor? decryptor; |
|
ddorwin
2014/12/08 23:46:48
How do these things get initialized?
xhwang
2014/12/10 04:59:15
I think they will be initialized to null by defaul
|
| + int32 cdm_id; |
| +}; |
| + |
| +// Transport layer of media::CdmPromise (see media/base/cdm_promise.h). |
| +// - When |success| is true, the promise is resolved and all other fields should |
|
ddorwin
2014/12/08 23:46:48
This is weird. And what about the values we need f
xhwang
2014/12/10 04:59:15
Acknowledged.
|
| +// be ignored. |
| +// - When |success| is false, the promise is rejected with |exception_code|, |
| +// |system_code| and |error_message|. |
| +struct CdmPromiseResult { |
| + bool success; |
| + CdmException exception_code; |
|
ddorwin
2014/12/08 23:46:48
_code is unnecessary?
xhwang
2014/12/10 04:59:15
Done.
|
| + uint32 system_code; |
| + string error_message; |
| +}; |
| + |
| +// An interface that represents a CDM in the Encrypted Media Extensions (EME) |
| +// spec (https://w3c.github.io/encrypted-media/). See media/base/media_keys.h. |
| +[Client=ContentDecryptionModuleClient] |
| +interface ContentDecryptionModule { |
| + // See media::MediaKeys::SessionType. |
| + enum SessionType { |
| + TEMPORARY_SESSION, |
| + PERSISTENT_SESSION |
|
ddorwin
2014/12/08 23:46:48
See CDM_7 comments.
xhwang
2014/12/10 04:59:15
I 'll update this after MediaKeys interface is upd
|
| + }; |
| + |
| + // Provides a server certificate to be used to encrypt messages to the |
| + // license server. |
| + SetServerCertificate(array<uint8> certificate_data) |
| + => (CdmPromiseResult result); |
| + |
| + // Creates a session with the |init_data_type|, |init_data| and |session_type| |
|
ddorwin
2014/12/08 23:46:48
nit: s/a/the/ here and below?
xhwang
2014/12/10 04:59:15
For LoadSession, "the" makes sense. For CreateSess
ddorwin
2014/12/12 19:25:12
Acknowledged.
|
| + // provided. If |result.success| is false, the output |session_id| will be |
| + // null. |
| + CreateSession(string init_data_type, |
| + array<uint8> init_data, |
| + SessionType session_type) |
| + => (CdmPromiseResult result, string? session_id); |
| + |
| + // Loads a session with the |session_id| provided. If |result.success| is |
| + // false, the output |session_id| will be null. |
|
ddorwin
2014/12/08 23:46:48
There's also the "not found" case, so I think it c
xhwang
2014/12/10 04:59:15
Done.
|
| + LoadSession(string session_id) |
| + => (CdmPromiseResult result, string? session_id); |
| + |
| + // Updates a session specified by |session_id| with |response|. |
| + UpdateSession(string session_id, array<uint8> response) |
| + => (CdmPromiseResult result); |
| + |
| + // Closes the session specified by |session_id|. |
| + CloseSession(string session_id) => (CdmPromiseResult result); |
| + |
| + // Removes stored session data associated with the session specified by |
|
ddorwin
2014/12/08 23:46:48
...the _active_... session... ?
It can't just be
xhwang
2014/12/10 04:59:15
Done.
|
| + // |session_id|. |
| + RemoveSession(string session_id) => (CdmPromiseResult result); |
| + |
| + // Retrieves the key IDs for keys in the session that the CDM knows are |
| + // currently usable to decrypt media data. If |result.success| is |
| + // false, the |usable_key_ids| will be null. |
| + GetUsableKeyIds(string session_id) |
| + => (CdmPromiseResult result, array<array<uint8>>? usable_key_ids); |
| + |
| + // Retrieves the CdmContext associated with this CDM instance. |
| + GetCdmContext(CdmContext& cdm_context); |
| +}; |
| + |
| +// Session callbacks. See media/base/media_keys.h for details. |
| +interface ContentDecryptionModuleClient { |
| + OnSessionMessage(string session_id, array<uint8> message, |
| + string destination_url); |
| + |
| + OnSessionReady(string session_id); |
| + |
| + OnSessionClosed(string session_id); |
| + |
| + OnSessionError(string session_id, CdmException exception_code, |
|
ddorwin
2014/12/08 23:46:48
ditto on _code
xhwang
2014/12/10 04:59:15
Done.
|
| + uint32 system_code, string error_message); |
| + |
| + OnSessionKeysChange(string session_id, bool has_additional_usable_key); |
| + |
| + OnSessionExpirationUpdate(string session_id, int64 new_expiry_time_usec); |
| +}; |