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

Side by Side Diff: media/audio/audio_parameters.h

Issue 518433002: Revert of Revert of Remove the last piece of deprecated synchronous IO code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_output_resampler.cc ('k') | media/audio/audio_parameters.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_AUDIO_AUDIO_PARAMETERS_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_PARAMETERS_H_
6 #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_ 6 #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "media/base/channel_layout.h" 10 #include "media/base/channel_layout.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ECHO_CANCELLER = 0x1, 51 ECHO_CANCELLER = 0x1,
52 DUCKING = 0x2, // Enables ducking if the OS supports it. 52 DUCKING = 0x2, // Enables ducking if the OS supports it.
53 KEYBOARD_MIC = 0x4, 53 KEYBOARD_MIC = 0x4,
54 }; 54 };
55 55
56 AudioParameters(); 56 AudioParameters();
57 AudioParameters(Format format, ChannelLayout channel_layout, 57 AudioParameters(Format format, ChannelLayout channel_layout,
58 int sample_rate, int bits_per_sample, 58 int sample_rate, int bits_per_sample,
59 int frames_per_buffer); 59 int frames_per_buffer);
60 AudioParameters(Format format, ChannelLayout channel_layout, 60 AudioParameters(Format format, ChannelLayout channel_layout,
61 int input_channels,
62 int sample_rate, int bits_per_sample, 61 int sample_rate, int bits_per_sample,
63 int frames_per_buffer, int effects); 62 int frames_per_buffer, int effects);
64 AudioParameters(Format format, ChannelLayout channel_layout, 63 AudioParameters(Format format, ChannelLayout channel_layout,
65 int channels, int input_channels, 64 int channels, int sample_rate, int bits_per_sample,
66 int sample_rate, int bits_per_sample,
67 int frames_per_buffer, int effects); 65 int frames_per_buffer, int effects);
68 66
69 void Reset(Format format, ChannelLayout channel_layout, 67 void Reset(Format format, ChannelLayout channel_layout,
70 int channels, int input_channels, 68 int channels, int sample_rate, int bits_per_sample,
71 int sample_rate, int bits_per_sample,
72 int frames_per_buffer); 69 int frames_per_buffer);
73 70
74 // Checks that all values are in the expected range. All limits are specified 71 // Checks that all values are in the expected range. All limits are specified
75 // in media::Limits. 72 // in media::Limits.
76 bool IsValid() const; 73 bool IsValid() const;
77 74
78 // Returns size of audio buffer in bytes. 75 // Returns size of audio buffer in bytes.
79 int GetBytesPerBuffer() const; 76 int GetBytesPerBuffer() const;
80 77
81 // Returns the number of bytes representing one second of audio. 78 // Returns the number of bytes representing one second of audio.
82 int GetBytesPerSecond() const; 79 int GetBytesPerSecond() const;
83 80
84 // Returns the number of bytes representing a frame of audio. 81 // Returns the number of bytes representing a frame of audio.
85 int GetBytesPerFrame() const; 82 int GetBytesPerFrame() const;
86 83
87 // Returns the duration of this buffer as calculated from frames_per_buffer() 84 // Returns the duration of this buffer as calculated from frames_per_buffer()
88 // and sample_rate(). 85 // and sample_rate().
89 base::TimeDelta GetBufferDuration() const; 86 base::TimeDelta GetBufferDuration() const;
90 87
91 Format format() const { return format_; } 88 Format format() const { return format_; }
92 ChannelLayout channel_layout() const { return channel_layout_; } 89 ChannelLayout channel_layout() const { return channel_layout_; }
93 int sample_rate() const { return sample_rate_; } 90 int sample_rate() const { return sample_rate_; }
94 int bits_per_sample() const { return bits_per_sample_; } 91 int bits_per_sample() const { return bits_per_sample_; }
95 int frames_per_buffer() const { return frames_per_buffer_; } 92 int frames_per_buffer() const { return frames_per_buffer_; }
96 int channels() const { return channels_; } 93 int channels() const { return channels_; }
97 int input_channels() const { return input_channels_; }
98 int effects() const { return effects_; } 94 int effects() const { return effects_; }
99 95
100 // Comparison with other AudioParams. 96 // Comparison with other AudioParams.
101 bool operator==(const AudioParameters& other) const { 97 bool operator==(const AudioParameters& other) const {
102 return format_ == other.format() && 98 return format_ == other.format() &&
103 sample_rate_ == other.sample_rate() && 99 sample_rate_ == other.sample_rate() &&
104 channel_layout_ == other.channel_layout() && 100 channel_layout_ == other.channel_layout() &&
105 channels_ == other.channels() && 101 channels_ == other.channels() &&
106 input_channels_ == other.input_channels() &&
107 bits_per_sample_ == other.bits_per_sample() && 102 bits_per_sample_ == other.bits_per_sample() &&
108 frames_per_buffer_ == other.frames_per_buffer() && 103 frames_per_buffer_ == other.frames_per_buffer() &&
109 effects_ == other.effects(); 104 effects_ == other.effects();
110 } 105 }
111 106
112 private: 107 private:
113 // These members are mutable to support entire struct assignment. They should 108 // These members are mutable to support entire struct assignment. They should
114 // not be mutated individually. 109 // not be mutated individually.
115 Format format_; // Format of the stream. 110 Format format_; // Format of the stream.
116 ChannelLayout channel_layout_; // Order of surround sound channels. 111 ChannelLayout channel_layout_; // Order of surround sound channels.
117 int sample_rate_; // Sampling frequency/rate. 112 int sample_rate_; // Sampling frequency/rate.
118 int bits_per_sample_; // Number of bits per sample. 113 int bits_per_sample_; // Number of bits per sample.
119 int frames_per_buffer_; // Number of frames in a buffer. 114 int frames_per_buffer_; // Number of frames in a buffer.
120 115
121 int channels_; // Number of channels. Value set based on 116 int channels_; // Number of channels. Value set based on
122 // |channel_layout|. 117 // |channel_layout|.
123 int input_channels_; // Optional number of input channels.
124 // Normally 0, but can be set to specify
125 // synchronized I/O.
126 int effects_; // Bitmask using PlatformEffectsMask. 118 int effects_; // Bitmask using PlatformEffectsMask.
127 }; 119 };
128 120
129 // Comparison is useful when AudioParameters is used with std structures. 121 // Comparison is useful when AudioParameters is used with std structures.
130 inline bool operator<(const AudioParameters& a, const AudioParameters& b) { 122 inline bool operator<(const AudioParameters& a, const AudioParameters& b) {
131 if (a.format() != b.format()) 123 if (a.format() != b.format())
132 return a.format() < b.format(); 124 return a.format() < b.format();
133 if (a.channels() != b.channels()) 125 if (a.channels() != b.channels())
134 return a.channels() < b.channels(); 126 return a.channels() < b.channels();
135 if (a.input_channels() != b.input_channels())
136 return a.input_channels() < b.input_channels();
137 if (a.sample_rate() != b.sample_rate()) 127 if (a.sample_rate() != b.sample_rate())
138 return a.sample_rate() < b.sample_rate(); 128 return a.sample_rate() < b.sample_rate();
139 if (a.bits_per_sample() != b.bits_per_sample()) 129 if (a.bits_per_sample() != b.bits_per_sample())
140 return a.bits_per_sample() < b.bits_per_sample(); 130 return a.bits_per_sample() < b.bits_per_sample();
141 return a.frames_per_buffer() < b.frames_per_buffer(); 131 return a.frames_per_buffer() < b.frames_per_buffer();
142 } 132 }
143 133
144 } // namespace media 134 } // namespace media
145 135
146 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ 136 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_
OLDNEW
« no previous file with comments | « media/audio/audio_output_resampler.cc ('k') | media/audio/audio_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698