Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 module media.mojom; | 5 module media.mojom; |
| 6 | 6 |
| 7 import "media/mojo/interfaces/decryptor.mojom"; | 7 import "media/mojo/interfaces/decryptor.mojom"; |
| 8 import "url/mojo/url.mojom"; | 8 import "url/mojo/url.mojom"; |
| 9 | 9 |
| 10 // Transport layer of media::MediaKeys::Exception (see media/base/media_keys.h). | 10 // See media::EmeInitDataType. |
| 11 // This is used for ContentDecryptionModule (CDM) promise rejections. | 11 [Native] |
| 12 enum CdmException { | 12 enum EmeInitDataType; |
|
jrummell
2016/10/17 23:47:24
I'm curious why this is outside interface ContentD
xhwang
2016/10/17 23:51:14
Because the C++ media::EmeInitDataType is declared
| |
| 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 | 13 |
| 22 // Transport layer of media::CdmKeyInformation::KeyStatus (see | 14 // Transport layer of media::CdmKeyInformation::KeyStatus (see |
| 23 // media/base/cdm_key_information.h). This is used for indicating the status | 15 // media/base/cdm_key_information.h). This is used for indicating the status |
| 24 // of a specific key ID. | 16 // of a specific key ID. |
|
jrummell
2016/10/17 23:47:24
I think this comment should be deleted.
xhwang
2016/10/17 23:51:14
oops, thanks for catching that
done
| |
| 25 enum CdmKeyStatus { | |
| 26 USABLE, | |
| 27 INTERNAL_ERROR, | |
| 28 EXPIRED, | |
| 29 OUTPUT_RESTRICTED, | |
| 30 OUTPUT_DOWNSCALED, | |
| 31 KEY_STATUS_PENDING, | |
| 32 RELEASED | |
| 33 }; | |
| 34 | 17 |
| 35 // Transport layer of media::CdmConfig (see media/base/cdm_config.h). | 18 // Transport layer of media::CdmConfig (see media/base/cdm_config.h). |
| 36 struct CdmConfig { | 19 struct CdmConfig { |
| 37 bool allow_distinctive_identifier; | 20 bool allow_distinctive_identifier; |
| 38 bool allow_persistent_state; | 21 bool allow_persistent_state; |
| 39 bool use_hw_secure_codecs; | 22 bool use_hw_secure_codecs; |
| 40 }; | 23 }; |
| 41 | 24 |
| 42 // Transport layer of media::CdmPromise (see media/base/cdm_promise.h). | 25 // Transport layer of media::CdmPromise (see media/base/cdm_promise.h). |
| 43 // - When |success| is true, the promise is resolved and all other fields should | 26 // - When |success| is true, the promise is resolved and all other fields should |
| 44 // be ignored. | 27 // be ignored. |
| 45 // - When |success| is false, the promise is rejected with |exception|, | 28 // - When |success| is false, the promise is rejected with |exception|, |
| 46 // |system_code| and |error_message|. | 29 // |system_code| and |error_message|. |
| 47 struct CdmPromiseResult { | 30 struct CdmPromiseResult { |
| 31 // See media::MediaKeys::Exception | |
| 32 [Native] | |
| 33 enum Exception; | |
| 34 | |
| 48 bool success; | 35 bool success; |
| 49 CdmException exception; | 36 Exception exception; |
| 50 uint32 system_code; | 37 uint32 system_code; |
| 51 string error_message; | 38 string error_message; |
| 52 }; | 39 }; |
| 53 | 40 |
| 54 // Transport layer of media::CdmKeyInformation (see | 41 // Transport layer of media::CdmKeyInformation (see |
| 55 // media/base/cdm_key_information.h). It is used to specify a key_id and it's | 42 // media/base/cdm_key_information.h). It is used to specify a key_id and it's |
| 56 // associated status. | 43 // associated status. |
| 57 struct CdmKeyInformation { | 44 struct CdmKeyInformation { |
| 45 [Native] | |
| 46 enum KeyStatus; | |
| 47 | |
| 58 array<uint8> key_id; | 48 array<uint8> key_id; |
| 59 CdmKeyStatus status; | 49 KeyStatus status; |
| 60 uint32 system_code; | 50 uint32 system_code; |
| 61 }; | 51 }; |
| 62 | 52 |
| 63 // See media::MediaKeys::MessageType | |
| 64 enum CdmMessageType { | |
| 65 LICENSE_REQUEST, | |
| 66 LICENSE_RENEWAL, | |
| 67 LICENSE_RELEASE | |
| 68 }; | |
| 69 | |
| 70 // An interface that represents a CDM in the Encrypted Media Extensions (EME) | 53 // An interface that represents a CDM in the Encrypted Media Extensions (EME) |
| 71 // spec (https://w3c.github.io/encrypted-media/). See media/base/media_keys.h. | 54 // spec (https://w3c.github.io/encrypted-media/). See media/base/media_keys.h. |
| 72 interface ContentDecryptionModule { | 55 interface ContentDecryptionModule { |
| 73 // See media::MediaKeys::SessionType. | 56 // See media::MediaKeys::SessionType |
| 74 enum SessionType { | 57 [Native] |
| 75 TEMPORARY_SESSION, | 58 enum SessionType; |
| 76 PERSISTENT_LICENSE_SESSION, | |
| 77 PERSISTENT_RELEASE_MESSAGE_SESSION | |
| 78 }; | |
| 79 | |
| 80 // See media::EmeInitDataType. | |
| 81 enum InitDataType { | |
| 82 UNKNOWN, | |
| 83 WEBM, | |
| 84 CENC, | |
| 85 KEYIDS | |
| 86 }; | |
| 87 | 59 |
| 88 // Sets ContentDecryptionModuleClient. Must be called before any other calls. | 60 // Sets ContentDecryptionModuleClient. Must be called before any other calls. |
| 89 SetClient(ContentDecryptionModuleClient client); | 61 SetClient(ContentDecryptionModuleClient client); |
| 90 | 62 |
| 91 // Initializes the CDM. If initialization failed (e.g. |key_system| or | 63 // Initializes the CDM. If initialization failed (e.g. |key_system| or |
| 92 // |cdm_config| is not supported), |result.success| will be false and |cdm_id| | 64 // |cdm_config| is not supported), |result.success| will be false and |cdm_id| |
| 93 // will be zero. Upon success, |cdm_id| will be non-zero and will later be | 65 // will be zero. Upon success, |cdm_id| will be non-zero and will later be |
| 94 // used to locate the CDM at the remote side. |decryptor| is the remote | 66 // used to locate the CDM at the remote side. |decryptor| is the remote |
| 95 // Decryptor. | 67 // Decryptor. |
| 96 Initialize(string key_system, string security_origin, CdmConfig cdm_config) | 68 Initialize(string key_system, string security_origin, CdmConfig cdm_config) |
| 97 => (CdmPromiseResult result, int32 cdm_id, Decryptor? decryptor); | 69 => (CdmPromiseResult result, int32 cdm_id, Decryptor? decryptor); |
| 98 | 70 |
| 99 // Provides a server certificate to be used to encrypt messages to the | 71 // Provides a server certificate to be used to encrypt messages to the |
| 100 // license server. | 72 // license server. |
| 101 SetServerCertificate(array<uint8> certificate_data) | 73 SetServerCertificate(array<uint8> certificate_data) |
| 102 => (CdmPromiseResult result); | 74 => (CdmPromiseResult result); |
| 103 | 75 |
| 104 // Creates a session with the |init_data_type|, |init_data| and |session_type| | 76 // Creates a session with the |init_data_type|, |init_data| and |session_type| |
| 105 // provided. If |result.success| is false, the output |session_id| will be | 77 // provided. If |result.success| is false, the output |session_id| will be |
| 106 // empty. | 78 // empty. |
| 107 CreateSessionAndGenerateRequest(SessionType session_type, | 79 CreateSessionAndGenerateRequest(SessionType session_type, |
| 108 InitDataType init_data_type, | 80 EmeInitDataType init_data_type, |
| 109 array<uint8> init_data) | 81 array<uint8> init_data) |
| 110 => (CdmPromiseResult result, string session_id); | 82 => (CdmPromiseResult result, string session_id); |
| 111 | 83 |
| 112 // Loads the session associated with |session_id| and |session_type|. | 84 // Loads the session associated with |session_id| and |session_type|. |
| 113 // Combinations of |result.success| and |session_id| means: | 85 // Combinations of |result.success| and |session_id| means: |
| 114 // (true, non-empty) : Session successfully loaded. | 86 // (true, non-empty) : Session successfully loaded. |
| 115 // (true, empty) : Session not found. | 87 // (true, empty) : Session not found. |
| 116 // (false, non-empty): N/A; this combination is not allowed. | 88 // (false, non-empty): N/A; this combination is not allowed. |
| 117 // (false, empty) : Unexpected error. See other fields in |result|. | 89 // (false, empty) : Unexpected error. See other fields in |result|. |
| 118 LoadSession(SessionType session_type, string session_id) | 90 LoadSession(SessionType session_type, string session_id) |
| 119 => (CdmPromiseResult result, string session_id); | 91 => (CdmPromiseResult result, string session_id); |
| 120 | 92 |
| 121 // Updates a session specified by |session_id| with |response|. | 93 // Updates a session specified by |session_id| with |response|. |
| 122 UpdateSession(string session_id, array<uint8> response) | 94 UpdateSession(string session_id, array<uint8> response) |
| 123 => (CdmPromiseResult result); | 95 => (CdmPromiseResult result); |
| 124 | 96 |
| 125 // Closes the session specified by |session_id|. | 97 // Closes the session specified by |session_id|. |
| 126 CloseSession(string session_id) => (CdmPromiseResult result); | 98 CloseSession(string session_id) => (CdmPromiseResult result); |
| 127 | 99 |
| 128 // Removes stored session data associated with the active session specified by | 100 // Removes stored session data associated with the active session specified by |
| 129 // |session_id|. | 101 // |session_id|. |
| 130 RemoveSession(string session_id) => (CdmPromiseResult result); | 102 RemoveSession(string session_id) => (CdmPromiseResult result); |
| 131 }; | 103 }; |
| 132 | 104 |
| 133 // Session callbacks. See media/base/media_keys.h for details. | 105 // Session callbacks. See media/base/media_keys.h for details. |
| 134 interface ContentDecryptionModuleClient { | 106 interface ContentDecryptionModuleClient { |
| 135 OnSessionMessage(string session_id, CdmMessageType message_type, | 107 // See media::MediaKeys::MessageType |
| 108 [Native] | |
| 109 enum MessageType; | |
| 110 | |
| 111 OnSessionMessage(string session_id, MessageType message_type, | |
| 136 array<uint8> message); | 112 array<uint8> message); |
| 137 | 113 |
| 138 OnSessionClosed(string session_id); | 114 OnSessionClosed(string session_id); |
| 139 | 115 |
| 140 OnSessionKeysChange(string session_id, bool has_additional_usable_key, | 116 OnSessionKeysChange(string session_id, bool has_additional_usable_key, |
| 141 array<CdmKeyInformation> keys_info); | 117 array<CdmKeyInformation> keys_info); |
| 142 | 118 |
| 143 // Provide session expiration update for |session_id|. | 119 // Provide session expiration update for |session_id|. |
| 144 // |new_expiry_time_sec| is the number of seconds since epoch (Jan 1, 1970). | 120 // |new_expiry_time_sec| is the number of seconds since epoch (Jan 1, 1970). |
| 145 OnSessionExpirationUpdate(string session_id, double new_expiry_time_sec); | 121 OnSessionExpirationUpdate(string session_id, double new_expiry_time_sec); |
| 146 }; | 122 }; |
| OLD | NEW |