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 14 matching lines...) Expand all Loading... | |
25 }; | 25 }; |
26 | 26 |
27 // Telephone quality sample rate, mostly for speech-only audio. | 27 // Telephone quality sample rate, mostly for speech-only audio. |
28 static const uint32 kTelephoneSampleRate = 8000; | 28 static const uint32 kTelephoneSampleRate = 8000; |
29 // CD sampling rate is 44.1 KHz or conveniently 2x2x3x3x5x5x7x7. | 29 // CD sampling rate is 44.1 KHz or conveniently 2x2x3x3x5x5x7x7. |
30 static const uint32 kAudioCDSampleRate = 44100; | 30 static const uint32 kAudioCDSampleRate = 44100; |
31 // Digital Audio Tape sample rate. | 31 // Digital Audio Tape sample rate. |
32 static const uint32 kAudioDATSampleRate = 48000; | 32 static const uint32 kAudioDATSampleRate = 48000; |
33 | 33 |
34 AudioParameters(); | 34 AudioParameters(); |
35 AudioParameters(Format format, ChannelLayout channel_layout, | 35 AudioParameters(Format format, |
36 int sample_rate, int bits_per_sample, | 36 bool use_browser_mixer, |
scherkus (not reviewing)
2012/03/27 14:34:19
Is the only reason to have programmatic control ov
enal1
2012/03/27 15:12:01
yes, not having that flag is very lukrative sugges
scherkus (not reviewing)
2012/03/27 15:17:06
They are arguments that aren't based on any real w
enal1
2012/03/27 15:34:08
Arguments are "my code right now works reasonable,
| |
37 ChannelLayout channel_layout, | |
38 int sample_rate, | |
39 int bits_per_sample, | |
37 int frames_per_buffer); | 40 int frames_per_buffer); |
38 void Reset(Format format, ChannelLayout channel_layout, | 41 void Reset(Format format, |
39 int sample_rate, int bits_per_sample, | 42 bool use_browser_mixer, |
43 ChannelLayout channel_layout, | |
44 int sample_rate, | |
45 int bits_per_sample, | |
40 int frames_per_buffer); | 46 int frames_per_buffer); |
41 | 47 |
42 // Checks that all values are in the expected range. All limits are specified | 48 // Checks that all values are in the expected range. All limits are specified |
43 // in media::Limits. | 49 // in media::Limits. |
44 bool IsValid() const; | 50 bool IsValid() const; |
45 | 51 |
46 // Returns size of audio buffer in bytes. | 52 // Returns size of audio buffer in bytes. |
47 int GetBytesPerBuffer() const; | 53 int GetBytesPerBuffer() const; |
48 | 54 |
49 // Returns the number of bytes representing one second of audio. | 55 // Returns the number of bytes representing one second of audio. |
50 int GetBytesPerSecond() const; | 56 int GetBytesPerSecond() const; |
51 | 57 |
52 // Returns the number of bytes representing a frame of audio. | 58 // Returns the number of bytes representing a frame of audio. |
53 int GetBytesPerFrame() const; | 59 int GetBytesPerFrame() const; |
54 | 60 |
55 Format format() const { return format_; } | 61 Format format() const { return format_; } |
56 ChannelLayout channel_layout() const { return channel_layout_; } | 62 ChannelLayout channel_layout() const { return channel_layout_; } |
57 int sample_rate() const { return sample_rate_; } | 63 int sample_rate() const { return sample_rate_; } |
58 int bits_per_sample() const { return bits_per_sample_; } | 64 int bits_per_sample() const { return bits_per_sample_; } |
59 int frames_per_buffer() const { return frames_per_buffer_; } | 65 int frames_per_buffer() const { return frames_per_buffer_; } |
60 int channels() const { return channels_; } | 66 int channels() const { return channels_; } |
67 bool use_browser_mixer() const { return use_browser_mixer_; } | |
61 | 68 |
62 private: | 69 private: |
63 Format format_; // Format of the stream. | 70 Format format_; // Format of the stream. |
71 bool use_browser_mixer_; // Should we use browser-side or operating | |
72 // system audio mixer. | |
64 ChannelLayout channel_layout_; // Order of surround sound channels. | 73 ChannelLayout channel_layout_; // Order of surround sound channels. |
65 int sample_rate_; // Sampling frequency/rate. | 74 int sample_rate_; // Sampling frequency/rate. |
66 int bits_per_sample_; // Number of bits per sample. | 75 int bits_per_sample_; // Number of bits per sample. |
67 int frames_per_buffer_; // Number of frames in a buffer. | 76 int frames_per_buffer_; // Number of frames in a buffer. |
68 | 77 |
69 int channels_; // Number of channels. Value set based on | 78 int channels_; // Number of channels. Value set based on |
70 // |channel_layout|. | 79 // |channel_layout|. |
71 }; | 80 }; |
72 | 81 |
73 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ | 82 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |
OLD | NEW |