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