Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: media/base/decrypt_config.h

Issue 1905423003: [Merged] media: Properly tell whether the buffer is encrypted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/filters/android/media_codec_audio_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « no previous file | media/filters/android/media_codec_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698