OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ |
| 6 #define MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "media/base/channel_layout.h" |
| 11 #include "media/base/media_export.h" |
| 12 |
| 13 namespace media { |
| 14 |
| 15 enum AudioCodec { |
| 16 kUnknownAudioCodec, |
| 17 kCodecAAC, |
| 18 kCodecMP3, |
| 19 kCodecPCM, |
| 20 kCodecVorbis, |
| 21 |
| 22 // DO NOT ADD RANDOM AUDIO CODECS! |
| 23 // |
| 24 // The only acceptable time to add a new codec is if there is production code |
| 25 // that uses said codec in the same CL. |
| 26 }; |
| 27 |
| 28 class MEDIA_EXPORT AudioDecoderConfig { |
| 29 public: |
| 30 // Constructs an uninitialized object. Clients should call Initialize() with |
| 31 // appropriate values before using. |
| 32 AudioDecoderConfig(); |
| 33 |
| 34 // Constructs an initialized object. It is acceptable to pass in NULL for |
| 35 // |extra_data|, otherwise the memory is copied. |
| 36 AudioDecoderConfig(AudioCodec codec, int bits_per_channel, |
| 37 ChannelLayout channel_layout, int sample_rate, |
| 38 const uint8* extra_data, size_t extra_data_size); |
| 39 |
| 40 ~AudioDecoderConfig(); |
| 41 |
| 42 // Resets the internal state of this object. |
| 43 void Initialize(AudioCodec codec, int bits_per_channel, |
| 44 ChannelLayout channel_layout, int sample_rate, |
| 45 const uint8* extra_data, size_t extra_data_size); |
| 46 |
| 47 // Returns true if this object has appropriate configuration values, false |
| 48 // otherwise. |
| 49 bool IsValidConfig() const; |
| 50 |
| 51 AudioCodec codec() const; |
| 52 int bits_per_channel() const; |
| 53 ChannelLayout channel_layout() const; |
| 54 int sample_rate() const; |
| 55 |
| 56 // Optional byte data required to initialize audio decoders such as Vorbis |
| 57 // codebooks. |
| 58 uint8* extra_data() const; |
| 59 size_t extra_data_size() const; |
| 60 |
| 61 private: |
| 62 AudioCodec codec_; |
| 63 int bits_per_channel_; |
| 64 ChannelLayout channel_layout_; |
| 65 int sample_rate_; |
| 66 |
| 67 scoped_array<uint8> extra_data_; |
| 68 size_t extra_data_size_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(AudioDecoderConfig); |
| 71 }; |
| 72 |
| 73 } // namespace media |
| 74 |
| 75 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ |
OLD | NEW |