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