1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
media / mojo / mojom / audio_decoder.mojom [blame]
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
import "media/mojo/mojom/media_log.mojom";
import "media/mojo/mojom/media_types.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
// This defines a mojo transport format for media::SupportedAudioDecoderConfig.
// See media/base/supported_audio_decoder_config.h for descriptions.
struct SupportedAudioDecoderConfig {
AudioCodec codec;
AudioCodecProfile profile;
};
interface AudioDecoder {
// Returns a list of supported configs for the decoder which supports them.
//
// May be called before Construct().
[Sync]
GetSupportedConfigs()
=> (array<SupportedAudioDecoderConfig> supported_configs);
// Initialize the decoder. This must be called before any other method.
//
// TODO(sandersd): Rename to Initialize() if/when
// media::AudioDecoder::Initialize() is renamed to Configure().
Construct(pending_associated_remote<AudioDecoderClient> client,
pending_remote<MediaLog> media_log);
// Initializes the AudioDecoder with the audio codec configuration and CDM id.
// For the unencrypted streams the |cdm_id| is ignored. Executed the callback
// with whether the initialization succeeded, and whether the pipeline needs
// bitstream conversion.
Initialize(AudioDecoderConfig config,
mojo_base.mojom.UnguessableToken? cdm_id)
=> (DecoderStatus success,
bool needs_bitstream_conversion,
AudioDecoderType decoder_type);
// Establishes data connection. Should be called before Decode().
SetDataSource(handle<data_pipe_consumer> receive_pipe);
// Sends the |buffer| to the underlying codec. Should be called only after
// Initialize() succeeds. The callback with the status is called after the
// decoder has accepted corresponding DecoderBuffer, indicating that the
// pipeline can send next buffer to decode.
// If |buffer| is an EOS buffer then the decoder must be flushed, i.e. all
// pending buffers should be processed, the corresponding decoded buffers
// should be returned to the proxy, and only then the service should return
// DecoderStatus.
Decode(DecoderBuffer buffer) => (DecoderStatus status);
// Resets decoder state. Should be called only if Initialize() succeeds.
// All pending Decode() requests will be finished or aborted, then the method
// executes the callback.
Reset() => ();
};
interface AudioDecoderClient {
// Sends the decoded audio buffer back to the proxy.
OnBufferDecoded(AudioBuffer buffer);
// Called when the remote decoder is waiting because of |reason|, e.g. waiting
// for decryption key.
OnWaiting(WaitingReason reason);
};