diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 23:18:48 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 23:18:48 +0000 |
commit | 2f6d086da79c737bc2a0ee3023ca80c608c75d19 (patch) | |
tree | 6943204cb1c9c7d7cbe722f91a64a1c326601fef /media/audio/audio_parameters.h | |
parent | 87949cc2b85979964ca9de9483ba1ba2758e0b81 (diff) | |
download | chromium_src-2f6d086da79c737bc2a0ee3023ca80c608c75d19.zip chromium_src-2f6d086da79c737bc2a0ee3023ca80c608c75d19.tar.gz chromium_src-2f6d086da79c737bc2a0ee3023ca80c608c75d19.tar.bz2 |
Add AudioParameters struct. Use it everywhere.
BUG=None
TEST=unittests
Review URL: http://codereview.chromium.org/3226012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58097 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_parameters.h')
-rw-r--r-- | media/audio/audio_parameters.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/media/audio/audio_parameters.h b/media/audio/audio_parameters.h new file mode 100644 index 0000000..b7b8ae5 --- /dev/null +++ b/media/audio/audio_parameters.h @@ -0,0 +1,38 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MEDIA_AUDIO_AUDIO_PARAMETERS_H_ +#define MEDIA_AUDIO_AUDIO_PARAMETERS_H_ + +#include "base/basictypes.h" + +struct AudioParameters { + enum Format { + AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples. + AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested. + AUDIO_MOCK, // Creates a dummy AudioOutputStream object. + AUDIO_LAST_FORMAT // Only used for validation of format. + }; + + // Telephone quality sample rate, mostly for speech-only audio. + static const uint32 kTelephoneSampleRate = 8000; + // CD sampling rate is 44.1 KHz or conveniently 2x2x3x3x5x5x7x7. + static const uint32 kAudioCDSampleRate = 44100; + // Digital Audio Tape sample rate. + static const uint32 kAudioDATSampleRate = 48000; + + AudioParameters(); + + AudioParameters(Format format, int channels, + int sample_rate, int bits_per_sample); + + bool IsValid() const; + + Format format; // Format of the stream. + int channels; // Number of channels. + int sample_rate; // Sampling frequency/rate. + int bits_per_sample; // Number of bits per sample. +}; + +#endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |