Shaka Packager SDK
Loading...
Searching...
No Matches
playready_key_source.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_PLAYREADY_SOURCE_H_
8#define PACKAGER_MEDIA_BASE_PLAYREADY_SOURCE_H_
9
10#include <memory>
11#include <string>
12#include <vector>
13
14#include <packager/macros/classes.h>
15#include <packager/media/base/key_source.h>
16
17namespace shaka {
18namespace media {
19
22 public:
27 PlayReadyKeySource(const std::string& server_url,
28 ProtectionSystem protection_systems);
29 ~PlayReadyKeySource() override;
30
33 Status FetchKeys(EmeInitDataType init_data_type,
34 const std::vector<uint8_t>& init_data) override;
35 Status GetKey(const std::string& stream_label, EncryptionKey* key) override;
36 Status GetKey(const std::vector<uint8_t>& key_id,
37 EncryptionKey* key) override;
38 Status GetCryptoPeriodKey(uint32_t crypto_period_index,
39 int32_t crypto_period_duration_in_seconds,
40 const std::string& stream_label,
41 EncryptionKey* key) override;
43 virtual Status FetchKeysWithProgramIdentifier(const std::string& program_identifier);
44
49 static std::unique_ptr<PlayReadyKeySource> CreateFromKeyAndKeyId(
50 const std::vector<uint8_t>& key_id,
51 const std::vector<uint8_t>& key);
52
53 private:
54 Status GetKeyInternal();
55 Status GetCryptoPeriodKeyInternal();
56
57 // Indicates whether PlayReady protection system should be generated.
58 bool generate_playready_protection_system_ = true;
59
60 std::unique_ptr<EncryptionKey> encryption_key_;
61 std::string server_url_;
62
63 DISALLOW_COPY_AND_ASSIGN(PlayReadyKeySource);
64};
65
66} // namespace media
67} // namespace shaka
68
69#endif // PACKAGER_MEDIA_BASE_PLAYREADY_SOURCE_H_
KeySource is responsible for encryption key acquisition.
Definition key_source.h:52
A key source that uses PlayReady for encryption.
Status GetKey(const std::string &stream_label, EncryptionKey *key) override
Status FetchKeys(EmeInitDataType init_data_type, const std::vector< uint8_t > &init_data) override
static std::unique_ptr< PlayReadyKeySource > CreateFromKeyAndKeyId(const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &key)
Status GetCryptoPeriodKey(uint32_t crypto_period_index, int32_t crypto_period_duration_in_seconds, const std::string &stream_label, EncryptionKey *key) override
All the methods that are virtual are virtual for mocking.