• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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 // Note: ported from Chromium commit head: 7014d6d
5 
6 #ifndef SUBSAMPLE_ENTRY_H_
7 #define SUBSAMPLE_ENTRY_H_
8 
9 #include <stdint.h>
10 
11 namespace media {
12 
13 // The Common Encryption spec provides for subsample encryption, where portions
14 // of a sample are set in cleartext. A SubsampleEntry specifies the number of
15 // clear and encrypted bytes in each subsample. For decryption, all of the
16 // encrypted bytes in a sample should be considered a single logical stream,
17 // regardless of how they are divided into subsamples, and the clear bytes
18 // should not be considered as part of decryption. This is logically equivalent
19 // to concatenating all 'cypher_bytes' portions of subsamples, decrypting that
20 // result, and then copying each byte from the decrypted block over the
21 // position of the corresponding encrypted byte.
22 struct SubsampleEntry {
SubsampleEntrySubsampleEntry23   SubsampleEntry() : clear_bytes(0), cypher_bytes(0) {}
SubsampleEntrySubsampleEntry24   SubsampleEntry(uint32_t clear_bytes, uint32_t cypher_bytes)
25       : clear_bytes(clear_bytes), cypher_bytes(cypher_bytes) {}
26   uint32_t clear_bytes;
27   uint32_t cypher_bytes;
28 };
29 
30 }  // namespace media
31 
32 #endif  // SUBSAMPLE_ENTRY_H_
33