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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace webrtc { | 22 namespace webrtc { |
23 | 23 |
24 // Interface to provide access to WAV file parameters. | 24 // Interface to provide access to WAV file parameters. |
25 class WavFile { | 25 class WavFile { |
26 public: | 26 public: |
27 virtual ~WavFile() {} | 27 virtual ~WavFile() {} |
28 | 28 |
29 virtual int sample_rate() const = 0; | 29 virtual int sample_rate() const = 0; |
30 virtual int num_channels() const = 0; | 30 virtual int num_channels() const = 0; |
31 virtual uint32_t num_samples() const = 0; | 31 virtual uint32_t num_samples() const = 0; |
32 | |
33 // Returns a human-readable string containing the audio format. | |
34 std::string FormatAsString() const; | |
35 }; | 32 }; |
36 | 33 |
37 // Simple C++ class for writing 16-bit PCM WAV files. All error handling is | 34 // Simple C++ class for writing 16-bit PCM WAV files. All error handling is |
38 // by calls to RTC_CHECK(), making it unsuitable for anything but debug code. | 35 // by calls to RTC_CHECK(), making it unsuitable for anything but debug code. |
39 class WavWriter final : public WavFile { | 36 class WavWriter final : public WavFile { |
40 public: | 37 public: |
41 // Open a new WAV file for writing. | 38 // Open a new WAV file for writing. |
42 WavWriter(const std::string& filename, int sample_rate, int num_channels); | 39 WavWriter(const std::string& filename, int sample_rate, int num_channels); |
43 | 40 |
44 // Close the WAV file, after writing its header. | 41 // Close the WAV file, after writing its header. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 size_t num_samples); | 106 size_t num_samples); |
110 int rtc_WavSampleRate(const rtc_WavWriter* wf); | 107 int rtc_WavSampleRate(const rtc_WavWriter* wf); |
111 int rtc_WavNumChannels(const rtc_WavWriter* wf); | 108 int rtc_WavNumChannels(const rtc_WavWriter* wf); |
112 uint32_t rtc_WavNumSamples(const rtc_WavWriter* wf); | 109 uint32_t rtc_WavNumSamples(const rtc_WavWriter* wf); |
113 | 110 |
114 #ifdef __cplusplus | 111 #ifdef __cplusplus |
115 } // extern "C" | 112 } // extern "C" |
116 #endif | 113 #endif |
117 | 114 |
118 #endif // WEBRTC_COMMON_AUDIO_WAV_FILE_H_ | 115 #endif // WEBRTC_COMMON_AUDIO_WAV_FILE_H_ |
OLD | NEW |