Shaka Packager SDK
Loading...
Searching...
No Matches
raw_key_source.h
1// Copyright 2016 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_RAW_KEY_SOURCE_H_
8#define PACKAGER_MEDIA_BASE_RAW_KEY_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/media/base/key_source.h>
17
18namespace shaka {
19namespace media {
20
22class RawKeySource : public KeySource {
23 public:
24 ~RawKeySource() override;
25
28 Status FetchKeys(EmeInitDataType init_data_type,
29 const std::vector<uint8_t>& init_data) override;
30 Status GetKey(const std::string& stream_label, EncryptionKey* key) override;
31 Status GetKey(const std::vector<uint8_t>& key_id,
32 EncryptionKey* key) override;
33 Status GetCryptoPeriodKey(uint32_t crypto_period_index,
34 int32_t crypto_period_duration_in_seconds,
35 const std::string& stream_label,
36 EncryptionKey* key) override;
38
42 static std::unique_ptr<RawKeySource> Create(const RawKeyParams& raw_key);
43
44 protected:
45 // Allow default constructor for mock key sources.
47
48 private:
49 RawKeySource(EncryptionKeyMap&& encryption_key_map);
50 RawKeySource(const RawKeySource&) = delete;
51 RawKeySource& operator=(const RawKeySource&) = delete;
52
53 EncryptionKeyMap encryption_key_map_;
54};
55
56} // namespace media
57} // namespace shaka
58
59#endif // PACKAGER_MEDIA_BASE_RAW_KEY_SOURCE_H_
KeySource is responsible for encryption key acquisition.
Definition key_source.h:53
A key source that uses raw keys for encryption.
Status FetchKeys(EmeInitDataType init_data_type, const std::vector< uint8_t > &init_data) override
Status GetKey(const std::string &stream_label, EncryptionKey *key) override
Status GetCryptoPeriodKey(uint32_t crypto_period_index, int32_t crypto_period_duration_in_seconds, const std::string &stream_label, EncryptionKey *key) override
static std::unique_ptr< RawKeySource > Create(const RawKeyParams &raw_key)
All the methods that are virtual are virtual for mocking.