Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: media/mojo/interfaces/content_decryption_module.mojom

Issue 763883006: Add Mojo CDM Service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More updates. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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.
11 // Note: This can also be used for session errors in prefixed API.
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 implicit
26 // decryptor:
27 // - Explicit decryptor: non-null |decryptor| and invalid |cdm_id|. The client
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;
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
41 // be ignored.
42 // - When |success| is false, the promise is rejected with |exception|,
43 // |system_code| and |error_message|.
44 struct CdmPromiseResult {
45 bool success;
46 CdmException exception;
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
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|
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 the session associated with |session_id|. Combinations of
75 // |result.success| and |session_id| means:
76 // (true, non-null) : Session successfully loaded.
77 // (true, null) : Session not found.
78 // (false, non-null): N/A; this combination is not allowed.
79 // (false, null) : Unexpected error. See other fields in |result|.
80 LoadSession(string session_id)
81 => (CdmPromiseResult result, string? session_id);
82
83 // Updates a session specified by |session_id| with |response|.
84 UpdateSession(string session_id, array<uint8> response)
85 => (CdmPromiseResult result);
86
87 // Closes the session specified by |session_id|.
88 CloseSession(string session_id) => (CdmPromiseResult result);
89
90 // Removes stored session data associated with the active session specified by
91 // |session_id|.
92 RemoveSession(string session_id) => (CdmPromiseResult result);
93
94 // Retrieves the key IDs for keys in the session that the CDM knows are
95 // currently usable to decrypt media data. If |result.success| is
96 // false, the |usable_key_ids| will be null.
97 GetUsableKeyIds(string session_id)
98 => (CdmPromiseResult result, array<array<uint8>>? usable_key_ids);
99
100 // Retrieves the CdmContext associated with this CDM instance.
101 GetCdmContext(CdmContext& cdm_context);
jamesr 2014/12/11 18:32:37 hmm - the & syntax is for an InterfaceRequest but
xhwang 2014/12/12 23:15:44 Changed to pass a client side ID in. It's a bit ha
102 };
103
104 // Session callbacks. See media/base/media_keys.h for details.
105 interface ContentDecryptionModuleClient {
106 OnSessionMessage(string session_id, array<uint8> message,
107 string destination_url);
108
109 OnSessionReady(string session_id);
110
111 OnSessionClosed(string session_id);
112
113 OnSessionError(string session_id, CdmException exception,
114 uint32 system_code, string error_message);
115
116 OnSessionKeysChange(string session_id, bool has_additional_usable_key);
117
118 OnSessionExpirationUpdate(string session_id, int64 new_expiry_time_usec);
119 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698