Shaka Packager SDK
pssh_generator_util.cc
1 // Copyright 2017 Google LLC. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include <packager/media/base/pssh_generator_util.h>
8 
9 #include <string>
10 
11 #include <packager/media/base/widevine_pssh_data.pb.h>
12 
13 namespace shaka {
14 namespace media {
15 namespace {
16 
17 std::vector<uint8_t> StringToBytes(const std::string& string) {
18  return std::vector<uint8_t>(string.begin(), string.end());
19 }
20 } // namespace
21 
22 std::vector<uint8_t> GenerateWidevinePsshDataFromKeyIds(
23  const std::vector<std::vector<uint8_t>>& key_ids) {
24  media::WidevinePsshData widevine_pssh_data;
25  for (const std::vector<uint8_t>& key_id : key_ids)
26  widevine_pssh_data.add_key_id(key_id.data(), key_id.size());
27  return StringToBytes(widevine_pssh_data.SerializeAsString());
28 }
29 } // namespace media
30 } // namespace shaka
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66