OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/common_audio/wav_file.h" | 11 #include "webrtc/common_audio/wav_file.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <cstdio> | 14 #include <cstdio> |
15 #include <limits> | 15 #include <limits> |
16 #include <sstream> | 16 #include <sstream> |
17 | 17 |
18 #include "webrtc/base/checks.h" | |
19 #include "webrtc/base/safe_conversions.h" | |
20 #include "webrtc/common_audio/include/audio_util.h" | 18 #include "webrtc/common_audio/include/audio_util.h" |
21 #include "webrtc/common_audio/wav_header.h" | 19 #include "webrtc/common_audio/wav_header.h" |
| 20 #include "webrtc/rtc_base/checks.h" |
| 21 #include "webrtc/rtc_base/safe_conversions.h" |
22 | 22 |
23 namespace webrtc { | 23 namespace webrtc { |
24 | 24 |
25 // We write 16-bit PCM WAV files. | 25 // We write 16-bit PCM WAV files. |
26 static const WavFormat kWavFormat = kWavFormatPcm; | 26 static const WavFormat kWavFormat = kWavFormatPcm; |
27 static const size_t kBytesPerSample = 2; | 27 static const size_t kBytesPerSample = 2; |
28 | 28 |
29 // Doesn't take ownership of the file handle and won't close it. | 29 // Doesn't take ownership of the file handle and won't close it. |
30 class ReadableWavFile : public ReadableWav { | 30 class ReadableWavFile : public ReadableWav { |
31 public: | 31 public: |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 return reinterpret_cast<const webrtc::WavWriter*>(wf)->sample_rate(); | 196 return reinterpret_cast<const webrtc::WavWriter*>(wf)->sample_rate(); |
197 } | 197 } |
198 | 198 |
199 size_t rtc_WavNumChannels(const rtc_WavWriter* wf) { | 199 size_t rtc_WavNumChannels(const rtc_WavWriter* wf) { |
200 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_channels(); | 200 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_channels(); |
201 } | 201 } |
202 | 202 |
203 size_t rtc_WavNumSamples(const rtc_WavWriter* wf) { | 203 size_t rtc_WavNumSamples(const rtc_WavWriter* wf) { |
204 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_samples(); | 204 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_samples(); |
205 } | 205 } |
OLD | NEW |