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_BASE_AUDIO_DECODER_CONFIG_H_ | 5 #ifndef MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ |
6 #define MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ | 6 #define MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "media/base/channel_layout.h" | 10 #include "media/base/channel_layout.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 const uint8* extra_data, size_t extra_data_size, | 58 const uint8* extra_data, size_t extra_data_size, |
59 bool record_stats); | 59 bool record_stats); |
60 | 60 |
61 // Deep copies |audio_config|. | 61 // Deep copies |audio_config|. |
62 void CopyFrom(const AudioDecoderConfig& audio_config); | 62 void CopyFrom(const AudioDecoderConfig& audio_config); |
63 | 63 |
64 // Returns true if this object has appropriate configuration values, false | 64 // Returns true if this object has appropriate configuration values, false |
65 // otherwise. | 65 // otherwise. |
66 bool IsValidConfig() const; | 66 bool IsValidConfig() const; |
67 | 67 |
| 68 // Returns true if all fields in |config| match this config. |
| 69 // Note: The contents of |extra_data_| are compared not the raw pointers. |
| 70 bool Matches(const AudioDecoderConfig& config) const; |
| 71 |
68 AudioCodec codec() const; | 72 AudioCodec codec() const; |
69 int bits_per_channel() const; | 73 int bits_per_channel() const; |
70 ChannelLayout channel_layout() const; | 74 ChannelLayout channel_layout() const; |
71 int samples_per_second() const; | 75 int samples_per_second() const; |
72 | 76 |
73 // Optional byte data required to initialize audio decoders such as Vorbis | 77 // Optional byte data required to initialize audio decoders such as Vorbis |
74 // codebooks. | 78 // codebooks. |
75 uint8* extra_data() const; | 79 uint8* extra_data() const; |
76 size_t extra_data_size() const; | 80 size_t extra_data_size() const; |
77 | 81 |
78 private: | 82 private: |
79 AudioCodec codec_; | 83 AudioCodec codec_; |
80 int bits_per_channel_; | 84 int bits_per_channel_; |
81 ChannelLayout channel_layout_; | 85 ChannelLayout channel_layout_; |
82 int samples_per_second_; | 86 int samples_per_second_; |
83 | 87 |
84 scoped_array<uint8> extra_data_; | 88 scoped_array<uint8> extra_data_; |
85 size_t extra_data_size_; | 89 size_t extra_data_size_; |
86 | 90 |
87 DISALLOW_COPY_AND_ASSIGN(AudioDecoderConfig); | 91 DISALLOW_COPY_AND_ASSIGN(AudioDecoderConfig); |
88 }; | 92 }; |
89 | 93 |
90 } // namespace media | 94 } // namespace media |
91 | 95 |
92 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ | 96 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ |
OLD | NEW |