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

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

Issue 10651006: Add Common Encryption support to BMFF, including subsample decryption. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove references to non-public encrypted files in tests Created 8 years, 6 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
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 #include "media/base/decrypt_config.h" 5 #include "media/base/decrypt_config.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
11 // TODO(strobe): Remove along with CBC mode.
12 static const char kDefaultIV[] = "0000000000000000";
fgalligan1 2012/06/27 00:28:36 s/kDefaultIV/kDefaultIv/
strobe_ 2012/06/27 02:01:21 Done.
13 static const int kDefaultIVSize = 16;
fgalligan1 2012/06/27 00:28:36 s/kDefaultIVSize/kDefaultIvSize/
strobe_ 2012/06/27 02:01:21 Done.
14
11 DecryptConfig::DecryptConfig(const uint8* key_id, int key_id_size) 15 DecryptConfig::DecryptConfig(const uint8* key_id, int key_id_size)
12 : key_id_size_(key_id_size) { 16 : key_id_size_(key_id_size),
17 iv_size_(kDefaultIVSize),
18 subsample_count_(0),
19 use_cbc_(true) {
13 CHECK_GT(key_id_size, 0); 20 CHECK_GT(key_id_size, 0);
14 key_id_.reset(new uint8[key_id_size]); 21 key_id_.reset(new uint8[key_id_size]);
15 memcpy(key_id_.get(), key_id, key_id_size); 22 memcpy(key_id_.get(), key_id, key_id_size);
23 iv_.reset(new uint8[iv_size_]);
24 memcpy(iv_.get(), kDefaultIV, iv_size_);
25 }
26
27 DecryptConfig::DecryptConfig(const uint8* key_id, int key_id_size,
28 const uint8* iv, int iv_size)
29 : key_id_size_(key_id_size),
30 iv_size_(iv_size),
31 subsample_count_(0),
32 use_cbc_(false) {
33 CHECK_GT(key_id_size, 0);
34 CHECK_GT(iv_size, 0);
35 key_id_.reset(new uint8[key_id_size]);
36 memcpy(key_id_.get(), key_id, key_id_size);
37 iv_.reset(new uint8[iv_size]);
38 memcpy(iv_.get(), iv, iv_size);
39 }
40
41 DecryptConfig::DecryptConfig(const uint8* key_id, int key_id_size,
42 const uint8* iv, int iv_size,
43 const SubsampleEntry* subsamples,
44 int subsample_count)
45 : key_id_size_(key_id_size),
46 iv_size_(iv_size),
47 subsample_count_(subsample_count),
48 use_cbc_(false) {
49 CHECK_GT(key_id_size, 0);
50 CHECK_GT(iv_size, 0);
51 key_id_.reset(new uint8[key_id_size]);
52 memcpy(key_id_.get(), key_id, key_id_size);
53 iv_.reset(new uint8[iv_size]);
54 memcpy(iv_.get(), iv, iv_size);
55 if (subsample_count > 0) {
56 subsamples_.reset(new SubsampleEntry[subsample_count]);
57 memcpy(subsamples_.get(), subsamples,
58 subsample_count * sizeof(SubsampleEntry));
59 }
16 } 60 }
17 61
18 DecryptConfig::~DecryptConfig() {} 62 DecryptConfig::~DecryptConfig() {}
19 63
20 } // namespace media 64 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698