OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
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_CAST_DECRYPT_CONFIG_H_ | |
6 #define CHROMECAST_PUBLIC_MEDIA_CAST_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) {} | |
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 metadata needed to decrypt a media sample. | |
33 class CastDecryptConfig { | |
34 public: | |
35 virtual ~CastDecryptConfig() {} | |
byungchul
2015/07/29 20:32:23
ditto
halliwell
2015/07/29 22:39:27
This is needed, similar to the other case.
| |
36 | |
37 // Returns the ID for this sample's decryption key. | |
38 virtual const std::string& key_id() const = 0; | |
39 | |
40 // Returns the initialization vector as defined by the encryption format. | |
41 virtual const std::string& iv() const = 0; | |
42 | |
43 // Returns the clear and encrypted portions of the sample as described above. | |
44 virtual const std::vector<SubsampleEntry>& subsamples() const = 0; | |
45 }; | |
46 | |
47 } // namespace media | |
48 } // namespace chromecast | |
49 | |
50 #endif // CHROMECAST_PUBLIC_MEDIA_CAST_DECRYPT_CONFIG_H_ | |
OLD | NEW |