Rename RawKeyPsshGenerator to CommonPsshGenerator

Change-Id: I59f9156ae0f13f04ba846806c661292f29339945
This commit is contained in:
KongQun Yang 2018-09-17 15:04:38 -07:00
parent 31fc2f5135
commit cb77b65117
9 changed files with 31 additions and 31 deletions

View File

@ -16,10 +16,10 @@
#include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_number_conversions.h"
#include "packager/base/strings/stringprintf.h" #include "packager/base/strings/stringprintf.h"
#include "packager/hls/base/media_playlist.h" #include "packager/hls/base/media_playlist.h"
#include "packager/media/base/common_pssh_generator.h"
#include "packager/media/base/fairplay_pssh_generator.h" #include "packager/media/base/fairplay_pssh_generator.h"
#include "packager/media/base/protection_system_specific_info.h" #include "packager/media/base/protection_system_specific_info.h"
#include "packager/media/base/proto_json_util.h" #include "packager/media/base/proto_json_util.h"
#include "packager/media/base/raw_key_pssh_generator.h"
#include "packager/media/base/raw_key_source.h" #include "packager/media/base/raw_key_source.h"
#include "packager/media/base/widevine_key_source.h" #include "packager/media/base/widevine_key_source.h"
#include "packager/media/base/widevine_pssh_data.pb.h" #include "packager/media/base/widevine_pssh_data.pb.h"

View File

@ -14,9 +14,9 @@
#include "packager/base/files/file_path.h" #include "packager/base/files/file_path.h"
#include "packager/hls/base/mock_media_playlist.h" #include "packager/hls/base/mock_media_playlist.h"
#include "packager/hls/base/simple_hls_notifier.h" #include "packager/hls/base/simple_hls_notifier.h"
#include "packager/media/base/common_pssh_generator.h"
#include "packager/media/base/fairplay_pssh_generator.h" #include "packager/media/base/fairplay_pssh_generator.h"
#include "packager/media/base/protection_system_specific_info.h" #include "packager/media/base/protection_system_specific_info.h"
#include "packager/media/base/raw_key_pssh_generator.h"
#include "packager/media/base/raw_key_source.h" #include "packager/media/base/raw_key_source.h"
#include "packager/media/base/widevine_key_source.h" #include "packager/media/base/widevine_key_source.h"
#include "packager/media/base/widevine_pssh_data.pb.h" #include "packager/media/base/widevine_pssh_data.pb.h"

View File

