Shaka Packager SDK
Loading...
Searching...
No Matches
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 <cstdint>
10#include <string>
11#include <vector>
12
13#include <packager/media/base/widevine_pssh_data.pb.h>
14
15namespace shaka {
16namespace media {
17namespace {
18
19std::vector<uint8_t> StringToBytes(const std::string& string) {
20 return std::vector<uint8_t>(string.begin(), string.end());
21}
22} // namespace
23
24std::vector<uint8_t> GenerateWidevinePsshDataFromKeyIds(
25 const std::vector<std::vector<uint8_t>>& key_ids) {
26 media::WidevinePsshData widevine_pssh_data;
27 for (const std::vector<uint8_t>& key_id : key_ids)
28 widevine_pssh_data.add_key_id(key_id.data(), key_id.size());
29 return StringToBytes(widevine_pssh_data.SerializeAsString());
30}
31} // namespace media
32} // namespace shaka
All the methods that are virtual are virtual for mocking.