[M120 Migration][MM] Framerate calculation
[platform/framework/web/chromium-efl.git] / media / mojo / mojom / audio_decoder.mojom
1 // Copyright 2016 The Chromium Authors
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 media.mojom;
6
7 import "media/mojo/mojom/media_log.mojom";
8 import "media/mojo/mojom/media_types.mojom";
9 import "mojo/public/mojom/base/unguessable_token.mojom";
10
11 interface AudioDecoder {
12   // Initialize the decoder. This must be called before any other method.
13   //
14   // TODO(sandersd): Rename to Initialize() if/when
15   // media::AudioDecoder::Initialize() is renamed to Configure().
16   Construct(pending_associated_remote<AudioDecoderClient> client,
17             pending_remote<MediaLog> media_log);
18
19   // Initializes the AudioDecoder with the audio codec configuration and CDM id.
20   // For the unencrypted streams the |cdm_id| is ignored. Executed the callback
21   // with whether the initialization succeeded, and whether the pipeline needs
22   // bitstream conversion.
23   Initialize(AudioDecoderConfig config,
24              mojo_base.mojom.UnguessableToken? cdm_id)
25       => (DecoderStatus success,
26           bool needs_bitstream_conversion,
27           AudioDecoderType decoder_type);
28
29   // Establishes data connection. Should be called before Decode().
30   SetDataSource(handle<data_pipe_consumer> receive_pipe);
31
32   // Sends the |buffer| to the underlying codec. Should be called only after
33   // Initialize() succeeds. The callback with the status is called after the
34   // decoder has accepted corresponding DecoderBuffer, indicating that the
35   // pipeline can send next buffer to decode.
36   // If |buffer| is an EOS buffer then the decoder must be flushed, i.e. all
37   // pending buffers should be processed, the corresponding decoded buffers
38   // should be returned to the proxy, and only then the service should return
39   // DecoderStatus.
40   Decode(DecoderBuffer buffer) => (DecoderStatus status);
41
42   // Resets decoder state. Should be called only if Initialize() succeeds.
43   // All pending Decode() requests will be finished or aborted, then the method
44   // executes the callback.
45   Reset() => ();
46 };
47
48 interface AudioDecoderClient {
49   // Sends the decoded audio buffer back to the proxy.
50   OnBufferDecoded(AudioBuffer buffer);
51
52   // Called when the remote decoder is waiting because of |reason|, e.g. waiting
53   // for decryption key.
54   OnWaiting(WaitingReason reason);
55 };