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 mojo; | 5 module mojo; |
6 | 6 |
7 import "media/mojo/interfaces/decryptor.mojom"; | 7 import "media/mojo/interfaces/decryptor.mojom"; |
8 | 8 |
9 // Transport layer of media::MediaKeys::Exception (see media/base/media_keys.h). | 9 // Transport layer of media::MediaKeys::Exception (see media/base/media_keys.h). |
10 // This is used for ContentDecryptionModule (CDM) promise rejections. | 10 // This is used for ContentDecryptionModule (CDM) promise rejections. |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // Transport layer of media::CdmPromise (see media/base/cdm_promise.h). | 22 // Transport layer of media::CdmPromise (see media/base/cdm_promise.h). |
23 // - When |success| is true, the promise is resolved and all other fields should | 23 // - When |success| is true, the promise is resolved and all other fields should |
24 // be ignored. | 24 // be ignored. |
25 // - When |success| is false, the promise is rejected with |exception|, | 25 // - When |success| is false, the promise is rejected with |exception|, |
26 // |system_code| and |error_message|. | 26 // |system_code| and |error_message|. |
27 struct CdmPromiseResult { | 27 struct CdmPromiseResult { |
28 bool success; | 28 bool success; |
29 CdmException exception; | 29 CdmException exception; |
30 uint32 system_code; | 30 uint32 system_code; |
31 string error_message; | 31 string? error_message; |
32 }; | 32 }; |
33 | 33 |
34 // An interface that represents a CDM in the Encrypted Media Extensions (EME) | 34 // An interface that represents a CDM in the Encrypted Media Extensions (EME) |
35 // spec (https://w3c.github.io/encrypted-media/). See media/base/media_keys.h. | 35 // spec (https://w3c.github.io/encrypted-media/). See media/base/media_keys.h. |
36 [Client=ContentDecryptionModuleClient] | 36 [Client=ContentDecryptionModuleClient] |
37 interface ContentDecryptionModule { | 37 interface ContentDecryptionModule { |
38 // See media::MediaKeys::SessionType. | 38 // See media::MediaKeys::SessionType. |
39 enum SessionType { | 39 enum SessionType { |
40 TEMPORARY_SESSION, | 40 TEMPORARY_SESSION, |
41 PERSISTENT_SESSION | 41 PERSISTENT_SESSION |
(...skipping 25 matching lines...) Expand all Loading... |
67 UpdateSession(string session_id, array<uint8> response) | 67 UpdateSession(string session_id, array<uint8> response) |
68 => (CdmPromiseResult result); | 68 => (CdmPromiseResult result); |
69 | 69 |
70 // Closes the session specified by |session_id|. | 70 // Closes the session specified by |session_id|. |
71 CloseSession(string session_id) => (CdmPromiseResult result); | 71 CloseSession(string session_id) => (CdmPromiseResult result); |
72 | 72 |
73 // Removes stored session data associated with the active session specified by | 73 // Removes stored session data associated with the active session specified by |
74 // |session_id|. | 74 // |session_id|. |
75 RemoveSession(string session_id) => (CdmPromiseResult result); | 75 RemoveSession(string session_id) => (CdmPromiseResult result); |
76 | 76 |
77 // Assigns the |cdm_id| to the CDM, and retrieves the |decryptor| associated | 77 // Retrieves the |decryptor| associated with this CDM instance. |
78 // with this CDM instance. | 78 // If the returned |decryptor| is not null, it will be used by the client |
79 // A CDM implementation must choose to support either an explicit or implicit | 79 // (e.g. media pipeline) directly to decrypt (and decode) encrypted buffers. |
80 // decryptor: | 80 GetDecryptor(Decryptor&? decryptor); |
81 // - Explicit (non-null) decryptor: The client (e.g. media pipeline) will use | |
82 // the |decryptor| directly to decrypt (and decode) encrypted buffers. | |
83 // - Implicit (null) decryptor: The client (e.g. media pipeline) will use the | |
84 // |cdm_id| to locate a decryptor and associate it with the client. | |
85 // Note: In Chromium GetCdmContext() is a sync call. But we don't have an easy | |
86 // way to support sync calls on a mojo interface. Instead the client should | |
87 // generate a client side ID and pass it to the service. | |
88 GetCdmContext(int32 cdm_id, Decryptor&? decryptor); | |
89 }; | 81 }; |
90 | 82 |
91 // Session callbacks. See media/base/media_keys.h for details. | 83 // Session callbacks. See media/base/media_keys.h for details. |
92 interface ContentDecryptionModuleClient { | 84 interface ContentDecryptionModuleClient { |
93 OnSessionMessage(string session_id, array<uint8> message, | 85 OnSessionMessage(string session_id, array<uint8> message, |
94 string destination_url); | 86 string destination_url); |
95 | 87 |
96 OnSessionClosed(string session_id); | 88 OnSessionClosed(string session_id); |
97 | 89 |
98 OnSessionError(string session_id, CdmException exception, | 90 OnSessionError(string session_id, CdmException exception, |
99 uint32 system_code, string error_message); | 91 uint32 system_code, string error_message); |
100 | 92 |
101 OnSessionKeysChange(string session_id, bool has_additional_usable_key); | 93 OnSessionKeysChange(string session_id, bool has_additional_usable_key); |
102 | 94 |
103 OnSessionExpirationUpdate(string session_id, int64 new_expiry_time_usec); | 95 OnSessionExpirationUpdate(string session_id, int64 new_expiry_time_usec); |
104 }; | 96 }; |
OLD | NEW |