Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
|
gunsch
2015/07/27 17:14:49
remove (c)
halliwell
2015/07/28 02:19:36
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMECAST_PUBLIC_MEDIA_DECRYPT_CONFIG_H_ | |
| 6 #define CHROMECAST_PUBLIC_MEDIA_DECRYPT_CONFIG_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 namespace chromecast { | |
| 13 namespace media { | |
| 14 | |
| 15 // The Common Encryption spec provides for subsample encryption, where portions | |
| 16 // of a sample are set in cleartext. A SubsampleEntry specifies the number of | |
| 17 // clear and encrypted bytes in each subsample. For decryption, all of the | |
| 18 // encrypted bytes in a sample should be considered a single logical stream, | |
| 19 // regardless of how they are divided into subsamples, and the clear bytes | |
| 20 // should not be considered as part of decryption. This is logically equivalent | |
| 21 // to concatenating all 'cypher_bytes' portions of subsamples, decrypting that | |
| 22 // result, and then copying each byte from the decrypted block over the | |
| 23 // position of the corresponding encrypted byte. | |
| 24 struct SubsampleEntry { | |
| 25 SubsampleEntry() : clear_bytes(0), cypher_bytes(0) {} | |
|
gunsch
2015/07/27 17:14:49
Do we need both ctors, or in practice do we only u
halliwell
2015/07/28 02:19:36
we need both - obviously we only use the uint32_t,
| |
| 26 SubsampleEntry(uint32_t clear_bytes, uint32_t cypher_bytes) | |
| 27 : clear_bytes(clear_bytes), cypher_bytes(cypher_bytes) {} | |
| 28 uint32_t clear_bytes; | |
| 29 uint32_t cypher_bytes; | |
| 30 }; | |
| 31 | |
| 32 // Contains all information that a decryptor needs to decrypt a media sample. | |
| 33 class DecryptConfig { | |
| 34 public: | |
| 35 virtual ~DecryptConfig() {} | |
| 36 | |
| 37 virtual const std::string& key_id() const = 0; | |
|
gunsch
2015/07/27 17:14:49
I'm a little wary of providing references here rat
byungchul
2015/07/27 18:22:23
Make it as a simple struct?
halliwell
2015/07/28 02:19:36
correct, it's us implementing this, not vendors.
| |
| 38 virtual const std::string& iv() const = 0; | |
| 39 virtual const std::vector<SubsampleEntry>& subsamples() const = 0; | |
| 40 }; | |
| 41 | |
| 42 } // namespace media | |
| 43 } // namespace chromecast | |
| 44 | |
| 45 #endif // CHROMECAST_PUBLIC_MEDIA_DECRYPT_CONFIG_H_ | |
| OLD | NEW |