OLD | NEW |
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 "media/base/channel_layout.h" | 9 #include "media/base/channel_layout.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 ChannelLayout channel_layout() const { return channel_layout_; } | 72 ChannelLayout channel_layout() const { return channel_layout_; } |
73 int sample_rate() const { return sample_rate_; } | 73 int sample_rate() const { return sample_rate_; } |
74 int bits_per_sample() const { return bits_per_sample_; } | 74 int bits_per_sample() const { return bits_per_sample_; } |
75 int frames_per_buffer() const { return frames_per_buffer_; } | 75 int frames_per_buffer() const { return frames_per_buffer_; } |
76 int channels() const { return channels_; } | 76 int channels() const { return channels_; } |
77 int input_channels() const { return input_channels_; } | 77 int input_channels() const { return input_channels_; } |
78 | 78 |
79 // Set to CHANNEL_LAYOUT_DISCRETE with given number of channels. | 79 // Set to CHANNEL_LAYOUT_DISCRETE with given number of channels. |
80 void SetDiscreteChannels(int channels); | 80 void SetDiscreteChannels(int channels); |
81 | 81 |
| 82 // Comparison with other AudioParams. |
| 83 bool operator==(const AudioParameters& other) const { |
| 84 return format_ == other.format() && |
| 85 channel_layout_ == other.channel_layout() && |
| 86 channels_ == other.channels() && |
| 87 input_channels_ == other.input_channels() && |
| 88 bits_per_sample_ == other.bits_per_sample() && |
| 89 frames_per_buffer_ == other.frames_per_buffer(); |
| 90 } |
| 91 |
82 private: | 92 private: |
83 Format format_; // Format of the stream. | 93 Format format_; // Format of the stream. |
84 ChannelLayout channel_layout_; // Order of surround sound channels. | 94 ChannelLayout channel_layout_; // Order of surround sound channels. |
85 int sample_rate_; // Sampling frequency/rate. | 95 int sample_rate_; // Sampling frequency/rate. |
86 int bits_per_sample_; // Number of bits per sample. | 96 int bits_per_sample_; // Number of bits per sample. |
87 int frames_per_buffer_; // Number of frames in a buffer. | 97 int frames_per_buffer_; // Number of frames in a buffer. |
88 | 98 |
89 int channels_; // Number of channels. Value set based on | 99 int channels_; // Number of channels. Value set based on |
90 // |channel_layout|. | 100 // |channel_layout|. |
91 int input_channels_; // Optional number of input channels. | 101 int input_channels_; // Optional number of input channels. |
(...skipping 12 matching lines...) Expand all Loading... |
104 if (a.sample_rate() != b.sample_rate()) | 114 if (a.sample_rate() != b.sample_rate()) |
105 return a.sample_rate() < b.sample_rate(); | 115 return a.sample_rate() < b.sample_rate(); |
106 if (a.bits_per_sample() != b.bits_per_sample()) | 116 if (a.bits_per_sample() != b.bits_per_sample()) |
107 return a.bits_per_sample() < b.bits_per_sample(); | 117 return a.bits_per_sample() < b.bits_per_sample(); |
108 return a.frames_per_buffer() < b.frames_per_buffer(); | 118 return a.frames_per_buffer() < b.frames_per_buffer(); |
109 } | 119 } |
110 | 120 |
111 } // namespace media | 121 } // namespace media |
112 | 122 |
113 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ | 123 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |
OLD | NEW |