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 <cstdint>
11#include <memory>
12#include <string>
13#include <vector>
14
15#include <packager/macros/classes.h>
16#include <packager/media/base/key_source.h>
17
18namespace shaka {
19namespace media {
20
23 public:
28 PlayReadyKeySource(const std::string& server_url,
29 ProtectionSystem protection_systems);
30 ~PlayReadyKeySource() override;
31
34 Status FetchKeys(EmeInitDataType init_data_type,
35 const std::vector<uint8_t>& init_data) override;
36 Status GetKey(const std::string& stream_label, EncryptionKey* key) override;
37 Status GetKey(const std::vector<uint8_t>& key_id,
38 EncryptionKey* key) override;
39 Status GetCryptoPeriodKey(uint32_t crypto_period_index,
40 int32_t crypto_period_duration_in_seconds,
41 const std::string& stream_label,
42 EncryptionKey* key) override;
44 virtual Status FetchKeysWithProgramIdentifier(const std::string& program_identifier);
45
50 static std::unique_ptr<PlayReadyKeySource> CreateFromKeyAndKeyId(
51 const std::vector<uint8_t>& key_id,
52 const std::vector<uint8_t>& key);
53
54 private:
55 Status GetKeyInternal();
56 Status GetCryptoPeriodKeyInternal();
57
58 // Indicates whether PlayReady protection system should be generated.
59 bool generate_playready_protection_system_ = true;
60
61 std::unique_ptr<EncryptionKey> encryption_key_;
62 std::string server_url_;
63
64 DISALLOW_COPY_AND_ASSIGN(PlayReadyKeySource);
65};
66
67} // namespace media
68} // namespace shaka
69
70#endif // PACKAGER_MEDIA_BASE_PLAYREADY_SOURCE_H_
KeySource is responsible for encryption key acquisition.
Definition key_source.h:53
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.