@ -4,7 +4,7 @@
// license that can be found in the LICENSE file or at // license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd // https://developers.google.com/open-source/licenses/bsd
#include "packager/media/base/raw_key_pssh_generator.h" #include "packager/media/base/common_pssh_generator.h"
namespace shaka { namespace shaka {
namespace media { namespace media {
@ -12,19 +12,19 @@ namespace {
const uint8_t kCommonSystemPsshBoxVersion = 1; const uint8_t kCommonSystemPsshBoxVersion = 1;
} // namespace } // namespace
RawKeyPsshGenerator::RawKeyPsshGenerator() CommonPsshGenerator::CommonPsshGenerator()
: PsshGenerator(std::vector<uint8_t>(std::begin(kCommonSystemId), : PsshGenerator(std::vector<uint8_t>(std::begin(kCommonSystemId),
std::end(kCommonSystemId)), std::end(kCommonSystemId)),
kCommonSystemPsshBoxVersion) {} kCommonSystemPsshBoxVersion) {}
RawKeyPsshGenerator::~RawKeyPsshGenerator() = default; CommonPsshGenerator::~CommonPsshGenerator() = default;
bool RawKeyPsshGenerator::SupportMultipleKeys() { bool CommonPsshGenerator::SupportMultipleKeys() {
return true; return true;
} }
base::Optional<std::vector<uint8_t>> base::Optional<std::vector<uint8_t>>
RawKeyPsshGenerator::GeneratePsshDataFromKeyIdAndKey( CommonPsshGenerator::GeneratePsshDataFromKeyIdAndKey(
const std::vector<uint8_t>& key_id, const std::vector<uint8_t>& key_id,
const std::vector<uint8_t>& key) const { const std::vector<uint8_t>& key) const {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
@ -32,7 +32,7 @@ RawKeyPsshGenerator::GeneratePsshDataFromKeyIdAndKey(
} }
base::Optional<std::vector<uint8_t>> base::Optional<std::vector<uint8_t>>
RawKeyPsshGenerator::GeneratePsshDataFromKeyIds( CommonPsshGenerator::GeneratePsshDataFromKeyIds(
const std::vector<std::vector<uint8_t>>& key_ids) const { const std::vector<std::vector<uint8_t>>& key_ids) const {
// Intentionally empty PSSH data for RawKey. // Intentionally empty PSSH data for RawKey.
return std::vector<uint8_t>(); return std::vector<uint8_t>();

View File

@ -4,8 +4,8 @@
// license that can be found in the LICENSE file or at // license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd // https://developers.google.com/open-source/licenses/bsd
#ifndef MEDIA_BASE_RAW_KEY_PSSH_GENERATOR_H_ #ifndef PACKAGER_MEDIA_BASE_COMMON_PSSH_GENERATOR_H_
#define MEDIA_BASE_RAW_KEY_PSSH_GENERATOR_H_ #define PACKAGER_MEDIA_BASE_COMMON_PSSH_GENERATOR_H_
#include "packager/media/base/pssh_generator.h" #include "packager/media/base/pssh_generator.h"
@ -19,10 +19,10 @@ const uint8_t kCommonSystemId[] = {0x10, 0x77, 0xef, 0xec, 0xc0, 0xb2,
0x4d, 0x02, 0xac, 0xe3, 0x3c, 0x1e, 0x4d, 0x02, 0xac, 0xe3, 0x3c, 0x1e,
0x52, 0xe2, 0xfb, 0x4b}; 0x52, 0xe2, 0xfb, 0x4b};
class RawKeyPsshGenerator : public PsshGenerator { class CommonPsshGenerator : public PsshGenerator {
public: public:
RawKeyPsshGenerator(); CommonPsshGenerator();
~RawKeyPsshGenerator() override; ~CommonPsshGenerator() override;
/// @name PsshGenerator implemetation overrides. /// @name PsshGenerator implemetation overrides.
/// @{ /// @{
@ -30,8 +30,8 @@ class RawKeyPsshGenerator : public PsshGenerator {
/// @} /// @}
private: private:
RawKeyPsshGenerator& operator=(const RawKeyPsshGenerator&) = delete; CommonPsshGenerator& operator=(const CommonPsshGenerator&) = delete;
RawKeyPsshGenerator(const RawKeyPsshGenerator&) = delete; CommonPsshGenerator(const CommonPsshGenerator&) = delete;
// PsshGenerator implemetation overrides. // PsshGenerator implemetation overrides.
@ -45,4 +45,4 @@ class RawKeyPsshGenerator : public PsshGenerator {
} // namespace media } // namespace media
} // namespace shaka } // namespace shaka
#endif // MEDIA_BASE_RAW_KEY_PSSH_GENERATOR_H_ #endif // PACKAGER_MEDIA_BASE_COMMON_PSSH_GENERATOR_H_

View File

@ -7,9 +7,9 @@
#include "packager/media/base/key_source.h" #include "packager/media/base/key_source.h"
#include "packager/base/logging.h" #include "packager/base/logging.h"
#include "packager/media/base/common_pssh_generator.h"
#include "packager/media/base/fairplay_pssh_generator.h" #include "packager/media/base/fairplay_pssh_generator.h"
#include "packager/media/base/playready_pssh_generator.h" #include "packager/media/base/playready_pssh_generator.h"
#include "packager/media/base/raw_key_pssh_generator.h"
#include "packager/media/base/widevine_pssh_generator.h" #include "packager/media/base/widevine_pssh_generator.h"
#include "packager/status_macros.h" #include "packager/status_macros.h"
@ -18,7 +18,7 @@ namespace media {
KeySource::KeySource(int protection_systems_flags, FourCC protection_scheme) { KeySource::KeySource(int protection_systems_flags, FourCC protection_scheme) {
if (protection_systems_flags & COMMON_PROTECTION_SYSTEM_FLAG) { if (protection_systems_flags & COMMON_PROTECTION_SYSTEM_FLAG) {
pssh_generators_.emplace_back(new RawKeyPsshGenerator()); pssh_generators_.emplace_back(new CommonPsshGenerator());
} }
if (protection_systems_flags & PLAYREADY_PROTECTION_SYSTEM_FLAG) { if (protection_systems_flags & PLAYREADY_PROTECTION_SYSTEM_FLAG) {

View File

@ -37,6 +37,8 @@
'byte_queue.h', 'byte_queue.h',
'closure_thread.cc', 'closure_thread.cc',
'closure_thread.h', 'closure_thread.h',
'common_pssh_generator.cc',
'common_pssh_generator.h',
'container_names.cc', 'container_names.cc',
'container_names.h', 'container_names.h',
'decrypt_config.cc', 'decrypt_config.cc',
@ -88,8 +90,6 @@
'pssh_generator_util.cc', 'pssh_generator_util.cc',
'pssh_generator_util.h', 'pssh_generator_util.h',
'range.h', 'range.h',
'raw_key_pssh_generator.cc',
'raw_key_pssh_generator.h',
'raw_key_source.cc', 'raw_key_source.cc',
'raw_key_source.h', 'raw_key_source.h',
'rcheck.h', 'rcheck.h',

View File

@ -7,8 +7,8 @@
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "packager/media/base/common_pssh_generator.h"
#include "packager/media/base/playready_pssh_generator.h" #include "packager/media/base/playready_pssh_generator.h"
#include "packager/media/base/raw_key_pssh_generator.h"
#include "packager/media/base/widevine_pssh_generator.h" #include "packager/media/base/widevine_pssh_generator.h"
#include "packager/status_test_util.h" #include "packager/status_test_util.h"
@ -165,24 +165,24 @@ TEST(PsshGeneratorTest, GeneratePlayReadyPsshFromKeyIdAndKey) {
std::end(kExpectedPlayReadyPssh))); std::end(kExpectedPlayReadyPssh)));
} }
TEST(PsshGeneratorTest, GenerateRawKeyPsshFromKeyIds) { TEST(PsshGeneratorTest, GenerateCommonPsshFromKeyIds) {
const std::vector<std::vector<uint8_t>> kTestKeyIds = {GetTestKeyId1(), const std::vector<std::vector<uint8_t>> kTestKeyIds = {GetTestKeyId1(),
GetTestKeyId2()}; GetTestKeyId2()};
std::unique_ptr<RawKeyPsshGenerator> raw_key_pssh_generator( std::unique_ptr<CommonPsshGenerator> common_pssh_generator(
new RawKeyPsshGenerator()); new CommonPsshGenerator());
ProtectionSystemSpecificInfo info; ProtectionSystemSpecificInfo info;
EXPECT_OK(raw_key_pssh_generator->GeneratePsshFromKeyIds(kTestKeyIds, &info)); EXPECT_OK(common_pssh_generator->GeneratePsshFromKeyIds(kTestKeyIds, &info));
EXPECT_THAT(info.psshs, ElementsAreArray(std::begin(kExpectedCommonPssh), EXPECT_THAT(info.psshs, ElementsAreArray(std::begin(kExpectedCommonPssh),
std::end(kExpectedCommonPssh))); std::end(kExpectedCommonPssh)));
} }
TEST(PsshGeneratorTest, GenerateRawKeyPsshFromKeyIdAndKey) { TEST(PsshGeneratorTest, GenerateCommonPsshFromKeyIdAndKey) {
const std::vector<uint8_t> kTestKeyId = GetTestKeyId1(); const std::vector<uint8_t> kTestKeyId = GetTestKeyId1();
const std::vector<uint8_t> kTestKey = GetTestKey1(); const std::vector<uint8_t> kTestKey = GetTestKey1();
std::unique_ptr<RawKeyPsshGenerator> raw_key_pssh_generator( std::unique_ptr<CommonPsshGenerator> common_pssh_generator(
new RawKeyPsshGenerator()); new CommonPsshGenerator());
ProtectionSystemSpecificInfo info; ProtectionSystemSpecificInfo info;
EXPECT_NOT_OK(raw_key_pssh_generator->GeneratePsshFromKeyIdAndKey( EXPECT_NOT_OK(common_pssh_generator->GeneratePsshFromKeyIdAndKey(
kTestKeyId, kTestKey, &info)); kTestKeyId, kTestKey, &info));
} }

View File

@ -9,8 +9,8 @@
#include <algorithm> #include <algorithm>
#include "packager/base/logging.h" #include "packager/base/logging.h"
#include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_number_conversions.h"
#include "packager/media/base/common_pssh_generator.h"
#include "packager/media/base/key_source.h" #include "packager/media/base/key_source.h"
#include "packager/media/base/raw_key_pssh_generator.h"
#include "packager/status_macros.h" #include "packager/status_macros.h"
namespace { namespace {

View File

@ -12,8 +12,8 @@
#include "packager/base/base64.h" #include "packager/base/base64.h"
#include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_number_conversions.h"
#include "packager/base/strings/stringprintf.h" #include "packager/base/strings/stringprintf.h"
#include "packager/media/base/common_pssh_generator.h"
#include "packager/media/base/key_fetcher.h" #include "packager/media/base/key_fetcher.h"
#include "packager/media/base/raw_key_pssh_generator.h"
#include "packager/media/base/request_signer.h" #include "packager/media/base/request_signer.h"
#include "packager/media/base/widevine_key_source.h" #include "packager/media/base/widevine_key_source.h"
#include "packager/media/base/widevine_pssh_generator.h" #include "packager/media/base/widevine_pssh_generator.h"