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

Side by Side Diff: media/mojo/interfaces/decryptor.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/demuxer_stream.mojom";
8 import "media/mojo/interfaces/media_types.mojom";
9
10 // TODO(xhwang): Add mojo types for AudioBuffer and VideoFrame.
11 struct AudioBuffer {};
12 struct VideoFrame {};
13
14 // Interface for decrypting (and decoding) encrypted streams.
15 // See media/base/decryptor.h for details.
16 [Client=DecryptorClient]
17 interface Decryptor {
18 // Status of a decrypt or decrypt-and-decode operation. The returned
19 // buffer/frame of such an operation is NOT null iff the status is SUCCESS.
20 enum Status {
21 SUCCESS, // Successfully completed. Decrypted buffer ready.
22 NO_KEY, // No key is available to decrypt.
23 NEED_MORE_DATA, // Decoder needs more data to produce an output.
24 ERROR // Key is available but an error occurred during decryption.
25 };
26
27 // Decrypts the |encrypted| buffer and returns the decrypt |status| and
28 // decrypted |buffer|.
29 // At most one decrypt call is allowed at any time for a |stream_type|.
30 Decrypt(DemuxerStream.Type stream_type, MediaDecoderBuffer encrypted)
31 => (Status status, MediaDecoderBuffer? buffer);
32
33 // Cancels any pending decrypt for |stream_type| with SUCCESS.
34 CancelDecrypt(DemuxerStream.Type stream_type);
35
36 // Initializes a decoder with the given |config|. Returns whether the
37 // initialization succeeded.
38 InitializeAudioDecoder(AudioDecoderConfig config) => (bool success);
39 InitializeVideoDecoder(VideoDecoderConfig config) => (bool success);
40
41 // Decrypts and decodes the |encrypted| buffer and returns the |status| and
42 // the decrypted |audio_buffers| or |video_frame|.
43 // At end-of-stream, this method should be called repeatedly with
44 // end-of-stream |encrypted| until no buffer/frame can be produced.
45 // These methods can only be called after the corresponding decoder has
46 // been successfully initialized.
47 // At most one decrypt-and-decode call is allowed at any time for a
48 // |stream_type|.
49 DecryptAndDecodeAudio(MediaDecoderBuffer encrypted)
50 => (Status status, array<AudioBuffer>? audio_buffers);
51 DecryptAndDecodeVideo(
52 MediaDecoderBuffer encrypted) => (Status status, VideoFrame? video_frame);
53
54 // Resets the decoder for |stream_type| to a clean initialized state and
55 // cancels any pending decrypt-and-decode operations immediately with ERROR.
56 // This method can only be called after the corresponding decoder has been
57 // successfully initialized.
58 ResetDecoder(DemuxerStream.Type stream_type);
59
60 // Releases decoder resources, deinitializes the decoder, aborts any pending
61 // initialization (with false) or decrypt-and-decode (with ERROR) for
62 // |stream_type| immediately.
63 // This method can be called any time after Initialize{Audio|Video}Decoder()
64 // has been called (with the correct stream type).
65 // After this operation, the decoder is set to an uninitialized state.
66 // The decoder can be reinitialized after it is deinitialized.
67 DeinitializeDecoder(DemuxerStream.Type stream_type);
68 };
69
70 interface DecryptorClient {
71 // Indicates that a new usable key is available in the CDM associated with the
72 // Decryptor.
73 OnNewUsableKey();
74 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698