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

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

Issue 10535029: Add support for encrypted WebM files as defined in the RFC. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix uint64 literal. 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') | 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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
11 11
12 namespace media { 12 namespace media {
13 13
14 // Contains all information that a decryptor needs to decrypt. 14 // Contains all information that a decryptor needs to decrypt a frame.
15 class MEDIA_EXPORT DecryptConfig { 15 class MEDIA_EXPORT DecryptConfig {
16 public: 16 public:
17 explicit DecryptConfig(const uint8* key_id, int key_id_size); 17 // Keys are always 128 bits.
18 static const int kDecryptionKeySize = 16;
19
20 // |key_id| is the ID that references the decryption key for this frame. |iv|
21 // is the initialization vector defined by the encrypted format. Currently
22 // |iv_size| must be 16 bytes as defined by WebM and ISO. |checksum| is the
23 // hash value of the encrypted buffer. |checksum| is defined by the
24 // encrypted format and may be NULL. |encrypted_frame_offset| is the offset
25 // into the encrypted buffer that the encrypted frame starts. The class
26 // will copy the data from |key_id|, |iv|, and |checksum|.
27 DecryptConfig(const uint8* key_id, int key_id_size,
28 const uint8* iv, int iv_size,
29 const uint8* checksum, int checksum_size,
30 int encrypted_frame_offset);
18 ~DecryptConfig(); 31 ~DecryptConfig();
19 32
20 const uint8* key_id() const { return key_id_.get(); } 33 const uint8* key_id() const { return key_id_.get(); }
21 int key_id_size() const { return key_id_size_; } 34 int key_id_size() const { return key_id_size_; }
35 const uint8* iv() const { return iv_.get(); }
36 int iv_size() const { return iv_size_; }
37 const uint8* checksum() const { return checksum_.get(); }
38 int checksum_size() const { return checksum_size_; }
39 int encrypted_frame_offset() const { return encrypted_frame_offset_; }
22 40
23 private: 41 private:
24 scoped_array<uint8> key_id_; 42 const scoped_array<uint8> key_id_;
25 int key_id_size_; 43 const int key_id_size_;
44
45 // Initialization vector.
46 const scoped_array<uint8> iv_;
47 const int iv_size_;
48
49 // Checksum of the data to be verified before decrypting the data. This may
50 // be NULL for some formats.
51 const scoped_array<uint8> checksum_;
52 const int checksum_size_;
53
54 // This is the offset in bytes to where the encrypted data starts within
55 // the input buffer.
56 const int encrypted_frame_offset_;
26 57
27 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); 58 DISALLOW_COPY_AND_ASSIGN(DecryptConfig);
28 }; 59 };
29 60
30 } // namespace media 61 } // namespace media
31 62
32 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ 63 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/decrypt_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698