Commit 1a60f2b8 authored by Rintaro Kuroiwa's avatar Rintaro Kuroiwa Committed by Commit Bot

Add DecryptConfig::Clone()

- Add a clone method on DecryptConfig.
- This is required for later patches for decoders and CodecPictures to
  copy and own DecryptConfigs.

Bug: 820192
Change-Id: I5ae0826e86781d876af09509a9168e8a8e5be8a6
Reviewed-on: https://chromium-review.googlesource.com/1123767Reviewed-by: default avatarJohn Rummell <jrummell@chromium.org>
Commit-Queue: Rintaro Kuroiwa <rkuroiwa@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574002}
parent 1ca416dc
...@@ -72,6 +72,10 @@ DecryptConfig::DecryptConfig( ...@@ -72,6 +72,10 @@ DecryptConfig::DecryptConfig(
DecryptConfig::~DecryptConfig() = default; DecryptConfig::~DecryptConfig() = default;
std::unique_ptr<DecryptConfig> DecryptConfig::Clone() {
return base::WrapUnique(new DecryptConfig(*this));
}
bool DecryptConfig::HasPattern() const { bool DecryptConfig::HasPattern() const {
return encryption_pattern_.has_value(); return encryption_pattern_.has_value();
} }
...@@ -113,4 +117,6 @@ std::ostream& DecryptConfig::Print(std::ostream& os) const { ...@@ -113,4 +117,6 @@ std::ostream& DecryptConfig::Print(std::ostream& os) const {
return os; return os;
} }
DecryptConfig::DecryptConfig(const DecryptConfig& other) = default;
} // namespace media } // namespace media
...@@ -72,6 +72,8 @@ class MEDIA_EXPORT DecryptConfig { ...@@ -72,6 +72,8 @@ class MEDIA_EXPORT DecryptConfig {
return encryption_pattern_; return encryption_pattern_;
}; };
std::unique_ptr<DecryptConfig> Clone();
// Returns whether this config has EncryptionPattern set or not. // Returns whether this config has EncryptionPattern set or not.
bool HasPattern() const; bool HasPattern() const;
...@@ -82,6 +84,8 @@ class MEDIA_EXPORT DecryptConfig { ...@@ -82,6 +84,8 @@ class MEDIA_EXPORT DecryptConfig {
std::ostream& Print(std::ostream& os) const; std::ostream& Print(std::ostream& os) const;
private: private:
DecryptConfig(const DecryptConfig& other);
const EncryptionMode encryption_mode_; const EncryptionMode encryption_mode_;
const std::string key_id_; const std::string key_id_;
...@@ -95,7 +99,7 @@ class MEDIA_EXPORT DecryptConfig { ...@@ -95,7 +99,7 @@ class MEDIA_EXPORT DecryptConfig {
// Only specified if |encryption_mode_| requires a pattern. // Only specified if |encryption_mode_| requires a pattern.
base::Optional<EncryptionPattern> encryption_pattern_; base::Optional<EncryptionPattern> encryption_pattern_;
DISALLOW_COPY_AND_ASSIGN(DecryptConfig); DISALLOW_ASSIGN(DecryptConfig);
}; };
} // namespace media } // namespace media
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment