Chromium Code Reviews| 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" |
| 11 | 11 |
| 12 namespace media { | 12 namespace media { |
| 13 | 13 |
| 14 struct MEDIA_EXPORT AudioInputBufferParameters { | 14 struct MEDIA_EXPORT AudioInputBufferParameters { |
| 15 double volume; | 15 double volume; |
| 16 uint32 size; | 16 uint32 size; |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 // Use a struct-in-struct approach to ensure that we can calculate the required | 19 // Use a struct-in-struct approach to ensure that we can calculate the required |
| 20 // size as sizeof(AudioInputBufferParameters) + #(bytes in audio buffer) without | 20 // size as sizeof(AudioInputBufferParameters) + #(bytes in audio buffer) without |
| 21 // using packing. | 21 // using packing. |
| 22 struct MEDIA_EXPORT AudioInputBuffer { | 22 struct MEDIA_EXPORT AudioInputBuffer { |
| 23 AudioInputBufferParameters params; | 23 AudioInputBufferParameters params; |
| 24 int8 audio[1]; | 24 int8 audio[1]; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 class MEDIA_EXPORT AudioParameters { | 27 class MEDIA_EXPORT AudioParameters { |
| 28 public: | 28 public: |
| 29 enum Format { | 29 enum Format { |
|
miu
2012/11/22 00:53:50
Observation: Looks like this enum is polluted. It
justinlin
2012/11/26 20:19:20
Hmm, maybe Dale can comment on this?
DaleCurtis
2012/11/28 23:43:18
Yeah, eventually this could be something like NORM
| |
| 30 AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples. | 30 AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples. |
| 31 AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested. | 31 AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested. |
| 32 AUDIO_FAKE, // Creates a fake AudioOutputStream object. | 32 AUDIO_FAKE, // Creates a fake AudioOutputStream object. |
| 33 AUDIO_LAST_FORMAT // Only used for validation of format. | 33 AUDIO_WEB_CONTENTS, // Audio streams from a specific tab. |
|
miu
2012/11/22 00:53:50
Naming: Right now, this is browser-wide audio mirr
justinlin
2012/11/26 20:19:20
Done. How about AUDIO_MIRROR_BROWSER?
DaleCurtis
2012/11/28 23:43:18
I think this is an odd name and if you plan to use
justinlin
2012/11/29 10:08:33
Let's stick with nouns: AUDIO_VIRTUAL.
| |
| 34 AUDIO_LAST_FORMAT, // Only used for validation of format. | |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 enum { | 37 enum { |
| 37 // Telephone quality sample rate, mostly for speech-only audio. | 38 // Telephone quality sample rate, mostly for speech-only audio. |
| 38 kTelephoneSampleRate = 8000, | 39 kTelephoneSampleRate = 8000, |
| 39 // CD sampling rate is 44.1 KHz or conveniently 2x2x3x3x5x5x7x7. | 40 // CD sampling rate is 44.1 KHz or conveniently 2x2x3x3x5x5x7x7. |
| 40 kAudioCDSampleRate = 44100, | 41 kAudioCDSampleRate = 44100, |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 AudioParameters(); | 44 AudioParameters(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 if (a.sample_rate() != b.sample_rate()) | 89 if (a.sample_rate() != b.sample_rate()) |
| 89 return a.sample_rate() < b.sample_rate(); | 90 return a.sample_rate() < b.sample_rate(); |
| 90 if (a.bits_per_sample() != b.bits_per_sample()) | 91 if (a.bits_per_sample() != b.bits_per_sample()) |
| 91 return a.bits_per_sample() < b.bits_per_sample(); | 92 return a.bits_per_sample() < b.bits_per_sample(); |
| 92 return a.frames_per_buffer() < b.frames_per_buffer(); | 93 return a.frames_per_buffer() < b.frames_per_buffer(); |
| 93 } | 94 } |
| 94 | 95 |
| 95 } // namespace media | 96 } // namespace media |
| 96 | 97 |
| 97 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ | 98 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |
| OLD | NEW |