From fa2c4409a64fee7b8e1a5cd35ca4d4e715fbc01b Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Tue, 16 Apr 2019 07:55:08 -0700 Subject: [PATCH] Add a flag --video_feature for Widevine Change-Id: Id9ab958add1239972a4f94faf5e65cffe64444be --- packager/media/base/media_base.gyp | 1 + packager/media/base/widevine_common_encryption.proto | 7 +++++++ packager/media/base/widevine_key_source.cc | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/packager/media/base/media_base.gyp b/packager/media/base/media_base.gyp index 4b86ac824b..0843f2761a 100644 --- a/packager/media/base/media_base.gyp +++ b/packager/media/base/media_base.gyp @@ -120,6 +120,7 @@ '../../packager.gyp:status', '../../third_party/boringssl/boringssl.gyp:boringssl', '../../third_party/curl/curl.gyp:libcurl', + '../../third_party/gflags/gflags.gyp:gflags', '../../third_party/libxml/libxml.gyp:libxml', '../../version/version.gyp:version', ], diff --git a/packager/media/base/widevine_common_encryption.proto b/packager/media/base/widevine_common_encryption.proto index 39eb05a0e6..db8f0b3ffb 100644 --- a/packager/media/base/widevine_common_encryption.proto +++ b/packager/media/base/widevine_common_encryption.proto @@ -74,6 +74,13 @@ message CommonEncryptionRequest { // Enable entitlement license if set to true. optional bool enable_entitlement_license = 16; + + // Video feature identifier, which is used in conjunction with |content_id| + // to derive key IDs and content keys. For example, it can be used to generate + // different keys for HDR and SDR. The value is propagated to PSSH. + // Ignored for tracks with type “AUDIO”. + // Current values are "HDR". + optional string video_feature = 19; } message CommonEncryptionResponse { diff --git a/packager/media/base/widevine_key_source.cc b/packager/media/base/widevine_key_source.cc index 00dbe3b63d..df91b55a50 100644 --- a/packager/media/base/widevine_key_source.cc +++ b/packager/media/base/widevine_key_source.cc @@ -6,6 +6,8 @@ #include "packager/media/base/widevine_key_source.h" +#include + #include "packager/base/base64.h" #include "packager/base/bind.h" #include "packager/base/strings/string_number_conversions.h" @@ -20,6 +22,10 @@ #include "packager/media/base/request_signer.h" #include "packager/media/base/widevine_common_encryption.pb.h" +DEFINE_string(video_feature, + "", + "Specify the optional video feature, e.g. HDR."); + namespace shaka { namespace media { namespace { @@ -364,6 +370,9 @@ void WidevineKeySource::FillRequest(bool enable_key_rotation, if (!group_id_.empty()) request->set_group_id(group_id_.data(), group_id_.size()); + + if (!FLAGS_video_feature.empty()) + request->set_video_feature(FLAGS_video_feature); } Status WidevineKeySource::GenerateKeyMessage(