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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class MEDIA_EXPORT AudioDecoderConfig { | 44 class MEDIA_EXPORT AudioDecoderConfig { |
45 public: | 45 public: |
46 // Constructs an uninitialized object. Clients should call Initialize() with | 46 // Constructs an uninitialized object. Clients should call Initialize() with |
47 // appropriate values before using. | 47 // appropriate values before using. |
48 AudioDecoderConfig(); | 48 AudioDecoderConfig(); |
49 | 49 |
50 // Constructs an initialized object. It is acceptable to pass in NULL for | 50 // Constructs an initialized object. It is acceptable to pass in NULL for |
51 // |extra_data|, otherwise the memory is copied. | 51 // |extra_data|, otherwise the memory is copied. |
52 AudioDecoderConfig(AudioCodec codec, int bits_per_channel, | 52 AudioDecoderConfig(AudioCodec codec, int bits_per_channel, |
53 ChannelLayout channel_layout, int samples_per_second, | 53 ChannelLayout channel_layout, int samples_per_second, |
54 const uint8* extra_data, size_t extra_data_size); | 54 const uint8* extra_data, size_t extra_data_size, |
| 55 bool is_encrypted); |
55 | 56 |
56 ~AudioDecoderConfig(); | 57 ~AudioDecoderConfig(); |
57 | 58 |
58 // Resets the internal state of this object. | 59 // Resets the internal state of this object. |
59 void Initialize(AudioCodec codec, int bits_per_channel, | 60 void Initialize(AudioCodec codec, int bits_per_channel, |
60 ChannelLayout channel_layout, int samples_per_second, | 61 ChannelLayout channel_layout, int samples_per_second, |
61 const uint8* extra_data, size_t extra_data_size, | 62 const uint8* extra_data, size_t extra_data_size, |
| 63 bool is_encrypted, |
62 bool record_stats); | 64 bool record_stats); |
63 | 65 |
64 // Deep copies |audio_config|. | 66 // Deep copies |audio_config|. |
65 void CopyFrom(const AudioDecoderConfig& audio_config); | 67 void CopyFrom(const AudioDecoderConfig& audio_config); |
66 | 68 |
67 // Returns true if this object has appropriate configuration values, false | 69 // Returns true if this object has appropriate configuration values, false |
68 // otherwise. | 70 // otherwise. |
69 bool IsValidConfig() const; | 71 bool IsValidConfig() const; |
70 | 72 |
71 // Returns true if all fields in |config| match this config. | 73 // Returns true if all fields in |config| match this config. |
72 // Note: The contents of |extra_data_| are compared not the raw pointers. | 74 // Note: The contents of |extra_data_| are compared not the raw pointers. |
73 bool Matches(const AudioDecoderConfig& config) const; | 75 bool Matches(const AudioDecoderConfig& config) const; |
74 | 76 |
75 AudioCodec codec() const; | 77 AudioCodec codec() const; |
76 int bits_per_channel() const; | 78 int bits_per_channel() const; |
77 ChannelLayout channel_layout() const; | 79 ChannelLayout channel_layout() const; |
78 int samples_per_second() const; | 80 int samples_per_second() const; |
79 | 81 |
80 // Optional byte data required to initialize audio decoders such as Vorbis | 82 // Optional byte data required to initialize audio decoders such as Vorbis |
81 // codebooks. | 83 // codebooks. |
82 uint8* extra_data() const; | 84 uint8* extra_data() const; |
83 size_t extra_data_size() const; | 85 size_t extra_data_size() const; |
84 | 86 |
| 87 // Whether the audio stream is potentially encrypted. |
| 88 // Note that in a potentially encrypted audio stream, individual buffers |
| 89 // can be encrypted or not encrypted. |
| 90 bool is_encrypted() const; |
| 91 |
85 private: | 92 private: |
86 AudioCodec codec_; | 93 AudioCodec codec_; |
87 int bits_per_channel_; | 94 int bits_per_channel_; |
88 ChannelLayout channel_layout_; | 95 ChannelLayout channel_layout_; |
89 int samples_per_second_; | 96 int samples_per_second_; |
90 | 97 |
91 scoped_array<uint8> extra_data_; | 98 scoped_array<uint8> extra_data_; |
92 size_t extra_data_size_; | 99 size_t extra_data_size_; |
93 | 100 |
| 101 bool is_encrypted_; |
| 102 |
94 DISALLOW_COPY_AND_ASSIGN(AudioDecoderConfig); | 103 DISALLOW_COPY_AND_ASSIGN(AudioDecoderConfig); |
95 }; | 104 }; |
96 | 105 |
97 } // namespace media | 106 } // namespace media |
98 | 107 |
99 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ | 108 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ |
OLD | NEW |