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

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

Issue 10651006: Add Common Encryption support to BMFF, including subsample decryption. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add wrong subsample size test Created 8 years, 5 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/base/decrypt_config.cc » ('j') | media/crypto/aes_decryptor.cc » ('J')
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 <string>
9 #include <vector>
10
8 #include "base/basictypes.h" 11 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
10 #include "media/base/media_export.h" 13 #include "media/base/media_export.h"
11 14
12 namespace media { 15 namespace media {
13 16
17 // The Common Encryption spec provides for subsample encryption, where portions
18 // of a sample are set in cleartext. A SubsampleEntry specifies the number of
19 // clear and encrypted bytes in each subsample. For decryption, all of the
20 // encrypted bytes in a sample should be considered a single logical stream,
21 // regardless of how they are divided into subsamples, and the clear bytes
22 // should not be considered as part of decryption. This is logically equivalent
23 // to concatenating all 'cypher_bytes' portions of subsamples, decrypting that
24 // result, and then copying each byte from the decrypted block over the
25 // position of the corresponding encrypted byte.
26 struct SubsampleEntry {
27 int clear_bytes;
28 int cypher_bytes;
29 };
30
14 // Contains all information that a decryptor needs to decrypt. 31 // Contains all information that a decryptor needs to decrypt.
15 class MEDIA_EXPORT DecryptConfig { 32 class MEDIA_EXPORT DecryptConfig {
16 public: 33 public:
17 explicit DecryptConfig(const uint8* key_id, int key_id_size); 34 DecryptConfig(const uint8* key_id, int key_id_size,
35 const std::string& iv,
36 const std::vector<SubsampleEntry>& subsamples);
37
38 // TODO(strobe): This constructor implicitly sets CBC mode and uses a default
39 // IV, to preserve compatibility with an early implementation. It should be
40 // removed, along with CBC mode and the default IV, when
41 // https://chromiumcodereview.appspot.com/10535029 lands.
42 DecryptConfig(const uint8* key_id, int key_id_size);
43
18 ~DecryptConfig(); 44 ~DecryptConfig();
19 45
20 const uint8* key_id() const { return key_id_.get(); } 46 const uint8* key_id() const { return key_id_.get(); }
21 int key_id_size() const { return key_id_size_; } 47 int key_id_size() const { return key_id_size_; }
48 const std::string& iv() const { return iv_; }
49 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; }
50 bool use_cbc() const { return use_cbc_; }
22 51
23 private: 52 private:
24 scoped_array<uint8> key_id_; 53 scoped_array<uint8> key_id_;
25 int key_id_size_; 54 int key_id_size_;
55 std::string iv_;
56 std::vector<SubsampleEntry> subsamples_;
57 // TODO(strobe): Remove when CBC is no longer used.
58 bool use_cbc_;
26 59
27 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); 60 DISALLOW_COPY_AND_ASSIGN(DecryptConfig);
28 }; 61 };
29 62
30 } // namespace media 63 } // namespace media
31 64
32 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ 65 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/decrypt_config.cc » ('j') | media/crypto/aes_decryptor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698