| 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/decrypt_config.h" | 5 #include "media/base/decrypt_config.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace media { | 9 namespace media { |
| 10 | 10 |
| 11 // TODO(strobe): Remove along with CBC mode. |
| 12 static const char kDefaultIv[] = "0000000000000000"; |
| 13 |
| 11 DecryptConfig::DecryptConfig(const uint8* key_id, int key_id_size) | 14 DecryptConfig::DecryptConfig(const uint8* key_id, int key_id_size) |
| 12 : key_id_size_(key_id_size) { | 15 : key_id_size_(key_id_size), |
| 16 iv_(kDefaultIv), |
| 17 use_cbc_(true) { |
| 13 CHECK_GT(key_id_size, 0); | 18 CHECK_GT(key_id_size, 0); |
| 14 key_id_.reset(new uint8[key_id_size]); | 19 key_id_.reset(new uint8[key_id_size]); |
| 15 memcpy(key_id_.get(), key_id, key_id_size); | 20 memcpy(key_id_.get(), key_id, key_id_size); |
| 21 } |
| 22 |
| 23 DecryptConfig::DecryptConfig(const uint8* key_id, int key_id_size, |
| 24 const std::string& iv, |
| 25 const std::vector<SubsampleEntry>& subsamples) |
| 26 : key_id_size_(key_id_size), |
| 27 iv_(iv), |
| 28 subsamples_(subsamples), |
| 29 use_cbc_(false) { |
| 30 CHECK_GT(key_id_size, 0); |
| 31 key_id_.reset(new uint8[key_id_size]); |
| 32 memcpy(key_id_.get(), key_id, key_id_size); |
| 16 } | 33 } |
| 17 | 34 |
| 18 DecryptConfig::~DecryptConfig() {} | 35 DecryptConfig::~DecryptConfig() {} |
| 19 | 36 |
| 20 } // namespace media | 37 } // namespace media |
| OLD | NEW |