OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/media/audio_decoder.h" | 5 #include "content/renderer/media/audio_decoder.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "media/base/audio_bus.h" | 12 #include "media/base/audio_bus.h" |
13 #include "media/base/limits.h" | 13 #include "media/base/limits.h" |
14 #include "media/filters/audio_file_reader.h" | 14 #include "media/filters/audio_file_reader.h" |
15 #include "media/filters/in_memory_url_protocol.h" | 15 #include "media/filters/in_memory_url_protocol.h" |
16 #include "third_party/WebKit/public/platform/WebAudioBus.h" | 16 #include "third_party/WebKit/public/platform/WebAudioBus.h" |
17 | 17 |
18 using media::AudioBus; | 18 using media::AudioBus; |
19 using media::AudioFileReader; | 19 using media::AudioFileReader; |
20 using media::InMemoryUrlProtocol; | 20 using media::InMemoryUrlProtocol; |
21 using std::vector; | 21 using std::vector; |
22 using blink::WebAudioBus; | 22 using blink::WebAudioBus; |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 // Decode in-memory audio file data. | 26 // Decode in-memory audio file data. |
27 bool DecodeAudioFileData( | 27 bool DecodeAudioFileData( |
28 blink::WebAudioBus* destination_bus, | 28 blink::WebAudioBus* destination_bus, |
29 const char* data, size_t data_size, double sample_rate) { | 29 const char* data, size_t data_size) { |
30 DCHECK(destination_bus); | 30 DCHECK(destination_bus); |
31 if (!destination_bus) | 31 if (!destination_bus) |
32 return false; | 32 return false; |
33 | 33 |
34 // Uses the FFmpeg library for audio file reading. | 34 // Uses the FFmpeg library for audio file reading. |
35 InMemoryUrlProtocol url_protocol(reinterpret_cast<const uint8*>(data), | 35 InMemoryUrlProtocol url_protocol(reinterpret_cast<const uint8*>(data), |
36 data_size, false); | 36 data_size, false); |
37 AudioFileReader reader(&url_protocol); | 37 AudioFileReader reader(&url_protocol); |
38 | 38 |
39 if (!reader.Open()) | 39 if (!reader.Open()) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 << " data size: " << data_size | 85 << " data size: " << data_size |
86 << " duration: " << duration | 86 << " duration: " << duration |
87 << " number of frames: " << actual_frames | 87 << " number of frames: " << actual_frames |
88 << " sample rate: " << file_sample_rate | 88 << " sample rate: " << file_sample_rate |
89 << " number of channels: " << number_of_channels; | 89 << " number of channels: " << number_of_channels; |
90 | 90 |
91 return actual_frames > 0; | 91 return actual_frames > 0; |
92 } | 92 } |
93 | 93 |
94 } // namespace content | 94 } // namespace content |
OLD | NEW |