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/video_decoder_config.h" | 5 #include "media/base/video_decoder_config.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "media/base/media_util.h" |
10 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
11 #include "media/base/video_types.h" | 12 #include "media/base/video_types.h" |
12 | 13 |
13 namespace media { | 14 namespace media { |
14 | 15 |
15 VideoCodec VideoCodecProfileToVideoCodec(VideoCodecProfile profile) { | 16 VideoCodec VideoCodecProfileToVideoCodec(VideoCodecProfile profile) { |
16 switch (profile) { | 17 switch (profile) { |
17 case VIDEO_CODEC_PROFILE_UNKNOWN: | 18 case VIDEO_CODEC_PROFILE_UNKNOWN: |
18 return kUnknownVideoCodec; | 19 return kUnknownVideoCodec; |
19 case H264PROFILE_BASELINE: | 20 case H264PROFILE_BASELINE: |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 << natural_size().height() << "]" | 152 << natural_size().height() << "]" |
152 << " has extra data? " << (extra_data().empty() ? "false" : "true") | 153 << " has extra data? " << (extra_data().empty() ? "false" : "true") |
153 << " encrypted? " << (is_encrypted() ? "true" : "false"); | 154 << " encrypted? " << (is_encrypted() ? "true" : "false"); |
154 return s.str(); | 155 return s.str(); |
155 } | 156 } |
156 | 157 |
157 void VideoDecoderConfig::SetExtraData(const std::vector<uint8_t>& extra_data) { | 158 void VideoDecoderConfig::SetExtraData(const std::vector<uint8_t>& extra_data) { |
158 extra_data_ = extra_data; | 159 extra_data_ = extra_data; |
159 } | 160 } |
160 | 161 |
| 162 void VideoDecoderConfig::SetIsEncrypted(bool is_encrypted) { |
| 163 if (!is_encrypted) { |
| 164 DCHECK(encryption_scheme_.is_encrypted()) << "Config is already clear."; |
| 165 encryption_scheme_ = Unencrypted(); |
| 166 } else { |
| 167 DCHECK(!encryption_scheme_.is_encrypted()) |
| 168 << "Config is already encrypted."; |
| 169 // TODO(xhwang): This is only used to guide decoder selection, so set |
| 170 // a common encryption scheme that should be supported by all decrypting |
| 171 // decoders. We should be able to remove this when we support switching |
| 172 // decoders at run time. See http://crbug.com/695595 |
| 173 encryption_scheme_ = AesCtrEncryptionScheme(); |
| 174 } |
| 175 } |
| 176 |
161 } // namespace media | 177 } // namespace media |
OLD | NEW |