| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.mojom; | 5 module media.mojom; |
| 6 | 6 |
| 7 import "media/mojo/interfaces/media_types.mojom"; | 7 import "media/mojo/interfaces/media_types.mojom"; |
| 8 | 8 |
| 9 interface AudioDecoder { | 9 interface AudioDecoder { |
| 10 // Initialize the decoder. This must be called before any other method. |
| 11 // |
| 12 // TODO(sandersd): Rename to Initialize() if/when |
| 13 // media::AudioDecoder::Initialize() is renamed to Configure(). |
| 14 Construct(associated AudioDecoderClient client); |
| 15 |
| 10 // Initializes the AudioDecoder with the audio codec configuration and CDM id. | 16 // Initializes the AudioDecoder with the audio codec configuration and CDM id. |
| 11 // For the unencrypted streams the |cdm_id| is ignored. Executed the callback | 17 // For the unencrypted streams the |cdm_id| is ignored. Executed the callback |
| 12 // with whether the initialization succeeded, and whether the pipeline needs | 18 // with whether the initialization succeeded, and whether the pipeline needs |
| 13 // bitstream conversion. | 19 // bitstream conversion. |
| 14 Initialize(associated AudioDecoderClient client, AudioDecoderConfig config, | 20 Initialize(AudioDecoderConfig config, int32 cdm_id) |
| 15 int32 cdm_id) => (bool success, bool needs_bitstream_conversion); | 21 => (bool success, bool needs_bitstream_conversion); |
| 16 | 22 |
| 17 // Establishes data connection. Should be called before Decode(). | 23 // Establishes data connection. Should be called before Decode(). |
| 18 SetDataSource(handle<data_pipe_consumer> receive_pipe); | 24 SetDataSource(handle<data_pipe_consumer> receive_pipe); |
| 19 | 25 |
| 20 // Sends the |buffer| to the underlying codec. Should be called only after | 26 // Sends the |buffer| to the underlying codec. Should be called only after |
| 21 // Initialize() succeeds. The callback with the status is called after the | 27 // Initialize() succeeds. The callback with the status is called after the |
| 22 // decoder has accepted corresponding DecoderBuffer, indicating that the | 28 // decoder has accepted corresponding DecoderBuffer, indicating that the |
| 23 // pipeline can send next buffer to decode. | 29 // pipeline can send next buffer to decode. |
| 24 // If |buffer| is an EOS buffer then the decoder must be flushed, i.e. all | 30 // If |buffer| is an EOS buffer then the decoder must be flushed, i.e. all |
| 25 // pending buffers should be processed, the corresponding decoded buffers | 31 // pending buffers should be processed, the corresponding decoded buffers |
| 26 // should be returned to the proxy, and only then the service should return | 32 // should be returned to the proxy, and only then the service should return |
| 27 // DecoderStatus. | 33 // DecoderStatus. |
| 28 Decode(DecoderBuffer buffer) => (DecodeStatus status); | 34 Decode(DecoderBuffer buffer) => (DecodeStatus status); |
| 29 | 35 |
| 30 // Resets decoder state. Should be called only if Initialize() succeeds. | 36 // Resets decoder state. Should be called only if Initialize() succeeds. |
| 31 // All pending Decode() requests will be finished or aborted, then the method | 37 // All pending Decode() requests will be finished or aborted, then the method |
| 32 // executes the callback. | 38 // executes the callback. |
| 33 Reset() => (); | 39 Reset() => (); |
| 34 }; | 40 }; |
| 35 | 41 |
| 36 interface AudioDecoderClient { | 42 interface AudioDecoderClient { |
| 37 // Sends the decoded audio buffer back to the proxy. | 43 // Sends the decoded audio buffer back to the proxy. |
| 38 OnBufferDecoded(AudioBuffer buffer); | 44 OnBufferDecoded(AudioBuffer buffer); |
| 39 }; | 45 }; |
| OLD | NEW |