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 <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | |
13 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
14 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
15 | 14 |
16 namespace media { | 15 namespace media { |
17 | 16 |
18 // The Common Encryption spec provides for subsample encryption, where portions | 17 // The Common Encryption spec provides for subsample encryption, where portions |
19 // of a sample are set in cleartext. A SubsampleEntry specifies the number of | 18 // of a sample are set in cleartext. A SubsampleEntry specifies the number of |
20 // clear and encrypted bytes in each subsample. For decryption, all of the | 19 // clear and encrypted bytes in each subsample. For decryption, all of the |
21 // encrypted bytes in a sample should be considered a single logical stream, | 20 // encrypted bytes in a sample should be considered a single logical stream, |
22 // regardless of how they are divided into subsamples, and the clear bytes | 21 // regardless of how they are divided into subsamples, and the clear bytes |
23 // should not be considered as part of decryption. This is logically equivalent | 22 // should not be considered as part of decryption. This is logically equivalent |
24 // to concatenating all 'cypher_bytes' portions of subsamples, decrypting that | 23 // to concatenating all 'cypher_bytes' portions of subsamples, decrypting that |
25 // result, and then copying each byte from the decrypted block over the | 24 // result, and then copying each byte from the decrypted block over the |
26 // position of the corresponding encrypted byte. | 25 // position of the corresponding encrypted byte. |
27 struct SubsampleEntry { | 26 struct SubsampleEntry { |
28 SubsampleEntry() : clear_bytes(0), cypher_bytes(0) {} | 27 SubsampleEntry() : clear_bytes(0), cypher_bytes(0) {} |
29 SubsampleEntry(uint32 clear_bytes, uint32 cypher_bytes) | 28 SubsampleEntry(uint32_t clear_bytes, uint32_t cypher_bytes) |
30 : clear_bytes(clear_bytes), cypher_bytes(cypher_bytes) {} | 29 : clear_bytes(clear_bytes), cypher_bytes(cypher_bytes) {} |
31 uint32 clear_bytes; | 30 uint32_t clear_bytes; |
32 uint32 cypher_bytes; | 31 uint32_t cypher_bytes; |
33 }; | 32 }; |
34 | 33 |
35 // Contains all information that a decryptor needs to decrypt a media sample. | 34 // Contains all information that a decryptor needs to decrypt a media sample. |
36 class MEDIA_EXPORT DecryptConfig { | 35 class MEDIA_EXPORT DecryptConfig { |
37 public: | 36 public: |
38 // Keys are always 128 bits. | 37 // Keys are always 128 bits. |
39 static const int kDecryptionKeySize = 16; | 38 static const int kDecryptionKeySize = 16; |
40 | 39 |
41 // |key_id| is the ID that references the decryption key for this sample. | 40 // |key_id| is the ID that references the decryption key for this sample. |
42 // |iv| is the initialization vector defined by the encrypted format. | 41 // |iv| is the initialization vector defined by the encrypted format. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 }; | 73 }; |
75 | 74 |
76 } // namespace media | 75 } // namespace media |
77 | 76 |
78 inline std::ostream& operator<<(std::ostream& os, | 77 inline std::ostream& operator<<(std::ostream& os, |
79 const media::DecryptConfig& obj) { | 78 const media::DecryptConfig& obj) { |
80 return obj.Print(os); | 79 return obj.Print(os); |
81 } | 80 } |
82 | 81 |
83 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ | 82 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ |
OLD | NEW |