// Copyright 2020 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/audio_data.mojom"; import "media/mojo/mojom/audio_parameters.mojom"; import "media/mojo/mojom/audio_stream_factory.mojom"; import "media/mojo/mojom/media_types.mojom"; import "media/mojo/mojom/speech_recognition.mojom"; import "mojo/public/mojom/base/file_path.mojom"; import "sandbox/policy/mojom/sandbox.mojom"; // Like a SpeechRecognitionContext, except it binds AudioSourceFetcher speech // recognizer objects, rather than SpeechRecognitionRecognizer objects. In // Chrome OS features like Dictation and Projector, every // OnDeviceSpeechRecognizer can own a // Remote. interface AudioSourceSpeechRecognitionContext { // Prepares microphone audio to be captured from within the // SpeechRecognitionService process, with results passed back to the // SpeechRecognitionRecognizerClient. BindAudioSourceFetcher( pending_receiver fetcher_receiver, pending_remote client, SpeechRecognitionOptions options) => (bool is_multichannel_supported); }; // The main interface to a speech secognition service process. // Used by the browser to issue top-level control requests to the service, // acquired during process launch. [ServiceSandbox=sandbox.mojom.Sandbox.kSpeechRecognition] interface SpeechRecognitionService { // Binds a new SpeechRecognitionContext hosted in the service process. BindSpeechRecognitionContext( pending_receiver context); // Binds a new AudioSourceSpeechRecognitionContext hosted in the service // process. BindAudioSourceSpeechRecognitionContext( pending_receiver context); // Sets the file path to the Speech On-Device API (SODA) binary, the config // file paths for the language packs, and the primary language name. SetSodaPaths(mojo_base.mojom.FilePath binary_path, map config_paths, string primary_language_name); // Sets various params to the Speech On-Device API (SODA) binary. SetSodaParams(bool mask_offensive_words); // Sets the config file paths for the language packs. Used to notify the // service when new language packs are installed. SetSodaConfigPaths(map config_paths); }; // The interface used to start and stop fetching audio from the microphone // for speech recognition. interface AudioSourceFetcher { // Begin fetching audio. Results will be returned using the // Remote which was passed in // BindAudioSourceFetcher. Start(pending_remote factory, string device_id, media.mojom.AudioParameters audio_parameters); // Stops audio fetching. Stop(); };