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 #include "media/base/audio_decoder_config.h" | 5 #include "media/base/audio_decoder_config.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/limits.h" | 8 #include "media/base/limits.h" |
| 9 #include "media/base/media_util.h" |
9 | 10 |
10 namespace media { | 11 namespace media { |
11 | 12 |
12 AudioDecoderConfig::AudioDecoderConfig() | 13 AudioDecoderConfig::AudioDecoderConfig() |
13 : codec_(kUnknownAudioCodec), | 14 : codec_(kUnknownAudioCodec), |
14 sample_format_(kUnknownSampleFormat), | 15 sample_format_(kUnknownSampleFormat), |
15 bytes_per_channel_(0), | 16 bytes_per_channel_(0), |
16 channel_layout_(CHANNEL_LAYOUT_UNSUPPORTED), | 17 channel_layout_(CHANNEL_LAYOUT_UNSUPPORTED), |
17 samples_per_second_(0), | 18 samples_per_second_(0), |
18 bytes_per_frame_(0), | 19 bytes_per_frame_(0), |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 << " samples_per_second: " << samples_per_second() | 89 << " samples_per_second: " << samples_per_second() |
89 << " sample_format: " << sample_format() | 90 << " sample_format: " << sample_format() |
90 << " bytes_per_frame: " << bytes_per_frame() | 91 << " bytes_per_frame: " << bytes_per_frame() |
91 << " seek_preroll: " << seek_preroll().InMilliseconds() << "ms" | 92 << " seek_preroll: " << seek_preroll().InMilliseconds() << "ms" |
92 << " codec_delay: " << codec_delay() << " has extra data? " | 93 << " codec_delay: " << codec_delay() << " has extra data? " |
93 << (extra_data().empty() ? "false" : "true") << " encrypted? " | 94 << (extra_data().empty() ? "false" : "true") << " encrypted? " |
94 << (is_encrypted() ? "true" : "false"); | 95 << (is_encrypted() ? "true" : "false"); |
95 return s.str(); | 96 return s.str(); |
96 } | 97 } |
97 | 98 |
| 99 void AudioDecoderConfig::SetIsEncrypted(bool is_encrypted) { |
| 100 if (!is_encrypted) { |
| 101 DCHECK(encryption_scheme_.is_encrypted()) << "Config is already clear."; |
| 102 encryption_scheme_ = Unencrypted(); |
| 103 } else { |
| 104 DCHECK(!encryption_scheme_.is_encrypted()) |
| 105 << "Config is already encrypted."; |
| 106 // TODO(xhwang): This is only used to guide decoder selection, so set |
| 107 // a common encryption scheme that should be supported by all decrypting |
| 108 // decoders. We should be able to remove this when we support switching |
| 109 // decoders at run time. See http://crbug.com/695595 |
| 110 encryption_scheme_ = AesCtrEncryptionScheme(); |
| 111 } |
| 112 } |
| 113 |
98 } // namespace media | 114 } // namespace media |
OLD | NEW |