From cb77b65117af7f64a28a6aa992ad5e883614b26d Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Mon, 17 Sep 2018 15:04:38 -0700 Subject: [PATCH] Rename RawKeyPsshGenerator to CommonPsshGenerator Change-Id: I59f9156ae0f13f04ba846806c661292f29339945 --- packager/hls/base/simple_hls_notifier.cc | 2 +- .../hls/base/simple_hls_notifier_unittest.cc | 2 +- ...h_generator.cc => common_pssh_generator.cc} | 12 ++++++------ ...ssh_generator.h => common_pssh_generator.h} | 16 ++++++++-------- packager/media/base/key_source.cc | 4 ++-- packager/media/base/media_base.gyp | 4 ++-- packager/media/base/pssh_generator_unittest.cc | 18 +++++++++--------- packager/media/base/raw_key_source.cc | 2 +- .../media/base/widevine_key_source_unittest.cc | 2 +- 9 files changed, 31 insertions(+), 31 deletions(-) rename packager/media/base/{raw_key_pssh_generator.cc => common_pssh_generator.cc} (75%) rename packager/media/base/{raw_key_pssh_generator.h => common_pssh_generator.h} (75%) diff --git a/packager/hls/base/simple_hls_notifier.cc b/packager/hls/base/simple_hls_notifier.cc index 7b70ff601b..2387ace981 100644 --- a/packager/hls/base/simple_hls_notifier.cc +++ b/packager/hls/base/simple_hls_notifier.cc @@ -16,10 +16,10 @@ #include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/stringprintf.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/protection_system_specific_info.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/widevine_key_source.h" #include "packager/media/base/widevine_pssh_data.pb.h" diff --git a/packager/hls/base/simple_hls_notifier_unittest.cc b/packager/hls/base/simple_hls_notifier_unittest.cc index f52a67830e..a4fbc4aedd 100644 --- a/packager/hls/base/simple_hls_notifier_unittest.cc +++ b/packager/hls/base/simple_hls_notifier_unittest.cc @@ -14,9 +14,9 @@ #include "packager/base/files/file_path.h" #include "packager/hls/base/mock_media_playlist.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/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/widevine_key_source.h" #include "packager/media/base/widevine_pssh_data.pb.h" diff --git a/packager/media/base/raw_key_pssh_generator.cc b/packager/media/base/common_pssh_generator.cc similarity index 75% rename from packager/media/base/raw_key_pssh_generator.cc rename to packager/media/base/common_pssh_generator.cc index d645888151..a54ad16e7b 100644 --- a/packager/media/base/raw_key_pssh_generator.cc +++ b/packager/media/base/common_pssh_generator.cc @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file or at // 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 media { @@ -12,19 +12,19 @@ namespace { const uint8_t kCommonSystemPsshBoxVersion = 1; } // namespace -RawKeyPsshGenerator::RawKeyPsshGenerator() +CommonPsshGenerator::CommonPsshGenerator() : PsshGenerator(std::vector(std::begin(kCommonSystemId), std::end(kCommonSystemId)), kCommonSystemPsshBoxVersion) {} -RawKeyPsshGenerator::~RawKeyPsshGenerator() = default; +CommonPsshGenerator::~CommonPsshGenerator() = default; -bool RawKeyPsshGenerator::SupportMultipleKeys() { +bool CommonPsshGenerator::SupportMultipleKeys() { return true; } base::Optional> -RawKeyPsshGenerator::GeneratePsshDataFromKeyIdAndKey( +CommonPsshGenerator::GeneratePsshDataFromKeyIdAndKey( const std::vector& key_id, const std::vector& key) const { NOTIMPLEMENTED(); @@ -32,7 +32,7 @@ RawKeyPsshGenerator::GeneratePsshDataFromKeyIdAndKey( } base::Optional> -RawKeyPsshGenerator::GeneratePsshDataFromKeyIds( +CommonPsshGenerator::GeneratePsshDataFromKeyIds( const std::vector>& key_ids) const { // Intentionally empty PSSH data for RawKey. return std::vector(); diff --git a/packager/media/base/raw_key_pssh_generator.h b/packager/media/base/common_pssh_generator.h similarity index 75% rename from packager/media/base/raw_key_pssh_generator.h rename to packager/media/base/common_pssh_generator.h index 8d169c67e2..71a7eb0546 100644 --- a/packager/media/base/raw_key_pssh_generator.h +++ b/packager/media/base/common_pssh_generator.h @@ -4,8 +4,8 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -#ifndef MEDIA_BASE_RAW_KEY_PSSH_GENERATOR_H_ -#define MEDIA_BASE_RAW_KEY_PSSH_GENERATOR_H_ +#ifndef PACKAGER_MEDIA_BASE_COMMON_PSSH_GENERATOR_H_ +#define PACKAGER_MEDIA_BASE_COMMON_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, 0x52, 0xe2, 0xfb, 0x4b}; -class RawKeyPsshGenerator : public PsshGenerator { +class CommonPsshGenerator : public PsshGenerator { public: - RawKeyPsshGenerator(); - ~RawKeyPsshGenerator() override; + CommonPsshGenerator(); + ~CommonPsshGenerator() override; /// @name PsshGenerator implemetation overrides. /// @{ @@ -30,8 +30,8 @@ class RawKeyPsshGenerator : public PsshGenerator { /// @} private: - RawKeyPsshGenerator& operator=(const RawKeyPsshGenerator&) = delete; - RawKeyPsshGenerator(const RawKeyPsshGenerator&) = delete; + CommonPsshGenerator& operator=(const CommonPsshGenerator&) = delete; + CommonPsshGenerator(const CommonPsshGenerator&) = delete; // PsshGenerator implemetation overrides. @@ -45,4 +45,4 @@ class RawKeyPsshGenerator : public PsshGenerator { } // namespace media } // namespace shaka -#endif // MEDIA_BASE_RAW_KEY_PSSH_GENERATOR_H_ +#endif // PACKAGER_MEDIA_BASE_COMMON_PSSH_GENERATOR_H_ diff --git a/packager/media/base/key_source.cc b/packager/media/base/key_source.cc index 136aa5332f..6586d8aa4f 100644 --- a/packager/media/base/key_source.cc +++ b/packager/media/base/key_source.cc @@ -7,9 +7,9 @@ #include "packager/media/base/key_source.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/playready_pssh_generator.h" -#include "packager/media/base/raw_key_pssh_generator.h" #include "packager/media/base/widevine_pssh_generator.h" #include "packager/status_macros.h" @@ -18,7 +18,7 @@ namespace media { KeySource::KeySource(int protection_systems_flags, FourCC protection_scheme) { 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) { diff --git a/packager/media/base/media_base.gyp b/packager/media/base/media_base.gyp index fbb6def627..ca3534b94c 100644 --- a/packager/media/base/media_base.gyp +++ b/packager/media/base/media_base.gyp @@ -37,6 +37,8 @@ 'byte_queue.h', 'closure_thread.cc', 'closure_thread.h', + 'common_pssh_generator.cc', + 'common_pssh_generator.h', 'container_names.cc', 'container_names.h', 'decrypt_config.cc', @@ -88,8 +90,6 @@ 'pssh_generator_util.cc', 'pssh_generator_util.h', 'range.h', - 'raw_key_pssh_generator.cc', - 'raw_key_pssh_generator.h', 'raw_key_source.cc', 'raw_key_source.h', 'rcheck.h', diff --git a/packager/media/base/pssh_generator_unittest.cc b/packager/media/base/pssh_generator_unittest.cc index 216a846932..5a82050bd8 100644 --- a/packager/media/base/pssh_generator_unittest.cc +++ b/packager/media/base/pssh_generator_unittest.cc @@ -7,8 +7,8 @@ #include #include +#include "packager/media/base/common_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/status_test_util.h" @@ -165,24 +165,24 @@ TEST(PsshGeneratorTest, GeneratePlayReadyPsshFromKeyIdAndKey) { std::end(kExpectedPlayReadyPssh))); } -TEST(PsshGeneratorTest, GenerateRawKeyPsshFromKeyIds) { +TEST(PsshGeneratorTest, GenerateCommonPsshFromKeyIds) { const std::vector> kTestKeyIds = {GetTestKeyId1(), GetTestKeyId2()}; - std::unique_ptr raw_key_pssh_generator( - new RawKeyPsshGenerator()); + std::unique_ptr common_pssh_generator( + new CommonPsshGenerator()); 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), std::end(kExpectedCommonPssh))); } -TEST(PsshGeneratorTest, GenerateRawKeyPsshFromKeyIdAndKey) { +TEST(PsshGeneratorTest, GenerateCommonPsshFromKeyIdAndKey) { const std::vector kTestKeyId = GetTestKeyId1(); const std::vector kTestKey = GetTestKey1(); - std::unique_ptr raw_key_pssh_generator( - new RawKeyPsshGenerator()); + std::unique_ptr common_pssh_generator( + new CommonPsshGenerator()); ProtectionSystemSpecificInfo info; - EXPECT_NOT_OK(raw_key_pssh_generator->GeneratePsshFromKeyIdAndKey( + EXPECT_NOT_OK(common_pssh_generator->GeneratePsshFromKeyIdAndKey( kTestKeyId, kTestKey, &info)); } diff --git a/packager/media/base/raw_key_source.cc b/packager/media/base/raw_key_source.cc index f49b63a995..32963114e7 100644 --- a/packager/media/base/raw_key_source.cc +++ b/packager/media/base/raw_key_source.cc @@ -9,8 +9,8 @@ #include #include "packager/base/logging.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/raw_key_pssh_generator.h" #include "packager/status_macros.h" namespace { diff --git a/packager/media/base/widevine_key_source_unittest.cc b/packager/media/base/widevine_key_source_unittest.cc index 954ce43d3e..dcb7f030a7 100644 --- a/packager/media/base/widevine_key_source_unittest.cc +++ b/packager/media/base/widevine_key_source_unittest.cc @@ -12,8 +12,8 @@ #include "packager/base/base64.h" #include "packager/base/strings/string_number_conversions.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/raw_key_pssh_generator.h" #include "packager/media/base/request_signer.h" #include "packager/media/base/widevine_key_source.h" #include "packager/media/base/widevine_pssh_generator.h"