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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // Contains all information that a decryptor needs to decrypt a media sample. | 31 // Contains all information that a decryptor needs to decrypt a media sample. |
32 class MEDIA_EXPORT DecryptConfig { | 32 class MEDIA_EXPORT DecryptConfig { |
33 public: | 33 public: |
34 // Keys are always 128 bits. | 34 // Keys are always 128 bits. |
35 static const int kDecryptionKeySize = 16; | 35 static const int kDecryptionKeySize = 16; |
36 | 36 |
37 // |key_id| is the ID that references the decryption key for this sample. | 37 // |key_id| is the ID that references the decryption key for this sample. |
38 // |iv| is the initialization vector defined by the encrypted format. | 38 // |iv| is the initialization vector defined by the encrypted format. |
39 // Currently |iv| must be 16 bytes as defined by WebM and ISO. Or must be | 39 // Currently |iv| must be 16 bytes as defined by WebM and ISO. Or must be |
40 // empty which signals an unencrypted frame. | 40 // empty which signals an unencrypted frame. |
41 // |data_offset| is the amount of data that should be discarded from the | |
42 // head of the sample buffer before applying subsample information. A | |
43 // decrypted buffer will be shorter than an encrypted buffer by this amount. | |
44 // |subsamples| defines the clear and encrypted portions of the sample as | 41 // |subsamples| defines the clear and encrypted portions of the sample as |
45 // described above. A decrypted buffer will be equal in size to the sum | 42 // described above. A decrypted buffer will be equal in size to the sum |
46 // of the subsample sizes. | 43 // of the subsample sizes. |
47 // | |
48 // |data_offset| is applied before |subsamples|. | |
49 DecryptConfig(const std::string& key_id, | 44 DecryptConfig(const std::string& key_id, |
50 const std::string& iv, | 45 const std::string& iv, |
51 const int data_offset, | |
52 const std::vector<SubsampleEntry>& subsamples); | 46 const std::vector<SubsampleEntry>& subsamples); |
53 ~DecryptConfig(); | 47 ~DecryptConfig(); |
54 | 48 |
55 const std::string& key_id() const { return key_id_; } | 49 const std::string& key_id() const { return key_id_; } |
56 const std::string& iv() const { return iv_; } | 50 const std::string& iv() const { return iv_; } |
57 int data_offset() const { return data_offset_; } | |
58 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } | 51 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } |
59 | 52 |
60 private: | 53 private: |
61 const std::string key_id_; | 54 const std::string key_id_; |
62 | 55 |
63 // Initialization vector. | 56 // Initialization vector. |
64 const std::string iv_; | 57 const std::string iv_; |
65 | 58 |
66 // TODO(fgalligan): Remove |data_offset_| if there is no plan to use it in | |
67 // the future. | |
68 // Amount of data to be discarded before applying subsample information. | |
69 const int data_offset_; | |
70 | |
71 // Subsample information. May be empty for some formats, meaning entire frame | 59 // Subsample information. May be empty for some formats, meaning entire frame |
72 // (less data ignored by data_offset_) is encrypted. | 60 // (less data ignored by data_offset_) is encrypted. |
73 const std::vector<SubsampleEntry> subsamples_; | 61 const std::vector<SubsampleEntry> subsamples_; |
74 | 62 |
75 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); | 63 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); |
76 }; | 64 }; |
77 | 65 |
78 } // namespace media | 66 } // namespace media |
79 | 67 |
80 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ | 68 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ |
OLD | NEW |