Chromium Code Reviews| 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_DECRYPT_CONFIG_H_ | 5 #ifndef MEDIA_BASE_DECRYPT_CONFIG_H_ |
| 6 #define MEDIA_BASE_DECRYPT_CONFIG_H_ | 6 #define MEDIA_BASE_DECRYPT_CONFIG_H_ |
| 7 | 7 |
| 8 #include <vector> | |
|
xhwang
2012/06/27 19:37:43
nit: usually we have empty line after including c+
strobe_
2012/07/13 00:47:07
Done.
strobe_
2012/07/13 00:47:07
Done.
| |
| 8 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
| 11 | 12 |
| 12 namespace media { | 13 namespace media { |
| 13 | 14 |
| 15 struct SubsampleEntry { | |
| 16 int clear_bytes; | |
| 17 int cypher_bytes; | |
| 18 }; | |
| 19 | |
|
xhwang
2012/06/27 19:37:43
Can we have more docs on this? Ideally, people sho
ddorwin
2012/07/03 21:03:47
Docs on what? DecryptConfig, the parameters, or CE
xhwang
2012/07/03 21:17:12
About SubsampleEntry.
strobe_
2012/07/13 00:47:07
Done.
| |
| 14 // Contains all information that a decryptor needs to decrypt. | 20 // Contains all information that a decryptor needs to decrypt. |
| 15 class MEDIA_EXPORT DecryptConfig { | 21 class MEDIA_EXPORT DecryptConfig { |
| 16 public: | 22 public: |
| 17 explicit DecryptConfig(const uint8* key_id, int key_id_size); | 23 DecryptConfig(const uint8* key_id, int key_id_size, |
| 24 const uint8* iv, int iv_size, | |
| 25 const SubsampleEntry* subsamples, int subsample_count); | |
|
xhwang
2012/06/27 19:37:43
Can we just pass const std::vector<SubsampleEntry>
ddorwin
2012/07/03 21:03:47
Agreed, especially since we store and return it as
strobe_
2012/07/13 00:47:07
Done.
| |
| 26 | |
| 27 // TODO(strobe): This constructor implicitly sets CBC mode and uses a default | |
| 28 // IV, to preserve compatibility with an early implementation. It should be | |
| 29 // removed, along with CBC mode and the default IV, when | |
| 30 // https://chromiumcodereview.appspot.com/10535029 lands. | |
| 31 DecryptConfig(const uint8* key_id, int key_id_size); | |
| 32 | |
| 18 ~DecryptConfig(); | 33 ~DecryptConfig(); |
| 19 | 34 |
| 20 const uint8* key_id() const { return key_id_.get(); } | 35 const uint8* key_id() const { return key_id_.get(); } |
| 21 int key_id_size() const { return key_id_size_; } | 36 int key_id_size() const { return key_id_size_; } |
| 37 const uint8* iv() const { return iv_.get(); } | |
| 38 int iv_size() const { return iv_size_; } | |
|
xhwang
2012/06/27 19:37:43
We have a plan to replace scoped_array with std::s
| |
| 39 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } | |
| 40 bool use_cbc() const { return use_cbc_; } | |
| 41 | |
| 42 std::vector<SubsampleEntry>* mutable_subsamples() { return &subsamples_; } | |
| 22 | 43 |
| 23 private: | 44 private: |
| 24 scoped_array<uint8> key_id_; | 45 scoped_array<uint8> key_id_; |
| 25 int key_id_size_; | 46 int key_id_size_; |
| 47 scoped_array<uint8> iv_; | |
| 48 int iv_size_; | |
| 49 std::vector<SubsampleEntry> subsamples_; | |
| 50 // TODO(strobe): Remove when CBC is no longer used. | |
| 51 bool use_cbc_; | |
| 26 | 52 |
| 27 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); | 53 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); |
| 28 }; | 54 }; |
| 29 | 55 |
| 30 } // namespace media | 56 } // namespace media |
| 31 | 57 |
| 32 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ | 58 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ |
| OLD | NEW |