Index: media/audio/audio_parameters.h |
diff --git a/media/audio/audio_parameters.h b/media/audio/audio_parameters.h |
index a73982e6ba259721770158a9c00bbf707b28f283..ea7f97bee2ef11f94f1ab1b99f1d4892ccb388da 100644 |
--- a/media/audio/audio_parameters.h |
+++ b/media/audio/audio_parameters.h |
@@ -80,18 +80,17 @@ class MEDIA_EXPORT AudioParameters { |
}; |
AudioParameters(); |
- AudioParameters(Format format, ChannelLayout channel_layout, |
- int sample_rate, int bits_per_sample, |
+ AudioParameters(Format format, |
+ ChannelLayout channel_layout, |
+ int sample_rate, |
+ int bits_per_sample, |
int frames_per_buffer); |
- AudioParameters(Format format, ChannelLayout channel_layout, |
- int sample_rate, int bits_per_sample, |
- int frames_per_buffer, int effects); |
- AudioParameters(Format format, ChannelLayout channel_layout, |
- int channels, int sample_rate, int bits_per_sample, |
- int frames_per_buffer, int effects); |
- |
- void Reset(Format format, ChannelLayout channel_layout, |
- int channels, int sample_rate, int bits_per_sample, |
+ |
+ // Re-initializes all members. |
+ void Reset(Format format, |
+ ChannelLayout channel_layout, |
+ int sample_rate, |
+ int bits_per_sample, |
int frames_per_buffer); |
// Checks that all values are in the expected range. All limits are specified |
@@ -118,25 +117,45 @@ class MEDIA_EXPORT AudioParameters { |
// Comparison with other AudioParams. |
bool Equals(const AudioParameters& other) const; |
+ void set_format(Format format) { format_ = format; } |
+ |
+ // The number of channels is usually computed from channel_layout_. Setting |
+ // this explictly is only required with CHANNEL_LAYOUT_DISCRETE. |
+ // |
+ // A setter for channel_layout_ is intentionally excluded. |
+ void set_channels_for_discrete(int channels) { |
+ DCHECK(channel_layout_ == CHANNEL_LAYOUT_DISCRETE || |
+ channels == ChannelLayoutToChannelCount(channel_layout_)); |
+ channels_ = channels; |
+ } |
+ |
+ void set_sample_rate(int sample_rate) { sample_rate_ = sample_rate; } |
+ |
+ void set_frames_per_buffer(int frames_per_buffer) { |
+ frames_per_buffer_ = frames_per_buffer; |
+ } |
+ |
+ void set_effects(int effects) { effects_ = effects; } |
+ |
Format format() const { return format_; } |
ChannelLayout channel_layout() const { return channel_layout_; } |
+ int channels() const { return channels_; } |
int sample_rate() const { return sample_rate_; } |
int bits_per_sample() const { return bits_per_sample_; } |
int frames_per_buffer() const { return frames_per_buffer_; } |
- int channels() const { return channels_; } |
int effects() const { return effects_; } |
+ AudioParameters(const AudioParameters&) = default; |
+ AudioParameters& operator=(const AudioParameters&) = default; |
+ |
private: |
- // These members are mutable to support entire struct assignment. They should |
- // not be mutated individually. |
Format format_; // Format of the stream. |
ChannelLayout channel_layout_; // Order of surround sound channels. |
+ int channels_; // Number of channels. Value set based on |
+ // |channel_layout|. |
int sample_rate_; // Sampling frequency/rate. |
int bits_per_sample_; // Number of bits per sample. |
int frames_per_buffer_; // Number of frames in a buffer. |
- |
- int channels_; // Number of channels. Value set based on |
- // |channel_layout|. |
int effects_; // Bitmask using PlatformEffectsMask. |
}; |