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 "packager/base/logging.h"
8 
9 namespace shaka {
10 namespace media {
11 
12 DecryptConfig::DecryptConfig(const std::vector<uint8_t>& key_id,
13  const std::vector<uint8_t>& iv,
14  const std::vector<SubsampleEntry>& subsamples)
15  : DecryptConfig(key_id, iv, subsamples, FOURCC_cenc, 0, 0) {}
16 
17 DecryptConfig::DecryptConfig(const std::vector<uint8_t>& key_id,
18  const std::vector<uint8_t>& iv,
19  const std::vector<SubsampleEntry>& subsamples,
20  FourCC protection_scheme,
21  uint8_t crypt_byte_block,
22  uint8_t skip_byte_block)
23  : key_id_(key_id),
24  iv_(iv),
25  subsamples_(subsamples),
26  protection_scheme_(protection_scheme),
27  crypt_byte_block_(crypt_byte_block),
28  skip_byte_block_(skip_byte_block) {
29  CHECK_GT(key_id.size(), 0u);
30 }
31 
32 DecryptConfig::~DecryptConfig() {}
33 
35  size_t size = 0;
36  for (const SubsampleEntry& subsample : subsamples_)
37  size += subsample.clear_bytes + subsample.cipher_bytes;
38  return size;
39 }
40 
41 } // namespace media
42 } // namespace shaka
DecryptConfig(const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &iv, const std::vector< SubsampleEntry > &subsamples)
All the methods that are virtual are virtual for mocking.
size_t GetTotalSizeOfSubsamples() const