From 5a912815c1efbeda450f103cd858c0fe346b9dc9 Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Mon, 17 Sep 2018 15:23:38 -0700 Subject: [PATCH] Move protection system Ids to protection_system_ids.h Change-Id: Ia22b89c38b3b1ff7ead05f8484e15edef6218953 --- packager/hls/base/simple_hls_notifier.cc | 6 +-- .../hls/base/simple_hls_notifier_unittest.cc | 6 +-- packager/media/base/common_pssh_generator.cc | 2 + packager/media/base/common_pssh_generator.h | 7 ---- .../media/base/fairplay_pssh_generator.cc | 2 + packager/media/base/fairplay_pssh_generator.h | 6 --- packager/media/base/media_base.gyp | 1 + packager/media/base/playready_key_source.cc | 2 +- .../media/base/playready_pssh_generator.cc | 1 + .../media/base/playready_pssh_generator.h | 5 --- packager/media/base/protection_system_ids.h | 37 +++++++++++++++++++ packager/media/base/raw_key_source.cc | 1 - packager/media/base/widevine_key_source.cc | 2 +- .../base/widevine_key_source_unittest.cc | 2 +- .../media/base/widevine_pssh_generator.cc | 1 + packager/media/base/widevine_pssh_generator.h | 4 -- 16 files changed, 49 insertions(+), 36 deletions(-) create mode 100644 packager/media/base/protection_system_ids.h diff --git a/packager/hls/base/simple_hls_notifier.cc b/packager/hls/base/simple_hls_notifier.cc index 2387ace981..11dde8e31e 100644 --- a/packager/hls/base/simple_hls_notifier.cc +++ b/packager/hls/base/simple_hls_notifier.cc @@ -16,14 +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_ids.h" #include "packager/media/base/protection_system_specific_info.h" #include "packager/media/base/proto_json_util.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" -#include "packager/media/base/widevine_pssh_generator.h" DEFINE_bool(enable_legacy_widevine_hls_signaling, false, diff --git a/packager/hls/base/simple_hls_notifier_unittest.cc b/packager/hls/base/simple_hls_notifier_unittest.cc index a4fbc4aedd..17f6943c88 100644 --- a/packager/hls/base/simple_hls_notifier_unittest.cc +++ b/packager/hls/base/simple_hls_notifier_unittest.cc @@ -14,13 +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_ids.h" #include "packager/media/base/protection_system_specific_info.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" -#include "packager/media/base/widevine_pssh_generator.h" DECLARE_bool(enable_legacy_widevine_hls_signaling); diff --git a/packager/media/base/common_pssh_generator.cc b/packager/media/base/common_pssh_generator.cc index a54ad16e7b..c411e5a201 100644 --- a/packager/media/base/common_pssh_generator.cc +++ b/packager/media/base/common_pssh_generator.cc @@ -6,6 +6,8 @@ #include "packager/media/base/common_pssh_generator.h" +#include "packager/media/base/protection_system_ids.h" + namespace shaka { namespace media { namespace { diff --git a/packager/media/base/common_pssh_generator.h b/packager/media/base/common_pssh_generator.h index 71a7eb0546..6179c59978 100644 --- a/packager/media/base/common_pssh_generator.h +++ b/packager/media/base/common_pssh_generator.h @@ -12,13 +12,6 @@ namespace shaka { namespace media { -// Common SystemID defined by EME, which requires Key System implementations -// supporting ISO Common Encryption to support this SystemID and format. -// https://goo.gl/kUv2Xd -const uint8_t kCommonSystemId[] = {0x10, 0x77, 0xef, 0xec, 0xc0, 0xb2, - 0x4d, 0x02, 0xac, 0xe3, 0x3c, 0x1e, - 0x52, 0xe2, 0xfb, 0x4b}; - class CommonPsshGenerator : public PsshGenerator { public: CommonPsshGenerator(); diff --git a/packager/media/base/fairplay_pssh_generator.cc b/packager/media/base/fairplay_pssh_generator.cc index b2562926a3..9fd509a413 100644 --- a/packager/media/base/fairplay_pssh_generator.cc +++ b/packager/media/base/fairplay_pssh_generator.cc @@ -6,6 +6,8 @@ #include "packager/media/base/fairplay_pssh_generator.h" +#include "packager/media/base/protection_system_ids.h" + namespace shaka { namespace media { namespace { diff --git a/packager/media/base/fairplay_pssh_generator.h b/packager/media/base/fairplay_pssh_generator.h index 9ab95ecfd9..285219aaf6 100644 --- a/packager/media/base/fairplay_pssh_generator.h +++ b/packager/media/base/fairplay_pssh_generator.h @@ -12,12 +12,6 @@ namespace shaka { namespace media { -// Unofficial FairPlay system id extracted from -// https://forums.developer.apple.com/thread/6185. -const uint8_t kFairPlaySystemId[] = {0x29, 0x70, 0x1F, 0xE4, 0x3C, 0xC7, - 0x4A, 0x34, 0x8C, 0x5B, 0xAE, 0x90, - 0xC7, 0x43, 0x9A, 0x47}; - class FairPlayPsshGenerator : public PsshGenerator { public: FairPlayPsshGenerator(); diff --git a/packager/media/base/media_base.gyp b/packager/media/base/media_base.gyp index ca3534b94c..00fe9f0aef 100644 --- a/packager/media/base/media_base.gyp +++ b/packager/media/base/media_base.gyp @@ -81,6 +81,7 @@ 'playready_pssh_generator.cc', 'playready_pssh_generator.h', 'producer_consumer_queue.h', + 'protection_system_ids.h', 'protection_system_specific_info.cc', 'protection_system_specific_info.h', 'proto_json_util.cc', diff --git a/packager/media/base/playready_key_source.cc b/packager/media/base/playready_key_source.cc index fa13ba0d96..c390dad53b 100644 --- a/packager/media/base/playready_key_source.cc +++ b/packager/media/base/playready_key_source.cc @@ -15,7 +15,7 @@ #include "packager/media/base/buffer_writer.h" #include "packager/media/base/http_key_fetcher.h" #include "packager/media/base/key_source.h" -#include "packager/media/base/playready_pssh_generator.h" +#include "packager/media/base/protection_system_ids.h" #include "packager/status_macros.h" namespace shaka { diff --git a/packager/media/base/playready_pssh_generator.cc b/packager/media/base/playready_pssh_generator.cc index e319b124c9..0c1b168564 100644 --- a/packager/media/base/playready_pssh_generator.cc +++ b/packager/media/base/playready_pssh_generator.cc @@ -17,6 +17,7 @@ #include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_util.h" #include "packager/media/base/buffer_writer.h" +#include "packager/media/base/protection_system_ids.h" namespace shaka { namespace media { diff --git a/packager/media/base/playready_pssh_generator.h b/packager/media/base/playready_pssh_generator.h index d6e03c7201..485568e214 100644 --- a/packager/media/base/playready_pssh_generator.h +++ b/packager/media/base/playready_pssh_generator.h @@ -12,11 +12,6 @@ namespace shaka { namespace media { -// SystemID defined for PlayReady Drm. -const uint8_t kPlayReadySystemId[] = {0x9a, 0x04, 0xf0, 0x79, 0x98, 0x40, - 0x42, 0x86, 0xab, 0x92, 0xe6, 0x5b, - 0xe0, 0x88, 0x5f, 0x95}; - class PlayReadyPsshGenerator : public PsshGenerator { public: PlayReadyPsshGenerator(); diff --git a/packager/media/base/protection_system_ids.h b/packager/media/base/protection_system_ids.h new file mode 100644 index 0000000000..ba4b8689f3 --- /dev/null +++ b/packager/media/base/protection_system_ids.h @@ -0,0 +1,37 @@ +// Copyright 2018 Google LLC. All rights reserved. +// +// 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 + +#ifndef PACKAGER_MEDIA_BASE_PROTECTION_SYSTEM_IDS_H_ +#define PACKAGER_MEDIA_BASE_PROTECTION_SYSTEM_IDS_H_ + +namespace shaka { +namespace media { + +// Common SystemID defined by EME, which requires Key System implementations +// supporting ISO Common Encryption to support this SystemID and format. +// https://goo.gl/kUv2Xd +const uint8_t kCommonSystemId[] = {0x10, 0x77, 0xef, 0xec, 0xc0, 0xb2, + 0x4d, 0x02, 0xac, 0xe3, 0x3c, 0x1e, + 0x52, 0xe2, 0xfb, 0x4b}; + +// Unofficial FairPlay system id extracted from +// https://forums.developer.apple.com/thread/6185. +const uint8_t kFairPlaySystemId[] = {0x29, 0x70, 0x1F, 0xE4, 0x3C, 0xC7, + 0x4A, 0x34, 0x8C, 0x5B, 0xAE, 0x90, + 0xC7, 0x43, 0x9A, 0x47}; + +const uint8_t kPlayReadySystemId[] = {0x9a, 0x04, 0xf0, 0x79, 0x98, 0x40, + 0x42, 0x86, 0xab, 0x92, 0xe6, 0x5b, + 0xe0, 0x88, 0x5f, 0x95}; + +const uint8_t kWidevineSystemId[] = {0xed, 0xef, 0x8b, 0xa9, 0x79, 0xd6, + 0x4a, 0xce, 0xa3, 0xc8, 0x27, 0xdc, + 0xd5, 0x1d, 0x21, 0xed}; + +} // namespace media +} // namespace shaka + +#endif // PACKAGER_MEDIA_BASE_PROTECTION_SYSTEM_IDS_H_ diff --git a/packager/media/base/raw_key_source.cc b/packager/media/base/raw_key_source.cc index 32963114e7..63af61170e 100644 --- a/packager/media/base/raw_key_source.cc +++ b/packager/media/base/raw_key_source.cc @@ -9,7 +9,6 @@ #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/status_macros.h" diff --git a/packager/media/base/widevine_key_source.cc b/packager/media/base/widevine_key_source.cc index 30e5465d5b..5f75eb2176 100644 --- a/packager/media/base/widevine_key_source.cc +++ b/packager/media/base/widevine_key_source.cc @@ -12,13 +12,13 @@ #include "packager/media/base/http_key_fetcher.h" #include "packager/media/base/network_util.h" #include "packager/media/base/producer_consumer_queue.h" +#include "packager/media/base/protection_system_ids.h" #include "packager/media/base/protection_system_specific_info.h" #include "packager/media/base/proto_json_util.h" #include "packager/media/base/pssh_generator_util.h" #include "packager/media/base/rcheck.h" #include "packager/media/base/request_signer.h" #include "packager/media/base/widevine_common_encryption.pb.h" -#include "packager/media/base/widevine_pssh_generator.h" namespace shaka { namespace media { diff --git a/packager/media/base/widevine_key_source_unittest.cc b/packager/media/base/widevine_key_source_unittest.cc index dcb7f030a7..70d5f67fb2 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/protection_system_ids.h" #include "packager/media/base/request_signer.h" #include "packager/media/base/widevine_key_source.h" #include "packager/media/base/widevine_pssh_generator.h" diff --git a/packager/media/base/widevine_pssh_generator.cc b/packager/media/base/widevine_pssh_generator.cc index 83b360f056..5cd4b7b370 100644 --- a/packager/media/base/widevine_pssh_generator.cc +++ b/packager/media/base/widevine_pssh_generator.cc @@ -6,6 +6,7 @@ #include "packager/media/base/widevine_pssh_generator.h" +#include "packager/media/base/protection_system_ids.h" #include "packager/media/base/widevine_pssh_data.pb.h" namespace shaka { diff --git a/packager/media/base/widevine_pssh_generator.h b/packager/media/base/widevine_pssh_generator.h index b0aedbc225..5ef228fbdc 100644 --- a/packager/media/base/widevine_pssh_generator.h +++ b/packager/media/base/widevine_pssh_generator.h @@ -13,10 +13,6 @@ namespace shaka { namespace media { -const uint8_t kWidevineSystemId[] = {0xed, 0xef, 0x8b, 0xa9, 0x79, 0xd6, - 0x4a, 0xce, 0xa3, 0xc8, 0x27, 0xdc, - 0xd5, 0x1d, 0x21, 0xed}; - class WidevinePsshGenerator : public PsshGenerator { public: explicit WidevinePsshGenerator(FourCC protection_scheme);