naiveproxy/chromeos/services/assistant/public/mojom/assistant_audio_decoder.mojom
2018-12-09 21:59:24 -05:00

40 lines
1.4 KiB
Plaintext

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module chromeos.assistant.mojom;
// A factory for creating an assistant audio decoder.
interface AssistantAudioDecoderFactory {
// Creates an AssistantAudioDecoder to decode audio stream data from
// |data_source|.
// |client|'s methods will be called when certain events happen.
CreateAssistantAudioDecoder(AssistantAudioDecoder& audio_decoder,
AssistantAudioDecoderClient client,
AssistantMediaDataSource data_source);
};
// Interface to communicate with assistant audio decoder service.
interface AssistantAudioDecoder {
// Reads the audio data format.
OpenDecoder() => (bool success,
int32 bytes_per_sample,
int32 samples_per_second,
int32 channels);
// Reads the audio data and decodes.
Decode();
};
// Interface for assistant audio decoder service to call into client.
interface AssistantAudioDecoderClient {
// Called when new audio buffers have been decoded.
// |buffers| are in interleaved format.
OnNewBuffers(array<array<uint8>> buffers);
};
// Interface used to read data from the calling process.
interface AssistantMediaDataSource {
Read(int32 size) => (array<uint8> data);
};