Shaka Packager SDK
pssh_generator.h
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 #ifndef PACKAGER_MEDIA_BASE_PSSH_GENERATOR_H_
8 #define PACKAGER_MEDIA_BASE_PSSH_GENERATOR_H_
9 
10 #include <optional>
11 #include <vector>
12 
13 #include <packager/media/base/protection_system_specific_info.h>
14 #include <packager/status.h>
15 
16 // TODO(hmchen): move pssh related files into a sperate folder.
17 namespace shaka {
18 namespace media {
19 
21  public:
24  PsshGenerator(const std::vector<uint8_t>& system_id, uint8_t box_version);
25  virtual ~PsshGenerator();
26 
29  virtual bool SupportMultipleKeys() = 0;
30 
36  const std::vector<std::vector<uint8_t>>& key_ids,
37  ProtectionSystemSpecificInfo* info) const;
38 
44  Status GeneratePsshFromKeyIdAndKey(const std::vector<uint8_t>& key_id,
45  const std::vector<uint8_t>& key,
46  ProtectionSystemSpecificInfo* info) const;
47 
48  private:
52  virtual std::optional<std::vector<uint8_t>> GeneratePsshDataFromKeyIds(
53  const std::vector<std::vector<uint8_t>>& key_ids) const = 0;
54 
59  virtual std::optional<std::vector<uint8_t>> GeneratePsshDataFromKeyIdAndKey(
60  const std::vector<uint8_t>& key_id,
61  const std::vector<uint8_t>& key) const = 0;
62 
63  std::vector<uint8_t> system_id_;
64  uint8_t box_version_ = 0;
65 };
66 
67 } // namespace media
68 } // namespace shaka
69 
70 #endif // PACKAGER_MEDIA_BASE_PSSH_GENERATOR_H_
virtual bool SupportMultipleKeys()=0
Status GeneratePsshFromKeyIds(const std::vector< std::vector< uint8_t >> &key_ids, ProtectionSystemSpecificInfo *info) const
PsshGenerator(const std::vector< uint8_t > &system_id, uint8_t box_version)
Status GeneratePsshFromKeyIdAndKey(const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &key, ProtectionSystemSpecificInfo *info) const
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66