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 "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/media_export.h" | 10 #include "media/base/media_export.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 struct SubsampleEntry { | |
15 int clear_bytes; | |
16 int cypher_bytes; | |
17 }; | |
18 | |
14 // Contains all information that a decryptor needs to decrypt. | 19 // Contains all information that a decryptor needs to decrypt. |
15 class MEDIA_EXPORT DecryptConfig { | 20 class MEDIA_EXPORT DecryptConfig { |
16 public: | 21 public: |
17 explicit DecryptConfig(const uint8* key_id, int key_id_size); | 22 DecryptConfig(const uint8* key_id, int key_id_size, |
ddorwin
2012/06/26 06:09:19
Do we really need two constructors - there is a lo
fgalligan1
2012/06/27 00:28:36
For WebM we will also be adding the HMAC parameter
strobe_
2012/06/27 02:01:21
Done.
| |
23 const uint8* iv, int iv_size); | |
24 DecryptConfig(const uint8* key_id, int key_id_size, | |
25 const uint8* iv, int iv_size, | |
26 const SubsampleEntry* subsamples, int subsample_count); | |
27 | |
28 // TODO(strobe): This constructor implicitly sets CBC mode and uses a default | |
29 // IV, to preserve compatibility with an early implementation. It should be | |
30 // removed, along with CBC mode and the default IV, when | |
31 // https://chromiumcodereview.appspot.com/10535029 lands. | |
32 DecryptConfig(const uint8* key_id, int key_id_size); | |
33 | |
18 ~DecryptConfig(); | 34 ~DecryptConfig(); |
19 | 35 |
20 const uint8* key_id() const { return key_id_.get(); } | 36 const uint8* key_id() const { return key_id_.get(); } |
21 int key_id_size() const { return key_id_size_; } | 37 int key_id_size() const { return key_id_size_; } |
38 const uint8* iv() const { return iv_.get(); } | |
39 int iv_size() const { return iv_size_; } | |
40 const SubsampleEntry* subsamples() const { return subsamples_.get(); } | |
ddorwin
2012/06/26 06:09:19
Any reason not to return and store these as a vect
strobe_
2012/06/27 02:01:21
Done.
| |
41 int subsample_count() const { return subsample_count_; } | |
42 bool use_cbc() const { return use_cbc_; } | |
43 | |
44 SubsampleEntry* mutable_subsamples() { return subsamples_.get(); } | |
ddorwin
2012/06/26 06:09:19
I'm wondering why this is necessary.
strobe_
2012/06/27 02:01:21
Addressed in later comments. Can either:
- Allow u
| |
22 | 45 |
23 private: | 46 private: |
24 scoped_array<uint8> key_id_; | 47 scoped_array<uint8> key_id_; |
25 int key_id_size_; | 48 int key_id_size_; |
49 scoped_array<uint8> iv_; | |
50 int iv_size_; | |
51 scoped_array<SubsampleEntry> subsamples_; | |
52 int subsample_count_; | |
53 // TODO(strobe): Remove when CBC is no longer used. | |
54 bool use_cbc_; | |
26 | 55 |
27 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); | 56 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); |
28 }; | 57 }; |
29 | 58 |
30 } // namespace media | 59 } // namespace media |
31 | 60 |
32 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ | 61 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ |
OLD | NEW |