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

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

Issue 2503233003: Add enumerations for compressed (E)AC3 sample format (Closed)
Patch Set: Fix proto Created 4 years, 1 month 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 | « media/base/audio_buffer.cc ('k') | media/base/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_BASE_AUDIO_PARAMETERS_H_ 5 #ifndef MEDIA_BASE_AUDIO_PARAMETERS_H_
6 #define MEDIA_BASE_AUDIO_PARAMETERS_H_ 6 #define MEDIA_BASE_AUDIO_PARAMETERS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 int8_t audio[1]; 65 int8_t audio[1];
66 }; 66 };
67 67
68 class MEDIA_EXPORT AudioParameters { 68 class MEDIA_EXPORT AudioParameters {
69 public: 69 public:
70 // TODO(miu): Rename this enum to something that correctly reflects its 70 // TODO(miu): Rename this enum to something that correctly reflects its
71 // semantics, such as "TransportScheme." 71 // semantics, such as "TransportScheme."
72 enum Format { 72 enum Format {
73 AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples. 73 AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples.
74 AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested. 74 AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested.
75 AUDIO_BITSTREAM_AC3, // Compressed AC3 bitstream.
76 AUDIO_BITSTREAM_EAC3, // Compressed E-AC3 bitstream.
75 AUDIO_FAKE, // Creates a fake AudioOutputStream object. 77 AUDIO_FAKE, // Creates a fake AudioOutputStream object.
76 AUDIO_FORMAT_LAST = AUDIO_FAKE, // Only used for validation of format. 78 AUDIO_FORMAT_LAST = AUDIO_FAKE, // Only used for validation of format.
77 }; 79 };
78 80
79 enum { 81 enum {
80 // Telephone quality sample rate, mostly for speech-only audio. 82 // Telephone quality sample rate, mostly for speech-only audio.
81 kTelephoneSampleRate = 8000, 83 kTelephoneSampleRate = 8000,
82 // CD sampling rate is 44.1 KHz or conveniently 2x2x3x3x5x5x7x7. 84 // CD sampling rate is 44.1 KHz or conveniently 2x2x3x3x5x5x7x7.
83 kAudioCDSampleRate = 44100, 85 kAudioCDSampleRate = 44100,
84 }; 86 };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // can lead to audio/video sync drift. 134 // can lead to audio/video sync drift.
133 double GetMicrosecondsPerFrame() const; 135 double GetMicrosecondsPerFrame() const;
134 136
135 // Returns the duration of this buffer as calculated from frames_per_buffer() 137 // Returns the duration of this buffer as calculated from frames_per_buffer()
136 // and sample_rate(). 138 // and sample_rate().
137 base::TimeDelta GetBufferDuration() const; 139 base::TimeDelta GetBufferDuration() const;
138 140
139 // Comparison with other AudioParams. 141 // Comparison with other AudioParams.
140 bool Equals(const AudioParameters& other) const; 142 bool Equals(const AudioParameters& other) const;
141 143
144 // Return true if |format_| is compressed bitstream.
145 bool IsBitstreamFormat() const;
146
142 void set_format(Format format) { format_ = format; } 147 void set_format(Format format) { format_ = format; }
143 Format format() const { return format_; } 148 Format format() const { return format_; }
144 149
145 // A setter for channel_layout_ is intentionally excluded. 150 // A setter for channel_layout_ is intentionally excluded.
146 ChannelLayout channel_layout() const { return channel_layout_; } 151 ChannelLayout channel_layout() const { return channel_layout_; }
147 152
148 // The number of channels is usually computed from channel_layout_. Setting 153 // The number of channels is usually computed from channel_layout_. Setting
149 // this explictly is only required with CHANNEL_LAYOUT_DISCRETE. 154 // this explictly is only required with CHANNEL_LAYOUT_DISCRETE.
150 void set_channels_for_discrete(int channels) { 155 void set_channels_for_discrete(int channels) {
151 DCHECK(channel_layout_ == CHANNEL_LAYOUT_DISCRETE || 156 DCHECK(channel_layout_ == CHANNEL_LAYOUT_DISCRETE ||
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 if (a.sample_rate() != b.sample_rate()) 228 if (a.sample_rate() != b.sample_rate())
224 return a.sample_rate() < b.sample_rate(); 229 return a.sample_rate() < b.sample_rate();
225 if (a.bits_per_sample() != b.bits_per_sample()) 230 if (a.bits_per_sample() != b.bits_per_sample())
226 return a.bits_per_sample() < b.bits_per_sample(); 231 return a.bits_per_sample() < b.bits_per_sample();
227 return a.frames_per_buffer() < b.frames_per_buffer(); 232 return a.frames_per_buffer() < b.frames_per_buffer();
228 } 233 }
229 234
230 } // namespace media 235 } // namespace media
231 236
232 #endif // MEDIA_BASE_AUDIO_PARAMETERS_H_ 237 #endif // MEDIA_BASE_AUDIO_PARAMETERS_H_
OLDNEW
« no previous file with comments | « media/base/audio_buffer.cc ('k') | media/base/audio_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698