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

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

Issue 1316523002: Convert channel counts to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix compile Created 4 years, 11 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/wav_file_unittest.cc ('k') | webrtc/common_audio/wav_header.cc » ('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 14 matching lines...) Expand all
25 virtual ~ReadableWav() {} 25 virtual ~ReadableWav() {}
26 }; 26 };
27 27
28 enum WavFormat { 28 enum WavFormat {
29 kWavFormatPcm = 1, // PCM, each sample of size bytes_per_sample 29 kWavFormatPcm = 1, // PCM, each sample of size bytes_per_sample
30 kWavFormatALaw = 6, // 8-bit ITU-T G.711 A-law 30 kWavFormatALaw = 6, // 8-bit ITU-T G.711 A-law
31 kWavFormatMuLaw = 7, // 8-bit ITU-T G.711 mu-law 31 kWavFormatMuLaw = 7, // 8-bit ITU-T G.711 mu-law
32 }; 32 };
33 33
34 // Return true if the given parameters will make a well-formed WAV header. 34 // Return true if the given parameters will make a well-formed WAV header.
35 bool CheckWavParameters(int num_channels, 35 bool CheckWavParameters(size_t num_channels,
36 int sample_rate, 36 int sample_rate,
37 WavFormat format, 37 WavFormat format,
38 size_t bytes_per_sample, 38 size_t bytes_per_sample,
39 size_t num_samples); 39 size_t num_samples);
40 40
41 // Write a kWavHeaderSize bytes long WAV header to buf. The payload that 41 // Write a kWavHeaderSize bytes long WAV header to buf. The payload that
42 // follows the header is supposed to have the specified number of interleaved 42 // follows the header is supposed to have the specified number of interleaved
43 // channels and contain the specified total number of samples of the specified 43 // channels and contain the specified total number of samples of the specified
44 // type. CHECKs the input parameters for validity. 44 // type. CHECKs the input parameters for validity.
45 void WriteWavHeader(uint8_t* buf, 45 void WriteWavHeader(uint8_t* buf,
46 int num_channels, 46 size_t num_channels,
47 int sample_rate, 47 int sample_rate,
48 WavFormat format, 48 WavFormat format,
49 size_t bytes_per_sample, 49 size_t bytes_per_sample,
50 size_t num_samples); 50 size_t num_samples);
51 51
52 // Read a WAV header from an implemented ReadableWav and parse the values into 52 // Read a WAV header from an implemented ReadableWav and parse the values into
53 // the provided output parameters. ReadableWav is used because the header can 53 // the provided output parameters. ReadableWav is used because the header can
54 // be variably sized. Returns false if the header is invalid. 54 // be variably sized. Returns false if the header is invalid.
55 bool ReadWavHeader(ReadableWav* readable, 55 bool ReadWavHeader(ReadableWav* readable,
56 int* num_channels, 56 size_t* num_channels,
57 int* sample_rate, 57 int* sample_rate,
58 WavFormat* format, 58 WavFormat* format,
59 size_t* bytes_per_sample, 59 size_t* bytes_per_sample,
60 size_t* num_samples); 60 size_t* num_samples);
61 61
62 } // namespace webrtc 62 } // namespace webrtc
63 63
64 #endif // WEBRTC_COMMON_AUDIO_WAV_HEADER_H_ 64 #endif // WEBRTC_COMMON_AUDIO_WAV_HEADER_H_
OLDNEW
« no previous file with comments | « webrtc/common_audio/wav_file_unittest.cc ('k') | webrtc/common_audio/wav_header.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698