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 
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 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 
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_
shaka::media::ProtectionSystemSpecificInfo
Definition: protection_system_specific_info.h:20
shaka
All the methods that are virtual are virtual for mocking.
Definition: gflags_hex_bytes.cc:11
shaka::Status
Definition: status.h:110
shaka::media::PsshGenerator::PsshGenerator
PsshGenerator(const std::vector< uint8_t > &system_id, uint8_t box_version)
Definition: pssh_generator.cc:31
shaka::media::PsshGenerator::GeneratePsshFromKeyIdAndKey
Status GeneratePsshFromKeyIdAndKey(const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &key, ProtectionSystemSpecificInfo *info) const
Definition: pssh_generator.cc:52
shaka::media::PsshGenerator
Definition: pssh_generator.h:20
shaka::media::PsshGenerator::GeneratePsshFromKeyIds
Status GeneratePsshFromKeyIds(const std::vector< std::vector< uint8_t >> &key_ids, ProtectionSystemSpecificInfo *info) const
Definition: pssh_generator.cc:37
shaka::media::PsshGenerator::SupportMultipleKeys
virtual bool SupportMultipleKeys()=0