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_SINC_RESAMPLER_H_ | 5 #ifndef MEDIA_BASE_SINC_RESAMPLER_H_ |
6 #define MEDIA_BASE_SINC_RESAMPLER_H_ | 6 #define MEDIA_BASE_SINC_RESAMPLER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/memory/aligned_memory.h" | 10 #include "base/memory/aligned_memory.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 // SincResampler is a high-quality single-channel sample-rate converter. | 16 // SincResampler is a high-quality single-channel sample-rate converter. |
17 class MEDIA_EXPORT SincResampler { | 17 class MEDIA_EXPORT SincResampler { |
18 public: | 18 public: |
19 // How many samples may be requested from the callback ahead of the current | |
20 // position in the stream. | |
21 static const int kLookAheadSize; | |
DaleCurtis
2012/10/18 00:45:01
Hmm, this is a misleading comment / name, the prim
Sergey Ulanov
2012/10/19 20:54:30
Done.
| |
22 | |
19 // Callback type for providing more data into the resampler. Expects |frames| | 23 // Callback type for providing more data into the resampler. Expects |frames| |
20 // of data to be rendered into |destination|; zero padded if not enough frames | 24 // of data to be rendered into |destination|; zero padded if not enough frames |
21 // are available to satisfy the request. | 25 // are available to satisfy the request. |
22 typedef base::Callback<void(float* destination, int frames)> ReadCB; | 26 typedef base::Callback<void(float* destination, int frames)> ReadCB; |
23 | 27 |
24 // Constructs a SincResampler with the specified |read_cb|, which is used to | 28 // Constructs a SincResampler with the specified |read_cb|, which is used to |
25 // acquire audio data for resampling. |io_sample_rate_ratio| is the ratio of | 29 // acquire audio data for resampling. |io_sample_rate_ratio| is the ratio of |
26 // input / output sample rates. | 30 // input / output sample rates. |
27 SincResampler(double io_sample_rate_ratio, const ReadCB& read_cb); | 31 SincResampler(double io_sample_rate_ratio, const ReadCB& read_cb); |
28 virtual ~SincResampler(); | 32 virtual ~SincResampler(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 float* const r3_; | 91 float* const r3_; |
88 float* const r4_; | 92 float* const r4_; |
89 float* const r5_; | 93 float* const r5_; |
90 | 94 |
91 DISALLOW_COPY_AND_ASSIGN(SincResampler); | 95 DISALLOW_COPY_AND_ASSIGN(SincResampler); |
92 }; | 96 }; |
93 | 97 |
94 } // namespace media | 98 } // namespace media |
95 | 99 |
96 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ | 100 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ |
OLD | NEW |