2013-09-24 01:35:40 +00:00
|
|
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/media/base/decrypt_config.h"
|
2013-09-24 01:35:40 +00:00
|
|
|
|
2022-11-04 22:46:41 +00:00
|
|
|
#include "glog/logging.h"
|
2013-09-24 01:35:40 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2013-09-24 01:35:40 +00:00
|
|
|
namespace media {
|
|
|
|
|
2016-04-08 18:41:17 +00:00
|
|
|
DecryptConfig::DecryptConfig(const std::vector<uint8_t>& key_id,
|
|
|
|
const std::vector<uint8_t>& iv,
|
|
|
|
const std::vector<SubsampleEntry>& subsamples)
|
2016-04-06 00:28:09 +00:00
|
|
|
: DecryptConfig(key_id, iv, subsamples, FOURCC_cenc, 0, 0) {}
|
2016-04-08 18:41:17 +00:00
|
|
|
|
2014-09-30 21:52:21 +00:00
|
|
|
DecryptConfig::DecryptConfig(const std::vector<uint8_t>& key_id,
|
|
|
|
const std::vector<uint8_t>& iv,
|
2016-03-17 17:03:19 +00:00
|
|
|
const std::vector<SubsampleEntry>& subsamples,
|
2016-04-06 00:28:09 +00:00
|
|
|
FourCC protection_scheme,
|
|
|
|
uint8_t crypt_byte_block,
|
|
|
|
uint8_t skip_byte_block)
|
2016-03-17 17:03:19 +00:00
|
|
|
: key_id_(key_id),
|
|
|
|
iv_(iv),
|
|
|
|
subsamples_(subsamples),
|
2016-04-06 00:28:09 +00:00
|
|
|
protection_scheme_(protection_scheme),
|
|
|
|
crypt_byte_block_(crypt_byte_block),
|
|
|
|
skip_byte_block_(skip_byte_block) {
|
2013-09-24 01:35:40 +00:00
|
|
|
CHECK_GT(key_id.size(), 0u);
|
|
|
|
}
|
|
|
|
|
|
|
|
DecryptConfig::~DecryptConfig() {}
|
|
|
|
|
2017-02-02 18:28:29 +00:00
|
|
|
size_t DecryptConfig::GetTotalSizeOfSubsamples() const {
|
|
|
|
size_t size = 0;
|
|
|
|
for (const SubsampleEntry& subsample : subsamples_)
|
|
|
|
size += subsample.clear_bytes + subsample.cipher_bytes;
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2013-09-24 01:35:40 +00:00
|
|
|
} // namespace media
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|