OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_SPEECH_AUDIO_ENCODER_H_ | |
6 #define CHROME_BROWSER_SPEECH_AUDIO_ENCODER_H_ | |
7 | |
8 #include <list> | |
9 #include <string> | |
10 | |
11 namespace speech_input { | |
bulach
2011/01/12 16:27:07
I think Brett sent an email a short time ago, you
Satish
2011/01/17 14:02:05
Yes will change to 'speech' in a subsequent CL
| |
12 | |
13 // Provides a simple interface to encode raw audio using the various speech | |
14 // codecs. | |
15 class AudioEncoder { | |
16 public: | |
17 enum Codec { | |
18 FLAC, | |
19 SPEEX | |
bulach
2011/01/12 16:27:07
add ","
afaict, normally enums values would also
| |
20 }; | |
21 | |
22 static AudioEncoder* Create(Codec codec, | |
23 int sampling_rate, | |
24 int bits_per_sample); | |
25 | |
26 virtual ~AudioEncoder(); | |
27 | |
28 // Encodes each frame of raw audio in |samples| to the internal buffer. Use | |
29 // |GetEncodedData| to read the result after this call or when recording | |
30 // completes. | |
31 virtual void Encode(const short* samples, int num_samples) = 0; | |
32 | |
33 // Finish encoding and flush any pending encoded bits out. | |
34 virtual void Flush() = 0; | |
35 | |
36 // Copies the encoded audio to the given string. Returns true if the output | |
37 // is not empty. | |
38 bool GetEncodedData(std::string* encoded_data); | |
39 | |
40 protected: | |
41 // Buffer holding the recorded audio. Owns the strings inside the list. | |
42 typedef std::list<std::string*> AudioBufferQueue; | |
43 AudioBufferQueue audio_buffers_; | |
bulach
2011/01/12 16:27:07
I think all data members should be private, with p
| |
44 }; | |
45 | |
46 } | |
bulach
2011/01/12 16:27:07
// namespace speech_input
| |
47 | |
48 #endif // CHROME_BROWSER_SPEECH_AUDIO_ENCODER_H_ | |
OLD | NEW |