OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ENCRYPTION_SCHEME_H_ | 5 #ifndef MEDIA_BASE_ENCRYPTION_SCHEME_H_ |
6 #define MEDIA_BASE_ENCRYPTION_SCHEME_H_ | 6 #define MEDIA_BASE_ENCRYPTION_SCHEME_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // If either of encrypt_blocks or skip_blocks is 0, pattern encryption is | 35 // If either of encrypt_blocks or skip_blocks is 0, pattern encryption is |
36 // disabled. | 36 // disabled. |
37 class MEDIA_EXPORT Pattern { | 37 class MEDIA_EXPORT Pattern { |
38 public: | 38 public: |
39 Pattern(); | 39 Pattern(); |
40 Pattern(uint32_t encrypt_blocks, uint32_t skip_blocks); | 40 Pattern(uint32_t encrypt_blocks, uint32_t skip_blocks); |
41 ~Pattern(); | 41 ~Pattern(); |
42 | 42 |
43 bool Matches(const Pattern& other) const; | 43 bool Matches(const Pattern& other) const; |
44 | 44 |
45 uint32_t encrypt_blocks() const { return encrypt_blocks_; } | 45 uint32_t encrypt_blocks() const; |
46 uint32_t skip_blocks() const { return skip_blocks_; } | 46 uint32_t skip_blocks() const; |
47 | 47 |
48 bool IsInEffect() const; | 48 bool IsInEffect() const; |
49 | 49 |
50 private: | 50 private: |
51 uint32_t encrypt_blocks_ = 0; | 51 uint32_t encrypt_blocks_ = 0; |
52 uint32_t skip_blocks_ = 0; | 52 uint32_t skip_blocks_ = 0; |
53 | 53 |
54 // Allow copy and assignment. | 54 // Allow copy and assignment. |
55 }; | 55 }; |
56 | 56 |
57 // The default constructor makes an instance that indicates no encryption. | 57 // The default constructor makes an instance that indicates no encryption. |
58 EncryptionScheme(); | 58 EncryptionScheme(); |
59 | 59 |
60 // This constructor allows specification of the cipher mode and the pattern. | 60 // This constructor allows specification of the cipher mode and the pattern. |
61 EncryptionScheme(CipherMode mode, const Pattern& pattern); | 61 EncryptionScheme(CipherMode mode, const Pattern& pattern); |
62 ~EncryptionScheme(); | 62 ~EncryptionScheme(); |
63 | 63 |
64 bool Matches(const EncryptionScheme& other) const; | 64 bool Matches(const EncryptionScheme& other) const; |
65 | 65 |
66 bool is_encrypted() const { return mode_ != CIPHER_MODE_UNENCRYPTED; } | 66 bool is_encrypted() const; |
67 CipherMode mode() const { return mode_; } | 67 CipherMode mode() const; |
68 const Pattern& pattern() const { return pattern_; } | 68 const Pattern& pattern() const; |
69 | 69 |
70 private: | 70 private: |
71 CipherMode mode_ = CIPHER_MODE_UNENCRYPTED; | 71 CipherMode mode_ = CIPHER_MODE_UNENCRYPTED; |
72 Pattern pattern_; | 72 Pattern pattern_; |
73 | 73 |
74 // Allow copy and assignment. | 74 // Allow copy and assignment. |
75 }; | 75 }; |
76 | 76 |
77 } // namespace media | 77 } // namespace media |
78 | 78 |
79 #endif // MEDIA_BASE_ENCRYPTION_SCHEME_H_ | 79 #endif // MEDIA_BASE_ENCRYPTION_SCHEME_H_ |
OLD | NEW |