diff options
author | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-15 15:45:22 +0000 |
---|---|---|
committer | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-15 15:45:22 +0000 |
commit | 7869c0d85c0588b9626ddc680512a0b398d5f10f (patch) | |
tree | d213ca113ea4cd45dc1483901b8177071b3f478c /content/browser/speech/speech_recognition_engine.h | |
parent | 93079e0c4d33bcbfa3e2c214aa3069827b1439be (diff) | |
download | chromium_src-7869c0d85c0588b9626ddc680512a0b398d5f10f.zip chromium_src-7869c0d85c0588b9626ddc680512a0b398d5f10f.tar.gz chromium_src-7869c0d85c0588b9626ddc680512a0b398d5f10f.tar.bz2 |
Introducing new data types and IPC messages for scripted JS speech recognition APIs (Speech CL2.0)
Furthermore GoogleOneShotRemoteEngineConfig struct has been renamed and moved into the (more generic) SpeechRecognitionEngineConfig, that will be shared with the streaming recognition engine implementation.
BUG=116954
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10233010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137141 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/speech/speech_recognition_engine.h')
-rw-r--r-- | content/browser/speech/speech_recognition_engine.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/content/browser/speech/speech_recognition_engine.h b/content/browser/speech/speech_recognition_engine.h index 5b64d67..2203c5ef 100644 --- a/content/browser/speech/speech_recognition_engine.h +++ b/content/browser/speech/speech_recognition_engine.h @@ -7,9 +7,10 @@ #pragma once #include <string> -#include <vector> #include "base/basictypes.h" +#include "content/common/content_export.h" +#include "content/public/common/speech_recognition_grammar.h" namespace content { struct SpeechRecognitionResult; @@ -27,7 +28,9 @@ class AudioChunk; // TakeAudioChunk For every audio chunk pushed. // AudioChunksEnded Finalize the audio stream (omitted in case of errors). // EndRecognition Mandatory at end of SR (even on errors). -// No delegate callback is allowed before Initialize() or after Cleanup(). +// No delegate callbacks are allowed before StartRecognition or after +// EndRecognition. If a recognition was started, the caller can free the +// SpeechRecognitionEngine only after calling EndRecognition. class SpeechRecognitionEngine { public: // Interface for receiving callbacks from this object. @@ -45,8 +48,26 @@ class SpeechRecognitionEngine { virtual ~Delegate() {} }; + // Remote engine configuration. + struct CONTENT_EXPORT Config { + Config(); + ~Config(); + + std::string language; + content::SpeechRecognitionGrammarArray grammars; + bool filter_profanities; + std::string hardware_info; + std::string origin_url; + int audio_sample_rate; + int audio_num_bits_per_sample; + }; + virtual ~SpeechRecognitionEngine() {} + // Set/change the recognition engine configuration. It is not allowed to call + // this function while a recognition is ongoing. + virtual void SetConfig(const Config& config) = 0; + // Called when the speech recognition begins, before any TakeAudioChunk call. virtual void StartRecognition() = 0; @@ -81,11 +102,11 @@ class SpeechRecognitionEngine { Delegate* delegate_; }; -// This typedef is to workaround the issue with certain versions of +// These typedefs are to workaround the issue with certain versions of // Visual Studio where it gets confused between multiple Delegate -// classes and gives a C2500 error. (I saw this error on the try bots - -// the workaround was not needed for my machine). +// classes and gives a C2500 error. typedef SpeechRecognitionEngine::Delegate SpeechRecognitionEngineDelegate; +typedef SpeechRecognitionEngine::Config SpeechRecognitionEngineConfig; } // namespace speech |