Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 module mojo; | |
| 6 | |
| 7 import "media/mojo/interfaces/decryptor.mojom"; | |
| 8 | |
| 9 // Transport layer of media::MediaKeys::Exception (see media/base/media_keys.h). | |
| 10 // 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.
| |
| 11 // errors. | |
| 12 enum CdmException { | |
| 13 NOT_SUPPORTED_ERROR, | |
| 14 INVALID_STATE_ERROR, | |
| 15 INVALID_ACCESS_ERROR, | |
| 16 QUOTA_EXCEEDED_ERROR, | |
| 17 UNKNOWN_ERROR, | |
| 18 CLIENT_ERROR, | |
| 19 OUTPUT_ERROR | |
| 20 }; | |
| 21 | |
| 22 // Transport layer of media::CdmContext (see media/base/cdm_context.h), which | |
| 23 // represents the context that a media pipeline needs from a CDM to decrypt | |
| 24 // (and decode) encrypted buffers. | |
| 25 // 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.
| |
| 26 // decryptor: | |
| 27 // - 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
| |
| 28 // (e.g. media pipeline) will use the |decryptor| directly | |
| 29 // to decrypt (and decode) encrypted buffers. | |
| 30 // - Implicit decryptor: null |decryptor| and valid |cdm_id|. The client (e.g. | |
| 31 // media pipeline) will use the |cdm_id| to locate a | |
| 32 // decryptor and associate it with the client. | |
| 33 const int32 kInvalidCdmId = 0; | |
| 34 struct CdmContext { | |
| 35 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
| |
| 36 int32 cdm_id; | |
| 37 }; | |
| 38 | |
| 39 // Transport layer of media::CdmPromise (see media/base/cdm_promise.h). | |
| 40 // - 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.
| |
| 41 // be ignored. | |
| 42 // - When |success| is false, the promise is rejected with |exception_code|, | |
| 43 // |system_code| and |error_message|. | |
| 44 struct CdmPromiseResult { | |
| 45 bool success; | |
| 46 CdmException exception_code; | |
|
ddorwin
2014/12/08 23:46:48
_code is unnecessary?
xhwang
2014/12/10 04:59:15
Done.
| |
| 47 uint32 system_code; | |
| 48 string error_message; | |
| 49 }; | |
| 50 | |
| 51 // An interface that represents a CDM in the Encrypted Media Extensions (EME) | |
| 52 // spec (https://w3c.github.io/encrypted-media/). See media/base/media_keys.h. | |
| 53 [Client=ContentDecryptionModuleClient] | |
| 54 interface ContentDecryptionModule { | |
| 55 // See media::MediaKeys::SessionType. | |
| 56 enum SessionType { | |
| 57 TEMPORARY_SESSION, | |
| 58 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
| |
| 59 }; | |
| 60 | |
| 61 // Provides a server certificate to be used to encrypt messages to the | |
| 62 // license server. | |
| 63 SetServerCertificate(array<uint8> certificate_data) | |
| 64 => (CdmPromiseResult result); | |
| 65 | |
| 66 // 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.
| |
| 67 // provided. If |result.success| is false, the output |session_id| will be | |
| 68 // null. | |
| 69 CreateSession(string init_data_type, | |
| 70 array<uint8> init_data, | |
| 71 SessionType session_type) | |
| 72 => (CdmPromiseResult result, string? session_id); | |
| 73 | |
| 74 // Loads a session with the |session_id| provided. If |result.success| is | |
| 75 // 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.
| |
| 76 LoadSession(string session_id) | |
| 77 => (CdmPromiseResult result, string? session_id); | |
| 78 | |
| 79 // Updates a session specified by |session_id| with |response|. | |
| 80 UpdateSession(string session_id, array<uint8> response) | |
| 81 => (CdmPromiseResult result); | |
| 82 | |
| 83 // Closes the session specified by |session_id|. | |
| 84 CloseSession(string session_id) => (CdmPromiseResult result); | |
| 85 | |
| 86 // 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.
| |
| 87 // |session_id|. | |
| 88 RemoveSession(string session_id) => (CdmPromiseResult result); | |
| 89 | |
| 90 // Retrieves the key IDs for keys in the session that the CDM knows are | |
| 91 // currently usable to decrypt media data. If |result.success| is | |
| 92 // false, the |usable_key_ids| will be null. | |
| 93 GetUsableKeyIds(string session_id) | |
| 94 => (CdmPromiseResult result, array<array<uint8>>? usable_key_ids); | |
| 95 | |
| 96 // Retrieves the CdmContext associated with this CDM instance. | |
| 97 GetCdmContext(CdmContext& cdm_context); | |
| 98 }; | |
| 99 | |
| 100 // Session callbacks. See media/base/media_keys.h for details. | |
| 101 interface ContentDecryptionModuleClient { | |
| 102 OnSessionMessage(string session_id, array<uint8> message, | |
| 103 string destination_url); | |
| 104 | |
| 105 OnSessionReady(string session_id); | |
| 106 | |
| 107 OnSessionClosed(string session_id); | |
| 108 | |
| 109 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.
| |
| 110 uint32 system_code, string error_message); | |
| 111 | |
| 112 OnSessionKeysChange(string session_id, bool has_additional_usable_key); | |
| 113 | |
| 114 OnSessionExpirationUpdate(string session_id, int64 new_expiry_time_usec); | |
| 115 }; | |
| OLD | NEW |