Shaka Packager SDK
pssh_generator.h
1 // Copyright 2017 Google Inc. 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 <vector>
11 
12 #include "packager/base/optional.h"
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 
20 struct EncryptionKey;
21 
23  public:
24  PsshGenerator();
25  virtual ~PsshGenerator() = 0;
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 base::Optional<std::vector<uint8_t>> GeneratePsshDataFromKeyIds(
53  const std::vector<std::vector<uint8_t>>& key_ids) const = 0;
54 
59  virtual base::Optional<std::vector<uint8_t>> GeneratePsshDataFromKeyIdAndKey(
60  const std::vector<uint8_t>& key_id,
61  const std::vector<uint8_t>& key) const = 0;
62 
64  virtual uint8_t PsshBoxVersion() const = 0;
65 
67  virtual const std::vector<uint8_t>& SystemId() const = 0;
68 };
69 
70 } // namespace media
71 } // namespace shaka
72 
73 #endif // PACKAGER_MEDIA_BASE_PSSH_GENERATOR_H_
Status GeneratePsshFromKeyIds(const std::vector< std::vector< uint8_t >> &key_ids, ProtectionSystemSpecificInfo *info) const
All the methods that are virtual are virtual for mocking.
virtual bool SupportMultipleKeys()=0
Status GeneratePsshFromKeyIdAndKey(const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &key, ProtectionSystemSpecificInfo *info) const