2022-08-26 15:44:59 +00:00
|
|
|
// Copyright 2017 Google LLC. All rights reserved.
|
2017-01-05 17:32:17 +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
|
|
|
|
//
|
2018-08-06 23:12:19 +00:00
|
|
|
// Defines command line flags for PlayReady encryption.
|
2017-01-05 17:32:17 +00:00
|
|
|
|
|
|
|
#include "packager/app/playready_key_encryption_flags.h"
|
|
|
|
|
|
|
|
#include "packager/app/validate_flag.h"
|
|
|
|
|
2023-09-09 00:44:17 +00:00
|
|
|
ABSL_FLAG(bool,
|
|
|
|
enable_playready_encryption,
|
|
|
|
false,
|
|
|
|
"Enable encryption with PlayReady key.");
|
|
|
|
ABSL_FLAG(std::string,
|
|
|
|
playready_server_url,
|
|
|
|
"",
|
|
|
|
"PlayReady packaging server url.");
|
|
|
|
ABSL_FLAG(std::string,
|
|
|
|
program_identifier,
|
|
|
|
"",
|
|
|
|
"Program identifier for packaging request.");
|
2017-01-05 17:32:17 +00:00
|
|
|
|
|
|
|
namespace shaka {
|
2018-04-20 17:46:14 +00:00
|
|
|
namespace {
|
|
|
|
const bool kFlagIsOptional = true;
|
|
|
|
}
|
2017-01-05 17:32:17 +00:00
|
|
|
|
|
|
|
bool ValidatePRCryptoFlags() {
|
|
|
|
bool success = true;
|
|
|
|
|
|
|
|
const char playready_label[] = "--enable_playready_encryption";
|
2023-09-09 00:44:17 +00:00
|
|
|
bool playready_enabled = absl::GetFlag(FLAGS_enable_playready_encryption);
|
|
|
|
if (!ValidateFlag("playready_server_url",
|
|
|
|
absl::GetFlag(FLAGS_playready_server_url),
|
2018-04-20 17:46:14 +00:00
|
|
|
playready_enabled, !kFlagIsOptional, playready_label)) {
|
2017-01-05 17:32:17 +00:00
|
|
|
success = false;
|
|
|
|
}
|
2023-09-09 00:44:17 +00:00
|
|
|
if (!ValidateFlag("program_identifier",
|
|
|
|
absl::GetFlag(FLAGS_program_identifier), playready_enabled,
|
|
|
|
!kFlagIsOptional, playready_label)) {
|
2017-01-05 17:32:17 +00:00
|
|
|
success = false;
|
|
|
|
}
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace shaka
|