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

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

Issue 7796033: Replace AudioDecoderConfig with simple accessors on AudioDecoder. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase Created 9 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/audio_renderer_impl.cc ('k') | media/audio/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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/audio_decoder_config.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 struct MEDIA_EXPORT AudioParameters { 12 struct MEDIA_EXPORT AudioParameters {
13 // Compare is useful when AudioParameters is used as a key in std::map. 13 // Compare is useful when AudioParameters is used as a key in std::map.
14 class MEDIA_EXPORT Compare { 14 class MEDIA_EXPORT Compare {
15 public: 15 public:
16 bool operator()(const AudioParameters& a, const AudioParameters& b) const; 16 bool operator()(const AudioParameters& a, const AudioParameters& b) const;
17 }; 17 };
18 18
19 enum Format { 19 enum Format {
20 AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples. 20 AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples.
21 AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested. 21 AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested.
22 AUDIO_MOCK, // Creates a dummy AudioOutputStream object. 22 AUDIO_MOCK, // Creates a dummy AudioOutputStream object.
23 AUDIO_LAST_FORMAT // Only used for validation of format.y 23 AUDIO_LAST_FORMAT // Only used for validation of format.y
24 }; 24 };
25 25
26 // Telephone quality sample rate, mostly for speech-only audio. 26 // Telephone quality sample rate, mostly for speech-only audio.
27 static const uint32 kTelephoneSampleRate = 8000; 27 static const uint32 kTelephoneSampleRate = 8000;
28 // CD sampling rate is 44.1 KHz or conveniently 2x2x3x3x5x5x7x7. 28 // CD sampling rate is 44.1 KHz or conveniently 2x2x3x3x5x5x7x7.
29 static const uint32 kAudioCDSampleRate = 44100; 29 static const uint32 kAudioCDSampleRate = 44100;
30 // Digital Audio Tape sample rate. 30 // Digital Audio Tape sample rate.
31 static const uint32 kAudioDATSampleRate = 48000; 31 static const uint32 kAudioDATSampleRate = 48000;
32 32
33 AudioParameters(); 33 AudioParameters();
34
35 explicit AudioParameters(const media::AudioDecoderConfig& config);
36
37 AudioParameters(Format format, ChannelLayout channel_layout, int sample_rate, 34 AudioParameters(Format format, ChannelLayout channel_layout, int sample_rate,
38 int bits_per_sample, int samples_per_packet); 35 int bits_per_sample, int samples_per_packet);
39 36
40 // Checks that all values are in the expected range. All limits are specified 37 // Checks that all values are in the expected range. All limits are specified
41 // in media::Limits. 38 // in media::Limits.
42 bool IsValid() const; 39 bool IsValid() const;
43 40
44 // Returns size of audio packets in bytes. 41 // Returns size of audio packets in bytes.
45 int GetPacketSize() const; 42 int GetPacketSize() const;
46 43
47 // Returns the number of bytes representing one second of audio. 44 // Returns the number of bytes representing one second of audio.
48 int GetBytesPerSecond() const; 45 int GetBytesPerSecond() const;
49 46
50 Format format; // Format of the stream. 47 Format format; // Format of the stream.
51 ChannelLayout channel_layout; // Order of surround sound channels. 48 ChannelLayout channel_layout; // Order of surround sound channels.
52 int sample_rate; // Sampling frequency/rate. 49 int sample_rate; // Sampling frequency/rate.
53 int bits_per_sample; // Number of bits per sample. 50 int bits_per_sample; // Number of bits per sample.
54 int samples_per_packet; // Size of a packet in frames. 51 int samples_per_packet; // Size of a packet in frames.
55 52
56 int channels; // Number of channels. Value set based on 53 int channels; // Number of channels. Value set based on
57 // |channel_layout|. 54 // |channel_layout|.
58 }; 55 };
59 56
60 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ 57 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_
OLDNEW
« no previous file with comments | « content/renderer/media/audio_renderer_impl.cc ('k') | media/audio/audio_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698