Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Side by Side Diff: webrtc/common_audio/wav_file.h

Issue 1345433002: Add RTC_ prefix to contructormagic macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Formatting fix. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/common_audio/sparse_fir_filter.h ('k') | webrtc/common_audio/window_generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 int num_channels() const override { return num_channels_; } 51 int num_channels() const override { return num_channels_; }
52 uint32_t num_samples() const override { return num_samples_; } 52 uint32_t num_samples() const override { return num_samples_; }
53 53
54 private: 54 private:
55 void Close(); 55 void Close();
56 const int sample_rate_; 56 const int sample_rate_;
57 const int num_channels_; 57 const int num_channels_;
58 uint32_t num_samples_; // Total number of samples written to file. 58 uint32_t num_samples_; // Total number of samples written to file.
59 FILE* file_handle_; // Output file, owned by this class 59 FILE* file_handle_; // Output file, owned by this class
60 60
61 DISALLOW_COPY_AND_ASSIGN(WavWriter); 61 RTC_DISALLOW_COPY_AND_ASSIGN(WavWriter);
62 }; 62 };
63 63
64 // Follows the conventions of WavWriter. 64 // Follows the conventions of WavWriter.
65 class WavReader final : public WavFile { 65 class WavReader final : public WavFile {
66 public: 66 public:
67 // Opens an existing WAV file for reading. 67 // Opens an existing WAV file for reading.
68 explicit WavReader(const std::string& filename); 68 explicit WavReader(const std::string& filename);
69 69
70 // Close the WAV file. 70 // Close the WAV file.
71 ~WavReader(); 71 ~WavReader();
72 72
73 // Returns the number of samples read. If this is less than requested, 73 // Returns the number of samples read. If this is less than requested,
74 // verifies that the end of the file was reached. 74 // verifies that the end of the file was reached.
75 size_t ReadSamples(size_t num_samples, float* samples); 75 size_t ReadSamples(size_t num_samples, float* samples);
76 size_t ReadSamples(size_t num_samples, int16_t* samples); 76 size_t ReadSamples(size_t num_samples, int16_t* samples);
77 77
78 int sample_rate() const override { return sample_rate_; } 78 int sample_rate() const override { return sample_rate_; }
79 int num_channels() const override { return num_channels_; } 79 int num_channels() const override { return num_channels_; }
80 uint32_t num_samples() const override { return num_samples_; } 80 uint32_t num_samples() const override { return num_samples_; }
81 81
82 private: 82 private:
83 void Close(); 83 void Close();
84 int sample_rate_; 84 int sample_rate_;
85 int num_channels_; 85 int num_channels_;
86 uint32_t num_samples_; // Total number of samples in the file. 86 uint32_t num_samples_; // Total number of samples in the file.
87 uint32_t num_samples_remaining_; 87 uint32_t num_samples_remaining_;
88 FILE* file_handle_; // Input file, owned by this class. 88 FILE* file_handle_; // Input file, owned by this class.
89 89
90 DISALLOW_COPY_AND_ASSIGN(WavReader); 90 RTC_DISALLOW_COPY_AND_ASSIGN(WavReader);
91 }; 91 };
92 92
93 } // namespace webrtc 93 } // namespace webrtc
94 94
95 extern "C" { 95 extern "C" {
96 #endif // __cplusplus 96 #endif // __cplusplus
97 97
98 // C wrappers for the WavWriter class. 98 // C wrappers for the WavWriter class.
99 typedef struct rtc_WavWriter rtc_WavWriter; 99 typedef struct rtc_WavWriter rtc_WavWriter;
100 rtc_WavWriter* rtc_WavOpen(const char* filename, 100 rtc_WavWriter* rtc_WavOpen(const char* filename,
101 int sample_rate, 101 int sample_rate,
102 int num_channels); 102 int num_channels);
103 void rtc_WavClose(rtc_WavWriter* wf); 103 void rtc_WavClose(rtc_WavWriter* wf);
104 void rtc_WavWriteSamples(rtc_WavWriter* wf, 104 void rtc_WavWriteSamples(rtc_WavWriter* wf,
105 const float* samples, 105 const float* samples,
106 size_t num_samples); 106 size_t num_samples);
107 int rtc_WavSampleRate(const rtc_WavWriter* wf); 107 int rtc_WavSampleRate(const rtc_WavWriter* wf);
108 int rtc_WavNumChannels(const rtc_WavWriter* wf); 108 int rtc_WavNumChannels(const rtc_WavWriter* wf);
109 uint32_t rtc_WavNumSamples(const rtc_WavWriter* wf); 109 uint32_t rtc_WavNumSamples(const rtc_WavWriter* wf);
110 110
111 #ifdef __cplusplus 111 #ifdef __cplusplus
112 } // extern "C" 112 } // extern "C"
113 #endif 113 #endif
114 114
115 #endif // WEBRTC_COMMON_AUDIO_WAV_FILE_H_ 115 #endif // WEBRTC_COMMON_AUDIO_WAV_FILE_H_
OLDNEW
« no previous file with comments | « webrtc/common_audio/sparse_fir_filter.h ('k') | webrtc/common_audio/window_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698