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 #ifndef MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ | 5 #ifndef MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ |
6 #define MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ | 6 #define MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "media/base/sinc_resampler.h" | 16 #include "media/base/sinc_resampler.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 class AudioBus; | 19 class AudioBus; |
20 | 20 |
21 // MultiChannelResampler is a multi channel wrapper for SincResampler; allowing | 21 // MultiChannelResampler is a multi channel wrapper for SincResampler; allowing |
22 // high quality sample rate conversion of multiple channels at once. | 22 // high quality sample rate conversion of multiple channels at once. |
23 class MEDIA_EXPORT MultiChannelResampler { | 23 class MEDIA_EXPORT MultiChannelResampler { |
24 public: | 24 public: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // each channel (in channel order) as SincResampler needs more data. | 65 // each channel (in channel order) as SincResampler needs more data. |
66 void ProvideInput(int channel, int frames, float* destination); | 66 void ProvideInput(int channel, int frames, float* destination); |
67 | 67 |
68 // Source of data for resampling. | 68 // Source of data for resampling. |
69 ReadCB read_cb_; | 69 ReadCB read_cb_; |
70 | 70 |
71 // Each channel has its own high quality resampler. | 71 // Each channel has its own high quality resampler. |
72 ScopedVector<SincResampler> resamplers_; | 72 ScopedVector<SincResampler> resamplers_; |
73 | 73 |
74 // Buffers for audio data going into SincResampler from ReadCB. | 74 // Buffers for audio data going into SincResampler from ReadCB. |
75 scoped_ptr<AudioBus> resampler_audio_bus_; | 75 std::unique_ptr<AudioBus> resampler_audio_bus_; |
76 | 76 |
77 // To avoid a memcpy() on the first channel we create a wrapped AudioBus where | 77 // To avoid a memcpy() on the first channel we create a wrapped AudioBus where |
78 // the first channel points to the |destination| provided to ProvideInput(). | 78 // the first channel points to the |destination| provided to ProvideInput(). |
79 scoped_ptr<AudioBus> wrapped_resampler_audio_bus_; | 79 std::unique_ptr<AudioBus> wrapped_resampler_audio_bus_; |
80 | 80 |
81 // The number of output frames that have successfully been processed during | 81 // The number of output frames that have successfully been processed during |
82 // the current Resample() call. | 82 // the current Resample() call. |
83 int output_frames_ready_; | 83 int output_frames_ready_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(MultiChannelResampler); | 85 DISALLOW_COPY_AND_ASSIGN(MultiChannelResampler); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace media | 88 } // namespace media |
89 | 89 |
90 #endif // MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ | 90 #endif // MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ |
OLD | NEW |