2016-01-13 01:32:48 +00:00
|
|
|
// Copyright 2016 Google Inc. All rights reserved.
|
2014-02-14 23:21:05 +00:00
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
2013-10-11 21:44:55 +00:00
|
|
|
|
|
|
|
#ifndef MEDIA_BASE_DECRYPTOR_SOURCE_H_
|
|
|
|
#define MEDIA_BASE_DECRYPTOR_SOURCE_H_
|
|
|
|
|
2016-01-13 01:32:48 +00:00
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
|
|
|
|
2016-03-17 17:03:19 +00:00
|
|
|
#include "packager/media/base/aes_decryptor.h"
|
2016-01-13 01:32:48 +00:00
|
|
|
#include "packager/media/base/decrypt_config.h"
|
|
|
|
#include "packager/media/base/key_source.h"
|
2013-10-11 21:44:55 +00:00
|
|
|
|
2014-09-19 20:41:13 +00:00
|
|
|
namespace edash_packager {
|
2013-10-11 21:44:55 +00:00
|
|
|
namespace media {
|
|
|
|
|
2016-01-13 01:32:48 +00:00
|
|
|
/// DecryptorSource wraps KeySource and is responsible for decryptor management.
|
2013-10-11 21:44:55 +00:00
|
|
|
class DecryptorSource {
|
|
|
|
public:
|
2016-01-13 01:32:48 +00:00
|
|
|
explicit DecryptorSource(KeySource* key_source);
|
|
|
|
~DecryptorSource();
|
2013-10-11 21:44:55 +00:00
|
|
|
|
2016-01-13 01:32:48 +00:00
|
|
|
bool DecryptSampleBuffer(const DecryptConfig* decrypt_config,
|
|
|
|
uint8_t* buffer,
|
|
|
|
size_t buffer_size);
|
2013-10-11 21:44:55 +00:00
|
|
|
|
|
|
|
private:
|
2016-01-13 01:32:48 +00:00
|
|
|
KeySource* key_source_;
|
2016-03-17 17:03:19 +00:00
|
|
|
std::map<std::vector<uint8_t>, AesDecryptor*> decryptor_map_;
|
2016-01-13 01:32:48 +00:00
|
|
|
|
2013-10-11 21:44:55 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(DecryptorSource);
|
|
|
|
};
|
|
|
|
|
2014-01-24 18:46:46 +00:00
|
|
|
} // namespace media
|
2014-09-19 20:41:13 +00:00
|
|
|
} // namespace edash_packager
|
2013-10-11 21:44:55 +00:00
|
|
|
|
|
|
|
#endif // MEDIA_BASE_DECRYPTOR_SOURCE_H_
|