| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/speech/audio_encoder.h" | 5 #include "content/browser/speech/audio_encoder.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "content/browser/speech/audio_buffer.h" | 12 #include "content/browser/speech/audio_buffer.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 const char* const kContentTypeFLAC = "audio/x-flac; rate="; | 18 const char kContentTypeFLAC[] = "audio/x-flac; rate="; |
| 19 const int kFLACCompressionLevel = 0; // 0 for speed | 19 const int kFLACCompressionLevel = 0; // 0 for speed |
| 20 | 20 |
| 21 FLAC__StreamEncoderWriteStatus WriteCallback( | 21 FLAC__StreamEncoderWriteStatus WriteCallback( |
| 22 const FLAC__StreamEncoder* encoder, | 22 const FLAC__StreamEncoder* encoder, |
| 23 const FLAC__byte buffer[], | 23 const FLAC__byte buffer[], |
| 24 size_t bytes, | 24 size_t bytes, |
| 25 unsigned samples, | 25 unsigned samples, |
| 26 unsigned current_frame, | 26 unsigned current_frame, |
| 27 void* client_data) { | 27 void* client_data) { |
| 28 AudioBuffer* encoded_audio_buffer = static_cast<AudioBuffer*>(client_data); | 28 AudioBuffer* encoded_audio_buffer = static_cast<AudioBuffer*>(client_data); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 std::string AudioEncoder::GetMimeType() { | 81 std::string AudioEncoder::GetMimeType() { |
| 82 return std::string(kContentTypeFLAC) + | 82 return std::string(kContentTypeFLAC) + |
| 83 base::UintToString(FLAC__stream_encoder_get_sample_rate(encoder_)); | 83 base::UintToString(FLAC__stream_encoder_get_sample_rate(encoder_)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 int AudioEncoder::GetBitsPerSample() { | 86 int AudioEncoder::GetBitsPerSample() { |
| 87 return FLAC__stream_encoder_get_bits_per_sample(encoder_); | 87 return FLAC__stream_encoder_get_bits_per_sample(encoder_); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace content | 90 } // namespace content |
| OLD | NEW |