Shaka Packager SDK
decryptor_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_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/macros/classes.h>
15 #include <packager/media/base/aes_decryptor.h>
16 #include <packager/media/base/decrypt_config.h>
17 #include <packager/media/base/key_source.h>
18 
19 namespace shaka {
20 namespace media {
21 
24  public:
27  explicit DecryptorSource(KeySource* key_source);
28  ~DecryptorSource();
29 
39  bool DecryptSampleBuffer(const DecryptConfig* decrypt_config,
40  const uint8_t* encrypted_buffer,
41  size_t buffer_size,
42  uint8_t* decrypted_buffer);
43 
44  private:
45  KeySource* key_source_;
46  std::map<std::vector<uint8_t>, std::unique_ptr<AesCryptor>> decryptor_map_;
47 
48  DISALLOW_COPY_AND_ASSIGN(DecryptorSource);
49 };
50 
51 } // namespace media
52 } // namespace shaka
53 
54 #endif // PACKAGER_MEDIA_BASE_DECRYPTOR_SOURCE_H_
DecryptorSource wraps KeySource and is responsible for decryptor management.
DecryptorSource(KeySource *key_source)
bool DecryptSampleBuffer(const DecryptConfig *decrypt_config, const uint8_t *encrypted_buffer, size_t buffer_size, uint8_t *decrypted_buffer)
KeySource is responsible for encryption key acquisition.
Definition: key_source.h:52
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66