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