OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/glue/media/audio_decoder.h" | 5 #include "webkit/media/audio_decoder.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "media/base/limits.h" | 11 #include "media/base/limits.h" |
12 #include "media/filters/audio_file_reader.h" | 12 #include "media/filters/audio_file_reader.h" |
13 #include "media/filters/in_memory_url_protocol.h" | 13 #include "media/filters/in_memory_url_protocol.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioBus.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioBus.h" |
15 | 15 |
16 using media::AudioFileReader; | 16 using media::AudioFileReader; |
17 using media::InMemoryUrlProtocol; | 17 using media::InMemoryUrlProtocol; |
18 using std::vector; | 18 using std::vector; |
19 using WebKit::WebAudioBus; | 19 using WebKit::WebAudioBus; |
20 | 20 |
21 namespace webkit_glue { | 21 namespace webkit_media { |
22 | 22 |
23 // Decode in-memory audio file data. | 23 // Decode in-memory audio file data. |
24 bool DecodeAudioFileData( | 24 bool DecodeAudioFileData( |
25 WebKit::WebAudioBus* destination_bus, | 25 WebKit::WebAudioBus* destination_bus, |
26 const char* data, size_t data_size, double sample_rate) { | 26 const char* data, size_t data_size, double sample_rate) { |
27 DCHECK(destination_bus); | 27 DCHECK(destination_bus); |
28 if (!destination_bus) | 28 if (!destination_bus) |
29 return false; | 29 return false; |
30 | 30 |
31 // Uses the FFmpeg library for audio file reading. | 31 // Uses the FFmpeg library for audio file reading. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 vector<float*> audio_data; | 77 vector<float*> audio_data; |
78 audio_data.reserve(number_of_channels); | 78 audio_data.reserve(number_of_channels); |
79 for (size_t i = 0; i < number_of_channels; ++i) { | 79 for (size_t i = 0; i < number_of_channels; ++i) { |
80 audio_data.push_back(destination_bus->channelData(i)); | 80 audio_data.push_back(destination_bus->channelData(i)); |
81 } | 81 } |
82 | 82 |
83 // Decode the audio file data. | 83 // Decode the audio file data. |
84 return reader.Read(audio_data, number_of_frames); | 84 return reader.Read(audio_data, number_of_frames); |
85 } | 85 } |
86 | 86 |
87 } // namespace webkit_glue | 87 } // namespace webkit_media |
OLD | NEW |