Shaka Packager SDK
decrypt_config.cc
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
3 // found in the LICENSE file.
4 
5 #include <packager/media/base/decrypt_config.h>
6 
7 #include <absl/log/check.h>
8 #include <absl/log/log.h>
9 
10 namespace shaka {
11 namespace media {
12 
13 DecryptConfig::DecryptConfig(const std::vector<uint8_t>& key_id,
14  const std::vector<uint8_t>& iv,
15  const std::vector<SubsampleEntry>& subsamples)
16  : DecryptConfig(key_id, iv, subsamples, FOURCC_cenc, 0, 0) {}
17 
18 DecryptConfig::DecryptConfig(const std::vector<uint8_t>& key_id,
19  const std::vector<uint8_t>& iv,
20  const std::vector<SubsampleEntry>& subsamples,
21  FourCC protection_scheme,
22  uint8_t crypt_byte_block,
23  uint8_t skip_byte_block)
24  : key_id_(key_id),
25  iv_(iv),
26  subsamples_(subsamples),
27  protection_scheme_(protection_scheme),
28  crypt_byte_block_(crypt_byte_block),
29  skip_byte_block_(skip_byte_block) {
30  CHECK_GT(key_id.size(), 0u);
31 }
32 
33 DecryptConfig::~DecryptConfig() {}
34 
36  size_t size = 0;
37  for (const SubsampleEntry& subsample : subsamples_)
38  size += subsample.clear_bytes + subsample.cipher_bytes;
39  return size;
40 }
41 
42 } // namespace media
43 } // namespace shaka
DecryptConfig(const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &iv, const std::vector< SubsampleEntry > &subsamples)
size_t GetTotalSizeOfSubsamples() const
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66