Shaka Packager SDK
decryptor_source.h
1 // Copyright 2016 Google Inc. 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_DECRYPTOR_SOURCE_H_
8 #define PACKAGER_MEDIA_BASE_DECRYPTOR_SOURCE_H_
9 
10 #include <map>
11 #include <memory>
12 #include <vector>
13 
14 #include "packager/media/base/aes_decryptor.h"
15 #include "packager/media/base/decrypt_config.h"
16 #include "packager/media/base/key_source.h"
17 
18 namespace shaka {
19 namespace media {
20 
23  public:
26  explicit DecryptorSource(KeySource* key_source);
27  ~DecryptorSource();
28 
38  bool DecryptSampleBuffer(const DecryptConfig* decrypt_config,
39  const uint8_t* encrypted_buffer,
40  size_t buffer_size,
41  uint8_t* decrypted_buffer);
42 
43  private:
44  KeySource* key_source_;
45  std::map<std::vector<uint8_t>, std::unique_ptr<AesCryptor>> decryptor_map_;
46 
47  DISALLOW_COPY_AND_ASSIGN(DecryptorSource);
48 };
49 
50 } // namespace media
51 } // namespace shaka
52 
53 #endif // PACKAGER_MEDIA_BASE_DECRYPTOR_SOURCE_H_
DecryptorSource(KeySource *key_source)
bool DecryptSampleBuffer(const DecryptConfig *decrypt_config, const uint8_t *encrypted_buffer, size_t buffer_size, uint8_t *decrypted_buffer)
All the methods that are virtual are virtual for mocking.
KeySource is responsible for encryption key acquisition.
Definition: key_source.h:48
DecryptorSource wraps KeySource and is responsible for decryptor management.