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

Unified Diff: chrome/browser/speech/audio_encoder.h

Issue 6111009: Add the option of compressing speech input audio using FLAC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/speech/audio_encoder.cc » ('j') | chrome/browser/speech/audio_encoder.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/speech/audio_encoder.h
diff --git a/chrome/browser/speech/audio_encoder.h b/chrome/browser/speech/audio_encoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..51ec26f6f6288631a5ad6c10afd793754d91d0a6
--- /dev/null
+++ b/chrome/browser/speech/audio_encoder.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 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.
+
+#ifndef CHROME_BROWSER_SPEECH_AUDIO_ENCODER_H_
+#define CHROME_BROWSER_SPEECH_AUDIO_ENCODER_H_
+
+#include <list>
+#include <string>
+
+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
+
+// Provides a simple interface to encode raw audio using the various speech
+// codecs.
+class AudioEncoder {
+ public:
+ enum Codec {
+ FLAC,
+ SPEEX
bulach 2011/01/12 16:27:07 add "," afaict, normally enums values would also
+ };
+
+ static AudioEncoder* Create(Codec codec,
+ int sampling_rate,
+ int bits_per_sample);
+
+ virtual ~AudioEncoder();
+
+ // Encodes each frame of raw audio in |samples| to the internal buffer. Use
+ // |GetEncodedData| to read the result after this call or when recording
+ // completes.
+ virtual void Encode(const short* samples, int num_samples) = 0;
+
+ // Finish encoding and flush any pending encoded bits out.
+ virtual void Flush() = 0;
+
+ // Copies the encoded audio to the given string. Returns true if the output
+ // is not empty.
+ bool GetEncodedData(std::string* encoded_data);
+
+ protected:
+ // Buffer holding the recorded audio. Owns the strings inside the list.
+ typedef std::list<std::string*> AudioBufferQueue;
+ AudioBufferQueue audio_buffers_;
bulach 2011/01/12 16:27:07 I think all data members should be private, with p
+};
+
+}
bulach 2011/01/12 16:27:07 // namespace speech_input
+
+#endif // CHROME_BROWSER_SPEECH_AUDIO_ENCODER_H_
« no previous file with comments | « no previous file | chrome/browser/speech/audio_encoder.cc » ('j') | chrome/browser/speech/audio_encoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698