Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Side by Side Diff: Source/modules/speech/SpeechRecognition.h

Issue 448163003: Support for providing media stream audio track to speech recognition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Wrap WebMediaStreamTrack into WebSpeechRecognitionParams Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 20 matching lines...) Expand all
31 #include "modules/speech/SpeechGrammarList.h" 31 #include "modules/speech/SpeechGrammarList.h"
32 #include "modules/speech/SpeechRecognitionResult.h" 32 #include "modules/speech/SpeechRecognitionResult.h"
33 #include "platform/heap/Handle.h" 33 #include "platform/heap/Handle.h"
34 #include "wtf/Compiler.h" 34 #include "wtf/Compiler.h"
35 #include "wtf/text/WTFString.h" 35 #include "wtf/text/WTFString.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 class ExceptionState; 39 class ExceptionState;
40 class ExecutionContext; 40 class ExecutionContext;
41 class MediaStreamTrack;
41 class SpeechRecognitionController; 42 class SpeechRecognitionController;
42 class SpeechRecognitionError; 43 class SpeechRecognitionError;
43 44
44 class SpeechRecognition FINAL : public RefCountedGarbageCollectedWillBeGarbageCo llectedFinalized<SpeechRecognition>, public ActiveDOMObject, public EventTargetW ithInlineData { 45 class SpeechRecognition FINAL : public RefCountedGarbageCollectedWillBeGarbageCo llectedFinalized<SpeechRecognition>, public ActiveDOMObject, public EventTargetW ithInlineData {
45 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S peechRecognition>); 46 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S peechRecognition>);
46 DEFINE_WRAPPERTYPEINFO(); 47 DEFINE_WRAPPERTYPEINFO();
47 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechRecognition); 48 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechRecognition);
48 public: 49 public:
49 static SpeechRecognition* create(ExecutionContext*); 50 static SpeechRecognition* create(ExecutionContext*);
50 virtual ~SpeechRecognition(); 51 virtual ~SpeechRecognition();
51 52
53 // SpeechRecognition.idl implemementation.
52 // Attributes. 54 // Attributes.
Mike West 2014/09/17 14:32:01 Nit: Fold the comments into one line
53 SpeechGrammarList* grammars() { return m_grammars; } 55 SpeechGrammarList* grammars() { return m_grammars; }
54 void setGrammars(SpeechGrammarList* grammars) { m_grammars = grammars; } 56 void setGrammars(SpeechGrammarList* grammars) { m_grammars = grammars; }
55 String lang() { return m_lang; } 57 String lang() { return m_lang; }
56 void setLang(const String& lang) { m_lang = lang; } 58 void setLang(const String& lang) { m_lang = lang; }
57 bool continuous() { return m_continuous; } 59 bool continuous() { return m_continuous; }
58 void setContinuous(bool continuous) { m_continuous = continuous; } 60 void setContinuous(bool continuous) { m_continuous = continuous; }
59 bool interimResults() { return m_interimResults; } 61 bool interimResults() { return m_interimResults; }
60 void setInterimResults(bool interimResults) { m_interimResults = interimResu lts; } 62 void setInterimResults(bool interimResults) { m_interimResults = interimResu lts; }
61 unsigned long maxAlternatives() { return m_maxAlternatives; } 63 unsigned long maxAlternatives() { return m_maxAlternatives; }
62 void setMaxAlternatives(unsigned long maxAlternatives) { m_maxAlternatives = maxAlternatives; } 64 void setMaxAlternatives(unsigned long maxAlternatives) { m_maxAlternatives = maxAlternatives; }
65 MediaStreamTrack* audioTrack() { return m_audioTrack; }
66 void setAudioTrack(MediaStreamTrack* audioTrack) { m_audioTrack = audioTrack ; }
63 67
64 // Callable by the user. 68 // Callable by the user.
65 void start(ExceptionState&); 69 void start(ExceptionState&);
66 void stopFunction(); 70 void stopFunction();
67 void abort(); 71 void abort();
68 72
69 // Called by the SpeechRecognitionClient. 73 // Called by the SpeechRecognitionClient.
70 void didStartAudio(); 74 void didStartAudio();
71 void didStartSound(); 75 void didStartSound();
72 void didStartSpeech(); 76 void didStartSpeech();
(...skipping 25 matching lines...) Expand all
98 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 102 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
99 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); 103 DEFINE_ATTRIBUTE_EVENT_LISTENER(start);
100 DEFINE_ATTRIBUTE_EVENT_LISTENER(end); 104 DEFINE_ATTRIBUTE_EVENT_LISTENER(end);
101 105
102 virtual void trace(Visitor*) OVERRIDE; 106 virtual void trace(Visitor*) OVERRIDE;
103 107
104 private: 108 private:
105 explicit SpeechRecognition(ExecutionContext*); 109 explicit SpeechRecognition(ExecutionContext*);
106 110
107 Member<SpeechGrammarList> m_grammars; 111 Member<SpeechGrammarList> m_grammars;
112 Member<MediaStreamTrack> m_audioTrack;
108 String m_lang; 113 String m_lang;
109 bool m_continuous; 114 bool m_continuous;
110 bool m_interimResults; 115 bool m_interimResults;
111 unsigned long m_maxAlternatives; 116 unsigned long m_maxAlternatives;
112 117
113 RawPtrWillBeMember<SpeechRecognitionController> m_controller; 118 RawPtrWillBeMember<SpeechRecognitionController> m_controller;
114 bool m_stoppedByActiveDOMObject; 119 bool m_stoppedByActiveDOMObject;
115 bool m_started; 120 bool m_started;
116 bool m_stopping; 121 bool m_stopping;
117 HeapVector<Member<SpeechRecognitionResult> > m_finalResults; 122 HeapVector<Member<SpeechRecognitionResult> > m_finalResults;
118 }; 123 };
119 124
120 } // namespace blink 125 } // namespace blink
121 126
122 #endif // SpeechRecognition_h 127 #endif // SpeechRecognition_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/speech/SpeechRecognition.cpp » ('j') | Source/modules/speech/SpeechRecognition.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698