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 <memory>
11#include <string>
12#include <vector>
13
14#include <packager/crypto_params.h>
15#include <packager/media/base/key_source.h>
16
17namespace shaka {
18namespace media {
19
21class RawKeySource : public KeySource {
22 public:
23 ~RawKeySource() override;
24
27 Status FetchKeys(EmeInitDataType init_data_type,
28 const std::vector<uint8_t>& init_data) override;
29 Status GetKey(const std::string& stream_label, EncryptionKey* key) override;
30 Status GetKey(const std::vector<uint8_t>& key_id,
31 EncryptionKey* key) override;
32 Status GetCryptoPeriodKey(uint32_t crypto_period_index,
33 int32_t crypto_period_duration_in_seconds,
34 const std::string& stream_label,
35 EncryptionKey* key) override;
37
41 static std::unique_ptr<RawKeySource> Create(const RawKeyParams& raw_key);
42
43 protected:
44 // Allow default constructor for mock key sources.
46
47 private:
48 RawKeySource(EncryptionKeyMap&& encryption_key_map);
49 RawKeySource(const RawKeySource&) = delete;
50 RawKeySource& operator=(const RawKeySource&) = delete;
51
52 EncryptionKeyMap encryption_key_map_;
53};
54
55} // namespace media
56} // namespace shaka
57
58#endif // PACKAGER_MEDIA_BASE_RAW_KEY_SOURCE_H_
KeySource is responsible for encryption key acquisition.
Definition key_source.h:52
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.