| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <iosfwd> | 10 #include <iosfwd> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // of the subsample sizes. | 49 // of the subsample sizes. |
| 50 DecryptConfig(const std::string& key_id, | 50 DecryptConfig(const std::string& key_id, |
| 51 const std::string& iv, | 51 const std::string& iv, |
| 52 const std::vector<SubsampleEntry>& subsamples); | 52 const std::vector<SubsampleEntry>& subsamples); |
| 53 ~DecryptConfig(); | 53 ~DecryptConfig(); |
| 54 | 54 |
| 55 const std::string& key_id() const { return key_id_; } | 55 const std::string& key_id() const { return key_id_; } |
| 56 const std::string& iv() const { return iv_; } | 56 const std::string& iv() const { return iv_; } |
| 57 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } | 57 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } |
| 58 | 58 |
| 59 // Returns true if the corresponding decoder buffer requires decryption and |
| 60 // false if that buffer is clear despite the presense of DecryptConfig. |
| 61 bool is_encrypted() const { return !key_id_.empty() && !iv_.empty(); } |
| 62 |
| 59 // Returns true if all fields in |config| match this config. | 63 // Returns true if all fields in |config| match this config. |
| 60 bool Matches(const DecryptConfig& config) const; | 64 bool Matches(const DecryptConfig& config) const; |
| 61 | 65 |
| 62 // Prints to std::ostream. | 66 // Prints to std::ostream. |
| 63 std::ostream& Print(std::ostream& os) const; | 67 std::ostream& Print(std::ostream& os) const; |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 const std::string key_id_; | 70 const std::string key_id_; |
| 67 | 71 |
| 68 // Initialization vector. | 72 // Initialization vector. |
| 69 const std::string iv_; | 73 const std::string iv_; |
| 70 | 74 |
| 71 // Subsample information. May be empty for some formats, meaning entire frame | 75 // Subsample information. May be empty for some formats, meaning entire frame |
| 72 // (less data ignored by data_offset_) is encrypted. | 76 // (less data ignored by data_offset_) is encrypted. |
| 73 const std::vector<SubsampleEntry> subsamples_; | 77 const std::vector<SubsampleEntry> subsamples_; |
| 74 | 78 |
| 75 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); | 79 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); |
| 76 }; | 80 }; |
| 77 | 81 |
| 78 } // namespace media | 82 } // namespace media |
| 79 | 83 |
| 80 inline std::ostream& operator<<(std::ostream& os, | 84 inline std::ostream& operator<<(std::ostream& os, |
| 81 const media::DecryptConfig& obj) { | 85 const media::DecryptConfig& obj) { |
| 82 return obj.Print(os); | 86 return obj.Print(os); |
| 83 } | 87 } |
| 84 | 88 |
| 85 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ | 89 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ |
| OLD | NEW |