| 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.interfaces; | 5 module media.interfaces; |
| 6 | 6 |
| 7 import "media/mojo/interfaces/demuxer_stream.mojom"; | 7 import "media/mojo/interfaces/demuxer_stream.mojom"; |
| 8 import "media/mojo/interfaces/media_types.mojom"; | 8 import "media/mojo/interfaces/media_types.mojom"; |
| 9 | 9 |
| 10 // Interface for decrypting (and decoding) encrypted streams. | 10 // Interface for decrypting (and decoding) encrypted streams. |
| 11 // See media/base/decryptor.h for details. | 11 // See media/base/decryptor.h for details. |
| 12 interface Decryptor { | 12 interface Decryptor { |
| 13 // Status of a decrypt or decrypt-and-decode operation. The returned | 13 // Status of a decrypt or decrypt-and-decode operation. The returned |
| 14 // buffer/frame of such an operation is NOT null iff the status is SUCCESS. | 14 // buffer/frame of such an operation is NOT null iff the status is SUCCESS. |
| 15 enum Status { | 15 enum Status { |
| 16 SUCCESS, // Successfully completed. Decrypted buffer ready. | 16 SUCCESS, // Successfully completed. Decrypted buffer ready. |
| 17 NO_KEY, // No key is available to decrypt. | 17 NO_KEY, // No key is available to decrypt. |
| 18 NEED_MORE_DATA, // Decoder needs more data to produce an output. | 18 NEED_MORE_DATA, // Decoder needs more data to produce an output. |
| 19 ERROR // Key is available but an error occurred during decryption. | 19 ERROR // Key is available but an error occurred during decryption. |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 // Pass the two data pipes used to transfer DecoderBuffer contents to and |
| 23 // from the Decryptor. |receive_pipe| will be used to receive DecoderBuffer |
| 24 // data on Decrypt(), DecryptAndDecodeAudio(), and DecryptAndDecodeVideo() |
| 25 // calls. |transmit_pipe| will be used to pass the DecoderBuffer data |
| 26 // back with OnDecryptDone() calls. This method must be called before any |
| 27 // methods listed are called. |
| 28 Initialize(handle<data_pipe_consumer> receive_pipe, |
| 29 handle<data_pipe_producer> transmit_pipe); |
| 30 |
| 22 // Decrypts the |encrypted| buffer and returns the decrypt |status| and | 31 // Decrypts the |encrypted| buffer and returns the decrypt |status| and |
| 23 // decrypted |buffer|. | 32 // decrypted |buffer|. |
| 24 // At most one decrypt call is allowed at any time for a |stream_type|. | 33 // At most one decrypt call is allowed at any time for a |stream_type|. |
| 25 Decrypt(DemuxerStream.Type stream_type, DecoderBuffer encrypted) | 34 Decrypt(DemuxerStream.Type stream_type, DecoderBuffer encrypted) |
| 26 => (Status status, DecoderBuffer? buffer); | 35 => (Status status, DecoderBuffer? buffer); |
| 27 | 36 |
| 28 // Cancels any pending decrypt for |stream_type| with SUCCESS. | 37 // Cancels any pending decrypt for |stream_type| with SUCCESS. |
| 29 CancelDecrypt(DemuxerStream.Type stream_type); | 38 CancelDecrypt(DemuxerStream.Type stream_type); |
| 30 | 39 |
| 31 // Initializes a decoder with the given |config|. Returns whether the | 40 // Initializes a decoder with the given |config|. Returns whether the |
| (...skipping 22 matching lines...) Expand all Loading... |
| 54 | 63 |
| 55 // Releases decoder resources, deinitializes the decoder, aborts any pending | 64 // Releases decoder resources, deinitializes the decoder, aborts any pending |
| 56 // initialization (with false) or decrypt-and-decode (with ERROR) for | 65 // initialization (with false) or decrypt-and-decode (with ERROR) for |
| 57 // |stream_type| immediately. | 66 // |stream_type| immediately. |
| 58 // This method can be called any time after Initialize{Audio|Video}Decoder() | 67 // This method can be called any time after Initialize{Audio|Video}Decoder() |
| 59 // has been called (with the correct stream type). | 68 // has been called (with the correct stream type). |
| 60 // After this operation, the decoder is set to an uninitialized state. | 69 // After this operation, the decoder is set to an uninitialized state. |
| 61 // The decoder can be reinitialized after it is deinitialized. | 70 // The decoder can be reinitialized after it is deinitialized. |
| 62 DeinitializeDecoder(DemuxerStream.Type stream_type); | 71 DeinitializeDecoder(DemuxerStream.Type stream_type); |
| 63 }; | 72 }; |
| OLD | NEW |