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

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: comments addressed 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,
ddorwin 2014/12/17 19:17:51 Do all the enums need to be fixed values since thi
xhwang 2014/12/18 17:04:59 Added static assert for this so that these values
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::CdmPromise (see media/base/cdm_promise.h).
23 // - When |success| is true, the promise is resolved and all other fields should
24 // be ignored.
25 // - When |success| is false, the promise is rejected with |exception|,
26 // |system_code| and |error_message|.
27 struct CdmPromiseResult {
28 bool success;
29 CdmException exception;
30 uint32 system_code;
31 string error_message;
32 };
33
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.
36 [Client=ContentDecryptionModuleClient]
37 interface ContentDecryptionModule {
38 // See media::MediaKeys::SessionType.
39 enum SessionType {
40 TEMPORARY_SESSION,
41 PERSISTENT_SESSION
42 };
43
44 // Provides a server certificate to be used to encrypt messages to the
45 // license server.
46 SetServerCertificate(array<uint8> certificate_data)
47 => (CdmPromiseResult result);
48
49 // Creates a session with the |init_data_type|, |init_data| and |session_type|
50 // provided. If |result.success| is false, the output |session_id| will be
51 // null.
52 CreateSession(string init_data_type,
53 array<uint8> init_data,
54 SessionType session_type)
55 => (CdmPromiseResult result, string? session_id);
56
57 // Loads the session associated with |session_id|. Combinations of
58 // |result.success| and |session_id| means:
59 // (true, non-null) : Session successfully loaded.
60 // (true, null) : Session not found.
61 // (false, non-null): N/A; this combination is not allowed.
62 // (false, null) : Unexpected error. See other fields in |result|.
63 LoadSession(string session_id)
64 => (CdmPromiseResult result, string? session_id);
65
66 // Updates a session specified by |session_id| with |response|.
67 UpdateSession(string session_id, array<uint8> response)
68 => (CdmPromiseResult result);
69
70 // Closes the session specified by |session_id|.
71 CloseSession(string session_id) => (CdmPromiseResult result);
72
73 // Removes stored session data associated with the active session specified by
74 // |session_id|.
75 RemoveSession(string session_id) => (CdmPromiseResult result);
76
77 // Retrieves the key IDs for keys in the session that the CDM knows are
78 // currently usable to decrypt media data. If |result.success| is
79 // false, the |usable_key_ids| will be null.
80 GetUsableKeyIds(string session_id)
81 => (CdmPromiseResult result, array<array<uint8>>? usable_key_ids);
82
83 // Assigns the |cdm_id| to the CDM, and retrieves the |decryptor| associated
84 // with this CDM instance.
85 // A CDM implementation must choose to support either an explicit or implicit
86 // decryptor:
87 // - Explicit (non-null) decryptor: The client (e.g. media pipeline) will use
88 // the |decryptor| directly to decrypt (and decode) encrypted buffers.
89 // - Implicit (null) decryptor: The client (e.g. media pipeline) will use the
90 // |cdm_id| to locate a decryptor and associate it with the client.
91 // Note: In Chromium GetCdmContext() is a sync call. But we don't have an easy
92 // way to support sync calls on a mojo interface. Instead the client should
93 // generate a client side ID and pass it to the service.
94 GetCdmContext(int32 cdm_id, Decryptor&? decryptor);
ddorwin 2014/12/13 02:34:02 Are these parameters mutually exclusive? Does the
xhwang 2014/12/15 21:18:03 I agree this interface is not ideal, but so far I
95 };
96
97 // Session callbacks. See media/base/media_keys.h for details.
98 interface ContentDecryptionModuleClient {
99 OnSessionMessage(string session_id, array<uint8> message,
100 string destination_url);
101
102 OnSessionReady(string session_id);
103
104 OnSessionClosed(string session_id);
105
106 OnSessionError(string session_id, CdmException exception,
107 uint32 system_code, string error_message);
108
109 OnSessionKeysChange(string session_id, bool has_additional_usable_key);
110
111 OnSessionExpirationUpdate(string session_id, int64 new_expiry_time_usec);
112 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698