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